-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
113 lines (104 loc) · 5.04 KB
/
build.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
<?xml version="1.0" encoding="UTF-8"?>
<project name="CocoDoc" default="make" basedir=".">
<description>Build CocoDoc: HTML App builder</description>
<!-- Launch4j directory -->
<property name="launch4j.dir" location="C:/Program Files (x86)/Launch4j" />
<!-- Jar main class -->
<property name="jar.main" value="sheepy.cocodoc.CocoDoc" />
<!-- App title -->
<property name="app.title" value="CocoDoc" />
<!-- Source code folder -->
<property name="dir.src" value="src" />
<!-- Jar compilation folder -->
<property name="dir.jar" value="dist" />
<!-- Jar file name -->
<property name="jar.name" value="CocoDoc.jar" />
<!-- Convert ${jar.main} to path and set ${file.main} -->
<script language="javascript">
project.setProperty( "file.main", project.getProperty("jar.main").replaceAll( "\\.", "/" ) + ".java" );
project.setProperty( "file.main.class", project.getProperty("file.main").replace( ".java", ".class" ) );
</script>
<!-- Delete class folder which is left from extrading the jar -->
<condition property="class-in-root">
<available file="./${file.main.class}" />
</condition>
<target name="-delete-class" if="class-in-root">
<delete includeemptydirs="true" failonerror="false">
<fileset dir ="sheepy" />
<fileset dir ="SevenZip" />
</delete>
</target>
<!-- Compile and create a redistritabue jar -->
<target name="make" depends="-delete-class" description="Compile and build a deliverable.">
<!-- check -->
<fail message="Not found: ${dir.src}/${file.main}">
<condition><not><available file="${dir.src}/${file.main}" /></not></condition>
</fail>
<!-- clean -->
<delete includeemptydirs="true" failonerror="false"><fileset dir ="${dir.jar}" /></delete>
<mkdir dir="${dir.jar}" />
<!-- compile & copy support files -->
<javac srcdir="${dir.src}" destdir="${dir.jar}" encoding="UTF-8" debug="true" includeantruntime="false" />
<property name="jar.root" value="${dir.jar}" />
<antcall target="-copy-file" />
<!-- jar -->
<delete file="${jar.name}" />
<jar destfile="${jar.name}">
<fileset dir="${dir.jar}"/>
<manifest>
<attribute name="Main-Class" value="${jar.main}" />
<attribute name="Application-Name" value="${jar.main}" />
<attribute name="Permissions" value="all-permissions" />
</manifest>
</jar>
<!-- clean -->
<delete includeemptydirs="true" failonerror="false"><fileset dir ="${dir.jar}" /></delete>
</target>
<!-- Wrap jar file into exe -->
<target name="exe" depends="make" description="Compile and build a Windows deliverable.">
<!-- Windows binary -->
<taskdef name="launch4j" classname="net.sf.launch4j.ant.Launch4jTask" classpath="${launch4j.dir}/launch4j.jar:${launch4j.dir}/lib/xstream.jar" />
<launch4j configFile="launch4j.xml" />
</target>
<!-- Copy support files to ${jar.root} -->
<target name="-copy-file">
<copy todir="${jar.root}/res"><fileset dir="res"/></copy>
<copy todir="${jar.root}/META-INF"><fileset dir="META-INF"/></copy>
<copy todir="${jar.root}/src"><fileset dir="src"/></copy>
<copy todir="${jar.root}">
<fileset file="build.xml"/>
<fileset file="read.me"/>
</copy>
</target>
<!--
There exist several NetBeans targets which are by default empty and which can be
used for execution of your tasks. They are:
-pre-init: called before initialization of project properties
-post-init: called after initialization of project properties
-pre-compile: called before javac compilation
-post-compile: called after javac compilation
-pre-compile-single: called before javac compilation of single file
-post-compile-single: called after javac compilation of single file
-pre-compile-test: called before javac compilation of JUnit tests
-post-compile-test: called after javac compilation of JUnit tests
-pre-compile-test-single: called before javac compilation of single JUnit test
-post-compile-test-single: called after javac compilation of single JUunit test
-pre-jar: called before JAR building
-post-jar: called after JAR building
-post-clean: called after cleaning build products
-->
<import file="nbproject/build-impl.xml" optional="true" />
<target name="-pre-jar" if="src.src.dir">
<property name="jar.root" value="${build.dir}/classes" />
<antcall target="-copy-file" />
</target>
<target name="-post-jar" if="src.src.dir">
<delete includeemptydirs="true" failonerror="false">
<fileset dir ="${build.dir}/classes/res" />
<fileset dir ="${build.dir}/classes/META-INF"/>
<fileset dir ="${build.dir}/classes/src"/>
<fileset file="${build.dir}/classes/build.xml"/>
<fileset file="${build.dir}/classes/read.me"/>
</delete>
</target>
</project>