java - ANT - How i cant move File to JAR -
i've had edited ant build process. here working list:
- create copy of
src
folder , selfwritten anttask obfuscated strings - ant creates jar
<jar>
- the jar obfuscated
proguard
- an additional file must copied jar
- jar signed
the bodled step question. how can copy single file root directory of jar. must make step here! before or after won't work: before: proguard try obfuscate file , gives exceptions. after cant work, file must signed.
anyone have smart idea?
here minified version of ant build script:
<?xml version="1.0" encoding="utf-8" standalone="yes" ?> <project basedir="." default="default" name="demo"> <property environment="env" /> <property name="debuglevel" value="source,lines,vars" /> <property name="target" value="1.7" /> <property name="source" value="1.7" /> <!-- applet informationen --> <property name="version" value="1.0.0" /> <!-- start build process --> <target name="default"> <echo message="copy source" /> <delete dir="builds/temp/" /> <mkdir dir="builds/temp/" /> <copydir src="src" dest="builds/temp/" /> <echo message="obfuscate strings" /> <taskdef resource="task.properties" classpath="libs/mystringhelper.jar" /> <mystringhelper dir="builds/temp/" name="_x.class" decoder="myclass.mymethod" imports="import test.myclass;" /> <javac srcdir="builds/temp/" destdir="bin" /> <sleep seconds="1" /> <echo message="create jar archive version ${version}" /> <jar destfile="builds/${name}${version}.jar" basedir="bin"> <manifest> <attribute name="application-name" value="${name}" /> <attribute name="application-library-allowable-codebase" value="*.domain.com localhost" /> <attribute name="caller-allowable-codebase" value="*.domain.com localhost" /> <attribute name="codebase" value="*.domain.com localhost" /> <attribute name="permissions" value="all-permissions" /> <attribute name="author" value="adrian preuss" /> <attribute name="main-class" value="main.run" /> </manifest> </jar> <echo message="obfuscate archive" /> <taskdef resource="proguard/ant/task.properties" classpath="libs/proguard.jar" /> <proguard printmapping="proguard.map" overloadaggressively="off" repackageclasses="" renamesourcefileattribute="sourcefile"> <injar file="builds/${name}${version}.jar" /> <outjar file="builds/__${name}${version}.jar" /> <libraryjar file="${java.home}/lib/rt.jar" /> <libraryjar file="libs/ant.jar" /> <libraryjar file="libs/gradle-plugins-1.3.jar" /> <libraryjar file="libs/gradle-base-services-1.3.jar" /> <libraryjar file="libs/gradle-core-1.3.jar" /> <libraryjar file="libs/groovy-all-1.8.6.jar" /> <libraryjar file="libs/kenv.zip" /> <keeppackagename name="main" /> <keep access="public" name="main.run"> <method access="public" type="void" name="changelanguage" parameters="java.lang.string" /> </keep> </proguard> <delete file="builds/${name}${version}.jar" failonerror="false" /> <move file="builds/__${name}${version}.jar" tofile="builds/${name}${version}.jar" /> <!-- ## ## add file "builds/temp/_xa.class" jar ## ## info: _xa.class is'nt java-class file! --> <echo message="roll code signing" /> <signjar jar="builds/${name}${version}.jar" alias="${name}" keystore="${name}.keystore" storepass="${password}" preservelastmodified="true" /> <echo message="verify code signing" /> <verifyjar jar="builds/${name}${version}.jar" alias="${name}" storepass="${password}"/> <echo message="copy applet local environment" /> <copy file="builds/${name}${version}.jar" tofile="c:/devsrv/htdocs/${name}${version}.jar" failonerror="false" /> <echo message="cleanup,..." /> <!-- .... --> </target> </project>
this part ant build file including xml, jpg, gif , png:
<!-- ============================================================== --> <!-- build application --> <!-- ============================================================== --> <target name="build" depends="make-bin-dir" description="build application"> <javac srcdir="${src.dir}" destdir="${bin.dir}" debug="on" classpathref="javac.classpath" /> <copy todir="${bin.dir}"> <fileset dir="${src.dir}"> <include name="**/*.xml" /> <include name="**/*.jpg" /> <include name="**/*.gif" /> <include name="**/*.png" /> </fileset> </copy> </target>
to include 1 file put full name in include name= "fullnamehere" />
sorry...haven't seen part add... try this:
include name= "builds/temp/_xa.class" />
Comments
Post a Comment