-
Notifications
You must be signed in to change notification settings - Fork 7
/
build.xml
118 lines (103 loc) · 4.76 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
114
115
116
117
118
<?xml version="1.0" encoding="UTF-8"?>
<project name="oddi" default="make" basedir=".">
<description> D&D 4e Compendium Viewer / Downloader </description>
<!-- Launch4j directory -->
<property name="launch4j.dir" location="C:/Program Files (x86)/Launch4j" />
<!-- Jar main class -->
<property name="jar.main" value="db4e.Main" />
<!-- App title -->
<property name="app.title" value="4e Compendium Downloader" />
<!-- Source code folder -->
<property name="dir.src" value="java" />
<!-- Jar compilation folder -->
<property name="dir.jar" value="dist" />
<!-- Jar file name -->
<property name="jar.name" value="4e_compendium_downloader.jar" />
<target name="-make-html">
<!-- Build viewer. -->
<delete file="res/4e_database.html" failonerror="false" />
<java jar="java_lib/CocoDoc.1.1.1.jar">
<arg line="html/html_template.html" />
</java>
</target>
<target name="make" depends="-make-html" description="Compile html and jar">
<!-- Cleanup -->
<delete file="${jar.name}" />
<delete includeemptydirs="true" failonerror="false"><fileset dir ="${dir.jar}" /></delete>
<mkdir dir="${dir.jar}" />
<!-- Compile -->
<javac srcdir="${dir.src}" destdir="${dir.jar}" encoding="UTF-8" debug="true" includeantruntime="false">
<classpath>
<pathelement path="java_lib/sqljet/sqljet-1.1.10.jar" />
</classpath>
</javac>
<!-- Copy support files -->
<property name="jar.root" value="${dir.jar}" />
<copy todir="${jar.root}/res"><fileset dir="res" excludes="img/" /></copy>
<unjar src="java_lib/antlr/antlr-3.5.2-runtime.jar" dest="${jar.root}" />
<unjar src="java_lib/sqljet/sqljet-1.1.10.jar" dest="${jar.root}" />
<!-- Copy source code -->
<copy todir="${jar.root}">
<fileset file="build.xml" />
<fileset file="launch4j.xml" />
<fileset file="license_agpl.html" />
<fileset file="README.md" />
</copy>
<copy todir="${jar.root}/src/html"><fileset dir="html"/></copy>
<copy todir="${jar.root}/src/java"><fileset dir="java"/></copy>
<!-- Make jar -->
<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>
</target>
<!-- Wrap jar file into exe, will make jar if not exists -->
<target name="make_exe" depends="-make-if-no-jar" description="Compile and build a Windows deliverable.">
<!-- Call launch4j -->
<taskdef name="launch4j" classname="net.sf.launch4j.ant.Launch4jTask" classpath="${launch4j.dir}/launch4j.jar:${launch4j.dir}/lib/xstream.jar" />
<launch4j configFile="launch4j.xml" />
</target>
<!-- With an extracted jar structure, convert it back to original (pre-make) structure. -->
<target name="setup_from_jar" depends="-check-is-jar-structure" if="is.jar.structure" description="Restore a jar folder structure to original project structures.">
<move todir=".">
<fileset dir="src"/>
</move>
<zip destfile="java_lib/antlr/antlr-3.5.2-runtime.jar">
<fileset dir="." includes="org/antlr/**/*"/>
</zip>
<zip destfile="java_lib/sqljet/sqljet-1.1.10.jar">
<fileset dir="." includes="org/tmatesoft/**/*,sqljet.build.properties"/>
</zip>
<delete includeemptydirs="true">
<fileset dir="org"/>
<fileset dir="db4e"/>
<fileset dir="sheepy"/>
<fileset dir="SevenZip"/>
<fileset dir="META-INF"/>
<fileset file="sqljet.build.properties"/>
</delete>
<get src="https://github.com/Sheep-y/CocoDoc/releases/download/v1.1.1.0/CocoDoc.1.1.1.jar"
dest="java_lib/CocoDoc.1.1.1.jar" verbose="true" skipexisting="true" ignoreerrors="true" />
</target>
<!-- Compile viewer and copy to user home, will always rebuild -->
<target name="make_viewer" depends="-make-html" description="Compile the HTML viewer and moves it to default export location (user home)" >
<copy todir="${user.home}"><fileset file="res/4e_database.html"/></copy>
<copy todir="${user.home}/4e_database_files/res">
<fileset file="res/script.js"/>
<fileset file="res/style.css"/>
</copy>
</target>
<target name="-check-jar">
<available file="${jar.name}" property="has.jar"/>
</target>
<target name="-make-if-no-jar" depends="-check-jar" unless="has.jar">
<antcall target="make" />
</target>
<target name="-check-is-jar-structure">
<available file="sqljet.build.properties" property="is.jar.structure"/>
</target>
</project>