| 1 | <?xml version="1.0" encoding="UTF-8"?> |
| 2 | <project name="cakelight" default="all"> |
| 3 | |
| 4 | |
| 5 | <property file="config.properties"/> |
| 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" value="${jdk.home}/bin"/> |
| 58 | <path id="jdk.classpath"> |
| 59 | <fileset dir="${jdk.home}"> |
| 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}"/> |
| 81 | <property name="project.jdk.bin" value="${jdk.bin}"/> |
| 82 | <property name="project.jdk.classpath" value="jdk.classpath"/> |
| 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 | <path id="library.jnativehook.classpath"> |
| 98 | <pathelement location="${basedir}/lib/jnativehook-2.1.0.jar"/> |
| 99 | </path> |
| 100 | |
| 101 | <!-- Modules --> |
| 102 | |
| 103 | |
| 104 | <!-- Module CakeLight --> |
| 105 | |
| 106 | <dirname property="module.cakelight.basedir" file="${ant.file}"/> |
| 107 | |
| 108 | |
| 109 | <property name="module.jdk.home.cakelight" value="${project.jdk.home}"/> |
| 110 | <property name="module.jdk.bin.cakelight" value="${project.jdk.bin}"/> |
| 111 | <property name="module.jdk.classpath.cakelight" value="${project.jdk.classpath}"/> |
| 112 | |
| 113 | <property name="compiler.args.cakelight" value="-encoding UTF-8 -source 8 -target 8 ${compiler.args}"/> |
| 114 | |
| 115 | <property name="cakelight.output.dir" value="${module.cakelight.basedir}/out/production/CakeLight"/> |
| 116 | <property name="cakelight.testoutput.dir" value="${module.cakelight.basedir}/out/test/CakeLight"/> |
| 117 | |
| 118 | <path id="cakelight.module.bootclasspath"> |
| 119 | <!-- Paths to be included in compilation bootclasspath --> |
| 120 | </path> |
| 121 | |
| 122 | <path id="cakelight.module.production.classpath"> |
| 123 | <path refid="${module.jdk.classpath.cakelight}"/> |
| 124 | <path refid="library.opencv.classpath"/> |
| 125 | <path refid="library.pi4j.classpath"/> |
| 126 | <path refid="library.jnativehook.classpath"/> |
| 127 | </path> |
| 128 | |
| 129 | <path id="cakelight.runtime.production.module.classpath"> |
| 130 | <pathelement location="${cakelight.output.dir}"/> |
| 131 | <path refid="library.opencv.classpath"/> |
| 132 | <path refid="library.pi4j.classpath"/> |
| 133 | <path refid="library.jnativehook.classpath"/> |
| 134 | </path> |
| 135 | |
| 136 | <path id="cakelight.module.classpath"> |
| 137 | <path refid="${module.jdk.classpath.cakelight}"/> |
| 138 | <pathelement location="${cakelight.output.dir}"/> |
| 139 | <path refid="library.opencv.classpath"/> |
| 140 | <path refid="library.pi4j.classpath"/> |
| 141 | <path refid="library.jnativehook.classpath"/> |
| 142 | </path> |
| 143 | |
| 144 | <path id="cakelight.runtime.module.classpath"> |
| 145 | <pathelement location="${cakelight.testoutput.dir}"/> |
| 146 | <pathelement location="${cakelight.output.dir}"/> |
| 147 | <path refid="library.opencv.classpath"/> |
| 148 | <path refid="library.pi4j.classpath"/> |
| 149 | <path refid="library.jnativehook.classpath"/> |
| 150 | </path> |
| 151 | |
| 152 | |
| 153 | <patternset id="excluded.from.module.cakelight"> |
| 154 | <patternset refid="ignored.files"/> |
| 155 | </patternset> |
| 156 | |
| 157 | <patternset id="excluded.from.compilation.cakelight"> |
| 158 | <patternset refid="excluded.from.module.cakelight"/> |
| 159 | </patternset> |
| 160 | |
| 161 | <path id="cakelight.module.sourcepath"> |
| 162 | <dirset dir="${module.cakelight.basedir}"> |
| 163 | <include name="src"/> |
| 164 | </dirset> |
| 165 | </path> |
| 166 | |
| 167 | |
| 168 | <target name="compile.module.cakelight" depends="compile.module.cakelight.production,compile.module.cakelight.tests" description="Compile module CakeLight"/> |
| 169 | |
| 170 | <target name="compile.module.cakelight.production" description="Compile module CakeLight; production classes"> |
| 171 | <mkdir dir="${cakelight.output.dir}"/> |
| 172 | <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"> |
| 173 | <compilerarg line="${compiler.args.cakelight}"/> |
| 174 | <bootclasspath refid="cakelight.module.bootclasspath"/> |
| 175 | <classpath refid="cakelight.module.production.classpath"/> |
| 176 | <src refid="cakelight.module.sourcepath"/> |
| 177 | <patternset refid="excluded.from.compilation.cakelight"/> |
| 178 | </javac> |
| 179 | |
| 180 | <copy todir="${cakelight.output.dir}"> |
| 181 | <fileset dir="${module.cakelight.basedir}/src"> |
| 182 | <patternset refid="compiler.resources"/> |
| 183 | <type type="file"/> |
| 184 | </fileset> |
| 185 | </copy> |
| 186 | </target> |
| 187 | |
| 188 | <target name="jar" description="Builds a jar file"> |
| 189 | <delete file="${cakelight.output.dir}/cakelight.jar"/> |
| 190 | <jar destfile="${cakelight.output.dir}/cakelight.jar"> |
| 191 | <fileset dir="${cakelight.output.dir}" /> |
| 192 | <!-- TODO replace hard links --> |
| 193 | <zipfileset includes="**/*.class" src="/opt/pi4j/lib/pi4j-core.jar" /> |
| 194 | <zipfileset includes="**/*.class" src="/usr/share/java/opencv.jar" /> |
| 195 | <zipfileset includes="**/*.class" src="${module.cakelight.basedir}/lib/jnativehook-2.1.0.jar" /> |
| 196 | <manifest> |
| 197 | <attribute name="Main-Class" value="kaka.cakelight.LedController" /> |
| 198 | </manifest> |
| 199 | </jar> |
| 200 | </target> |
| 201 | |
| 202 | <target name="compile.module.cakelight.tests" depends="compile.module.cakelight.production" description="compile module CakeLight; test classes" unless="skip.tests"/> |
| 203 | |
| 204 | <target name="clean.module.cakelight" description="cleanup module"> |
| 205 | <delete dir="${cakelight.output.dir}"/> |
| 206 | <delete dir="${cakelight.testoutput.dir}"/> |
| 207 | </target> |
| 208 | |
| 209 | <target name="init" description="Build initialization"> |
| 210 | <!-- Perform any build initialization in this target --> |
| 211 | </target> |
| 212 | |
| 213 | <target name="clean" depends="clean.module.cakelight" description="cleanup all"/> |
| 214 | |
| 215 | <target name="build.modules" depends="init, clean, compile.module.cakelight, jar" description="build all modules"/> |
| 216 | |
| 217 | <target name="all" depends="build.modules" description="build all"/> |
| 218 | |
| 219 | <target name="build" depends="compile.module.cakelight" description="build cakelight"/> |
| 220 | </project> |