yuikns / google-gson

Automatically exported from code.google.com/p/google-gson
0 stars 0 forks source link

Make it possible to build Gson with Ant directly #206

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The Maven integration is nifty, but I believe the use of Ant is far more
widespread than that of Maven, so it would be nice if it weren't required.
I suppose the counterargument is to use this guy:

http://maven.apache.org/plugins/maven-ant-plugin/index.html

Though that still requires installing and setting up Maven initially, so
that doesn't exactly solve the problem.

Original issue reported on code.google.com by bolinf...@gmail.com on 27 Apr 2010 at 4:06

GoogleCodeExporter commented 9 years ago
Here is an example of ANT script:
build.xml:
<?xml version="1.0" encoding="UTF-8"?>
<project name="Juridoc Client" basedir=".">
    <property file="build.properties" />

    <!-- Init all properties for the ANT script -->
    <property name="jarsDir" value="${build.dir}/${build.dir.package}" />
    <property name="compileDir" value="${build.dir}/${build.dir.gson}" />
    <property name="resourcesDir" value="${project.dir}/src/main/resources" />
    <property name="sourceDir" value="${project.dir}/src/main/java" />
    <property name="jarName" value="${build.name.gson}" />

    <target name="compile" depends="setup" description="Compile into ${compileDir}">
        <!-- Compile the client source -->
        <javac srcdir="${sourceDir}" destdir="${compileDir}" source="${version.source}"
target="${version.compile}" debug="on" encoding="${compile.encoding}">
        </javac>
    </target>

    <target name="package" depends="setupJAR, compile" description="Package to file
${jarName}">
        <!-- Build the manifest file -->
        <manifest file="MANIFEST.MF">
            <attribute name="Build-Version" value="${build.version.num}"/>
        </manifest>
        <copy todir="${compileDir}">
            <fileset dir="${resourcesDir}" includes="**/*.*" />
        </copy>
        <!-- Build the jar with compilation folder content -->
        <jar destfile="${jarsDir}/${jarName}" manifest="MANIFEST.MF">
            <fileset dir="${compileDir}" includes="**" />
        </jar>
        <!-- Delete the compilation folder -->
        <delete dir="${compileDir}" />
        <!-- Delete the manifest file -->
        <delete file="MANIFEST.MF" />
    </target>

    <target name="deploy" depends="package" />

    <target name="setup" description="Creates the ${compileDir} directory">
        <!-- generate the client compilation folder -->
        <delete dir="${compileDir}" />
        <mkdir dir="${compileDir}" />
    </target>

    <target name="setupJAR" description="Creates the ${jarsDir} directory">
        <!-- generate the jar folder -->
        <mkdir dir="${jarsDir}" />
    </target>

</project>

build.properties:
build.dir=c:/temp/gson

build.dir.gson=gson-core
build.name.gson=gson-1.3-patch.jar
build.dir.package=jars

build.version.num=1.3

project.dir=.

compile.encoding=ISO_8859-1
version.source=1.5
version.compile=1.5

Original comment by lapinouj...@gmail.com on 15 May 2010 at 12:52

GoogleCodeExporter commented 9 years ago

Original comment by limpbizkit on 6 Oct 2010 at 5:52

GoogleCodeExporter commented 9 years ago
It's hard enough to support one build system. If you'd like to use Ant, I 
invite you to copy the build.xml above into your copy of GSON.

Original comment by limpbizkit on 1 Jul 2011 at 9:46