source: apps/BOB/build.xml @ 5912c606

Last change on this file since 5912c606 was 5912c606, checked in by sponge <sponge@…>, 9 years ago

Remove the one little html file that ends up in BOB.jar. The file is NOT a javadoc file, it is a package file. Still, it is zapped.

  • Property mode set to 100644
File size: 5.6 KB
Line 
1<?xml version="1.0" encoding="UTF-8"?>
2<!-- You may freely edit this file. See commented blocks below for -->
3<!-- some examples of how to customize the build. -->
4<!-- (If you delete it and reopen the project it will be recreated.) -->
5<!-- By default, only the Clean and Build commands use this build script. -->
6<!-- Commands such as Run, Debug, and Test only use this build script if -->
7<!-- the Compile on Save feature is turned off for the project. -->
8<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
9<!-- in the project's Project Properties dialog box.-->
10<project name="BOB" default="default" basedir=".">
11    <description>Builds, tests, and runs the project BOB.</description>
12    <import file="nbproject/build-impl.xml"/>
13    <!--
14
15    There exist several targets which are by default empty and which can be
16    used for execution of your tasks. These targets are usually executed
17    before and after some main targets. They are:
18
19      -pre-init:                 called before initialization of project properties
20      -post-init:                called after initialization of project properties
21      -pre-compile:              called before javac compilation
22      -post-compile:             called after javac compilation
23      -pre-compile-single:       called before javac compilation of single file
24      -post-compile-single:      called after javac compilation of single file
25      -pre-compile-test:         called before javac compilation of JUnit tests
26      -post-compile-test:        called after javac compilation of JUnit tests
27      -pre-compile-test-single:  called before javac compilation of single JUnit test
28      -post-compile-test-single: called after javac compilation of single JUunit test
29      -pre-jar:                  called before JAR building
30      -post-jar:                 called after JAR building
31      -post-clean:               called after cleaning build products
32
33    (Targets beginning with '-' are not intended to be called on their own.)
34
35    Example of inserting an obfuscator after compilation could look like this:
36
37        <target name="-post-compile">
38            <obfuscate>
39                <fileset dir="${build.classes.dir}"/>
40            </obfuscate>
41        </target>
42
43    For list of available properties check the imported
44    nbproject/build-impl.xml file.
45
46
47    Another way to customize the build is by overriding existing main targets.
48    The targets of interest are:
49
50      -init-macrodef-javac:     defines macro for javac compilation
51      -init-macrodef-junit:     defines macro for junit execution
52      -init-macrodef-debug:     defines macro for class debugging
53      -init-macrodef-java:      defines macro for class execution
54      -do-jar-with-manifest:    JAR building (if you are using a manifest)
55      -do-jar-without-manifest: JAR building (if you are not using a manifest)
56      run:                      execution of project
57      -javadoc-build:           Javadoc generation
58      test-report:              JUnit report generation
59
60    An example of overriding the target for project execution could look like this:
61
62        <target name="run" depends="BOB-impl.jar">
63            <exec dir="bin" executable="launcher.exe">
64                <arg file="${dist.jar}"/>
65            </exec>
66        </target>
67
68    Notice that the overridden target depends on the jar target and not only on
69    the compile target as the regular run target does. Again, for a list of available
70    properties which you can use, check the target you are overriding in the
71    nbproject/build-impl.xml file.
72
73    -->
74    <target name="-post-jar">
75        <!-- clean up leftover html file in final jar. -->
76        <mkdir dir="${dist.dir}/rejar" />
77        <unjar dest="${dist.dir}/rejar/" >
78                <fileset dir="${dist.dir}" >
79                        <include name="**/*.jar" />
80                </fileset>
81        </unjar>
82        <delete dir="${dist.dir}/rejar/" >
83                <include name="**/*.html" />
84        </delete>
85        <jar jarfile="dist/BOB.jar">
86                 <fileset dir="${dist.dir}/rejar/" />
87        </jar>
88        <delete dir="${dist.dir}" followsymlinks="false" includeemptydirs="true">
89                <include name="rejar/**/*" />
90                <include name="rejar" />
91        </delete>
92                 
93    </target>
94    <target depends="jar" description="Build BOB into a SINGLE JAR." name="onejar">
95        <!-- Make needed working dirs -->
96        <mkdir dir="${dist.dir}/lib" />
97        <mkdir dir="${dist.dir}/classes" />
98
99        <!-- Copy jars -->
100        <copy todir="${dist.dir}/lib" flatten="true" >
101            <path>
102                <pathelement path="${javac.classpath}" />
103            </path>
104        </copy>
105        <copy todir="${dist.dir}/lib" file="../../installer/lib/jbigi/jbigi.jar" />
106
107        <!-- Extract the classes inside the jar files -->
108        <unjar dest="${dist.dir}/classes" >
109            <fileset dir="${dist.dir}/lib" >
110                <include name="**/*.jar" />
111            </fileset>
112        </unjar>
113
114        <!-- Recombine the classes into a new jar file -->
115        <jar jarfile="${dist.dir}/lib/all-in-one.jar" >
116            <fileset dir="${dist.dir}/classes" />
117        </jar>
118
119        <!-- Clean up work area -->       
120        <delete dir="${dist.dir}/classes" followsymlinks="false" includeemptydirs="true"/>
121
122        <!-- Make the single jar file -->
123        <jar jarfile="dist/BOB-one.jar" >
124            <zipfileset src="${dist.jar}" excludes="META-INF/*" />
125            <zipfileset src="${dist.dir}/lib/all-in-one.jar" excludes="**/META-INF/*" />
126            <manifest>
127                <attribute name="Main-Class" value="net.i2p.BOB.Main" />
128            </manifest>
129        </jar>
130
131        <!-- Clean up the fake jar file -->
132        <delete file="${dist.dir}/lib/all-in-one.jar" />
133    </target>
134</project>
Note: See TracBrowser for help on using the repository browser.