[mdoc] New make test for the --dropns functionality
[mono.git] / mcs / tools / mdoc / Makefile
1 thisdir = tools/mdoc
2 SUBDIRS = 
3 include ../../build/rules.make
4
5 MDOC_COMMON_FLAGS = \
6         /resource:../../class/monodoc/Resources/mdoc-html-format.xsl,mdoc-html-format.xsl    \
7         /resource:../../class/monodoc/Resources/mdoc-html-utils.xsl,mdoc-html-utils.xsl      \
8         /resource:../../class/monodoc/Resources/mdoc-sections-css.xsl,mdoc-sections-css.xsl  \
9         /resource:../../class/monodoc/Resources/mono-ecma-css.xsl,mono-ecma-css.xsl          \
10         /resource:Resources/defaulttemplate.xsl,defaulttemplate.xsl                 \
11         /resource:Resources/monodoc-ecma.xsd,monodoc-ecma.xsd                       \
12         /resource:Resources/msitomsx.xsl,msitomsx.xsl                               \
13         /resource:Resources/overview.xsl,overview.xsl                               \
14         /resource:Resources/stylesheet.xsl,stylesheet.xsl                           \
15         /r:System.Web.dll                                                           \
16         /r:System.Xml.Linq.dll                                                      \
17         /r:ICSharpCode.SharpZipLib.dll                                              \
18         /r:Mono.Cecil.dll
19
20 LOCAL_MCS_FLAGS = $(MDOC_COMMON_FLAGS) \
21         /r:monodoc.dll
22 PROGRAM = mdoc.exe
23 PROGRAM_DEPS = $(topdir)/class/lib/$(PROFILE)/monodoc.dll
24
25 ifdef NET
26 all : copy-with-deps
27
28 copy-with-deps:
29         -mkdir mdoc-net
30         cp $(PROGRAM) mdoc-net
31         cp $(topdir)/class/lib/$(PROFILE)/Commons.Xml.Relaxng.dll mdoc-net
32         cp $(topdir)/class/lib/$(PROFILE)/ICSharpCode.SharpZipLib.dll mdoc-net
33         cp $(topdir)/class/lib/$(PROFILE)/Mono.Cecil.dll mdoc-net
34         cp $(topdir)/class/lib/$(PROFILE)/monodoc.dll mdoc-net
35 endif
36
37 MONODOC_RESOURCES = \
38         ../../class/monodoc/Resources/mdoc-html-utils.xsl    \
39         ../../class/monodoc/Resources/mdoc-sections-css.xsl  \
40         ../../class/monodoc/Resources/mono-ecma-css.xsl
41
42 MDOC_RESOURCES = \
43         Resources/defaulttemplate.xsl     \
44         Resources/monodoc-ecma.xsd        \
45         Resources/msitomsx.xsl            \
46         Resources/overview.xsl            \
47         Resources/stylesheet.xsl
48
49 MDOC_TEST_FILES = \
50         Test/DocTest-v1.cs                                        \
51         Test/DocTest-v2.patch                                     \
52         Test/msxdoc-expected.importslashdoc.xml                   \
53         Test/TestEcmaDocs.xml                                     \
54         Test/validate.check.monodocer                             \
55         Test/validate.check.monodocer.importslashdoc              \
56         Test/validate.check.monodocer.since
57
58 EXTRA_DISTFILES = \
59         $(MDOC_RESOURCES) \
60         $(MDOC_TEST_FILES)
61
62 $(PROGRAM) : $(MDOC_RESOURCES) $(MONODOC_RESOURCES) $(PROGRAM_DEPS)
63
64 PROGRAM_COMPILE = $(CSCOMPILE) -platform:x86
65
66 include ../../build/executable.make
67
68 $(PROGRAM) : $(build_lib)
69         cp $< $@
70
71 $(PROGRAM) : Makefile
72
73 MONO = \
74         MONO_PATH="$(topdir)/class/lib/$(PROFILE)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" \
75         $(RUNTIME) $(RUNTIME_FLAGS)
76
77 dist-local: dist-default dist-tests
78
79 dist-tests:
80         find Test/en.expected* -name '*.xml'     > .files
81         find Test/html.expected* -name '*.html' >> .files
82         tar cTf .files - | (cd $(distdir); tar xf -)
83         rm .files ; \
84
85 test-local: $(PROGRAM)
86
87 clean-local: cleanup
88
89 cleanup:
90         -rm -Rf Test/en.actual Test/html.actual
91         -rm -f monodocer1.exe*
92
93 Test/DocTest-DropNS-classic.dll:
94         @echo $(value @)
95         $(CSCOMPILE) $(TEST_CSCFLAGS) -debug -unsafe -target:library -out:$@ Test/DocTest-DropNS-classic.cs
96
97 Test/DocTest-DropNS-unified.dll:
98         $(CSCOMPILE) $(TEST_CSCFLAGS) -debug -unsafe -target:library -out:$@ Test/DocTest-DropNS-unified.cs
99
100 Test/DocTest.dll: 
101         $(CSCOMPILE) $(TEST_CSCFLAGS) -debug -unsafe -target:library -out:$@ Test/DocTest.cs
102
103 Test/DocTest.dll-v1: 
104         -rm -f Test/DocTest.cs
105         cp Test/DocTest-v1.cs Test/DocTest.cs
106         -rm -f Test/DocTest.dll
107         $(MAKE) TEST_CSCFLAGS=$(TEST_CSCFLAGS) Test/DocTest.dll
108
109 Test/DocTest.dll-v2: 
110         -rm -f Test/DocTest.cs
111         cp Test/DocTest-v1.cs Test/DocTest.cs
112         cd Test && patch -p0 < DocTest-v2.patch
113         -rm -f Test/DocTest.dll
114         $(MAKE) TEST_CSCFLAGS=$(TEST_CSCFLAGS) Test/DocTest.dll
115
116 check-monodocer-dropns-classic: $(PROGRAM)
117         -rm -Rf Test/en.actual
118         $(MAKE) Test/DocTest-DropNS-classic.dll
119         $(MONO) $(PROGRAM) update --exceptions=all -o Test/en.actual Test/DocTest-DropNS-classic.dll
120         $(MAKE) check-monodocer-dropns-unified
121         diff --exclude=.svn -rup Test/en.expected-dropns-classic-v1 Test/en.actual
122
123 check-monodocer-dropns-unified: $(PROGRAM)
124         $(MAKE) Test/DocTest-DropNS-unified.dll
125         $(MONO) $(PROGRAM) update --exceptions=all -o Test/en.actual Test/DocTest-DropNS-unified.dll --dropns=MyFramework
126                 
127
128 check-monodocer-update: $(PROGRAM)
129         find Test/en.expected -name \*.xml -exec rm "{}" \;
130         $(MAKE) Test/DocTest.dll-v1
131         $(MONO) $(PROGRAM) update --exceptions=all -o Test/en.expected Test/DocTest.dll
132
133 check-monodocer: $(PROGRAM)
134         -rm -Rf Test/en.actual
135         $(MAKE) Test/DocTest.dll-v1
136         $(MONO) $(PROGRAM) update --debug --exceptions=all -o Test/en.actual Test/DocTest.dll
137         diff --exclude=.svn -rup Test/en.expected Test/en.actual
138         $(MONO) $(PROGRAM) update --debug --exceptions=all -o Test/en.actual Test/DocTest.dll 
139         diff --exclude=.svn -rup Test/en.expected Test/en.actual
140
141 check-monodocer-since-update: $(PROGRAM)
142         find Test/en.expected.since -name \*.xml -exec rm "{}" \;
143         $(MAKE) Test/DocTest.dll-v1
144         $(MONO) $(PROGRAM) update --exceptions=all -o Test/en.expected.since Test/DocTest.dll 
145         $(MAKE) Test/DocTest.dll-v2
146         $(MONO) $(PROGRAM) update --exceptions=all --since="Version 2.0" \
147                 -o Test/en.expected.since Test/DocTest.dll 
148
149 check-monodocer-since: $(PROGRAM)
150         rm -Rf Test/en.actual
151         $(MAKE) Test/DocTest.dll-v1
152         $(MONO) $(PROGRAM) --debug update --exceptions=all -o Test/en.actual Test/DocTest.dll 
153         $(MAKE) Test/DocTest.dll-v2
154         $(MONO) $(PROGRAM) --debug update --exceptions=all --since="Version 2.0" \
155                 -o Test/en.actual Test/DocTest.dll 
156         diff --exclude=.svn -rup Test/en.expected.since Test/en.actual
157
158 check-monodocer-delete-update: $(PROGRAM)
159         find Test/en.expected.delete -type f -exec rm "{}" \;
160         $(MAKE) Test/DocTest.dll-v1
161         $(MONO) $(PROGRAM) update --exceptions=all -o Test/en.expected.delete Test/DocTest.dll
162         $(MAKE) Test/DocTest.dll-v2
163         $(MONO) $(PROGRAM) update --exceptions=all -o Test/en.expected.delete Test/DocTest.dll
164         $(MAKE) Test/DocTest.dll-v1
165         $(MONO) $(PROGRAM) update -fno-assembly-versions --delete --exceptions=all \
166                 -o Test/en.expected.delete Test/DocTest.dll
167
168 check-monodocer-delete: $(PROGRAM)
169         rm -Rf Test/en.actual
170         $(MAKE) Test/DocTest.dll-v1
171         $(MONO) $(PROGRAM) --debug update --exceptions=all -o Test/en.actual Test/DocTest.dll
172         $(MAKE) Test/DocTest.dll-v2
173         $(MONO) $(PROGRAM) --debug update --exceptions=all -o Test/en.actual Test/DocTest.dll
174         $(MAKE) Test/DocTest.dll-v1
175         $(MONO) $(PROGRAM) --debug update -fno-assembly-versions --delete --exceptions=all -o Test/en.actual Test/DocTest.dll
176         diff --exclude=.svn -rup Test/en.expected.delete Test/en.actual
177
178 check-monodocer-importslashdoc-update: $(PROGRAM)
179         find Test/en.expected.importslashdoc -name \*.xml -exec rm "{}" \;
180         $(MAKE) Test/DocTest.dll-v1 TEST_CSCFLAGS=-doc:Test/DocTest.xml
181         $(MONO) $(PROGRAM) --debug update --exceptions=all -i Test/DocTest.xml \
182                 -o Test/en.expected.importslashdoc Test/DocTest.dll 
183
184 check-monodocer-importslashdoc: $(PROGRAM)
185         rm -Rf Test/en.actual
186         $(MAKE) Test/DocTest.dll-v1 TEST_CSCFLAGS=-doc:Test/DocTest.xml
187         $(MONO) $(PROGRAM) --debug update --exceptions=all -i Test/DocTest.xml \
188                 -o Test/en.actual Test/DocTest.dll 
189         diff --exclude=.svn -rup Test/en.expected.importslashdoc Test/en.actual
190
191 check-monodocer-importecmadoc-update: $(PROGRAM)
192         find Test/en.expected.importecmadoc -name \*.xml -exec rm "{}" \;
193         $(MAKE) Test/DocTest.dll-v1
194         $(MONO) $(PROGRAM) --debug update --exceptions=all -i Test/TestEcmaDocs.xml \
195                 '--type=System.Action`1' --type=System.AsyncCallback \
196                 --type=System.Environment --type=System.Array \
197                 -o Test/en.expected.importecmadoc Test/DocTest.dll 
198
199 check-monodocer-importecmadoc: $(PROGRAM)
200         rm -Rf Test/en.actual
201         $(MAKE) Test/DocTest.dll-v1
202         $(MONO) $(PROGRAM) --debug update --exceptions=all -i Test/TestEcmaDocs.xml \
203                 '--type=System.Action`1' --type=System.AsyncCallback \
204                 --type=System.Environment --type=System.Array \
205                 -o Test/en.actual Test/DocTest.dll 
206         diff --exclude=.svn -rup Test/en.expected.importecmadoc Test/en.actual
207
208 check-mdoc-export-html-update: $(PROGRAM)
209         find Test/html.expected -name \*.html -exec rm "{}" \;
210         $(MONO) $(PROGRAM) export-html -o Test/html.expected \
211                 Test/en.expected.importslashdoc 
212
213 check-mdoc-export-html: check-monodocer $(PROGRAM)
214         rm -Rf Test/html.actual
215         $(MONO) $(PROGRAM) export-html -o Test/html.actual \
216                 Test/en.expected.importslashdoc
217         diff --exclude=.svn -rup Test/html.expected Test/html.actual
218
219 check-mdoc-export-html-with-version: $(PROGRAM)
220         rm -Rf Test/html.actual.v0 Test/html.actual.since-with-v0 .v0.txt .v2.txt
221         $(MONO) $(PROGRAM) export-html -o Test/html.actual.v0 \
222                 Test/en.expected
223         $(MONO) $(PROGRAM) export-html -o Test/html.actual.since-with-v0 \
224                 Test/en.expected.since -with-version 0.0.0.0
225         (cd Test/html.actual.v0            && find . -type f) | sort > .v0.txt
226         (cd Test/html.actual.since-with-v0 && find . -type f) | sort > .v2.txt
227         diff -rup .v0.txt .v2.txt   # assert no types added
228
229 check-md-html-dir: $(PROGRAM)
230         rm -Rf Test/html.actual
231         $(MONO) $(PROGRAM) export-html -dest:Test/html.actual $(DIR) 
232         diff --exclude=.svn -rup Test/html.expected Test/html.actual
233
234 check-mdoc-export-msxdoc-update:
235         $(MONO) $(PROGRAM) export-msxdoc -o - Test/en.expected.importslashdoc \
236                 > Test/msxdoc-expected.importslashdoc.xml
237
238 check-mdoc-export-msxdoc:
239         $(MONO) $(PROGRAM) export-msxdoc -o - Test/en.expected.importslashdoc \
240                 | diff --brief - Test/msxdoc-expected.importslashdoc.xml
241
242 my_abs_top_srcdir = $(shell cd . && pwd)
243
244 check-mdoc-validate-update: $(PROGRAM)
245         $(MONO) $(PROGRAM) validate -f ecma Test/en.expected 2>&1 | \
246                 sed 's#file://$(my_abs_top_srcdir)/##g' > \
247                 Test/validate.check.monodocer
248         $(MONO) $(PROGRAM) validate -f ecma Test/en.expected.importslashdoc 2>&1 | \
249                 sed 's#file://$(my_abs_top_srcdir)/##g' > \
250                 Test/validate.check.monodocer.importslashdoc
251         $(MONO) $(PROGRAM) validate -f ecma Test/en.expected.since 2>&1 | \
252                 sed 's#file://$(my_abs_top_srcdir)/##g' > \
253                 Test/validate.check.monodocer.since
254
255 check-mdoc-validate: $(PROGRAM)
256         $(MONO) $(PROGRAM) validate -f ecma Test/en.expected 2>&1 | \
257                 sed 's#file://$(my_abs_top_srcdir)/##g' | \
258                 diff - Test/validate.check.monodocer
259         $(MONO) $(PROGRAM) validate -f ecma Test/en.expected.importslashdoc 2>&1 | \
260                 sed 's#file://$(my_abs_top_srcdir)/##g' | \
261                 diff --brief - Test/validate.check.monodocer.importslashdoc
262         $(MONO) $(PROGRAM) validate -f ecma Test/en.expected.since 2>&1 | \
263                 sed 's#file://$(my_abs_top_srcdir)/##g' | \
264                 diff --brief - Test/validate.check.monodocer.since
265
266 run-test-local: check-doc-tools
267
268 run-test-update : check-doc-tools-update
269
270 check-doc-tools: check-monodocer-since \
271         check-monodocer-importecmadoc \
272         check-monodocer-importslashdoc \
273         check-monodocer \
274         check-monodocer-delete \
275         check-mdoc-export-html \
276         check-mdoc-export-html-with-version \
277         check-mdoc-export-msxdoc \
278         check-mdoc-validate
279
280 check-doc-tools-update: check-monodocer-since-update \
281         check-monodocer-importecmadoc-update \
282         check-monodocer-importslashdoc-update \
283         check-monodocer-update \
284         check-monodocer-delete-update \
285         check-mdoc-export-html-update \
286         check-mdoc-export-msxdoc-update \
287         check-mdoc-validate-update
288