-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbuild.xml
More file actions
126 lines (109 loc) · 4.5 KB
/
Copy pathbuild.xml
File metadata and controls
126 lines (109 loc) · 4.5 KB
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
<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright (c) 2020 by Dr. Jody Paul
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.
http://creativecommons.org/licenses/by-sa/4.0/ -->
<project name="Explorations" basedir="." default="main">
<description>
Build file for student explorations and discovery learning
</description>
<property name="version" value="20201021_1"/>
<property name="author" value="Dr. Jody Paul"/>
<property name="copyright" value="Copyright (c) 2020 by Dr. Jody Paul"/>
<property name="license"
value="This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License."/>
<!-- Global properties -->
<property name="src.dir" value="src"/>
<property name="build.dir" value="build"/>
<property name="classes.dir" value="${build.dir}/classes"/>
<property name="jar.dir" value="${build.dir}/jar"/>
<property name="lib.dir" value="lib"/>
<property name="reports.dir" location="reports"/>
<!-- Identify main class -->
<property name="main-class" value="Demo"/>
<!-- Establish classpaths for production and testing. -->
<path id="classpath">
<fileset dir="${lib.dir}" includes="**/*.jar"/>
</path>
<path id="test.classpath">
<pathelement path="${classes.dir}"/>
<fileset dir="${ant.home}/lib" includes="*.jar"/>
<fileset dir="${lib.dir}" includes="*.jar"/>
</path>
<target name="clean"
description="Clean up dynamically-created files and directories">
<delete dir="${build.dir}"/>
<delete dir="${reports.dir}"/>
</target>
<target name="compile">
<mkdir dir="${classes.dir}"/>
<javac srcdir="${src.dir}"
destdir="${classes.dir}"
classpathref="test.classpath"
encoding="UTF-8"
debug="on"
nowarn="true"
includeantruntime="false">
<compilerarg value="-Xlint"/>
</javac>
</target>
<target name="jar" depends="compile">
<mkdir dir="${jar.dir}"/>
<jar destfile="${jar.dir}/${ant.project.name}.jar" basedir="${classes.dir}">
<manifest>
<attribute name="Main-Class" value="${main-class}"/>
</manifest>
</jar>
</target>
<target name="run" description="Run the application" depends="jar">
<java jar="${jar.dir}/${ant.project.name}.jar"
error="/dev/null"
fork="true"/>
</target>
<target name="main"
description="Clean, Build, and Run"
depends="clean,run"/>
<target name="init">
<!-- Create a time stamp -->
<tstamp/>
</target>
<!-- Checkstyle properties -->
<property name="checkstyle.jar" value="${lib.dir}/checkstyle.jar"/>
<property name="checkstyle.xsl" value="${lib.dir}/checkstyle.xsl"/>
<property name="checks.xml" value="${lib.dir}/jp_checks.xml"/>
<property name="checkstyle.reports.dir" value="${reports.dir}/checkstyle"/>
<target name="checkstyle"
description="Generate Checkstyle report of code convention violations">
<taskdef resource="com/puppycrawl/tools/checkstyle/ant/checkstyle-ant-task.properties"
classpath="${checkstyle.jar}" />
<mkdir dir="${checkstyle.reports.dir}"/>
<checkstyle config="${checks.xml}"
failureProperty="checkstyle.failure"
failOnViolation="false">
<fileset dir="${src.dir}" includes="**/*.java" />
<!-- formatter type="plain" / -->
<formatter type="xml" tofile="${checkstyle.reports.dir}/checkstyle_report.xml" />
</checkstyle>
<xslt in="${checkstyle.reports.dir}/checkstyle_report.xml"
out="${checkstyle.reports.dir}/checkstyle_report.html"
style="${checkstyle.xsl}" />
</target>
<target name="test" description="Run tests" depends="unitTest"/>
<target name="unitTest" depends="test.console.launcher"/>
<property name="testreports.dir" location="${reports.dir}/testresults"/>
<!-- https://junit.org/junit5/docs/current/user-guide/#running-tests-console-launcher -->
<target name="test.console.launcher" depends="compile">
<java classpathref="test.classpath"
classname="org.junit.platform.console.ConsoleLauncher"
fork="true"
failonerror="false">
<arg value="--scan-classpath"/>
<arg line="--reports-dir ${testreports.dir}"/>
</java>
<junitreport todir="${testreports.dir}">
<fileset dir="${testreports.dir}">
<include name="TEST-*.xml"/>
</fileset>
<report format="frames" todir="${testreports.dir}"/>
</junitreport>
</target>
</project>