Enable an apex to include a java_import.
With the addition of the compile_dex property to the
java_import module it becomes possible to include a
java_import module in an apex. This change allows the
dependency and adds a test.
Bug: 177228901
Test: m nothing
Test: new TestApexWithJavaImport
Change-Id: I9336dade1857109e2fd21f7d57e1dc4abc4a402c
diff --git a/apex/apex_test.go b/apex/apex_test.go
index 58739b0..3c7e019 100644
--- a/apex/apex_test.go
+++ b/apex/apex_test.go
@@ -4515,6 +4515,34 @@
`)
}
+func TestApexWithJavaImport(t *testing.T) {
+ ctx, _ := testApex(t, `
+ apex {
+ name: "myapex",
+ key: "myapex.key",
+ java_libs: ["myjavaimport"],
+ }
+
+ apex_key {
+ name: "myapex.key",
+ public_key: "testkey.avbpubkey",
+ private_key: "testkey.pem",
+ }
+
+ java_import {
+ name: "myjavaimport",
+ apex_available: ["myapex"],
+ jars: ["my.jar"],
+ compile_dex: true,
+ }
+ `)
+
+ module := ctx.ModuleForTests("myapex", "android_common_myapex_image")
+ apexRule := module.Rule("apexRule")
+ copyCmds := apexRule.Args["copy_commands"]
+ ensureContains(t, copyCmds, "image.apex/javalib/myjavaimport.jar")
+}
+
func TestApexWithApps(t *testing.T) {
ctx, _ := testApex(t, `
apex {