1
+ <?xml version =" 1.0" encoding =" UTF-8" standalone =" no" ?>
2
+ <project default =" create_run_jar" name =" fastaTrimmer.jar Create Runnable Jar for Jar-in-Jar Loader" >
3
+
4
+ <property name =" java_target" value =" 1.8" />
5
+ <property name =" java_source" value =" 1.8" />
6
+
7
+ <property name =" java.source.character.set" value =" iso-8859-1" />
8
+
9
+ <property name =" jar.main.class" value =" org.uwpr.fasta_trimmer.program.MainProgram" />
10
+
11
+ <property name =" output_runnable_jar" value =" fastaTrimmer.jar" />
12
+
13
+
14
+ <property name =" deploy" value =" deploy" />
15
+
16
+ <property name =" src" value =" src" />
17
+ <property name =" classes" value =" classes" />
18
+
19
+ <available file =" .git" type =" dir" property =" git.present" />
20
+
21
+
22
+ <target name =" create_run_jar" depends =" compile,prepare,git.revision" >
23
+
24
+ <path id =" build.classpath" >
25
+ <fileset dir =" lib" >
26
+ <include name =" **/*.jar" />
27
+ </fileset >
28
+ </path >
29
+
30
+ <!-- convert classpath to a flat list/string for use in manifest task -->
31
+ <pathconvert property =" jars.classpath" pathsep =" " >
32
+ <path refid =" build.classpath" />
33
+ <flattenmapper />
34
+ </pathconvert >
35
+
36
+
37
+ <property name =" final.classpath" value =" ./ ${jars.classpath}" />
38
+
39
+
40
+ <echo >Classpath for runnable jar ${final.classpath}</echo >
41
+
42
+
43
+
44
+
45
+ <jar destfile =" deploy/${output_runnable_jar}" >
46
+
47
+ <manifest >
48
+ <attribute name =" Main-Class" value =" org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader" />
49
+ <attribute name =" Rsrc-Main-Class"
50
+ value=" ${jar.main.class}" />
51
+ <attribute name =" Class-Path" value =" ." />
52
+ <attribute name =" Rsrc-Class-Path" value =" ${final.classpath}" />
53
+
54
+ <attribute name =" GIT-last-tag-commit-hash" value =" ${git.last.tag.and.commit.hash}" />
55
+ <attribute name =" GIT-commit-hash" value =" ${git.last.commit.hash}" />
56
+
57
+ <attribute name =" Date" value =" ${build-info.current-date}" />
58
+ <attribute name =" Time" value =" ${build-info.current-time}" />
59
+ </manifest >
60
+
61
+ <zipfileset src =" jar-in-jar-loader.zip" />
62
+ <fileset dir =" ${classes}" />
63
+ <zipfileset dir =" lib" />
64
+ </jar >
65
+ </target >
66
+
67
+
68
+ <target name =" create_jar_this_project" depends =" compile,prepare,git.revision" >
69
+
70
+ <jar destfile =" ${jar_this_project_dir}/${output_jar_this_project}" >
71
+
72
+ <manifest >
73
+ <attribute name =" Main-Class" value =" ${jar.main.class}" />
74
+
75
+ <attribute name =" GIT-last-tag-commit-hash" value =" ${git.last.tag.and.commit.hash}" />
76
+ <attribute name =" GIT-commit-hash" value =" ${git.last.commit.hash}" />
77
+
78
+ <attribute name =" Date" value =" ${build-info.current-date}" />
79
+ <attribute name =" Time" value =" ${build-info.current-time}" />
80
+ </manifest >
81
+
82
+ <fileset dir =" ${classes}" />
83
+ <fileset dir =" ${config}" />
84
+ </jar >
85
+
86
+ </target >
87
+
88
+
89
+ <target name =" prepare" >
90
+ <tstamp prefix =" build-info" >
91
+ <format property =" current-date" pattern =" d-MMMM-yyyy" locale =" en" />
92
+ <format property =" current-time" pattern =" hh:mm:ss a z" locale =" en" />
93
+ <format property =" year-month-day" pattern =" yyyy-MM-dd" locale =" en" />
94
+ </tstamp >
95
+
96
+ </target >
97
+
98
+
99
+ <target name =" git.revision"
100
+ description=" Store git revision in ${git.last.tag.and.commit.hash} and ${git.last.commit.hash}"
101
+ if=" git.present" >
102
+
103
+ <exec executable =" git" outputproperty =" git.last.tag.and.commit.hash.from.cmd" failifexecutionfails =" false" errorproperty =" " >
104
+ <arg value =" describe" />
105
+ <arg value =" --tags" />
106
+ <arg value =" --always" />
107
+ <arg value =" HEAD" />
108
+ </exec >
109
+
110
+ <echo message =" git.last.tag.and.commit.hash.from.cmd: ${git.last.tag.and.commit.hash.from.cmd}" />
111
+
112
+ <condition property =" git.last.tag.and.commit.hash" value =" ${git.last.tag.and.commit.hash.from.cmd}" else =" unknown" >
113
+ <and >
114
+ <isset property =" git.last.tag.and.commit.hash.from.cmd" />
115
+ <length string =" ${git.last.tag.and.commit.hash.from.cmd}" trim =" yes" length =" 0" when =" greater" />
116
+ </and >
117
+ </condition >
118
+
119
+ <echo message =" git.last.tag.and.commit.hash: ${git.last.tag.and.commit.hash}" />
120
+
121
+
122
+ <exec executable =" git" outputproperty =" git.last.commit.hash.from.cmd" failifexecutionfails =" false" errorproperty =" " >
123
+ <arg value =" describe" />
124
+ <arg value =" --always" />
125
+ <arg value =" HEAD" />
126
+ </exec >
127
+
128
+
129
+ <echo message =" git.last.commit.hash.from.cmd: ${git.last.commit.hash.from.cmd}" />
130
+
131
+ <condition property =" git.last.commit.hash" value =" ${git.last.commit.hash.from.cmd}" else =" unknown" >
132
+ <and >
133
+ <isset property =" git.last.commit.hash.from.cmd" />
134
+ <length string =" ${git.last.commit.hash.from.cmd}" trim =" yes" length =" 0" when =" greater" />
135
+ </and >
136
+ </condition >
137
+
138
+ <echo message =" git.last.commit.hash: ${git.last.commit.hash}" />
139
+
140
+ </target >
141
+
142
+
143
+
144
+ <!-- ================================================================================== -->
145
+ <!-- Clean the build directory -->
146
+ <!-- ================================================================================== -->
147
+ <target name =" clean" description =" Prepare for clean build" >
148
+ <delete dir =" ${classes}" />
149
+ <mkdir dir =" ${classes}" />
150
+ <delete dir =" ${deploy}" />
151
+ <mkdir dir =" ${deploy}" />
152
+ </target >
153
+
154
+ <!-- ================================================================================== -->
155
+ <!-- Normal build of application -->
156
+ <!-- ================================================================================== -->
157
+ <target name =" compile" depends =" clean" >
158
+ <!-- <echo message="${toString:compile.classpath}"/> -->
159
+ <javac includeantruntime =" false" debug =" on" srcdir =" src" destdir =" ${classes}" source =" ${java_source}" target =" ${java_target}" encoding =" ${java.source.character.set}" >
160
+ <classpath refid =" compile.classpath" />
161
+ </javac >
162
+
163
+ <!--
164
+ <copy todir="${classes}">
165
+
166
+ </copy>
167
+ -->
168
+
169
+ <copy todir =" ${classes}" >
170
+
171
+ <fileset dir =" ${src}" >
172
+ <exclude name =" **/*.java" />
173
+ </fileset >
174
+ </copy >
175
+
176
+ </target >
177
+
178
+ <!-- classpath -->
179
+ <path id =" compile.classpath" >
180
+ <fileset dir =" lib" >
181
+ <include name =" **/*.jar" />
182
+ </fileset >
183
+ </path >
184
+
185
+ </project >
0 commit comments