Debian Codegraph @

app/build.xml

raw symbols SCIP
1 <?xml version="1.0"?>
2 <project name="Arduino PDE" xmlns:if="ant:if" xmlns:unless="ant:unless" default="build">
3
4 <path id="class.path">
5 <fileset dir="lib">
6 <include name="*.jar"/>
7 </fileset>
8 <pathelement path="${env.JAVA_HOME}/lib/tools.jar"/>
9 <pathelement path="../arduino-core/arduino-core.jar"/>
10 </path>
11
12 <path id="class.path.test">
13 <path refid="class.path"/>
14 <pathelement location="bin/"/>
15 <fileset dir="test-lib">
16 <include name="*.jar"/>
17 </fileset>
18 </path>
19
20 <target name="clean" description="Clean the build directories">
21 <delete dir="bin" />
22 <delete dir="test-bin" />
23 <delete file="pde.jar" />
24 </target>
25
26 <target name="compile" description="Compile sources">
27 <condition property="core-built">
28 <available file="../arduino-core/arduino-core.jar" />
29 </condition>
30 <fail unless="core-built" message="Please build the Arduino-core library first and make sure it sits in ../arduino-core/arduino-core.jar" />
31
32 <mkdir dir="bin" />
33
34 <!-- ant seems to nuke ${java.home} for some reason, pointing at the JRE
35 subfolder instead of the actual JDK found at JAVA_HOME.
36 To avoid this, we grab the actual JAVA_HOME environment variable
37 and use that to specify the location of tools.jar. -->
38
39 <!-- if someone is better with ant please help clean this up -->
40 <property environment="env" />
41 <property name="java_home" value="${env.JAVA_HOME}" />
42
43 <condition property="linux"><os family="unix" /></condition>
44 <fail if="linux" unless="java_home"
45 message="The JAVA_HOME variable must be set to the location of a full JDK. For instance, on Ubuntu Linux, this might be /usr/lib/jvm/java-6-sun." />
46
47 <condition property="windows"><os family="windows" /></condition>
48 <fail if="windows" unless="java_home"
49 message="The JAVA_HOME variable must be set to the location of a full JDK. For instance, on Windows, this might be c:\jdk1.6.0_18." />
50
51 <condition property="work.dir" value="../build/macosx/work/Arduino.app/Contents/Java/">
52 <os family="mac"/>
53 </condition>
54 <condition property="java.additional.library.path" value=".">
55 <os family="mac"/>
56 </condition>
57 <condition property="work.dir" value="../build/windows/work/">
58 <os family="windows"/>
59 </condition>
60 <condition property="java.additional.library.path" value=".">
61 <os family="windows"/>
62 </condition>
63 <condition property="work.dir" value="../build/linux/work/">
64 <os family="unix"/>
65 </condition>
66 <condition property="java.additional.library.path" value="lib">
67 <os family="unix"/>
68 </condition>
69
70 <!--
71 <dirname property="blah" file="${java.home}" />
72 <echo message="here! ${java.home}/lib/tools.jar or there: ${blah}" />
73 <echo message="override ${env.JAVA_HOME}/lib/tools.jar" />
74 <fail />
75 -->
76 <javac source="1.8" target="1.8"
77 srcdir="src"
78 destdir="bin"
79 encoding="UTF-8"
80 includeAntRuntime="false"
81 debug="true"
82 classpathref="class.path" />
83 </target>
84
85 <target name="test" depends="compile" description="Runs the test">
86 <mkdir dir="test-bin"/>
87
88 <javac source="1.8" target="1.8"
89 srcdir="test"
90 destdir="test-bin"
91 encoding="UTF-8"
92 includeAntRuntime="false"
93 debug="true"
94 classpathref="class.path.test">
95 </javac>
96
97 <copy todir="test-bin" overwrite="true" verbose="true">
98 <fileset dir="test" includes="**/*.zip" />
99 <fileset dir="test" includes="**/*.txt" />
100 <fileset dir="test" includes="**/*.properties" />
101 <fileset dir="test" includes="**/*.ino" />
102 <fileset dir="test" includes="**/*.json*" />
103 <fileset dir="test" includes="**/*.key" />
104 <fileset dir="test" includes="**/*.hex" />
105 <fileset dir="test" includes="**/*.pac" />
106 </copy>
107
108 <!-- XML and TXT reports will be written here -->
109 <property name="test.reportdir" value="test-bin/results"/>
110 <!-- Summary HTML report will be written here -->
111 <property name="test.htmldir" value="test-bin/results/html"/>
112
113 <!-- Remove the reportdir, so the HTML report only includes tests from this run -->
114 <delete dir="${test.reportdir}" />
115 <mkdir dir="${test.reportdir}"/>
116 <mkdir dir="${test.htmldir}"/>
117
118 <!-- Sanity check: when single-test-methods is set, but single-test-class is not, raise an error -->
119 <fail message="Need single-test-class if single-test-methods is set" if="single-test-methods" unless="single-test-class"/>
120
121 <junit printsummary="yes" dir="${work.dir}" fork="true" showoutput="no" failureproperty="test.failed">
122 <jvmarg value="-Djava.library.path=${java.additional.library.path}"/>
123 <jvmarg value="-DWORK_DIR=."/>
124 <jvmarg value="-ea"/>
125 <classpath>
126 <pathelement location="bin"/>
127 <pathelement location="test-bin"/>
128 <pathelement location="${work.dir}/lib/jna-4.2.2.jar"/>
129 <pathelement location="${work.dir}/lib/jna-platform-4.2.2.jar"/>
130 <path refid="class.path.test"/>
131 </classpath>
132
133 <!-- Write XML files (for report-generation) and TXT files (for manual review) for every test class -->
134 <formatter type="plain" />
135 <formatter type="xml"/>
136 <!-- Print full details to stdout when running a single test -->
137 <formatter type="plain" usefile="false" if="single-test-class"/>
138 <!-- When running all tests, print details for failing tests and a summary for each test class (printsummary=yes above) -->
139 <formatter type="brief" usefile="false" unless="single-test-class"/>
140
141 <!-- When both single-test-class and single-test-methods are specified, pass both to unit -->
142 <test name="${single-test-class}" methods="${single-test-methods}" todir="${test.reportdir}" if="single-test-methods"/>
143 <!-- When just single-test-class is specified, omit methods to run the entire class -->
144 <test name="${single-test-class}" todir="${test.reportdir}" if="single-test-class" unless="single-test-methods"/>
145 <!-- When neither are specified, run *all* testcases -->
146 <batchtest fork="yes" todir="${test.reportdir}" unless="single-test-class">
147 <fileset dir="test">
148 <include name="**/*Test.java"/>
149 <exclude name="**/Abstract*.java"/>
150 </fileset>
151 </batchtest>
152 </junit>
153
154 <!-- Convert generated XML reports to browsable HTML -->
155 <junitreport todir="${test.reportdir}">
156 <fileset dir="${test.reportdir}">
157 <include name="TEST-*.xml" />
158 </fileset>
159 <!-- Create a browsable frame-based HTML -->
160 <report format="frames" todir="${test.htmldir}" />
161 <!-- Also create a single-page version, to use as CI test result -->
162 <report format="noframes" todir="${test.htmldir}" />
163 </junitreport>
164
165 <!-- Make these paths relative to user.dir, which is the current directory when invoking ant (so the resulting paths are relative to the environment of the user. -->
166 <property name="test.htmldir.display" location="${test.htmldir}" relative="true" basedir="${user.dir}"/>
167 <property name="test.reportdir.display" location="${test.reportdir}" relative="true" basedir="${user.dir}"/>
168 <echo unless:set="running-from-github-action" message="Detailed test results can be found in ${test.reportdir.display}"/>
169 <echo unless:set="running-from-github-action" message="A browsable HTML summary is generated in ${test.htmldir.display}/index.html"/>
170 <echo if:set="running-from-github-action" message="Detailed test results can be downloaded as an asset from this github action. Easiest to view is the single-file version in junit-noframes.html. Alternatively, the multi-file version can be viewed from index.html and includes full stdout/stderr output of tests."/>
171
172 <fail if="test.failed"/>
173 </target>
174
175 <target name="build" depends="compile" description="Build PDE">
176 <jar basedir="bin" destfile="pde.jar" />
177 </target>
178 </project>