Skip to content

Instantly share code, notes, and snippets.

@Arneball
Created January 8, 2014 14:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Arneball/8317874 to your computer and use it in GitHub Desktop.
Save Arneball/8317874 to your computer and use it in GitHub Desktop.
<target name="init" depends="-set-release-mode, -build-setup">
<property
name="scala-library.jar"
value="${scala.dir}/lib/scala-library.jar"
/>
<path id="build.classpath">
<pathelement location="${scala-library.jar}" />
<!--<pathelement location="${your.path}" />-->
<pathelement location="${build.dir}" />
</path>
<taskdef resource="scala/tools/ant/antlib.xml">
<classpath>
<pathelement location="${scala.dir}/lib/scala-compiler.jar" />
<!-- NEW: For scala 2.10.2 you need scala-reflect: -->
<pathelement location="${scala.dir}/lib/scala-reflect.jar" />
<pathelement location="${scala-library.jar}" />
</classpath>
</taskdef>
</target>
<target name="scalac" depends="init">
<path id="scalac.classpath">
<path path="${java.compiler.classpath}" />
<path path="${scala-library.jar}"/>
<path path="${out.classes.absolute.dir}" />
<path refid="project.all.jars.path" />
<path refid="tested.project.classpath" />
<path path="${java.compiler.classpath}" />
</path>
<path id="scala.srcpath">
<path path="${source.absolute.dir}" />
<path path="${gen.absolute.dir}" />
</path>
<scalac
srcdir="${source.dir}"
destdir="${out.classes.absolute.dir}"
classpathref="scalac.classpath"
sourcepathref="scala.srcpath"
bootclasspathref="project.target.class.path"
force="changed">
<!-- addparams="-Yclosure-elim -optimise" -->
<classpath>
<fileset dir="${jar.libs.absolute.dir}" includes="*.jar" />
</classpath>
<include name="**/*.scala"/>
</scalac>
</target>
<target name="-pre-compile" depends="scalac"/>
<!-- <target name="-debug-obfuscation-check">
<property name="proguard.enabled" value="true"/>
</target> -->
<!-- Custom targets -->
<target name="-custom-git-version">
<exec executable="sh" outputproperty="git.commits">
<arg value="-c" />
<arg value="git rev-parse HEAD" />
</exec>
<echo>git.commits: ${git.commits}</echo>
</target>
<target name="-custom-manifest-version" depends="-custom-git-version">
<echo>Creating backup of AndroidManifest.xml</echo>
<copy file="AndroidManifest.xml" tofile="AndroidManifest.xml.antbak" preservelastmodified="true" />
<replaceregexp
file="AndroidManifest.xml"
match='android:versionName=".*"'
replace='android:versionName="2.1.0.${git.commits}"' />
</target>
<target name="-pre-build" depends="-custom-manifest-version"/>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment