Commit | Line | Data |
---|---|---|
01ee91e7 TW |
1 | <?xml version="1.0" encoding="UTF-8"?> |
2 | <project name="cakelight" default="all"> | |
3 | ||
4 | ||
5 | <property file="config.properties"/> | |
01ee91e7 TW |
6 | <!-- Uncomment the following property if no tests compilation is needed --> |
7 | <!-- | |
8 | <property name="skip.tests" value="true"/> | |
9 | --> | |
10 | ||
11 | <!-- Compiler options --> | |
12 | ||
13 | <property name="compiler.debug" value="on"/> | |
14 | <property name="compiler.generate.no.warnings" value="off"/> | |
15 | <property name="compiler.args" value=""/> | |
16 | <property name="compiler.max.memory" value="700m"/> | |
17 | <patternset id="ignored.files"> | |
18 | <exclude name="**/*.hprof/**"/> | |
19 | <exclude name="**/*.pyc/**"/> | |
20 | <exclude name="**/*.pyo/**"/> | |
21 | <exclude name="**/*.rbc/**"/> | |
22 | <exclude name="**/*.yarb/**"/> | |
23 | <exclude name="**/*~/**"/> | |
24 | <exclude name="**/.DS_Store/**"/> | |
25 | <exclude name="**/.git/**"/> | |
26 | <exclude name="**/.hg/**"/> | |
27 | <exclude name="**/.svn/**"/> | |
28 | <exclude name="**/CVS/**"/> | |
29 | <exclude name="**/__pycache__/**"/> | |
30 | <exclude name="**/_svn/**"/> | |
31 | <exclude name="**/vssver.scc/**"/> | |
32 | <exclude name="**/vssver2.scc/**"/> | |
33 | </patternset> | |
34 | <patternset id="library.patterns"> | |
35 | <include name="*.war"/> | |
36 | <include name="*.swc"/> | |
37 | <include name="*.zip"/> | |
38 | <include name="*.egg"/> | |
39 | <include name="*.ane"/> | |
40 | <include name="*.jar"/> | |
41 | <include name="*.ear"/> | |
42 | </patternset> | |
43 | <patternset id="compiler.resources"> | |
44 | <exclude name="**/?*.java"/> | |
45 | <exclude name="**/?*.form"/> | |
46 | <exclude name="**/?*.class"/> | |
47 | <exclude name="**/?*.groovy"/> | |
48 | <exclude name="**/?*.scala"/> | |
49 | <exclude name="**/?*.flex"/> | |
50 | <exclude name="**/?*.kt"/> | |
51 | <exclude name="**/?*.clj"/> | |
52 | <exclude name="**/?*.aj"/> | |
53 | </patternset> | |
54 | ||
55 | <!-- JDK definitions --> | |
56 | ||
57 | <property name="jdk.bin.1.8" value="${jdk.home.1.8}/bin"/> | |
58 | <path id="jdk.classpath.1.8"> | |
59 | <fileset dir="${jdk.home.1.8}"> | |
60 | <include name="jre/lib/charsets.jar"/> | |
61 | <include name="jre/lib/ext/cldrdata.jar"/> | |
62 | <include name="jre/lib/ext/dnsns.jar"/> | |
63 | <include name="jre/lib/ext/icedtea-sound.jar"/> | |
64 | <include name="jre/lib/ext/jaccess.jar"/> | |
65 | <include name="jre/lib/ext/localedata.jar"/> | |
66 | <include name="jre/lib/ext/nashorn.jar"/> | |
67 | <include name="jre/lib/ext/sunec.jar"/> | |
68 | <include name="jre/lib/ext/sunjce_provider.jar"/> | |
69 | <include name="jre/lib/ext/sunpkcs11.jar"/> | |
70 | <include name="jre/lib/ext/zipfs.jar"/> | |
71 | <include name="jre/lib/jce.jar"/> | |
72 | <include name="jre/lib/jsse.jar"/> | |
73 | <include name="jre/lib/management-agent.jar"/> | |
74 | <include name="jre/lib/resources.jar"/> | |
75 | <include name="jre/lib/rt.jar"/> | |
76 | <include name="jre/lib/ext/jfxrt.jar"/> | |
77 | </fileset> | |
78 | </path> | |
79 | ||
80 | <property name="project.jdk.home" value="${jdk.home.1.8}"/> | |
81 | <property name="project.jdk.bin" value="${jdk.bin.1.8}"/> | |
82 | <property name="project.jdk.classpath" value="jdk.classpath.1.8"/> | |
83 | ||
84 | ||
85 | <!-- Project Libraries --> | |
86 | ||
87 | <path id="library.opencv.classpath"> | |
88 | <pathelement location="/usr/share/java/opencv.jar"/> | |
89 | </path> | |
90 | ||
91 | <path id="library.pi4j.classpath"> | |
92 | <fileset dir="${basedir}/lib/pi4j"> | |
93 | <patternset refid="library.patterns"/> | |
94 | </fileset> | |
95 | </path> | |
96 | ||
97 | <!-- Modules --> | |
98 | ||
99 | ||
100 | <!-- Module CakeLight --> | |
101 | ||
102 | <dirname property="module.cakelight.basedir" file="${ant.file}"/> | |
103 | ||
104 | ||
105 | <property name="module.jdk.home.cakelight" value="${project.jdk.home}"/> | |
106 | <property name="module.jdk.bin.cakelight" value="${project.jdk.bin}"/> | |
107 | <property name="module.jdk.classpath.cakelight" value="${project.jdk.classpath}"/> | |
108 | ||
109 | <property name="compiler.args.cakelight" value="-encoding UTF-8 -source 8 -target 8 ${compiler.args}"/> | |
110 | ||
111 | <property name="cakelight.output.dir" value="${module.cakelight.basedir}/out/production/CakeLight"/> | |
112 | <property name="cakelight.testoutput.dir" value="${module.cakelight.basedir}/out/test/CakeLight"/> | |
113 | ||
114 | <path id="cakelight.module.bootclasspath"> | |
115 | <!-- Paths to be included in compilation bootclasspath --> | |
116 | </path> | |
117 | ||
118 | <path id="cakelight.module.production.classpath"> | |
119 | <path refid="${module.jdk.classpath.cakelight}"/> | |
120 | <path refid="library.opencv.classpath"/> | |
121 | <path refid="library.pi4j.classpath"/> | |
122 | </path> | |
123 | ||
124 | <path id="cakelight.runtime.production.module.classpath"> | |
125 | <pathelement location="${cakelight.output.dir}"/> | |
126 | <path refid="library.opencv.classpath"/> | |
127 | <path refid="library.pi4j.classpath"/> | |
128 | </path> | |
129 | ||
130 | <path id="cakelight.module.classpath"> | |
131 | <path refid="${module.jdk.classpath.cakelight}"/> | |
132 | <pathelement location="${cakelight.output.dir}"/> | |
133 | <path refid="library.opencv.classpath"/> | |
134 | <path refid="library.pi4j.classpath"/> | |
135 | </path> | |
136 | ||
137 | <path id="cakelight.runtime.module.classpath"> | |
138 | <pathelement location="${cakelight.testoutput.dir}"/> | |
139 | <pathelement location="${cakelight.output.dir}"/> | |
140 | <path refid="library.opencv.classpath"/> | |
141 | <path refid="library.pi4j.classpath"/> | |
142 | </path> | |
143 | ||
144 | ||
145 | <patternset id="excluded.from.module.cakelight"> | |
146 | <patternset refid="ignored.files"/> | |
147 | </patternset> | |
148 | ||
149 | <patternset id="excluded.from.compilation.cakelight"> | |
150 | <patternset refid="excluded.from.module.cakelight"/> | |
151 | </patternset> | |
152 | ||
153 | <path id="cakelight.module.sourcepath"> | |
154 | <dirset dir="${module.cakelight.basedir}"> | |
155 | <include name="src"/> | |
156 | </dirset> | |
157 | </path> | |
158 | ||
159 | ||
160 | <target name="compile.module.cakelight" depends="compile.module.cakelight.production,compile.module.cakelight.tests" description="Compile module CakeLight"/> | |
161 | ||
162 | <target name="compile.module.cakelight.production" description="Compile module CakeLight; production classes"> | |
163 | <mkdir dir="${cakelight.output.dir}"/> | |
164 | <javac destdir="${cakelight.output.dir}" debug="${compiler.debug}" nowarn="${compiler.generate.no.warnings}" memorymaximumsize="${compiler.max.memory}" fork="true" executable="${module.jdk.bin.cakelight}/javac"> | |
165 | <compilerarg line="${compiler.args.cakelight}"/> | |
166 | <bootclasspath refid="cakelight.module.bootclasspath"/> | |
167 | <classpath refid="cakelight.module.production.classpath"/> | |
168 | <src refid="cakelight.module.sourcepath"/> | |
169 | <patternset refid="excluded.from.compilation.cakelight"/> | |
170 | </javac> | |
171 | ||
172 | <copy todir="${cakelight.output.dir}"> | |
173 | <fileset dir="${module.cakelight.basedir}/src"> | |
174 | <patternset refid="compiler.resources"/> | |
175 | <type type="file"/> | |
176 | </fileset> | |
177 | </copy> | |
df46bbde | 178 | </target> |
01ee91e7 | 179 | |
df46bbde TW |
180 | <target name="jar" description="Builds a jar file"> |
181 | <delete file="${cakelight.output.dir}/cakelight.jar"/> | |
01ee91e7 TW |
182 | <jar destfile="${cakelight.output.dir}/cakelight.jar"> |
183 | <fileset dir="${cakelight.output.dir}" /> | |
184 | <!-- TODO replace hard links --> | |
df46bbde | 185 | <zipfileset includes="**/*.class" src="/opt/pi4j/lib/pi4j-core.jar" /> |
01ee91e7 TW |
186 | <zipfileset includes="**/*.class" src="/usr/share/java/opencv.jar" /> |
187 | <manifest> | |
188 | <attribute name="Main-Class" value="kaka.cakelight.LedController" /> | |
189 | </manifest> | |
190 | </jar> | |
191 | </target> | |
192 | ||
193 | <target name="compile.module.cakelight.tests" depends="compile.module.cakelight.production" description="compile module CakeLight; test classes" unless="skip.tests"/> | |
194 | ||
195 | <target name="clean.module.cakelight" description="cleanup module"> | |
196 | <delete dir="${cakelight.output.dir}"/> | |
197 | <delete dir="${cakelight.testoutput.dir}"/> | |
198 | </target> | |
199 | ||
200 | <target name="init" description="Build initialization"> | |
201 | <!-- Perform any build initialization in this target --> | |
202 | </target> | |
203 | ||
204 | <target name="clean" depends="clean.module.cakelight" description="cleanup all"/> | |
205 | ||
df46bbde | 206 | <target name="build.modules" depends="init, clean, compile.module.cakelight, jar" description="build all modules"/> |
01ee91e7 TW |
207 | |
208 | <target name="all" depends="build.modules" description="build all"/> | |
209 | </project> |