Browse files

Update Neko to latest SDK build system.

  • Loading branch information...
1 parent 30bf682 commit 067990ec3ff1443c2b625966e9d65fffbfc283c9 @sattvik sattvik committed Mar 29, 2012
Showing with 131 additions and 74 deletions.
  1. +13 −16 README.asciidoc
  2. +13 −7 build-support/clojure.xml
  3. +15 −17 build.xml
  4. +20 −0 proguard-project.txt
  5. +15 −17 test-app/build.xml
  6. +20 −0 test-app/proguard-project.txt
  7. +15 −17 test/build.xml
  8. +20 −0 test/proguard-project.txt
View
29 README.asciidoc
@@ -47,14 +47,15 @@ Clojure 1.2::
Android SDK Tools::
Neko has been developed with the latest revision of the Android SDK tools,
- and is compatible with r14 and up of the Android SDK.
+ and is compatible with r17 and up of the Android SDK.
+
-WARNING: Revision 14 of the Android SDK introduced some major changes in the
-Ant build system. Neko has been updated to use the new build system. You will
+WARNING: Revisions 14 and 17 of the Android SDK introduced changes in the Ant
+build system. Neko has been updated to use the build system in r17. You will
probably need to change your project if you have been using an older version of
-Neko/SDK. For more detailed information,
-http://tools.android.com/recent/buildchangesinrevision14[check the Android
-Tools Project Site].
+Neko/SDK. For more detailed information, check the Android Tools Project site
+for information about the breaking changes in
+http://tools.android.com/recent/buildchangesinrevision14[r14] and
+http://tools.android.com/recent/dealingwithdependenciesinandroidprojects[r17].
Android Platform SDK 7 (2.1/Eclair) or newer::
In order to maintain backwards-compatibility, Neko does not support any APIs
@@ -86,8 +87,9 @@ be either a relative or absolute path.
`1` to `custom`. If you do not do this, Android may overwrite your changes.
For most projects, that is all you have to do. So long as your Clojure source
-files are in `src/clojure` and you have placed a Clojure JAR file in `libs`,
-Ant will now automatically find and compile all of your Clojure code.
+files are in `src/clojure` and you have placed a Clojure JAR file in `libs`
+directory of your Neko installation, Ant will now automatically find and
+compile all of your Clojure code.
=== Reflection warnings ===
@@ -104,14 +106,9 @@ project in which you have enabled Clojure support.
=== Test and library projects ===
-If your project is a test or library project, you should not place a copy of
-the Clojure library in the `libs` directory. If you do this, when building an
-application that uses your library or when building your test project, the `dx`
-tool will fail due to multiple inclusions of the same Clojure classes.
-
-In these circumstances, you should either set a `clojure.jar` property in your
-project’s `ant.properties` file or in the `clojure.properties` file as
-described in the previous section.
+As of r17 of the Android SDK, you should now be able to place a copy of the
+Clojure JAR in the `libs` directory of Neko and it should automatically be
+picked up by any projects that depend on it.
Also, if you are developing an Android library project, you should add the
following line to your `ant.properties` file:
View
20 build-support/clojure.xml
@@ -58,18 +58,19 @@
</condition>
<javac encoding="${java.encoding}"
source="${java.source}" target="${java.target}"
- debug="true" extdirs=""
+ debug="true" extdirs="" includeantruntime="false"
destdir="${out.classes.absolute.dir}"
bootclasspathref="android.target.classpath"
verbose="${verbose}"
classpath="${extensible.classpath}"
- classpathref="jar.libs.ref"
- includeantruntime="false">
+ classpathref="project.libraries.jars"
+ fork="${need.javac.fork}">
<src path="${source.absolute.dir}" />
<src path="${gen.absolute.dir}" />
<classpath>
<fileset dir="${extensible.libs.classpath}" includes="*.jar" />
</classpath>
+ <compilerarg line="${java.compilerargs}" />
</javac>
<java classname="clojure.main"
classpath="${clojure.jar}"
@@ -81,7 +82,7 @@
<classpath>
<pathelement path="${extensible.classpath}"/>
<pathelement path="${clojure.source.absolute.dir}"/>
- <path refid="jar.libs.ref"/>
+ <path refid="project.libraries.jars"/>
<fileset dir="${extensible.libs.classpath}" includes="*.jar" />
<pathelement path="${clojure.out.classes.absolute.dir}"/>
</classpath>
@@ -101,8 +102,13 @@
<echo>Custom jar packaging exclusion: ${android.package.excludes}</echo>
</then>
</if>
+
+ <propertybyreplace name="manifest.package.path" input="${manifest.package}" replace="." with="/" />
+
<jar destfile="${out.library.jar.file}">
- <fileset dir="${out.classes.absolute.dir}" excludes="**/R.class **/R$*.class"/>
+ <fileset dir="${out.classes.absolute.dir}"
+ includes="**/*.class"
+ excludes="${manifest.package.path}/R.class ${manifest.package.path}/R$*.class ${manifest.package.path}/Manifest.class ${manifest.package.path}/Manifest$*.class ${manifest.package.path}/BuildConfig.class"/>
<fileset dir="${source.absolute.dir}" excludes="**/*.java ${android.package.excludes}" />
</jar>
</then>
@@ -118,9 +124,9 @@
mode="overwrite"
instrpath="${out.absolute.dir}/classes"
outdir="${out.absolute.dir}/classes">
+ <filter excludes="${manifest.package}.R,${manifest.package}.R$$*,${manifest.package}.BuildConfig" />
+ <filter value="${emma.filter}" />
</instr>
- <!-- TODO: exclusion filters on R*.class and allowing custom exclusion from
- user defined file -->
</emma>
</then>
</if>
View
32 build.xml
@@ -4,7 +4,7 @@
<!-- The local.properties file is created and updated by the 'android' tool.
It contains the path to the SDK. It should *NOT* be checked into
Version Control Systems. -->
- <loadproperties srcFile="local.properties" />
+ <property file="local.properties" />
<!-- The ant.properties file can be created by you. It is only edited by the
'android' tool to add properties to it.
@@ -41,25 +41,23 @@
<!-- quick check on sdk.dir -->
<fail
- message="sdk.dir is missing. Make sure to generate local.properties using 'android update project'"
+ message="sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through an env var"
unless="sdk.dir"
/>
-
-<!-- extension targets. Uncomment the ones where you want to do custom work
- in between standard targets -->
-<!--
- <target name="-pre-build">
- </target>
- <target name="-pre-compile">
- </target>
-
- /* This is typically used for code obfuscation.
- Compiled code location: ${out.classes.absolute.dir}
- If this is not done in place, override ${out.dex.input.absolute.dir} */
- <target name="-post-compile">
- </target>
--->
+ <!--
+ Import per project custom build rules if present at the root of the project.
+ This is the place to put custom intermediary targets such as:
+ -pre-build
+ -pre-compile
+ -post-compile (This is typically used for code obfuscation.
+ Compiled code location: ${out.classes.absolute.dir}
+ If this is not done in place, override ${out.dex.input.absolute.dir})
+ -post-package
+ -post-build
+ -pre-clean
+ -->
+ <import file="custom_rules.xml" optional="true" />
<import file="build-support/clojure.xml" />
View
20 proguard-project.txt
@@ -0,0 +1,20 @@
+# To enable ProGuard in your project, edit project.properties
+# to define the proguard.config property as described in that file.
+#
+# Add project specific ProGuard rules here.
+# By default, the flags in this file are appended to flags specified
+# in ${sdk.dir}/tools/proguard/proguard-android.txt
+# You can edit the include path and order by changing the ProGuard
+# include property in project.properties.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# Add any project specific keep options here:
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
View
32 test-app/build.xml
@@ -4,7 +4,7 @@
<!-- The local.properties file is created and updated by the 'android' tool.
It contains the path to the SDK. It should *NOT* be checked into
Version Control Systems. -->
- <loadproperties srcFile="local.properties" />
+ <property file="local.properties" />
<!-- The ant.properties file can be created by you. It is only edited by the
'android' tool to add properties to it.
@@ -41,25 +41,23 @@
<!-- quick check on sdk.dir -->
<fail
- message="sdk.dir is missing. Make sure to generate local.properties using 'android update project'"
+ message="sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through an env var"
unless="sdk.dir"
/>
-
-<!-- extension targets. Uncomment the ones where you want to do custom work
- in between standard targets -->
-<!--
- <target name="-pre-build">
- </target>
- <target name="-pre-compile">
- </target>
-
- /* This is typically used for code obfuscation.
- Compiled code location: ${out.classes.absolute.dir}
- If this is not done in place, override ${out.dex.input.absolute.dir} */
- <target name="-post-compile">
- </target>
--->
+ <!--
+ Import per project custom build rules if present at the root of the project.
+ This is the place to put custom intermediary targets such as:
+ -pre-build
+ -pre-compile
+ -post-compile (This is typically used for code obfuscation.
+ Compiled code location: ${out.classes.absolute.dir}
+ If this is not done in place, override ${out.dex.input.absolute.dir})
+ -post-package
+ -post-build
+ -pre-clean
+ -->
+ <import file="custom_rules.xml" optional="true" />
<import file="../build-support/clojure.xml" />
View
20 test-app/proguard-project.txt
@@ -0,0 +1,20 @@
+# To enable ProGuard in your project, edit project.properties
+# to define the proguard.config property as described in that file.
+#
+# Add project specific ProGuard rules here.
+# By default, the flags in this file are appended to flags specified
+# in ${sdk.dir}/tools/proguard/proguard-android.txt
+# You can edit the include path and order by changing the ProGuard
+# include property in project.properties.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# Add any project specific keep options here:
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
View
32 test/build.xml
@@ -4,7 +4,7 @@
<!-- The local.properties file is created and updated by the 'android' tool.
It contains the path to the SDK. It should *NOT* be checked into
Version Control Systems. -->
- <loadproperties srcFile="local.properties" />
+ <property file="local.properties" />
<!-- The ant.properties file can be created by you. It is only edited by the
'android' tool to add properties to it.
@@ -41,25 +41,23 @@
<!-- quick check on sdk.dir -->
<fail
- message="sdk.dir is missing. Make sure to generate local.properties using 'android update project'"
+ message="sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through an env var"
unless="sdk.dir"
/>
-
-<!-- extension targets. Uncomment the ones where you want to do custom work
- in between standard targets -->
-<!--
- <target name="-pre-build">
- </target>
- <target name="-pre-compile">
- </target>
-
- /* This is typically used for code obfuscation.
- Compiled code location: ${out.classes.absolute.dir}
- If this is not done in place, override ${out.dex.input.absolute.dir} */
- <target name="-post-compile">
- </target>
--->
+ <!--
+ Import per project custom build rules if present at the root of the project.
+ This is the place to put custom intermediary targets such as:
+ -pre-build
+ -pre-compile
+ -post-compile (This is typically used for code obfuscation.
+ Compiled code location: ${out.classes.absolute.dir}
+ If this is not done in place, override ${out.dex.input.absolute.dir})
+ -post-package
+ -post-build
+ -pre-clean
+ -->
+ <import file="custom_rules.xml" optional="true" />
<import file="../build-support/clojure.xml" />
View
20 test/proguard-project.txt
@@ -0,0 +1,20 @@
+# To enable ProGuard in your project, edit project.properties
+# to define the proguard.config property as described in that file.
+#
+# Add project specific ProGuard rules here.
+# By default, the flags in this file are appended to flags specified
+# in ${sdk.dir}/tools/proguard/proguard-android.txt
+# You can edit the include path and order by changing the ProGuard
+# include property in project.properties.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# Add any project specific keep options here:
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}

0 comments on commit 067990e

Please sign in to comment.