Merge "Automatically set compile_dex:true and hostdex:true for APEX variants"
This commit is contained in:
commit
6655756230
|
@ -453,7 +453,6 @@ func TestBasicApex(t *testing.T) {
|
||||||
srcs: ["foo/bar/MyClass.java"],
|
srcs: ["foo/bar/MyClass.java"],
|
||||||
sdk_version: "none",
|
sdk_version: "none",
|
||||||
system_modules: "none",
|
system_modules: "none",
|
||||||
compile_dex: true,
|
|
||||||
static_libs: ["myotherjar"],
|
static_libs: ["myotherjar"],
|
||||||
libs: ["mysharedjar"],
|
libs: ["mysharedjar"],
|
||||||
// TODO: remove //apex_available:platform
|
// TODO: remove //apex_available:platform
|
||||||
|
@ -468,7 +467,6 @@ func TestBasicApex(t *testing.T) {
|
||||||
srcs: ["foo/bar/MyClass.java"],
|
srcs: ["foo/bar/MyClass.java"],
|
||||||
sdk_version: "none",
|
sdk_version: "none",
|
||||||
system_modules: "none",
|
system_modules: "none",
|
||||||
compile_dex: true,
|
|
||||||
// TODO: remove //apex_available:platform
|
// TODO: remove //apex_available:platform
|
||||||
apex_available: [
|
apex_available: [
|
||||||
"//apex_available:platform",
|
"//apex_available:platform",
|
||||||
|
@ -481,7 +479,6 @@ func TestBasicApex(t *testing.T) {
|
||||||
srcs: ["foo/bar/MyClass.java"],
|
srcs: ["foo/bar/MyClass.java"],
|
||||||
sdk_version: "none",
|
sdk_version: "none",
|
||||||
system_modules: "none",
|
system_modules: "none",
|
||||||
compile_dex: true,
|
|
||||||
}
|
}
|
||||||
`)
|
`)
|
||||||
|
|
||||||
|
@ -595,7 +592,6 @@ func TestDefaults(t *testing.T) {
|
||||||
srcs: ["foo/bar/MyClass.java"],
|
srcs: ["foo/bar/MyClass.java"],
|
||||||
sdk_version: "none",
|
sdk_version: "none",
|
||||||
system_modules: "none",
|
system_modules: "none",
|
||||||
compile_dex: true,
|
|
||||||
apex_available: [ "myapex" ],
|
apex_available: [ "myapex" ],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2997,7 +2993,6 @@ func TestErrorsIfDepsAreNotEnabled(t *testing.T) {
|
||||||
srcs: ["foo/bar/MyClass.java"],
|
srcs: ["foo/bar/MyClass.java"],
|
||||||
sdk_version: "none",
|
sdk_version: "none",
|
||||||
system_modules: "none",
|
system_modules: "none",
|
||||||
compile_dex: true,
|
|
||||||
enabled: false,
|
enabled: false,
|
||||||
}
|
}
|
||||||
`)
|
`)
|
||||||
|
@ -3528,7 +3523,6 @@ func TestCompatConfig(t *testing.T) {
|
||||||
srcs: ["foo/bar/MyClass.java"],
|
srcs: ["foo/bar/MyClass.java"],
|
||||||
sdk_version: "none",
|
sdk_version: "none",
|
||||||
system_modules: "none",
|
system_modules: "none",
|
||||||
compile_dex: true,
|
|
||||||
apex_available: [ "myapex" ],
|
apex_available: [ "myapex" ],
|
||||||
}
|
}
|
||||||
`)
|
`)
|
||||||
|
@ -3557,6 +3551,7 @@ func TestRejectNonInstallableJavaLibrary(t *testing.T) {
|
||||||
srcs: ["foo/bar/MyClass.java"],
|
srcs: ["foo/bar/MyClass.java"],
|
||||||
sdk_version: "none",
|
sdk_version: "none",
|
||||||
system_modules: "none",
|
system_modules: "none",
|
||||||
|
compile_dex: false,
|
||||||
}
|
}
|
||||||
`)
|
`)
|
||||||
}
|
}
|
||||||
|
@ -3643,7 +3638,6 @@ func TestSymlinksFromApexToSystem(t *testing.T) {
|
||||||
sdk_version: "none",
|
sdk_version: "none",
|
||||||
system_modules: "none",
|
system_modules: "none",
|
||||||
libs: ["myotherjar"],
|
libs: ["myotherjar"],
|
||||||
compile_dex: true,
|
|
||||||
apex_available: [
|
apex_available: [
|
||||||
"myapex",
|
"myapex",
|
||||||
"//apex_available:platform",
|
"//apex_available:platform",
|
||||||
|
|
10
java/java.go
10
java/java.go
|
@ -1475,6 +1475,16 @@ func (j *Module) compile(ctx android.ModuleContext, aaptSrcJar android.Path) {
|
||||||
|
|
||||||
j.implementationAndResourcesJar = implementationAndResourcesJar
|
j.implementationAndResourcesJar = implementationAndResourcesJar
|
||||||
|
|
||||||
|
// Enable dex compilation for the APEX variants, unless it is disabled explicitly
|
||||||
|
if android.DirectlyInAnyApex(ctx, ctx.ModuleName()) && !j.IsForPlatform() {
|
||||||
|
if j.deviceProperties.Compile_dex == nil {
|
||||||
|
j.deviceProperties.Compile_dex = proptools.BoolPtr(true)
|
||||||
|
}
|
||||||
|
if j.deviceProperties.Hostdex == nil {
|
||||||
|
j.deviceProperties.Hostdex = proptools.BoolPtr(true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ctx.Device() && j.hasCode(ctx) &&
|
if ctx.Device() && j.hasCode(ctx) &&
|
||||||
(Bool(j.properties.Installable) || Bool(j.deviceProperties.Compile_dex)) {
|
(Bool(j.properties.Installable) || Bool(j.deviceProperties.Compile_dex)) {
|
||||||
// Dex compilation
|
// Dex compilation
|
||||||
|
|
Loading…
Reference in New Issue