-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.xml
127 lines (104 loc) · 5.7 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
119
120
121
122
123
124
125
126
127
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!--
Copyright 2014 Roque Pinel
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<project name="Mangue" basedir="." default="jar-and-sign" >
<!-- ===================================================================== -->
<!-- | PROPERTIES | -->
<!-- ===================================================================== -->
<!-- Load properties specific to this Kindlet. -->
<property file="kindlet.properties" />
<property file="local.properties" />
<property environment="env" />
<property name="compiler.debuglevel" value="source,lines,vars" />
<property name="compiler.target" value="1.4" />
<property name="compiler.source" value="1.4" />
<property name="file.keystore" location="${user.home}/.kindle/developer.keystore" />
<property name="dir.kdk" location="${user.home}/.kindle" />
<property name="dir.src" location="${basedir}/src" />
<property name="dir.res" location="${basedir}/res" />
<property name="dir.images" location="${basedir}/images" />
<property name="dir.bin" location="${basedir}/bin" />
<property name="dir.build" location="${basedir}/build" />
<property name="dir.build.classes" location="${dir.build}/classes" />
<property name="file.output" location="${dir.build}/${ant.project.name}.azw2" />
<!-- ===================================================================== -->
<!-- | PATHS | -->
<!-- ===================================================================== -->
<path id="app.classpath">
<pathelement location="${dir.build.classes}" />
<fileset dir="${dir.kdk}">
<include name="**/*.jar"/>
</fileset>
</path>
<!-- ===================================================================== -->
<!-- | ESSENCIAL TARGETS | -->
<!-- ===================================================================== -->
<target name="init">
<mkdir dir="${dir.build.classes}" />
<copy includeemptydirs="false" todir="${dir.build.classes}">
<fileset dir="${dir.src}">
<exclude name="**/*.java" />
</fileset>
</copy>
</target>
<target name="build" depends="init">
<echo message="${ant.project.name}: ${ant.file}" />
<javac debug="true"
debuglevel="${compiler.debuglevel}"
destdir="${dir.build.classes}"
source="${compiler.source}"
target="${compiler.target}"
includeantruntime="false">
<src path="${dir.src}" />
<classpath refid="app.classpath" />
</javac>
<copy todir="${dir.build.classes}/res">
<fileset dir="${dir.res}">
<include name="**/*" />
</fileset>
</copy>
<copy todir="${dir.build.classes}/images">
<fileset dir="${dir.images}">
<include name="**/*" />
</fileset>
</copy>
</target>
<target name="clean">
<delete dir="${dir.bin}" />
<delete dir="${dir.build}" />
</target>
<!-- ===================================================================== -->
<!-- | USEFUL TARGETS | -->
<!-- ===================================================================== -->
<target name="jar" depends="build">
<jar basedir="${dir.build.classes}" destfile="${file.output}">
<manifest>
<attribute name="Main-Class" value="${kindlet.mainClass}" />
<attribute name="Implementation-Vendor" value="${kindlet.vendor}" />
<attribute name="Implementation-Title" value="${kindlet.title}" />
<attribute name="Implementation-Version" value="${kindlet.version}" />
<attribute name="Implementation-URL" value="${kindlet.url}" />
<attribute name="Amazon-Cover-Image" value="${kindlet.image}" />
</manifest>
</jar>
</target>
<target name="jar-and-sign" depends="jar">
<available file="${file.output}" property="file.available"/>
<fail message="Jar file cannot be found (${file.output}). File signing failed." unless="file.available"/>
<available file="${file.keystore}" property="keystore.available"/>
<fail message="Unable to locate keystore file '${file.keystore}'. Please also ensure that the 'keystore.storepass' is defined in your 'local.properties' file." unless="keystore.available"/>
<signjar jar="${file.output}" keystore="${file.keystore}" alias="dk${keystore.alias.prefix}" storepass="${keystore.storepass}"/>
<signjar jar="${file.output}" keystore="${file.keystore}" alias="di${keystore.alias.prefix}" storepass="${keystore.storepass}"/>
<signjar jar="${file.output}" keystore="${file.keystore}" alias="dn${keystore.alias.prefix}" storepass="${keystore.storepass}"/>
</target>
</project>