diff options
author | Keith Packard <keithp@keithp.com> | 2019-07-16 11:15:20 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2019-08-04 20:30:20 -0700 |
commit | 489b429dbeb8b0fb69881161ff32fdc2fdfcf9f8 (patch) | |
tree | 4eadd81f7c6b6a18f2072b90bb425cabf8885e19 | |
parent | 93401542ab1bf53c5b7b2a2cad5da97e44d7244e (diff) |
altosdroid: Hack up build to 'work' for now
Android apps are now build with gradle instead of ant; the ant bits
are stale and only work with old java. Use old java to run ant while
using the current java compiler to build things.
This requires a custom version of the google play API library.
Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r-- | altosdroid/AndroidManifest.xml.in | 2 | ||||
-rw-r--r-- | altosdroid/Makefile.am | 6 | ||||
-rw-r--r-- | altosdroid/build.xml | 82 | ||||
-rw-r--r-- | altosdroid/default.properties | 2 | ||||
-rw-r--r-- | altosdroid/project.properties | 2 | ||||
-rw-r--r-- | configure.ac | 2 |
6 files changed, 89 insertions, 7 deletions
diff --git a/altosdroid/AndroidManifest.xml.in b/altosdroid/AndroidManifest.xml.in index 3f17188e..690f1990 100644 --- a/altosdroid/AndroidManifest.xml.in +++ b/altosdroid/AndroidManifest.xml.in @@ -22,7 +22,7 @@ package="org.altusmetrum.AltosDroid" android:versionCode="@ANDROID_VERSION@" android:versionName="@VERSION@"> - <uses-sdk android:targetSdkVersion="12" android:minSdkVersion="12"/> + <uses-sdk android:targetSdkVersion="21" android:minSdkVersion="21"/> <!-- Google Maps --> <uses-feature android:glEsVersion="0x00020000" android:required="true"/> diff --git a/altosdroid/Makefile.am b/altosdroid/Makefile.am index 686aeabf..dd875cab 100644 --- a/altosdroid/Makefile.am +++ b/altosdroid/Makefile.am @@ -34,7 +34,7 @@ SUPPORT_V4_JAR=android-support-v4.jar SUPPORT_V4=$(EXT_LIBDIR)/$(SUPPORT_V4_JAR) -GOOGLE_PLAY_SERVICES_LIB_SRCDIR=$(SDK)/extras/google/google_play_services/libproject +GOOGLE_PLAY_SERVICES_LIB_SRCDIR=$(SDK)/.. GOOGLE_PLAY_SERVICES_LIB=google-play-services_lib JAVA_SRC=$(JAVA_SRC_DIR)/*.java $(JAVA_SRC_DIR)/BuildInfo.java @@ -83,10 +83,10 @@ install-debug: bin/AltosDroid-debug.apk $(ADB) install -r bin/AltosDroid-debug.apk bin/AltosDroid-debug.apk: $(SRC) $(ALTOSLIB) $(SUPPORT_V4) $(GOOGLE_PLAY_SERVICES_LIB) - ant debug + JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64 ant debug bin/AltosDroid-release-unsigned.apk: $(SRC) $(ALTOSLIB) $(SUPPORT_V4) $(GOOGLE_PLAY_SERVICES_LIB) - ant release + JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64 ant release bin/AltosDroid-release.apk: bin/AltosDroid-release-unsigned.apk jarsigner -sigalg SHA1withDSA -digestalg SHA1 \ diff --git a/altosdroid/build.xml b/altosdroid/build.xml index 6a89edbe..e9382c77 100644 --- a/altosdroid/build.xml +++ b/altosdroid/build.xml @@ -61,6 +61,88 @@ </target> --> + <property name="java.target" value="1.7" /> + <property name="java.source" value="1.7" /> + + <!-- Compiles this project's .java files into .class files. --> + <target name="-compile" depends="-pre-build, -build-setup, -code-gen, -pre-compile"> + <do-only-if-manifest-hasCode elseText="hasCode = false. Skipping..."> + <!-- merge the project's own classpath and the tested project's classpath --> + <path id="project.javac.classpath"> + <path refid="project.all.jars.path" /> + <path refid="tested.project.classpath" /> + <path path="${java.compiler.classpath}" /> + </path> + <javac encoding="${java.encoding}" + source="${java.source}" target="${java.target}" + debug="true" extdirs="" includeantruntime="false" + destdir="${out.classes.absolute.dir}" + bootclasspathref="project.target.class.path" + verbose="${verbose}" + classpathref="project.javac.classpath" + fork="${need.javac.fork}"> + <src path="${source.absolute.dir}" /> + <src path="${gen.absolute.dir}" /> + <compilerarg line="${java.compilerargs}" /> + </javac> + + <!-- if the project is instrumented, intrument the classes --> + <if condition="${build.is.instrumented}"> + <then> + <echo level="info">Instrumenting classes from ${out.absolute.dir}/classes...</echo> + + <!-- build the filter to remove R, Manifest, BuildConfig --> + <getemmafilter + appPackage="${project.app.package}" + libraryPackagesRefId="project.library.packages" + filterOut="emma.default.filter"/> + + <!-- define where the .em file is going. This may have been + setup already if this is a library --> + <property name="emma.coverage.absolute.file" location="${out.absolute.dir}/coverage.em" /> + + <!-- It only instruments class files, not any external libs --> + <emma enabled="true"> + <instr verbosity="${verbosity}" + mode="overwrite" + instrpath="${out.absolute.dir}/classes" + outdir="${out.absolute.dir}/classes" + metadatafile="${emma.coverage.absolute.file}"> + <filter excludes="${emma.default.filter}" /> + <filter value="${emma.filter}" /> + </instr> + </emma> + </then> + </if> + + <!-- if the project is a library then we generate a jar file --> + <if condition="${project.is.library}"> + <then> + <echo level="info">Creating library output jar file...</echo> + <property name="out.library.jar.file" location="${out.absolute.dir}/classes.jar" /> + <if> + <condition> + <length string="${android.package.excludes}" trim="true" when="greater" length="0" /> + </condition> + <then> + <echo level="info">Custom jar packaging exclusion: ${android.package.excludes}</echo> + </then> + </if> + + <propertybyreplace name="project.app.package.path" input="${project.app.package}" replace="." with="/" /> + + <jar destfile="${out.library.jar.file}"> + <fileset dir="${out.classes.absolute.dir}" + includes="**/*.class" + excludes="${project.app.package.path}/R.class ${project.app.package.path}/R$*.class ${project.app.package.path}/BuildConfig.class"/> + <fileset dir="${source.absolute.dir}" excludes="**/*.java ${android.package.excludes}" /> + </jar> + </then> + </if> + + </do-only-if-manifest-hasCode> + </target> + <!-- Import the actual build file. To customize existing targets, there are two options: diff --git a/altosdroid/default.properties b/altosdroid/default.properties index 3ac25234..69baf6ba 100644 --- a/altosdroid/default.properties +++ b/altosdroid/default.properties @@ -8,4 +8,4 @@ # project structure. # Project target. -target=android-12 +target=android-21 diff --git a/altosdroid/project.properties b/altosdroid/project.properties index d178f98a..853d1b0a 100644 --- a/altosdroid/project.properties +++ b/altosdroid/project.properties @@ -8,5 +8,5 @@ # project structure. # Project target. -target=android-12 +target=android-21 android.library.reference.1=google-play-services_lib/ diff --git a/configure.ac b/configure.ac index cc6a23d4..56bd70ce 100644 --- a/configure.ac +++ b/configure.ac @@ -70,7 +70,7 @@ AC_ARG_WITH(jvm, AS_HELP_STRING([--with-jvm=PATH], if test "x$JVM" = "xauto"; then AC_MSG_CHECKING([JVM]) - for jvm in default-java java-6-openjdk java-7-openjdk java-8-openjdk java-9-openjdk java-10-openjdk java-11-openjdk java-12-openjdk java-13-openjdk java-6-sun; do + for jvm in default-java java-6-openjdk java-7-openjdk java-8-openjdk java-9-openjdk java-10-openjdk java-11-openjdk java-12-openjdk java-13-openjdk java-6-sun java-8-openjdk-amd64; do if test "x$JVM" = "xauto"; then INCLUDE="/usr/lib/jvm/$jvm/include" if test -f "$INCLUDE"/jni.h; then |