summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2012-01-03 21:15:21 +0000
committerThomas Martitz <kugel@rockbox.org>2012-01-03 21:15:21 +0000
commite9cb9538c76fc6560fc8475a0bfcd9821d0a66be (patch)
tree50f62afc26291c8a8b198461d64c0deddbcbd8ae
parent84f651f9b6b509224d9b8a57872f846ac4a0c646 (diff)
downloadrockbox-e9cb9538c76fc6560fc8475a0bfcd9821d0a66be.tar.gz
rockbox-e9cb9538c76fc6560fc8475a0bfcd9821d0a66be.zip
android: Update build system for recent SDK versions and target ice cream sandwich.
As a result, the java parts can now be build using ant (in the android dir). Just issue "ant debug" after "make libs". Building the java parts from eclipse also still works. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31543 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--android/.classpath2
-rw-r--r--android/android.make38
-rw-r--r--android/ant.properties12
-rw-r--r--android/build.xml85
-rw-r--r--android/proguard.cfg40
-rw-r--r--android/project.properties (renamed from android/default.properties)8
6 files changed, 161 insertions, 24 deletions
diff --git a/android/.classpath b/android/.classpath
index 6efcbb739a..1b4b1eed7e 100644
--- a/android/.classpath
+++ b/android/.classpath
@@ -3,5 +3,5 @@
3 <classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/> 3 <classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
4 <classpathentry kind="src" path="src"/> 4 <classpathentry kind="src" path="src"/>
5 <classpathentry kind="src" path="gen"/> 5 <classpathentry kind="src" path="gen"/>
6 <classpathentry kind="output" path="bin"/> 6 <classpathentry kind="output" path="bin/classes"/>
7</classpath> 7</classpath>
diff --git a/android/android.make b/android/android.make
index ec7ba32ea5..6180ef64da 100644
--- a/android/android.make
+++ b/android/android.make
@@ -27,9 +27,6 @@ $(CPUFEAT_BUILD)/cpu-features.o: $(CPUFEAT)/cpu-features.c
27.SECONDEXPANSION: # $$(OBJ) is not populated until after this 27.SECONDEXPANSION: # $$(OBJ) is not populated until after this
28.PHONY: apk classes clean dex dirs libs jar 28.PHONY: apk classes clean dex dirs libs jar
29 29
30
31java2class = $(addsuffix .class,$(basename $(subst $(ANDROID_DIR),$(BUILDDIR),$(1))))
32
33# API version 30# API version
34ANDROID_PLATFORM_VERSION=11 31ANDROID_PLATFORM_VERSION=11
35ANDROID_PLATFORM=$(ANDROID_SDK_PATH)/platforms/android-$(ANDROID_PLATFORM_VERSION) 32ANDROID_PLATFORM=$(ANDROID_SDK_PATH)/platforms/android-$(ANDROID_PLATFORM_VERSION)
@@ -42,21 +39,27 @@ ZIPALIGN=$(ANDROID_SDK_PATH)/tools/zipalign
42KEYSTORE=$(HOME)/.android/debug.keystore 39KEYSTORE=$(HOME)/.android/debug.keystore
43ADB=$(ANDROID_SDK_PATH)/platform-tools/adb 40ADB=$(ANDROID_SDK_PATH)/platform-tools/adb
44 41
42CLASSPATH := $(BUILDDIR)/bin/classes
43
45MANIFEST := $(BUILDDIR)/bin/AndroidManifest.xml 44MANIFEST := $(BUILDDIR)/bin/AndroidManifest.xml
46MANIFEST_SRC := $(ANDROID_DIR)/AndroidManifest.xml 45MANIFEST_SRC := $(ANDROID_DIR)/AndroidManifest.xml
47 46
48R_JAVA := $(BUILDDIR)/gen/$(PACKAGE_PATH)/R.java 47R_JAVA := $(BUILDDIR)/gen/$(PACKAGE_PATH)/R.java
49R_OBJ := $(BUILDDIR)/bin/$(PACKAGE_PATH)/R.class 48R_OBJ := $(CLASSPATH)/$(PACKAGE_PATH)/R.class
50 49
51JAVA_SRC := $(wildcard $(ANDROID_DIR)/src/$(PACKAGE_PATH)/*.java) 50JAVA_SRC := $(wildcard $(ANDROID_DIR)/src/$(PACKAGE_PATH)/*.java)
52JAVA_SRC += $(wildcard $(ANDROID_DIR)/src/$(PACKAGE_PATH)/Helper/*.java) 51JAVA_SRC += $(wildcard $(ANDROID_DIR)/src/$(PACKAGE_PATH)/Helper/*.java)
53JAVA_SRC += $(wildcard $(ANDROID_DIR)/src/$(PACKAGE_PATH)/widgets/*.java) 52JAVA_SRC += $(wildcard $(ANDROID_DIR)/src/$(PACKAGE_PATH)/widgets/*.java)
54JAVA_SRC += $(wildcard $(ANDROID_DIR)/src/$(PACKAGE_PATH)/monitors/*.java) 53JAVA_SRC += $(wildcard $(ANDROID_DIR)/src/$(PACKAGE_PATH)/monitors/*.java)
55JAVA_OBJ := $(call java2class,$(subst $(ANDROID)/src/$(PACKAGE_PATH),$(ANDROID)/bin/$(PACKAGE_PATH),$(JAVA_SRC))) 54
55java2class = $(addsuffix .class,$(basename $(subst $(ANDROID_DIR)/src,$(CLASSPATH),$(1))))
56
57JAVA_OBJ := $(call java2class,$(JAVA_SRC))
56 58
57 59
58LIBS := $(BINLIB_DIR)/$(BINARY) $(BINLIB_DIR)/libmisc.so 60LIBS := $(BINLIB_DIR)/$(BINARY) $(BINLIB_DIR)/libmisc.so
59LIBS += $(addprefix $(BINLIB_DIR)/lib,$(patsubst %.codec,%.so,$(notdir $(CODECS)))) 61LIBS += $(addprefix $(BINLIB_DIR)/lib,$(patsubst %.codec,%.so,$(notdir $(CODECS))))
62
60TEMP_APK := $(BUILDDIR)/bin/_rockbox.apk 63TEMP_APK := $(BUILDDIR)/bin/_rockbox.apk
61TEMP_APK2 := $(BUILDDIR)/bin/__rockbox.apk 64TEMP_APK2 := $(BUILDDIR)/bin/__rockbox.apk
62DEX := $(BUILDDIR)/bin/classes.dex 65DEX := $(BUILDDIR)/bin/classes.dex
@@ -65,17 +68,17 @@ AP_ := $(BUILDDIR)/bin/resources.ap_
65APK := $(BUILDDIR)/rockbox.apk 68APK := $(BUILDDIR)/rockbox.apk
66 69
67_DIRS := $(BUILDDIR)/___/$(PACKAGE_PATH) 70_DIRS := $(BUILDDIR)/___/$(PACKAGE_PATH)
68DIRS := $(subst ___,bin,$(_DIRS))
69DIRS += $(subst ___,gen,$(_DIRS)) 71DIRS += $(subst ___,gen,$(_DIRS))
70DIRS += $(subst ___,data,$(_DIRS)) 72DIRS += $(subst ___,data,$(_DIRS))
71DIRS += $(BUILDDIR)/libs/armeabi 73DIRS += $(BUILDDIR)/libs/armeabi
72DIRS += $(CPUFEAT_BUILD) 74DIRS += $(CPUFEAT_BUILD)
75DIRS += $(CLASSPATH)
73 76
74RES := $(wildcard $(ANDROID_DIR)/res/*/*) 77RES := $(wildcard $(ANDROID_DIR)/res/*/*)
75 78
76CLEANOBJS += bin gen libs data 79CLEANOBJS += bin gen libs data
77 80
78JAVAC_OPTS += -implicit:none -classpath $(ANDROID_PLATFORM)/android.jar:$(BUILDDIR)/bin 81JAVAC_OPTS += -implicit:none -classpath $(ANDROID_PLATFORM)/android.jar:$(CLASSPATH)
79 82
80.PHONY: 83.PHONY:
81$(MANIFEST): $(MANIFEST_SRC) $(DIRS) 84$(MANIFEST): $(MANIFEST_SRC) $(DIRS)
@@ -86,21 +89,18 @@ $(R_JAVA) $(AP_): $(MANIFEST) $(RES) | $(DIRS)
86 -J $(BUILDDIR)/gen -M $(MANIFEST) -S $(ANDROID_DIR)/res \ 89 -J $(BUILDDIR)/gen -M $(MANIFEST) -S $(ANDROID_DIR)/res \
87 -I $(ANDROID_PLATFORM)/android.jar -F $(AP_) 90 -I $(ANDROID_PLATFORM)/android.jar -F $(AP_)
88 91
89$(BUILDDIR)/bin/$(PACKAGE_PATH)/R.class: $(R_JAVA) 92$(CLASSPATH)/$(PACKAGE_PATH)/R.class: $(R_JAVA)
90 $(call PRINTS,JAVAC $(subst $(ROOTDIR)/,,$<))javac -d $(BUILDDIR)/bin \ 93 $(call PRINTS,JAVAC $(subst $(ROOTDIR)/,,$<))javac -d $(BUILDDIR)/bin \
91 $(JAVAC_OPTS) \ 94 $(JAVAC_OPTS) -sourcepath $(ANDROID_DIR)/gen $<
92 -sourcepath $(ANDROID_DIR)/gen $<
93 95
94$(BUILDDIR)/bin/$(PACKAGE_PATH)/%.class: $(ANDROID_DIR)/src/$(PACKAGE_PATH)/%.java $(BUILDDIR)/bin/$(PACKAGE_PATH)/R.class 96$(CLASSPATH)/$(PACKAGE_PATH)/%.class: $(ANDROID_DIR)/src/$(PACKAGE_PATH)/%.java $(CLASSPATH)/$(PACKAGE_PATH)/R.class
95 $(call PRINTS,JAVAC $(subst $(ROOTDIR)/,,$<))javac -d $(BUILDDIR)/bin \ 97 $(call PRINTS,JAVAC $(subst $(ROOTDIR)/,,$<))javac -d $(CLASSPATH) \
96 $(JAVAC_OPTS) \ 98 $(JAVAC_OPTS) -sourcepath $(ANDROID_DIR)/src $<
97 -sourcepath $(ANDROID_DIR)/src $<
98 99
99$(JAR): $(JAVA_SRC) $(R_JAVA) 100$(JAR): $(JAVA_SRC) $(R_JAVA)
100 $(call PRINTS,JAVAC $(subst $(ROOTDIR)/,,$?))javac -d $(BUILDDIR)/bin \ 101 $(call PRINTS,JAVAC $(subst $(ROOTDIR)/,,$?))javac -d $(CLASSPATH) \
101 $(JAVAC_OPTS) \ 102 $(JAVAC_OPTS) -sourcepath $(ANDROID_DIR)/src:$(ANDROID_DIR)/gen $?
102 -sourcepath $(ANDROID_DIR)/src:$(ANDROID_DIR)/gen $? 103 $(call PRINTS,JAR $(subst $(BUILDDIR)/,,$@))jar cf $(JAR) -C $(CLASSPATH) org
103 $(call PRINTS,JAR $(subst $(BUILDDIR)/,,$@))jar cf $(JAR) -C $(BUILDDIR)/bin org
104 104
105jar: $(JAR) 105jar: $(JAR)
106 106
@@ -127,7 +127,7 @@ $(BINLIB_DIR)/libmisc.so: $(BUILDDIR)/rockbox.zip
127$(BINLIB_DIR)/lib%.so: $(BUILDDIR)/apps/codecs/%.codec 127$(BINLIB_DIR)/lib%.so: $(BUILDDIR)/apps/codecs/%.codec
128 $(call PRINTS,CP $(@F))cp $^ $@ 128 $(call PRINTS,CP $(@F))cp $^ $@
129 129
130libs: $(LIBS) 130libs: $(DIRS) $(LIBS)
131 131
132$(TEMP_APK): $(AP_) $(LIBS) $(DEX) | $(DIRS) 132$(TEMP_APK): $(AP_) $(LIBS) $(DEX) | $(DIRS)
133 $(call PRINTS,APK $(subst $(BUILDDIR)/,,$@))$(APKBUILDER) $@ \ 133 $(call PRINTS,APK $(subst $(BUILDDIR)/,,$@))$(APKBUILDER) $@ \
diff --git a/android/ant.properties b/android/ant.properties
new file mode 100644
index 0000000000..55563df961
--- /dev/null
+++ b/android/ant.properties
@@ -0,0 +1,12 @@
1# Override some props according to android.make
2# see $ANDROID_SDK_PATH/tools/ant/build.xml for what's overridable
3# Once we can build signed *release* builds, we should have a different
4# names for the debug builds
5
6
7# the signed, unzipaligned file is bin/__rockbox.apk
8out.packaged.file=bin/__${ant.project.name}.apk
9
10# the final file is rockbox.apk, in the build dir
11out.packaged.file=${ant.project.name}.apk
12
diff --git a/android/build.xml b/android/build.xml
new file mode 100644
index 0000000000..1f81b8d655
--- /dev/null
+++ b/android/build.xml
@@ -0,0 +1,85 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<project name="rockbox" default="help">
3
4 <!-- The local.properties file is created and updated by the 'android' tool.
5 It contains the path to the SDK. It should *NOT* be checked into
6 Version Control Systems. -->
7 <property file="local.properties" />
8
9 <!-- The ant.properties file can be created by you. It is only edited by the
10 'android' tool to add properties to it.
11 This is the place to change some Ant specific build properties.
12 Here are some properties you may want to change/update:
13
14 source.dir
15 The name of the source directory. Default is 'src'.
16 out.dir
17 The name of the output directory. Default is 'bin'.
18
19 For other overridable properties, look at the beginning of the rules
20 files in the SDK, at tools/ant/build.xml
21
22 Properties related to the SDK location or the project target should
23 be updated using the 'android' tool with the 'update' action.
24
25 This file is an integral part of the build system for your
26 application and should be checked into Version Control Systems.
27
28 -->
29 <property file="ant.properties" />
30
31 <!-- The project.properties file is created and updated by the 'android'
32 tool, as well as ADT.
33
34 This contains project specific properties such as project target, and library
35 dependencies. Lower level build properties are stored in ant.properties
36 (or in .classpath for Eclipse projects).
37
38 This file is an integral part of the build system for your
39 application and should be checked into Version Control Systems. -->
40 <loadproperties srcFile="project.properties" />
41
42 <!-- quick check on sdk.dir -->
43 <fail
44 message="sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through an env var"
45 unless="sdk.dir"
46 />
47
48
49<!-- extension targets. Uncomment the ones where you want to do custom work
50 in between standard targets -->
51<!--
52 <target name="-pre-build">
53 </target>
54 <target name="-pre-compile">
55 </target>
56
57 /* This is typically used for code obfuscation.
58 Compiled code location: ${out.classes.absolute.dir}
59 If this is not done in place, override ${out.dex.input.absolute.dir} */
60 <target name="-post-compile">
61 </target>
62-->
63
64 <!-- Import the actual build file.
65
66 To customize existing targets, there are two options:
67 - Customize only one target:
68 - copy/paste the target into this file, *before* the
69 <import> task.
70 - customize it to your needs.
71 - Customize the whole content of build.xml
72 - copy/paste the content of the rules files (minus the top node)
73 into this file, replacing the <import> task.
74 - customize to your needs.
75
76 ***********************
77 ****** IMPORTANT ******
78 ***********************
79 In all cases you must update the value of version-tag below to read 'custom' instead of an integer,
80 in order to avoid having your file be overridden by tools such as "android update project"
81 -->
82 <!-- version-tag: 1 -->
83 <import file="${sdk.dir}/tools/ant/build.xml" />
84
85</project>
diff --git a/android/proguard.cfg b/android/proguard.cfg
new file mode 100644
index 0000000000..b1cdf17b5b
--- /dev/null
+++ b/android/proguard.cfg
@@ -0,0 +1,40 @@
1-optimizationpasses 5
2-dontusemixedcaseclassnames
3-dontskipnonpubliclibraryclasses
4-dontpreverify
5-verbose
6-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
7
8-keep public class * extends android.app.Activity
9-keep public class * extends android.app.Application
10-keep public class * extends android.app.Service
11-keep public class * extends android.content.BroadcastReceiver
12-keep public class * extends android.content.ContentProvider
13-keep public class * extends android.app.backup.BackupAgentHelper
14-keep public class * extends android.preference.Preference
15-keep public class com.android.vending.licensing.ILicensingService
16
17-keepclasseswithmembernames class * {
18 native <methods>;
19}
20
21-keepclasseswithmembers class * {
22 public <init>(android.content.Context, android.util.AttributeSet);
23}
24
25-keepclasseswithmembers class * {
26 public <init>(android.content.Context, android.util.AttributeSet, int);
27}
28
29-keepclassmembers class * extends android.app.Activity {
30 public void *(android.view.View);
31}
32
33-keepclassmembers enum * {
34 public static **[] values();
35 public static ** valueOf(java.lang.String);
36}
37
38-keep class * implements android.os.Parcelable {
39 public static final android.os.Parcelable$Creator *;
40}
diff --git a/android/default.properties b/android/project.properties
index 510b0908b3..8da376af8d 100644
--- a/android/default.properties
+++ b/android/project.properties
@@ -1,11 +1,11 @@
1# This file is automatically generated by Android Tools. 1# This file is automatically generated by Android Tools.
2# Do not modify this file -- YOUR CHANGES WILL BE ERASED! 2# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3# 3#
4# This file must be checked in Version Control Systems. 4# This file must be checked in Version Control Systems.
5# 5#
6# To customize properties used by the Ant build system use, 6# To customize properties used by the Ant build system use,
7# "build.properties", and override values to adapt the script to your 7# "ant.properties", and override values to adapt the script to your
8# project structure. 8# project structure.
9 9
10# Project target. 10# Project target.
11target=android-11 11target=android-15