Skip to content

Instantly share code, notes, and snippets.

@jimfulton
Created January 27, 2013 18:19
Show Gist options
  • Save jimfulton/4649546 to your computer and use it in GitHub Desktop.
Save jimfulton/4649546 to your computer and use it in GitHub Desktop.
A first stab ant code to build parts of an android project. See open issues in the comment.
<?xml version="1.0" encoding="UTF-8"?>
<!--
This is very much a work in progress.
Issues:
- You have to install scala. We aren't reusing the scala install
embedded in scala-ide.
It would be good to reuse the scala install in the eclipse plugins
directory. But maybe we don't want to depend on running eclipse.
- You have to add a definition for scala.home to local.properties.
This should automated.
Maybe the buildout should install scala, at which point, we know
where it is.
- The build.xml is now in git cuz I customized it. I wonder if it's
going to be overridden the next time I run buildout.
- I still haven't dealt with the scala library. My builds so far have
depended on a minified library created by the scala ide.
- I've read that proguard is critical for the scala library.
- There are bits done in the ant -compile target that I'm not doing.
I wonder if there's a better solution than copy and paste. I
suspect that a work-around is to just run ant debug twice, so the
additional steps are performed on the class files generated by
scala.
-->
<project name="android_scala_rules" default="debug">
<target name="init">
<property name="scala.lib" value="${scala.home}/lib" />
<property name="scala.compiler"
value="${scala.lib}/scala-compiler.jar" />
<property name="scala.reflect"
value="${scala.lib}/scala-reflect.jar" />
<property name="scala.library"
value="${scala.lib}/scala-library.jar"/>
<path id="build.classpath">
<pathelement location="${scala.library}"/>
<path refid="project.javac.classpath" />
<pathelement location="${project.target.android.jar}" />
<pathelement location="gen" />
<!-- <pathelement location="libs"/> -->
<!-- <pathelement location="parts/ActionBarSherlock/library/libs/*"/> -->
<pathelement location="${out.classes.absolute.dir}" />
</path>
<taskdef resource="scala/tools/ant/antlib.xml">
<classpath>
<pathelement location="${scala.library}"/>
<pathelement location="${scala.reflect}"/>
<pathelement location="${scala.compiler}"/>
</classpath>
</taskdef>
</target>
<target name="-post-compile" depends="init">
<mkdir dir="${out.classes.absolute.dir}" />
<scalac srcdir="${source.absolute.dir}"
destdir="${out.classes.absolute.dir}"
classpathref="build.classpath">
<include name="**/*.scala" />
</scalac>
</target>
</project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment