forked from liferay/liferay-docs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild-site-common.xml
120 lines (100 loc) · 4.26 KB
/
build-site-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
<?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 name="build.dir" value="./build"/>
<property name="pandoc.app" location="/home/${user.name}/.cabal/bin/pandoc"/>
<property name="dist.dir" value="./dist"/>
<!-- taskdefs -->
<taskdef name="checkimgssite" classname="com.liferay.documentation.util.CheckImagesTaskDevSite">
<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>
<!-- targets -->
<target name="article-to-html" depends="prepare, check-images-site" 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.MarkdownToHtmlMain"
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">
<java
classname="com.liferay.documentation.util.CheckHeadersTask"
classpathref="project.classpath"
fork="true"
failonerror="true"
>
<arg value="${doc.dir}"/>
</java>
</target>
<target name="check-images-site" description="Verifies all images referenced in a single Markdown article or a document's Markdown articles.">
<checkimgssite docdir="${doc.dir}" chapter="${article}">
</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="clean-dist" description="Deletes dist directory">
<echo message="... deleting dist directory"/>
<delete dir="${dist.dir}"/>
</target>
<target name="dist" depends="prepare-dist" description="Zips up the document's articles and images for importing.">
<property file="${project.dir}/release-site.properties" />
<zip destfile="${dist.dir}/${product.abbrev}-${product.version}-${purpose.dir}-${doc.dir}.zip">
<fileset dir="./" includes="articles/" />
<fileset dir="./" includes="images/" />
<fileset dir="./" includes="home.markdown" />
</zip>
</target>
<target name="number-headers" description="Numbers the headers of Markdown articles found in ${doc.dir}/articles">
<property file="${project.dir}/release-site.properties" />
<java
classname="com.liferay.documentation.util.NumberHeadersSiteMain"
classpathref="project.classpath"
failonerror="true"
fork="true"
>
<arg value="${doc.dir}"/>
</java>
</target>
<target name="prepare" description="Creates build directory.">
<echo message="... creating build directory"/>
<mkdir dir="${project.dir}/${purpose.dir}/${doc.dir}/${build.dir}"/>
<touch file="${project.dir}/${purpose.dir}/${doc.dir}/${build.dir}/${article}.html" mkdirs="true"/>
<mkdir dir="${build.dir}/images"/>
<copy todir="${build.dir}/images" overwrite="true">
<fileset dir="./images"/>
</copy>
</target>
<target name="prepare-dist" depends="check-images-site, check-intros, clean-dist, number-headers, check-headers" description="Prepares the document for distribution.">
<echo message="... creating ${dist.dir} directory"/>
<mkdir dir="${dist.dir}"/>
</target>
</project>