-
Notifications
You must be signed in to change notification settings - Fork 854
/
build-common.xml
647 lines (551 loc) · 27.4 KB
/
build-common.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
<?xml version="1.0"?>
<project name="Dev Site Documentation Management" basedir=".">
<property name="project.dir" value="." />
<path id="lib.classpath">
<fileset dir="${project.dir}/lib" includes="*.jar" />
<fileset dir="${project.dir}/code/liferay-doc-utils/lib" includes="*.jar" />
</path>
<path id="project.classpath">
<path refid="lib.classpath" />
</path>
<property environment="env" />
<property file="${project.dir}/build.${USERNAME}.properties" />
<property file="${project.dir}/build.${user.name}.properties" />
<property file="${project.dir}/build.${env.COMPUTERNAME}.properties" />
<property file="${project.dir}/build.${env.HOST}.properties" />
<property file="${project.dir}/build.${env.HOSTNAME}.properties" />
<property file="${project.dir}/build.properties" />
<property name="build.dir" value="./build"/>
<property name="dist.dir" value="./dist"/>
<property name="metadata.filename" value=".METADATA"/>
<property name="temp.dir" value="temp"/>
<property name="temp.dir2" value="prepare-temp"/>
<!-- taskdefs -->
<taskdef name="addtoc" classname="com.liferay.documentation.util.AddTOCTask">
<classpath>
<fileset dir="${project.dir}/lib" includes="*.jar" />
<!-- Use below instead of above fileset when testing changes to classes
<pathelement path="${project.dir}/code/liferay-doc-utils/classes"/>
-->
<fileset dir="${project.dir}/code/liferay-doc-utils/lib" includes="*.jar" />
</classpath>
</taskdef>
<taskdef name="checkarticleimgssite" classname="com.liferay.documentation.util.CheckArticleImagesTask">
<classpath>
<fileset dir="${project.dir}/lib" includes="*.jar" />
<!-- Use below instead of above fileset when testing changes to classes
<pathelement path="${project.dir}/code/liferay-doc-utils/classes"/>
-->
<fileset dir="${project.dir}/code/liferay-doc-utils/lib" includes="*.jar" />
</classpath>
</taskdef>
<taskdef name="checkheaders" classname="com.liferay.documentation.util.CheckHeadersTask">
<classpath>
<fileset dir="${project.dir}/lib" includes="*.jar" />
<!-- Use below instead of above fileset when testing changes to classes
<pathelement path="${project.dir}/code/liferay-doc-utils/classes"/>
-->
<fileset dir="${project.dir}/code/liferay-doc-utils/lib" includes="*.jar" />
</classpath>
</taskdef>
<taskdef name="checkimgssite" classname="com.liferay.documentation.util.CheckImagesTask">
<classpath>
<fileset dir="${project.dir}/lib" includes="*.jar" />
<!-- Use below instead of above fileset when testing changes to classes
<pathelement path="${project.dir}/code/liferay-doc-utils/classes"/>
-->
<fileset dir="${project.dir}/code/liferay-doc-utils/lib" includes="*.jar" />
</classpath>
</taskdef>
<taskdef name="checkintros" classname="com.liferay.documentation.util.CheckIntrosTask">
<classpath>
<fileset dir="${project.dir}/lib" includes="*.jar" />
<!-- Use below instead of above fileset when testing changes to classes
<pathelement path="${project.dir}/code/liferay-doc-utils/classes"/>
-->
<fileset dir="${project.dir}/code/liferay-doc-utils/lib" includes="*.jar" />
</classpath>
</taskdef>
<taskdef name="checklinks" classname="com.liferay.documentation.util.CheckLinksTask">
<classpath>
<fileset dir="${project.dir}/lib" includes="*.jar" />
<!-- Use below instead of above fileset when testing changes to classes
<pathelement path="${project.dir}/code/liferay-doc-utils/classes"/>
-->
<fileset dir="${project.dir}/code/liferay-doc-utils/lib" includes="*.jar" />
</classpath>
</taskdef>
<taskdef name="convertheaders" classname="com.liferay.documentation.util.ConvertHeadersTask">
<classpath>
<fileset dir="${project.dir}/lib" includes="*.jar" />
<!-- Use below instead of above fileset when testing changes to classes
<pathelement path="${project.dir}/code/liferay-doc-utils/classes"/>
-->
<fileset dir="${project.dir}/code/liferay-doc-utils/lib" includes="*.jar" />
</classpath>
</taskdef>
<taskdef name="convertlinks" classname="com.liferay.documentation.util.ConvertLinksTask">
<classpath>
<fileset dir="${project.dir}/lib" includes="*.jar" />
<!-- Use below instead of above fileset when testing changes to classes
<pathelement path="${project.dir}/code/liferay-doc-utils/classes"/>
-->
<fileset dir="${project.dir}/code/liferay-doc-utils/lib" includes="*.jar" />
</classpath>
</taskdef>
<taskdef name="convertsidebars" classname="com.liferay.documentation.util.ConvertSidebarsTask">
<classpath>
<fileset dir="${project.dir}/lib" includes="*.jar" />
<!-- Use below instead of above fileset when testing changes to classes
<pathelement path="${project.dir}/code/liferay-doc-utils/classes"/>
-->
<fileset dir="${project.dir}/code/liferay-doc-utils/lib" includes="*.jar" />
</classpath>
</taskdef>
<taskdef name="distdiff" classname="com.liferay.documentation.util.CheckLatestCommitTask">
<classpath>
<fileset dir="${project.dir}/lib" includes="*.jar" />
<!-- Use below instead of above fileset when testing changes to classes
<pathelement path="${project.dir}/code/liferay-doc-utils/classes"/>
-->
<fileset dir="${project.dir}/code/liferay-doc-utils/lib" includes="*.jar" />
</classpath>
</taskdef>
<taskdef name="numberheaders" classname="com.liferay.documentation.util.NumberHeadersTask">
<classpath>
<fileset dir="${project.dir}/lib" includes="*.jar" />
<!-- Use below instead of above fileset when testing changes to classes
<pathelement path="${project.dir}/code/liferay-doc-utils/classes"/>
-->
<fileset dir="${project.dir}/code/liferay-doc-utils/lib" includes="*.jar" />
</classpath>
</taskdef>
<taskdef name="numberimgssite" classname="com.liferay.documentation.util.NumberImagesTask">
<classpath>
<fileset dir="${project.dir}/lib" includes="*.jar" />
<!-- Use below instead of above fileset when testing changes to classes
<pathelement path="${project.dir}/code/liferay-doc-utils/classes"/>
-->
<fileset dir="${project.dir}/code/liferay-doc-utils/lib" includes="*.jar" />
</classpath>
</taskdef>
<taskdef name="concatmarkdown" classname="com.liferay.documentation.util.ConcatMarkdownTask">
<classpath>
<fileset dir="${project.dir}/lib" includes="*.jar" />
<fileset dir="${project.dir}/code/liferay-doc-utils/lib" includes="*.jar" />
</classpath>
</taskdef>
<!-- targets -->
<target name="add-article-to-temp" depends="process-article-to-temp, check-images-dist" description="Processes the article (-Darticle=...) and its parent article structure, adding the target article and all related parent articles and images to temp/">
</target>
<target name="article-to-html" depends="prepare, check-article-images" description="Converts a single Markdown article to an HTML file.">
<echo message="... converting ${article} to html file ${build.dir}/${article}.html"/>
<java
classname="com.liferay.documentation.util.MarkdownToHtml"
classpathref="project.classpath"
failonerror="true"
fork="true"
>
<arg value="${article}"/>
<arg value="${build.dir}/${article}.html"/>
</java>
</target>
<target name="add-toc" description="Adds the Table of Contents syntax for each CE Markdown article.">
<addtoc docdir="${doc.dir}" producttype="ce">
</addtoc>
</target>
<target name="add-toc-dist" description="Adds the Table of Contents syntax for each Markdown article when generating Zip.">
<addtoc docdir="${doc.dir}/${temp.dir}" producttype="dist">
</addtoc>
</target>
<target name="add-toc-dxp" description="Adds the Table of Contents syntax for each DXP Markdown article.">
<addtoc docdir="${doc.dir}" producttype="dxp">
</addtoc>
</target>
<target name="article-to-html-dxp" depends="prepare, check-article-images-dxp" description="Converts a single Markdown DXP article to an HTML file.">
<echo message="... converting ${article} to html file ${build.dir}/${article}.html"/>
<java
classname="com.liferay.documentation.util.MarkdownToHtml"
classpathref="project.classpath"
failonerror="true"
fork="true"
>
<arg value="${article}"/>
<arg value="${build.dir}/${article}.html"/>
</java>
</target>
<target name="check-headers" description="Check the headers of Markdown articles found in ${doc.dir}/articles">
<checkheaders docdir="${doc.dir}" producttype="ce">
</checkheaders>
</target>
<target name="check-headers-dist" description="Check the headers of Markdown articles found in ${doc.dir}/articles and ${doc.dir}/articles-dxp">
<checkheaders docdir="${doc.dir}/${temp.dir}" producttype="dist">
</checkheaders>
</target>
<target name="check-headers-dxp" description="Check the headers of Markdown articles found in ${doc.dir}/articles">
<checkheaders docdir="${doc.dir}" producttype="dxp">
</checkheaders>
</target>
<target name="concat-markdown" description="Concatenates the Markdown files in a specific folder for preparation to convert to other formats.">
<concatmarkdown docdir="${doc.dir}">
</concatmarkdown>
<move file="./book.markdown" tofile="${dist.dir}/book/text/${doc.dir}.markdown" />
<copy todir="${dist.dir}/images">
<fileset dir="images" includes="*.*"/>
</copy>
</target>
<target name="check" depends="add-toc, check-images, check-intros, number-headers, number-images, check-headers, check-links" description="Checks for necessary requirements before CE distribution.">
</target>
<target name="check-dxp" depends="add-toc-dxp, check-images-dxp, check-intros-dxp, number-headers-dxp, number-images-dxp, check-headers-dxp, check-links-dxp" description="Checks for necessary requirements before DXP distribution.">
</target>
<target name="check-article-images" description="Verifies all images referenced in a single Markdown article.">
<checkarticleimgssite docdir="${doc.dir}" article="${article}" imagedir="images">
</checkarticleimgssite>
</target>
<target name="check-article-images-dxp" description="Verifies all images referenced in a single Markdown article.">
<checkarticleimgssite docdir="${doc.dir}" article="${article}" imagedir="images-dxp">
</checkarticleimgssite>
</target>
<target name="check-images" description="Verifies all images referenced in a project's Markdown articles found in ${doc.dir}/articles.">
<checkimgssite docdir="${doc.dir}" producttype="ce">
</checkimgssite>
</target>
<target name="check-images-dist" description="Verifies all images referenced in a project's Markdown articles.">
<mkdir dir="${temp.dir}/images"/>
<checkimgssite docdir="${doc.dir}/${temp.dir}" producttype="dist" resolveimages="true">
</checkimgssite>
</target>
<target name="check-images-dxp" description="Verifies all images referenced in a project's Markdown articles found in ${doc.dir}/articles.">
<checkimgssite docdir="${doc.dir}" producttype="dxp">
</checkimgssite>
</target>
<target name="check-intros" description="Verifies all Learning Path article folders are accompanied with an introduction Markdown article.">
<checkintros docdir="${doc.dir}">
</checkintros>
</target>
<target name="check-intros-dist" description="Verifies all Learning Path article folders are accompanied with an introduction Markdown article.">
<checkintros docdir="${doc.dir}/${temp.dir}">
</checkintros>
</target>
<target name="check-intros-dxp" description="Verifies all Learning Path article folders are accompanied with an introduction Markdown article.">
<property name="base.filepath" value="${doc.dir}" />
<mkdir dir="${temp.dir}"/>
<copy todir="${temp.dir}">
<fileset dir="${project.dir}/${language.dir}/${purpose.dir}/${base.filepath}">
<include name="articles/**/*.markdown"/>
<include name="articles-dxp/**/*.markdown"/>
</fileset>
</copy>
<move todir="${temp.dir}/articles" failonerror="false">
<fileset dir="${temp.dir}/articles-dxp"/>
</move>
<checkintros docdir="${doc.dir}/${temp.dir}">
</checkintros>
<delete dir="${temp.dir}"/>
</target>
<target name="clean-dist" description="Deletes dist directory">
<echo message="... deleting dist directory"/>
<delete dir="${dist.dir}"/>
</target>
<target name="clean-images" description="Deletes images from ${doc.dir}/images and ${doc.dir}/images-dxp that are not referenced in any of the markdown files in any subdirectory of ${doc.dir}/articles and ${doc.dir}/articles-dxp">
<java
classname="com.liferay.documentation.util.CleanImages"
classpathref="project.classpath"
failonerror="true"
fork="true"
>
<arg value="${doc.dir}"/>
</java>
</target>
<target name="clean-temp">
<delete dir="${temp.dir}"/>
</target>
<target name="compare-portal-source" depends="prepare" description="Generates reports comparing a Liferay 6 source directory (-DoldDir) to a Liferay 7+ source directory (-DnewDir).">
<property name="movedClassesFile" value="${build.dir}/moved-classes.html"/>
<property name="removedClassesFile" value="${build.dir}/removed-classes.html"/>
<java
classname="com.liferay.documentation.movedclassreporter.MovedClassReporterMain"
classpathref="project.classpath"
failonerror="true"
fork="true"
>
<arg value="${oldDir}"/>
<arg value="${newDir}"/>
<arg value="${movedClassesFile}"/>
<arg value="${removedClassesFile}"/>
</java>
</target>
<target name="compare-with-older-branch" description="Compares your current branch with an older branch, specified by -Dolder.branch=someOlderBranch.">
<java
classname="com.liferay.documentation.util.GitCompare"
classpathref="project.classpath"
failonerror="true"
fork="true"
>
<arg value="${doc.dir}"/>
<arg value="${purpose.dir}"/>
<arg value="${older.branch}"/>
</java>
</target>
<target name="create-metadata-file" description="Builds a metadata file.">
<!-- Use base.filepath property to distinguish between tutorials and learning-paths directories. The build.xml file
in the learning-paths directory overwrites this value with "learning-paths/${doc.dir}" -->
<property name="base.filepath" value="${doc.dir}" />
<property name="metadata.file" value="${project.dir}/${language.dir}/${purpose.dir}/${base.filepath}/${metadata.filename}"/>
<delete file="${metadata.file}" failonerror="false"/>
<concat destfile="${metadata.file}">base.source.url=https://github.com/${repo.owner}/${repo.name}/blob/${repo.branch}/${language.dir}/${purpose.dir}/${base.filepath}</concat>
</target>
<target name="convert-headers" description="Converts legacy header IDs to new format. Run this before running the number-headers task for the first time.">
<convertheaders docdir="${doc.dir}">
</convertheaders>
</target>
<target name="convert-links" description="Converts legacy links to new format.">
<convertlinks docdir="${doc.dir}">
</convertlinks>
</target>
<target name="convert-sidebars" description="Converts legacy sidebars to new format.">
<convertsidebars docdir="${doc.dir}">
</convertsidebars>
</target>
<target name="dist-article-ce" depends="clean-temp, add-article-to-temp, dist-temp" description="Creates a ZIP file for importing the specified article (-Darticle=...), its images, and supporting structure to a Knowledge Base.">
</target>
<target name="dist-ce" depends="dist-ce-temp, prepare-dist, add-toc, number-headers, number-images" description="Processes the CE articles and images and zips them up for importing.">
<zip destfile="${dist.dir}/${product.abbrev}-${product.community}-${product.version}-${purpose.dir}-${doc.dir}-${language.dir}.zip">
<fileset dir="${temp.dir}" includes="articles/" />
<fileset dir="${temp.dir}" includes="images/" />
<fileset dir="./" includes="${metadata.filename}" />
</zip>
<delete dir="${temp.dir}"/>
<delete file="${metadata.file}"/>
</target>
<target name="dist-ce-temp" description="Processes the article tokens and copies the CE articles and images to temp/ for zipping up.">
<property file="${project.dir}/release-site.properties" />
<property name="base.filepath" value="${doc.dir}" />
<mkdir dir="${temp.dir}"/>
<copy todir="${temp.dir}">
<fileset dir="${project.dir}/${language.dir}/${purpose.dir}/${base.filepath}">
<include name="articles/**/*.markdown"/>
</fileset>
<filterchain>
<filterreader classname="org.apache.tools.ant.filters.ReplaceTokens">
<param type="token" name="${product.token}" value="${product.name}"/>
<param type="token" name="${product.token.app.reference}" value="${product.app.reference}"/>
<param type="token" name="${product.token.commerce}" value="${product.commerce.name}"/>
<param type="token" name="${product.token.commerce.version}" value="${product.commerce.name.version}"/>
<param type="token" name="${product.token.ide}" value="${product.ide.name}"/>
<param type="token" name="${product.token.platform.reference}" value="${product.platform.reference}"/>
<param type="token" name="${product.token.version}" value="${product.name.version}"/>
</filterreader>
</filterchain>
</copy>
<mkdir dir="${temp.dir}/images"/>
<copy todir="${temp.dir}">
<fileset dir="${project.dir}/${language.dir}/${purpose.dir}/${base.filepath}">
<include name="images/**"/>
</fileset>
</copy>
</target>
<target name="dist-diff-ce" depends="dist-ce" description="Generates files from differing commits based on CE content.">
<property file="${project.dir}/release-site.properties" />
<distdiff
docdir="${doc.dir}"
doclocation="${language.dir}/${purpose.dir}/${doc.dir}"
distdir="${dist.dir}"
zipname="${dist.dir}/${product.abbrev}-${product.community}-${product.version}-${purpose.dir}-${doc.dir}-${language.dir}"
dxpparam="false"
>
</distdiff>
<delete dir="${dist.dir}/${product.abbrev}-${product.community}-${product.version}-${purpose.dir}-${doc.dir}-${language.dir}"/>
<delete file="${dist.dir}/${product.abbrev}-${product.community}-${product.version}-${purpose.dir}-${doc.dir}-${language.dir}.zip"/>
</target>
<target name="dist-diff-dxp" depends="dist-dxp" description="Generates files from differing commits based on CE and DXP content.">
<property file="${project.dir}/release-site.properties" />
<distdiff
docdir="${doc.dir}"
doclocation="${purpose.dir}/${doc.dir}"
distdir="${dist.dir}"
zipname="${dist.dir}/${product.abbrev}-${product.enterprise}-${product.version}-${purpose.dir}-${doc.dir}-${language.dir}"
dxpparam="true"
>
</distdiff>
<delete dir="${dist.dir}/${product.abbrev}-${product.enterprise}-${product.version}-${purpose.dir}-${doc.dir}-${language.dir}"/>
<delete file="${dist.dir}/${product.abbrev}-${product.enterprise}-${product.version}-${purpose.dir}-${doc.dir}-${language.dir}.zip"/>
</target>
<target name="dist-dxp" depends="dist-dxp-temp, prepare-dist, add-toc-dxp, number-headers-dxp, number-images-dxp" description="Processes the article tokens and copies the DXP articles and images to temp/ for zipping up.">
<zip destfile="${dist.dir}/${product.abbrev}-${product.enterprise}-${product.version}-${purpose.dir}-${doc.dir}-${language.dir}.zip">
<fileset dir="${temp.dir}" includes="articles/" />
<fileset dir="${temp.dir}" includes="images/" />
<fileset dir="./" includes="${metadata.filename}" />
</zip>
<delete dir="${temp.dir}"/>
<delete file="${metadata.file}"/>
</target>
<target name="dist-dxp-temp" description="Zips up the folder's CE and DXP articles and images for importing.">
<property file="${project.dir}/release-site.properties" />
<property name="base.filepath" value="${doc.dir}" />
<mkdir dir="${temp.dir}"/>
<copy todir="${temp.dir}">
<fileset dir="${project.dir}/${language.dir}/${purpose.dir}/${base.filepath}">
<include name="articles/**/*.markdown"/>
<include name="articles-dxp/**/*.markdown"/>
</fileset>
<filterchain>
<filterreader classname="org.apache.tools.ant.filters.ReplaceTokens">
<param type="token" name="${product.token}" value="${product.name.enterprise}"/>
<param type="token" name="${product.token.app.reference}" value="${product.app.enterprise.reference}"/>
<param type="token" name="${product.token.commerce}" value="${product.commerce.name.enterprise}"/>
<param type="token" name="${product.token.commerce.version}" value="${product.commerce.name.enterprise.version}"/>
<param type="token" name="${product.token.ide}" value="${product.ide.name.enterprise}"/>
<param type="token" name="${product.token.platform.reference}" value="${product.platform.enterprise.reference}"/>
<param type="token" name="${product.token.version}" value="${product.name.enterprise.version}"/>
</filterreader>
</filterchain>
</copy>
<mkdir dir="${temp.dir}/images"/>
<!-- Cannot use filtering for images (due to corruption), so must copy separately -->
<copy todir="${temp.dir}">
<fileset dir="${project.dir}/${language.dir}/${purpose.dir}/${base.filepath}">
<include name="images/**"/>
<include name="images-dxp/**"/>
</fileset>
</copy>
<move todir="${temp.dir}/articles" failonerror="false">
<fileset dir="${temp.dir}/articles-dxp"/>
</move>
<move todir="${temp.dir}/images" failonerror="false">
<fileset dir="${temp.dir}/images-dxp"/>
</move>
</target>
<target name="dist-diffs" depends="prepare-dist" description="Zips up the document's articles and images that are new or modified, as specified in the git-modified-list.txt file.">
<mkdir dir="${dist.dir}"/>
<distdiff docdir="${doc.dir}" purposedir="${purpose.dir}">
</distdiff>
<!-- Until the Markdown converter no longer requires intro files that need to be added manually to the diffs.zip, include ALL images in the ZIP. -->
<zip destfile="${dist.dir}/diffs.zip" update="true">
<fileset dir="./" includes="images/" />
<fileset dir="./" includes="${metadata.filename}" />
</zip>
</target>
<target name="dist-temp" depends="prepare-dist, number-headers" description="Prepares the temp files and zips them up for importing.">
<property file="${project.dir}/release-site.properties" />
<zip destfile="${dist.dir}/${product.abbrev}-${product.community}-${product.version}-${purpose.dir}-${doc.dir}-${language.dir}.zip">
<fileset dir="${temp.dir}" includes="articles/" />
<fileset dir="${temp.dir}" includes="images/" />
<fileset dir="./" includes="${metadata.filename}" />
</zip>
</target>
<target name="number-headers" description="Numbers the headers of Markdown articles found in ${doc.dir}/articles">
<numberheaders docdir="${doc.dir}" producttype="ce">
</numberheaders>
</target>
<target name="number-headers-dist" description="Numbers the headers of Markdown articles.">
<numberheaders docdir="${doc.dir}/${temp.dir}" producttype="dist">
</numberheaders>
</target>
<target name="number-headers-dxp" description="Numbers the headers of Markdown articles.">
<numberheaders docdir="${doc.dir}" producttype="dxp">
</numberheaders>
</target>
<target name="number-images" description="numbers the images in a markdown chapter file">
<numberimgssite docdir="${doc.dir}" producttype="ce">
</numberimgssite>
</target>
<target name="number-images-dist" description="Numbers the images of Markdown articles found in ${doc.dir}/articles and ${doc.dir}/articles-dxp.">
<numberimgssite docdir="${doc.dir}/${temp.dir}" producttype="dist">
</numberimgssite>
</target>
<target name="number-images-dxp" description="Numbers the images of Markdown articles found in ${doc.dir}/articles and ${doc.dir}/articles-dxp.">
<numberimgssite docdir="${doc.dir}" producttype="dxp">
</numberimgssite>
</target>
<target name="prepare" description="Creates build directory.">
<!-- Use base.filepath property to distinguish between tutorials and learning-paths directories. The build.xml file
in the learning-paths directory overwrites this value with "learning-paths/${doc.dir}" -->
<property name="base.filepath" value="${doc.dir}" />
<echo message="... creating build directory"/>
<mkdir dir="${project.dir}/${language.dir}/${purpose.dir}/${base.filepath}/${build.dir}"/>
<touch file="${project.dir}/${language.dir}/${purpose.dir}/${base.filepath}/${build.dir}/${article}.html" mkdirs="true"/>
<mkdir dir="${build.dir}/images"/>
<copy todir="${build.dir}/images" overwrite="true">
<fileset dir="./images"/>
</copy>
<mkdir dir="${build.dir}/images-dxp"/>
<copy todir="${build.dir}/images-dxp" overwrite="true">
<fileset dir="./images-dxp"/>
</copy>
</target>
<target name="prepare-dist" depends="add-toc-dist, check-images-dist, check-intros-dist, clean-dist, number-headers-dist, number-images-dist, check-headers-dist, create-metadata-file" description="Prepares the document for distribution.">
<echo message="... creating ${dist.dir} directory"/>
<mkdir dir="${dist.dir}"/>
</target>
<target name="check-links" description="Checks Community (LDN) URL links to see if they're broken.">
<property file="${project.dir}/release-site.properties" />
<checklinks
apilinks="${api.links}"
docdir="${doc.dir}"
legacylinks="${legacy.links}"
appreferencesite="${product.app.reference}"
platformreferencesite="${product.platform.reference}"
apptoken="${product.token.app.reference}"
platformtoken="${product.token.platform.reference}"
dxpcheck="false"
>
</checklinks>
</target>
<target name="check-links-dxp" description="Checks Community (LDN) and DXP (Customer Portal) URL links to see if they're broken.">
<property file="${project.dir}/release-site.properties" />
<checklinks
apilinks="${api.links}"
docdir="${doc.dir}"
legacylinks="${legacy.links}"
appreferencesite="${product.app.enterprise.reference}"
platformreferencesite="${product.platform.enterprise.reference}"
apptoken="${product.token.app.reference}"
platformtoken="${product.token.platform.reference}"
dxpcheck="true"
>
</checklinks>
</target>
<target name="process-article-to-temp" description="Generates the target article's parent structure and then processes the articles' tokens. The resulting articles are copied (no images) to temp/.">
<property file="${project.dir}/release-site.properties" />
<property name="base.filepath" value="${doc.dir}" />
<mkdir dir="${temp.dir}"/>
<mkdir dir="${temp.dir2}"/>
<java
classname="com.liferay.documentation.util.FindParentIntros"
classpathref="project.classpath"
failonerror="true"
fork="true"
>
<arg value="${article}"/>
<arg value="${doc.dir}"/>
<arg value="${temp.dir2}"/>
</java>
<copy todir="${temp.dir}">
<fileset dir="${temp.dir2}"/>
<filterchain>
<filterreader classname="org.apache.tools.ant.filters.ReplaceTokens">
<param type="token" name="${product.token}" value="${product.name}"/>
<param type="token" name="${product.token.app.reference}" value="${product.app.reference}"/>
<param type="token" name="${product.token.ide}" value="${product.ide.name}"/>
<param type="token" name="${product.token.platform.reference}" value="${product.platform.reference}"/>
<param type="token" name="${product.token.version}" value="${product.name.version}"/>
</filterreader>
</filterchain>
</copy>
<delete dir="${temp.dir2}"/>
</target>
<target name="report-moved-portal-service-classes" depends="prepare" description="Compares two portal source trees to generate an HTML report of classes moved from the portal-service folder.">
<echo message="... comparing portal-service classes from ${old.src.dir} with those from ${new.src.dir}"/>
<java
classname="com.liferay.documentation.movedclassreporter.MovedClassReporterMain"
classpathref="project.classpath"
failonerror="true"
fork="true"
>
<arg value="${old.src.dir}"/>
<arg value="${new.src.dir}"/>
<arg value="${build.dir}/portal-service-moved-classes.html"/>
</java>
</target>
</project>