summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAdam Lesinski <adamlesinski@google.com>2014-06-18 15:06:01 -0700
committerAdam Lesinski <adamlesinski@google.com>2014-08-04 18:48:14 -0700
commit833f3ccbc8f4dd1ec8abb9121988b99ff34ec4c1 (patch)
treea57e8389088178108de1424faf41ea3bb87c934a /tests
parent5c09e8ad5ee8e67976066366527ee58792551953 (diff)
downloadframeworks_base-833f3ccbc8f4dd1ec8abb9121988b99ff34ec4c1.zip
frameworks_base-833f3ccbc8f4dd1ec8abb9121988b99ff34ec4c1.tar.gz
frameworks_base-833f3ccbc8f4dd1ec8abb9121988b99ff34ec4c1.tar.bz2
AAPT support for feature splits
This change allows the developer to add a base package for which to build a feature split. The generated resource types will begin after the base APK's defined types so as not to collide or override resources. Multiple features can be generated by first choosing an arbitrary order for the features. Then for each feature, the base APK and any preceding features are specified with the --feature-of flags. So with a base APK 'A' and features, 'B', and 'C', 'B' would be built with aapt package [...] --feature-of A [...] and 'C' would be built with aapt package [...] --feature-of A --feature-of B [...] Change-Id: I1be66e3f8df9a737b21c71f8a93685376c7e6780
Diffstat (limited to 'tests')
-rw-r--r--tests/FeatureSplit/base/Android.mk25
-rw-r--r--tests/FeatureSplit/base/AndroidManifest.xml22
-rw-r--r--tests/FeatureSplit/base/res/values/values.xml24
-rw-r--r--tests/FeatureSplit/feature1/Android.mk32
-rw-r--r--tests/FeatureSplit/feature1/AndroidManifest.xml21
-rw-r--r--tests/FeatureSplit/feature1/res/values/values.xml25
-rw-r--r--tests/FeatureSplit/feature2/Android.mk35
-rw-r--r--tests/FeatureSplit/feature2/AndroidManifest.xml21
-rw-r--r--tests/FeatureSplit/feature2/res/values/values.xml24
9 files changed, 229 insertions, 0 deletions
diff --git a/tests/FeatureSplit/base/Android.mk b/tests/FeatureSplit/base/Android.mk
new file mode 100644
index 0000000..7c0fc04
--- /dev/null
+++ b/tests/FeatureSplit/base/Android.mk
@@ -0,0 +1,25 @@
+#
+# Copyright (C) 2014 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+LOCAL_PATH:= $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := $(call all-subdir-java-files)
+LOCAL_PACKAGE_NAME := FeatureSplitBase
+
+LOCAL_MODULE_TAGS := tests
+
+include $(BUILD_PACKAGE)
diff --git a/tests/FeatureSplit/base/AndroidManifest.xml b/tests/FeatureSplit/base/AndroidManifest.xml
new file mode 100644
index 0000000..989e802
--- /dev/null
+++ b/tests/FeatureSplit/base/AndroidManifest.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.android.test.split.feature">
+ <application android:label="@string/app_title"
+ android:hasCode="false">
+ </application>
+</manifest>
diff --git a/tests/FeatureSplit/base/res/values/values.xml b/tests/FeatureSplit/base/res/values/values.xml
new file mode 100644
index 0000000..564d301
--- /dev/null
+++ b/tests/FeatureSplit/base/res/values/values.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<resources>
+ <string name="app_title">FeatureSplit APK</string>
+
+ <item type="id" name="test_id"/>
+ <integer name="test_integer">100</integer>
+ <color name="test_color">#ff0000</color>
+</resources>
+
diff --git a/tests/FeatureSplit/feature1/Android.mk b/tests/FeatureSplit/feature1/Android.mk
new file mode 100644
index 0000000..3059824
--- /dev/null
+++ b/tests/FeatureSplit/feature1/Android.mk
@@ -0,0 +1,32 @@
+#
+# Copyright (C) 2014 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+LOCAL_PATH:= $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := $(call all-subdir-java-files)
+LOCAL_PACKAGE_NAME := FeatureSplit1
+LOCAL_MODULE_TAGS := tests
+
+featureOf := FeatureSplitBase
+featureOfApk := $(call intermediates-dir-for,APPS,$(featureOf))/package.apk
+localRStamp := $(call intermediates-dir-for,APPS,$(LOCAL_PACKAGE_NAME),,COMMON)/src/R.stamp
+$(localRStamp): $(featureOfApk)
+
+$(info $(localRStamp))
+LOCAL_AAPT_FLAGS := --feature-of $(featureOfApk)
+
+include $(BUILD_PACKAGE)
diff --git a/tests/FeatureSplit/feature1/AndroidManifest.xml b/tests/FeatureSplit/feature1/AndroidManifest.xml
new file mode 100644
index 0000000..2aadc6d
--- /dev/null
+++ b/tests/FeatureSplit/feature1/AndroidManifest.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.android.test.split.feature"
+ featureName="feature1">
+ <application android:hasCode="false" />
+</manifest>
diff --git a/tests/FeatureSplit/feature1/res/values/values.xml b/tests/FeatureSplit/feature1/res/values/values.xml
new file mode 100644
index 0000000..70eb56a
--- /dev/null
+++ b/tests/FeatureSplit/feature1/res/values/values.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<resources>
+ <item type="id" name="test_id2"/>
+ <integer name="test_integer2">200</integer>
+ <color name="test_color2">#00ff00</color>
+ <string-array name="string_array2">
+ <item>@*string/app_title</item>
+ </string-array>
+</resources>
+
diff --git a/tests/FeatureSplit/feature2/Android.mk b/tests/FeatureSplit/feature2/Android.mk
new file mode 100644
index 0000000..e69cbe8
--- /dev/null
+++ b/tests/FeatureSplit/feature2/Android.mk
@@ -0,0 +1,35 @@
+#
+# Copyright (C) 2014 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+LOCAL_PATH:= $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := $(call all-subdir-java-files)
+LOCAL_PACKAGE_NAME := FeatureSplit2
+LOCAL_MODULE_TAGS := tests
+
+featureOf := FeatureSplitBase
+featureAfter := FeatureSplit1
+
+featureOfApk := $(call intermediates-dir-for,APPS,$(featureOf))/package.apk
+featureAfterApk := $(call intermediates-dir-for,APPS,$(featureAfter))/package.apk
+localRStamp := $(call intermediates-dir-for,APPS,$(LOCAL_PACKAGE_NAME),,COMMON)/src/R.stamp
+$(localRStamp): $(featureOfApk) $(featureAfterApk)
+
+LOCAL_AAPT_FLAGS := --feature-of $(featureOfApk)
+LOCAL_AAPT_FLAGS += --feature-after $(featureAfterApk)
+
+include $(BUILD_PACKAGE)
diff --git a/tests/FeatureSplit/feature2/AndroidManifest.xml b/tests/FeatureSplit/feature2/AndroidManifest.xml
new file mode 100644
index 0000000..d139900
--- /dev/null
+++ b/tests/FeatureSplit/feature2/AndroidManifest.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.android.test.split.feature"
+ featureName="feature2">
+ <application android:hasCode="false"/>
+</manifest>
diff --git a/tests/FeatureSplit/feature2/res/values/values.xml b/tests/FeatureSplit/feature2/res/values/values.xml
new file mode 100644
index 0000000..af5ed1b
--- /dev/null
+++ b/tests/FeatureSplit/feature2/res/values/values.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<resources>
+ <integer name="test_integer3">300</integer>
+ <color name="test_color3">#0000ff</color>
+ <string-array name="string_array3">
+ <item>@string/app_title</item>
+ </string-array>
+</resources>
+