I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
build.xml 8.56 KiB
Newer Older
  • Learn to ignore specific revisions
  • <?xml version="1.0" encoding="UTF-8"?>
    
    zzz's avatar
    zzz committed
    <!--
    
      -  Portions copied and modified from Android SDK
      -  Copyright (c) 2005-2008, The Android Open Source Project
      -  Apache 2.0 license
    
    zzz's avatar
    zzz committed
      -  See licenses/LICENSE-Apache2.0.txt
    
     -->
    
    <project name="I2PAndroid" default="help">
    
        <!-- The local.properties file is created and updated by the 'android' tool.
             It contain the path to the SDK. It should *NOT* be checked in in Version
             Control Systems. -->
        <property file="local.properties"/>
    
        <!-- The build.properties file can be created by you and is never touched
             by the 'android' tool. This is the place to change some of the default property values
             used by the Ant rules.
             Here are some properties you may want to change/update:
    
             application-package
                 the name of your application package as defined in the manifest. Used by the
                 'uninstall' rule.
             source-folder
                 the name of the source folder. Default is 'src'.
             out-folder
                 the name of the output folder. Default is 'bin'.
    
             Properties related to the SDK location or the project target should be updated
              using the 'android' tool with the 'update' action.
    
             This file is an integral part of the build system for your application and
             should be checked in in Version Control Systems.
    
             -->
        <property file="build.properties"/>
        <!-- set the old name to the new name -->
        <property name="sdk-location" value="${sdk.dir}" />
    
        <!-- The default.properties file is created and updated by the 'android' tool, as well
             as ADT. 
             This file is an integral part of the build system for your application and
             should be checked in in Version Control Systems. -->
        <property file="default.properties"/>
    
        <!-- Custom Android task to deal with the project target, and import the proper rules.
             This requires ant 1.6.0 or above. -->
        <path id="android.antlibs">
            <pathelement path="${sdk-location}/tools/lib/anttasks.jar" />
            <pathelement path="${sdk-location}/tools/lib/sdklib.jar" />
            <pathelement path="${sdk-location}/tools/lib/androidprefs.jar" />
            <pathelement path="${sdk-location}/tools/lib/apkbuilder.jar" />
            <pathelement path="${sdk-location}/tools/lib/jarutils.jar" />
        </path>
    
        <taskdef name="setup"
            classname="com.android.ant.SetupTask"
            classpathref="android.antlibs"/>
    
        <!-- Execute the Android Setup task that will setup some properties specific to the target,
             and import the rules files.
             To customize the rules, copy/paste them below the task, and disable import by setting
             the import attribute to false:
                <setup import="false" />
             
             This will ensure that the properties are setup correctly but that your customized
             targets are used.
        -->
        <setup import="true" />
    
        <echo>Ignore warning about SDK version</echo>
        <!--
             ================================================================================
             New I2P rules
             ================================================================================
        -->
    
        <!-- overrides of those in main_rules.xml -->
    
    zzz's avatar
    zzz committed
    
    
        <target name="-pre-build" depends="copy-i2p-resources, incrementBuild" />
    
    zzz's avatar
    zzz committed
    
    
        <target name="-pre-compile" depends="buildrouter" />
    
        <target name="-post-compile" depends="hackcleanup, jbigi" />
    
    zzz's avatar
    zzz committed
        <property name="i2pbase" value="../i2p.i2p"/>
    
    
        <target name="buildrouter" depends="-dirs" >
            <!-- build router and core -->
    
    zzz's avatar
    zzz committed
            <ant dir="${i2pbase}" target="buildrouter" />
    
    zzz's avatar
    zzz committed
            <copy file="${i2pbase}/build/router.jar" todir="${jar.libs.dir}" />
    
            <!-- org.bouncycastle.crypto already in android
                 but we need a little trickery because our HMac is incompatible...
                 and the libs aren't in the SDK to compile against??? -->
            <jar destfile="${jar.libs.dir}/crypto.jar" >
    
    zzz's avatar
    zzz committed
                <zipfileset src="${i2pbase}/build/i2p.jar" >
    
                    <include name="org/bouncycastle/crypto/Digest.class" />
                    <include name="org/bouncycastle/crypto/Mac.class" />
                    <include name="org/bouncycastle/crypto/digests/GeneralDigest.class" />
                    <include name="org/bouncycastle/crypto/digests/MD5Digest.class" />
                </zipfileset >
    
            <!-- lots of unneeded stuff could be deleted here -->
            <jar destfile="${jar.libs.dir}/i2p.jar" >
    
    zzz's avatar
    zzz committed
                <zipfileset src="${i2pbase}/build/i2p.jar" >
    
                    <exclude name="net/i2p/util/LogWriter.class" />
                    <exclude name="net/i2p/util/SecureDirectory.class" />
                    <exclude name="net/i2p/util/SecureFile.class" />
                    <exclude name="net/i2p/util/SecureFileOutputStream.class" />
                    <exclude name="org/bouncycastle/crypto/Digest.class" />
                    <exclude name="org/bouncycastle/crypto/Mac.class" />
                    <exclude name="org/bouncycastle/crypto/digests/GeneralDigest.class" />
                    <exclude name="org/bouncycastle/crypto/digests/MD5Digest.class" />
                </zipfileset >
    
            </jar>
        </target>
    
    
        <!-- some resources -->
        <target name="copy-i2p-resources" depends="-dirs" >
    
    zzz's avatar
    zzz committed
            <copy file="${i2pbase}/installer/resources/themes/console/images/i2plogo.png" todir="res/drawable/" />
            <copy file="${i2pbase}/installer/resources/blocklist.txt" tofile="res/raw/blocklist_txt" />
    
    zzz's avatar
    zzz committed
    
    
        <target name="hackcleanup">
            <delete file="${jar.libs.dir}/crypto.jar" />
    
    zzz's avatar
    zzz committed
        </target>
    
    zzz's avatar
    zzz committed
    
    
        <target name="jbigi">
    
            <exec executable="sh" osfamily="unix" failonerror="true">
    
    walking's avatar
    walking committed
                <arg value="-c" />
    
                <arg value="jni/build.sh" />
    
            <copy file="jni/libjbigi.so" todir="${native.libs.dir}/armeabi" />
    
    jrandom's avatar
    jrandom committed
        </target>
    
    zzz's avatar
    zzz committed
    
    
        <target name="incrementBuild">
            <buildnumber file="scripts/build.number" />
            <exec executable="sh" osfamily="unix" failonerror="true">
                <arg value="-c" />
                <arg value="scripts/setversion.sh" />
    
    zzz's avatar
    zzz committed
            </exec>
    
            <!-- this loads my.version.code and my.version.name -->
            <property file="scripts/version.properties" />
    
    zzz's avatar
    zzz committed
    
    
        <!-- install now does both -->
        <target name="reinstall" depends="install" />
    
    zzz's avatar
    zzz committed
    
    
        <target name="distclean" depends="clean">
            <delete dir="${jar.libs.dir}" verbose="${verbose}" />
            <delete file="res/drawable/i2plogo.png" verbose="${verbose}"/>
            <delete file="res/raw/blocklist_txt" verbose="${verbose}" />
            <delete dir="jni/build/" verbose="${verbose}" />
            <delete file="jni/libjbigi.so" verbose="${verbose}" />
            <delete file="scripts/build.number" verbose="${verbose}" />
            <delete file="scripts/version.properties" verbose="${verbose}" />
    
    zzz's avatar
    zzz committed
    
    
        <!--
             ================================================================================
             From here down copied from SDK tools/ant/main_rules.xml from Tools version 11
             and then modified
             ================================================================================
        -->
    
    zzz's avatar
    zzz committed
    
    
        <!-- not necessary to copy if setup import="true" -->
    
        <!--
             override this because the ant task com.android.ant.AaptExecLoopTask has issues:
                 a) it uses version.code which main_rules sets to "" and
                 b) it can't set versionName via the aapt task, have to use the aapt command line
        -->
    
        <!-- Puts the project's resources into the output package file
             This actually can create multiple resource package in case
             Some custom apk with specific configuration have been
             declared in default.properties.
             -->
        <target name="-package-resources">
            <echo>Packaging resources</echo>
            <exec executable="${aapt}" failonerror="true" >
                <arg value="package" />
                <arg value="--version-code" />
                <arg value="${my.version.code}" />
                <arg value="--version-name" />
                <arg value="${my.version.name}" />
                <arg value="-f" />
                <arg value="-m" />
                <arg value="-M" />
                <arg value="AndroidManifest.xml" />
                <arg value="-I" />
                <arg value="${android.jar}" />
                <arg value="-S" />
                <arg value="${resource.absolute.dir}" />
                <arg value="-J" />
                <arg value="${gen.absolute.dir}" />
                <arg value="-F" />
                <arg value="${out.absolute.dir}/${resource.package.file.name}" />
    
            </exec>
        </target>
    
    kytv's avatar
    kytv committed
    
    
    </project>