Refactor apex build rule and add test apex
This is used to setup installation test.
Bug: 146416755
Test: atest CronetApiTest
Change-Id: Ib4b3a559f1cab1c68c35ee79fab1f2590ea12de7
Merged-In: Ib4b3a559f1cab1c68c35ee79fab1f2590ea12de7
diff --git a/apex/Android.bp b/apex/Android.bp
index bf27220..64cadf2 100644
--- a/apex/Android.bp
+++ b/apex/Android.bp
@@ -12,18 +12,29 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-apex {
- name: "com.android.cronet",
- manifest: "manifest.json",
+apex_defaults {
+ name: "com.android.cronet-defaults",
compile_multilib: "both",
native_shared_libs: ["libcronet.80.0.3986.0"],
java_libs: ["org.chromium.net.cronet"],
-
key: "com.android.cronet.key",
certificate: ":com.android.cronet.certificate",
// Use a custom AndroidManifest.xml used for API targeting.
- androidManifest: "AndroidManifest.xml",
+ androidManifest: ":cronet-manifest.xml",
+}
+
+filegroup {
+ name: "cronet-manifest.xml",
+ srcs: [
+ "AndroidManifest.xml",
+ ],
+}
+
+apex {
+ name: "com.android.cronet",
+ defaults: ["com.android.cronet-defaults"],
+ manifest: "manifest.json",
}
apex_key {
diff --git a/apex/testing/Android.bp b/apex/testing/Android.bp
new file mode 100644
index 0000000..549b6e3
--- /dev/null
+++ b/apex/testing/Android.bp
@@ -0,0 +1,25 @@
+// Copyright 2019 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.
+
+apex {
+ name: "test_com.android.cronet",
+ visibility: [
+ "//system/apex/tests",
+ ],
+ defaults: ["com.android.cronet-defaults"],
+ manifest: "test_apex_manifest.json",
+ file_contexts: ":com.android.cronet-file_contexts",
+ // Test APEX, should never be installed
+ installable: false,
+}
diff --git a/apex/testing/test_apex_manifest.json b/apex/testing/test_apex_manifest.json
new file mode 100644
index 0000000..15aaead
--- /dev/null
+++ b/apex/testing/test_apex_manifest.json
@@ -0,0 +1,4 @@
+{
+ "name": "com.android.cronet",
+ "version": 300000000
+}
\ No newline at end of file