dex_import can be added to apex
Bug:157886942 Test: m Change-Id: Ida6f7bb784efe74cc1fa0e8d370eaee803f08b0f Merged-In: Ida6f7bb784efe74cc1fa0e8d370eaee803f08b0f
This commit is contained in:
committed by
Anton Hansson
parent
8383972ec0
commit
2cd081cf06
18
apex/apex.go
18
apex/apex.go
@@ -1670,7 +1670,8 @@ func apexFileForShBinary(ctx android.BaseModuleContext, sh *android.ShBinary) ap
|
|||||||
}
|
}
|
||||||
|
|
||||||
type javaDependency interface {
|
type javaDependency interface {
|
||||||
java.Dependency
|
DexJar() android.Path
|
||||||
|
JacocoReportClassesFile() android.Path
|
||||||
Stem() string
|
Stem() string
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1954,23 +1955,16 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
ctx.PropertyErrorf("binaries", "%q is neither cc_binary, (embedded) py_binary, (host) blueprint_go_binary, (host) bootstrap_go_binary, nor sh_binary", depName)
|
ctx.PropertyErrorf("binaries", "%q is neither cc_binary, (embedded) py_binary, (host) blueprint_go_binary, (host) bootstrap_go_binary, nor sh_binary", depName)
|
||||||
}
|
}
|
||||||
case javaLibTag:
|
case javaLibTag:
|
||||||
if javaLib, ok := child.(*java.Library); ok {
|
switch child.(type) {
|
||||||
af := apexFileForJavaLibrary(ctx, javaLib, javaLib)
|
case *java.Library, *java.SdkLibrary, *java.DexImport:
|
||||||
if !af.Ok() {
|
af := apexFileForJavaLibrary(ctx, child.(javaDependency), child.(android.Module))
|
||||||
ctx.PropertyErrorf("java_libs", "%q is not configured to be compiled into dex", depName)
|
|
||||||
} else {
|
|
||||||
filesInfo = append(filesInfo, af)
|
|
||||||
return true // track transitive dependencies
|
|
||||||
}
|
|
||||||
} else if sdkLib, ok := child.(*java.SdkLibrary); ok {
|
|
||||||
af := apexFileForJavaLibrary(ctx, sdkLib, sdkLib)
|
|
||||||
if !af.Ok() {
|
if !af.Ok() {
|
||||||
ctx.PropertyErrorf("java_libs", "%q is not configured to be compiled into dex", depName)
|
ctx.PropertyErrorf("java_libs", "%q is not configured to be compiled into dex", depName)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
filesInfo = append(filesInfo, af)
|
filesInfo = append(filesInfo, af)
|
||||||
return true // track transitive dependencies
|
return true // track transitive dependencies
|
||||||
} else {
|
default:
|
||||||
ctx.PropertyErrorf("java_libs", "%q of type %q is not supported", depName, ctx.OtherModuleType(child))
|
ctx.PropertyErrorf("java_libs", "%q of type %q is not supported", depName, ctx.OtherModuleType(child))
|
||||||
}
|
}
|
||||||
case androidAppTag:
|
case androidAppTag:
|
||||||
|
@@ -289,7 +289,10 @@ func TestBasicApex(t *testing.T) {
|
|||||||
binaries: ["foo",],
|
binaries: ["foo",],
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
java_libs: ["myjar"],
|
java_libs: [
|
||||||
|
"myjar",
|
||||||
|
"myjar_dex",
|
||||||
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
apex {
|
apex {
|
||||||
@@ -398,6 +401,15 @@ func TestBasicApex(t *testing.T) {
|
|||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dex_import {
|
||||||
|
name: "myjar_dex",
|
||||||
|
jars: ["prebuilt.jar"],
|
||||||
|
apex_available: [
|
||||||
|
"//apex_available:platform",
|
||||||
|
"myapex",
|
||||||
|
],
|
||||||
|
}
|
||||||
|
|
||||||
java_library {
|
java_library {
|
||||||
name: "myotherjar",
|
name: "myotherjar",
|
||||||
srcs: ["foo/bar/MyClass.java"],
|
srcs: ["foo/bar/MyClass.java"],
|
||||||
@@ -433,6 +445,7 @@ func TestBasicApex(t *testing.T) {
|
|||||||
// Ensure that apex variant is created for the direct dep
|
// Ensure that apex variant is created for the direct dep
|
||||||
ensureListContains(t, ctx.ModuleVariantsForTests("mylib"), "android_arm64_armv8-a_shared_myapex")
|
ensureListContains(t, ctx.ModuleVariantsForTests("mylib"), "android_arm64_armv8-a_shared_myapex")
|
||||||
ensureListContains(t, ctx.ModuleVariantsForTests("myjar"), "android_common_myapex")
|
ensureListContains(t, ctx.ModuleVariantsForTests("myjar"), "android_common_myapex")
|
||||||
|
ensureListContains(t, ctx.ModuleVariantsForTests("myjar_dex"), "android_common_myapex")
|
||||||
|
|
||||||
// Ensure that apex variant is created for the indirect dep
|
// Ensure that apex variant is created for the indirect dep
|
||||||
ensureListContains(t, ctx.ModuleVariantsForTests("mylib2"), "android_arm64_armv8-a_shared_myapex")
|
ensureListContains(t, ctx.ModuleVariantsForTests("mylib2"), "android_arm64_armv8-a_shared_myapex")
|
||||||
@@ -442,6 +455,7 @@ func TestBasicApex(t *testing.T) {
|
|||||||
ensureContains(t, copyCmds, "image.apex/lib64/mylib.so")
|
ensureContains(t, copyCmds, "image.apex/lib64/mylib.so")
|
||||||
ensureContains(t, copyCmds, "image.apex/lib64/mylib2.so")
|
ensureContains(t, copyCmds, "image.apex/lib64/mylib2.so")
|
||||||
ensureContains(t, copyCmds, "image.apex/javalib/myjar_stem.jar")
|
ensureContains(t, copyCmds, "image.apex/javalib/myjar_stem.jar")
|
||||||
|
ensureContains(t, copyCmds, "image.apex/javalib/myjar_dex.jar")
|
||||||
// .. but not for java libs
|
// .. but not for java libs
|
||||||
ensureNotContains(t, copyCmds, "image.apex/javalib/myotherjar.jar")
|
ensureNotContains(t, copyCmds, "image.apex/javalib/myotherjar.jar")
|
||||||
ensureNotContains(t, copyCmds, "image.apex/javalib/msharedjar.jar")
|
ensureNotContains(t, copyCmds, "image.apex/javalib/msharedjar.jar")
|
||||||
|
@@ -2684,6 +2684,10 @@ func (j *DexImport) Stem() string {
|
|||||||
return proptools.StringDefault(j.properties.Stem, j.ModuleBase.Name())
|
return proptools.StringDefault(j.properties.Stem, j.ModuleBase.Name())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (a *DexImport) JacocoReportClassesFile() android.Path {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func (j *DexImport) IsInstallable() bool {
|
func (j *DexImport) IsInstallable() bool {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user