Merge "android_app_import is now ApexModule"
diff --git a/android/apex.go b/android/apex.go
index 9bf6fc7..839a03a 100644
--- a/android/apex.go
+++ b/android/apex.go
@@ -32,6 +32,7 @@
ApexName string
MinSdkVersion int
+ Updatable bool
}
// Extracted from ApexModule to make it easier to define custom subsets of the
@@ -104,6 +105,9 @@
// For example, with maxSdkVersion is 10 and versionList is [9,11]
// it returns 9 as string
ChooseSdkVersion(versionList []string, maxSdkVersion int) (string, error)
+
+ // Tests if the module comes from an updatable APEX.
+ Updatable() bool
}
type ApexProperties struct {
@@ -229,6 +233,10 @@
}
}
+func (m *ApexModuleBase) Updatable() bool {
+ return m.ApexProperties.Info.Updatable
+}
+
type byApexName []ApexInfo
func (a byApexName) Len() int { return len(a) }
diff --git a/apex/apex.go b/apex/apex.go
index 8463ac1..3b17886 100644
--- a/apex/apex.go
+++ b/apex/apex.go
@@ -562,7 +562,6 @@
"libnativebridge_lazy",
"libnativeloader_lazy",
"libnativewindow_headers",
- "libopus",
"libpdx_headers",
"libprocessgroup",
"libprocessgroup_headers",
@@ -845,6 +844,7 @@
apexBundles = []android.ApexInfo{{
ApexName: mctx.ModuleName(),
MinSdkVersion: a.minSdkVersion(mctx),
+ Updatable: proptools.Bool(a.properties.Updatable),
}}
directDep = true
} else if am, ok := mctx.Module().(android.ApexModule); ok {
diff --git a/apex/apex_test.go b/apex/apex_test.go
index 482d874..eabbdac 100644
--- a/apex/apex_test.go
+++ b/apex/apex_test.go
@@ -4279,6 +4279,13 @@
"system/sepolicy/apex/some-updatable-apex-file_contexts",
],
}
+
+ filegroup {
+ name: "some-non-updatable-apex-file_contexts",
+ srcs: [
+ "system/sepolicy/apex/some-non-updatable-apex-file_contexts",
+ ],
+ }
`
bp += cc.GatherRequiredDepsForTest(android.Android)
bp += java.GatherRequiredDepsForTest()
@@ -4291,6 +4298,7 @@
"apex_manifest.json": nil,
"AndroidManifest.xml": nil,
"system/sepolicy/apex/some-updatable-apex-file_contexts": nil,
+ "system/sepolicy/apex/some-non-updatable-apex-file_contexts": nil,
"system/sepolicy/apex/com.android.art.something-file_contexts": nil,
"framework/aidl/a.aidl": nil,
}
@@ -4345,6 +4353,14 @@
}
java_library {
+ name: "some-non-updatable-apex-lib",
+ srcs: ["a.java"],
+ apex_available: [
+ "some-non-updatable-apex",
+ ],
+ }
+
+ java_library {
name: "some-platform-lib",
srcs: ["a.java"],
installable: true,
@@ -4363,16 +4379,28 @@
name: "some-updatable-apex",
key: "some-updatable-apex.key",
java_libs: ["some-updatable-apex-lib"],
+ updatable: true,
+ }
+
+ apex {
+ name: "some-non-updatable-apex",
+ key: "some-non-updatable-apex.key",
+ java_libs: ["some-non-updatable-apex-lib"],
}
apex_key {
name: "some-updatable-apex.key",
}
+ apex_key {
+ name: "some-non-updatable-apex.key",
+ }
+
apex {
name: "com.android.art.something",
key: "com.android.art.something.key",
java_libs: ["some-art-lib"],
+ updatable: true,
}
apex_key {
@@ -4403,6 +4431,13 @@
}
testNoUpdatableJarsInBootImage(t, error, bp, transform)
+ // non-updatable jar from some other apex in the ART boot image => error
+ error = "module 'some-non-updatable-apex-lib' is not allowed in the ART boot image"
+ transform = func(config *dexpreopt.GlobalConfig) {
+ config.ArtApexJars = []string{"some-non-updatable-apex-lib"}
+ }
+ testNoUpdatableJarsInBootImage(t, error, bp, transform)
+
// updatable jar from some other apex in the framework boot image => error
error = "module 'some-updatable-apex-lib' from updatable apex 'some-updatable-apex' is not allowed in the framework boot image"
transform = func(config *dexpreopt.GlobalConfig) {
@@ -4410,6 +4445,12 @@
}
testNoUpdatableJarsInBootImage(t, error, bp, transform)
+ // non-updatable jar from some other apex in the framework boot image => ok
+ transform = func(config *dexpreopt.GlobalConfig) {
+ config.BootJars = []string{"some-non-updatable-apex-lib"}
+ }
+ testNoUpdatableJarsInBootImage(t, "", bp, transform)
+
// nonexistent jar in the ART boot image => error
error = "failed to find a dex jar path for module 'nonexistent'"
transform = func(config *dexpreopt.GlobalConfig) {
@@ -4425,7 +4466,7 @@
testNoUpdatableJarsInBootImage(t, error, bp, transform)
// platform jar in the ART boot image => error
- error = "module 'some-platform-lib' is part of the platform and not allowed in the ART boot image"
+ error = "module 'some-platform-lib' is not allowed in the ART boot image"
transform = func(config *dexpreopt.GlobalConfig) {
config.ArtApexJars = []string{"some-platform-lib"}
}
diff --git a/cc/builder.go b/cc/builder.go
index b583586..d8e90b6 100644
--- a/cc/builder.go
+++ b/cc/builder.go
@@ -307,7 +307,7 @@
rsFlags string
toolchain config.Toolchain
tidy bool
- coverage bool
+ gcovCoverage bool
sAbiDump bool
emitXrefs bool
@@ -369,7 +369,7 @@
tidyFiles = make(android.Paths, 0, len(srcFiles))
}
var coverageFiles android.Paths
- if flags.coverage {
+ if flags.gcovCoverage {
coverageFiles = make(android.Paths, 0, len(srcFiles))
}
var kytheFiles android.Paths
@@ -470,7 +470,7 @@
var ccCmd string
tidy := flags.tidy
- coverage := flags.coverage
+ coverage := flags.gcovCoverage
dump := flags.sAbiDump
rule := cc
emitXref := flags.emitXrefs
diff --git a/cc/cc.go b/cc/cc.go
index 6e02b24..24173ee 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -182,11 +182,11 @@
// These must be after any module include flags, which will be in CommonFlags.
SystemIncludeFlags []string
- Toolchain config.Toolchain
- Tidy bool
- Coverage bool
- SAbiDump bool
- EmitXrefs bool // If true, generate Ninja rules to generate emitXrefs input files for Kythe
+ Toolchain config.Toolchain
+ Tidy bool
+ GcovCoverage bool
+ SAbiDump bool
+ EmitXrefs bool // If true, generate Ninja rules to generate emitXrefs input files for Kythe
RequiredInstructionSet string
DynamicLinker string
@@ -1909,8 +1909,7 @@
addSharedLibDependencies := func(depTag DependencyTag, name string, version string) {
var variations []blueprint.Variation
variations = append(variations, blueprint.Variation{Mutator: "link", Variation: "shared"})
- versionVariantAvail := !c.InRecovery() && !c.InRamdisk()
- if version != "" && versionVariantAvail {
+ if version != "" && VersionVariantAvailable(c) {
// Version is explicitly specified. i.e. libFoo#30
variations = append(variations, blueprint.Variation{Mutator: "version", Variation: version})
depTag.ExplicitlyVersioned = true
@@ -1920,7 +1919,7 @@
// If the version is not specified, add dependency to all stubs libraries.
// The stubs library will be used when the depending module is built for APEX and
// the dependent module is not in the same APEX.
- if version == "" && versionVariantAvail {
+ if version == "" && VersionVariantAvailable(c) {
for _, ver := range stubsVersionsFor(actx.Config())[name] {
// Note that depTag.ExplicitlyVersioned is false in this case.
actx.AddVariationDependencies([]blueprint.Variation{
@@ -2318,7 +2317,7 @@
}
if ccDep.CcLibrary() && !depIsStatic {
depIsStubs := ccDep.BuildStubs()
- depHasStubs := ccDep.HasStubsVariants()
+ depHasStubs := VersionVariantAvailable(c) && ccDep.HasStubsVariants()
depInSameApex := android.DirectlyInApex(c.ApexName(), depName)
depInPlatform := !android.DirectlyInAnyApex(ctx, depName)
@@ -2334,8 +2333,8 @@
// If not building for APEX, use stubs only when it is from
// an APEX (and not from platform)
useThisDep = (depInPlatform != depIsStubs)
- if c.InRamdisk() || c.InRecovery() || c.bootstrap() {
- // However, for ramdisk, recovery or bootstrap modules,
+ if c.bootstrap() {
+ // However, for host, ramdisk, recovery or bootstrap modules,
// always link to non-stub variant
useThisDep = !depIsStubs
}
diff --git a/cc/coverage.go b/cc/coverage.go
index b94b628..bde07fd 100644
--- a/cc/coverage.go
+++ b/cc/coverage.go
@@ -82,10 +82,10 @@
}
if cov.Properties.CoverageEnabled {
- flags.Coverage = true
cov.linkCoverage = true
if gcovCoverage {
+ flags.GcovCoverage = true
flags.Local.CommonFlags = append(flags.Local.CommonFlags, "--coverage", "-O0")
// Override -Wframe-larger-than and non-default optimization
diff --git a/cc/library.go b/cc/library.go
index 94fffb9..e79d9bd 100644
--- a/cc/library.go
+++ b/cc/library.go
@@ -1528,10 +1528,18 @@
}
}
-// Version mutator splits a module into the mandatory non-stubs variant
+func VersionVariantAvailable(module interface {
+ Host() bool
+ InRamdisk() bool
+ InRecovery() bool
+}) bool {
+ return !module.Host() && !module.InRamdisk() && !module.InRecovery()
+}
+
+// VersionMutator splits a module into the mandatory non-stubs variant
// (which is unnamed) and zero or more stubs variants.
func VersionMutator(mctx android.BottomUpMutatorContext) {
- if library, ok := mctx.Module().(LinkableInterface); ok && !library.InRecovery() {
+ if library, ok := mctx.Module().(LinkableInterface); ok && VersionVariantAvailable(library) {
if library.CcLibrary() && library.BuildSharedVariant() && len(library.StubsVersions()) > 0 {
versions := library.StubsVersions()
checkVersions(mctx, versions)
@@ -1567,7 +1575,7 @@
}
if genrule, ok := mctx.Module().(*genrule.Module); ok {
if _, ok := genrule.Extra.(*GenruleExtraProperties); ok {
- if !genrule.InRecovery() {
+ if VersionVariantAvailable(genrule) {
mctx.CreateVariations("")
return
}
diff --git a/cc/linkable.go b/cc/linkable.go
index fbe61a4..4a70d48 100644
--- a/cc/linkable.go
+++ b/cc/linkable.go
@@ -39,6 +39,8 @@
Shared() bool
Toc() android.OptionalPath
+ Host() bool
+
InRamdisk() bool
OnlyInRamdisk() bool
diff --git a/cc/util.go b/cc/util.go
index 60070bb..af26268 100644
--- a/cc/util.go
+++ b/cc/util.go
@@ -82,7 +82,7 @@
tidyFlags: strings.Join(in.TidyFlags, " "),
sAbiFlags: strings.Join(in.SAbiFlags, " "),
toolchain: in.Toolchain,
- coverage: in.Coverage,
+ gcovCoverage: in.GcovCoverage,
tidy: in.Tidy,
sAbiDump: in.SAbiDump,
emitXrefs: in.EmitXrefs,
diff --git a/java/dexpreopt_bootjars.go b/java/dexpreopt_bootjars.go
index 543b233..c3825cb 100644
--- a/java/dexpreopt_bootjars.go
+++ b/java/dexpreopt_bootjars.go
@@ -268,27 +268,28 @@
// Check that this module satisfies constraints for a particular boot image.
apex, isApexModule := module.(android.ApexModule)
+ fromUpdatableApex := isApexModule && apex.Updatable()
if image.name == artBootImageName {
if isApexModule && strings.HasPrefix(apex.ApexName(), "com.android.art.") {
- // ok, found the jar in the ART apex
- } else if isApexModule && !apex.IsForPlatform() {
- // this jar is part of an updatable apex other than ART, fail immediately
- ctx.Errorf("module '%s' from updatable apex '%s' is not allowed in the ART boot image", name, apex.ApexName())
+ // ok: found the jar in the ART apex
} else if isApexModule && apex.IsForPlatform() && Bool(module.(*Library).deviceProperties.Hostdex) {
- // this is a special "hostdex" variant, skip it and resume search
+ // exception (skip and continue): special "hostdex" platform variant
return -1, nil
} else if name == "jacocoagent" && ctx.Config().IsEnvTrue("EMMA_INSTRUMENT_FRAMEWORK") {
- // this is Jacoco platform variant for a coverage build, skip it and resume search
+ // exception (skip and continue): Jacoco platform variant for a coverage build
return -1, nil
+ } else if fromUpdatableApex {
+ // error: this jar is part of an updatable apex other than ART
+ ctx.Errorf("module '%s' from updatable apex '%s' is not allowed in the ART boot image", name, apex.ApexName())
} else {
- // this (installable) jar is part of the platform, fail immediately
- ctx.Errorf("module '%s' is part of the platform and not allowed in the ART boot image", name)
+ // error: this jar is part of the platform or a non-updatable apex
+ ctx.Errorf("module '%s' is not allowed in the ART boot image", name)
}
} else if image.name == frameworkBootImageName {
- if !isApexModule || apex.IsForPlatform() {
- // ok, this jar is part of the platform
+ if !fromUpdatableApex {
+ // ok: this jar is part of the platform or a non-updatable apex
} else {
- // this jar is part of an updatable apex, fail immediately
+ // error: this jar is part of an updatable apex
ctx.Errorf("module '%s' from updatable apex '%s' is not allowed in the framework boot image", name, apex.ApexName())
}
} else {
diff --git a/java/droiddoc.go b/java/droiddoc.go
index e4582f6..8df3c2d 100644
--- a/java/droiddoc.go
+++ b/java/droiddoc.go
@@ -177,37 +177,15 @@
// filegroup or genrule can be included within this property.
Knowntags []string `android:"path"`
- // the tag name used to distinguish if the API files belong to public/system/test.
- Api_tag_name *string
-
// the generated public API filename by Doclava.
Api_filename *string
- // the generated public Dex API filename by Doclava.
- Dex_api_filename *string
-
- // the generated private API filename by Doclava.
- Private_api_filename *string
-
- // the generated private Dex API filename by Doclava.
- Private_dex_api_filename *string
-
// the generated removed API filename by Doclava.
Removed_api_filename *string
// the generated removed Dex API filename by Doclava.
Removed_dex_api_filename *string
- // mapping of dex signatures to source file and line number. This is a temporary property and
- // will be deleted; you probably shouldn't be using it.
- Dex_mapping_filename *string
-
- // the generated exact API filename by Doclava.
- Exact_api_filename *string
-
- // the generated proguard filename by Doclava.
- Proguard_filename *string
-
// if set to false, don't allow droiddoc to generate stubs source files. Defaults to true.
Create_stubs *bool
@@ -229,37 +207,15 @@
}
type DroidstubsProperties struct {
- // the tag name used to distinguish if the API files belong to public/system/test.
- Api_tag_name *string
-
// the generated public API filename by Metalava.
Api_filename *string
- // the generated public Dex API filename by Metalava.
- Dex_api_filename *string
-
- // the generated private API filename by Metalava.
- Private_api_filename *string
-
- // the generated private Dex API filename by Metalava.
- Private_dex_api_filename *string
-
// the generated removed API filename by Metalava.
Removed_api_filename *string
// the generated removed Dex API filename by Metalava.
Removed_dex_api_filename *string
- // mapping of dex signatures to source file and line number. This is a temporary property and
- // will be deleted; you probably shouldn't be using it.
- Dex_mapping_filename *string
-
- // the generated exact API filename by Metalava.
- Exact_api_filename *string
-
- // the generated proguard filename by Metalava.
- Proguard_filename *string
-
Check_api struct {
Last_released ApiToCheck
@@ -731,14 +687,9 @@
properties DroiddocProperties
apiFile android.WritablePath
- dexApiFile android.WritablePath
privateApiFile android.WritablePath
- privateDexApiFile android.WritablePath
removedApiFile android.WritablePath
removedDexApiFile android.WritablePath
- exactApiFile android.WritablePath
- apiMappingFile android.WritablePath
- proguardFile android.WritablePath
checkCurrentApiTimestamp android.WritablePath
updateCurrentApiTimestamp android.WritablePath
@@ -876,41 +827,11 @@
cmd.FlagWithOutput("-removedApi ", d.removedApiFile)
}
- if String(d.properties.Private_api_filename) != "" {
- d.privateApiFile = android.PathForModuleOut(ctx, String(d.properties.Private_api_filename))
- cmd.FlagWithOutput("-privateApi ", d.privateApiFile)
- }
-
- if String(d.properties.Dex_api_filename) != "" {
- d.dexApiFile = android.PathForModuleOut(ctx, String(d.properties.Dex_api_filename))
- cmd.FlagWithOutput("-dexApi ", d.dexApiFile)
- }
-
- if String(d.properties.Private_dex_api_filename) != "" {
- d.privateDexApiFile = android.PathForModuleOut(ctx, String(d.properties.Private_dex_api_filename))
- cmd.FlagWithOutput("-privateDexApi ", d.privateDexApiFile)
- }
-
if String(d.properties.Removed_dex_api_filename) != "" {
d.removedDexApiFile = android.PathForModuleOut(ctx, String(d.properties.Removed_dex_api_filename))
cmd.FlagWithOutput("-removedDexApi ", d.removedDexApiFile)
}
- if String(d.properties.Exact_api_filename) != "" {
- d.exactApiFile = android.PathForModuleOut(ctx, String(d.properties.Exact_api_filename))
- cmd.FlagWithOutput("-exactApi ", d.exactApiFile)
- }
-
- if String(d.properties.Dex_mapping_filename) != "" {
- d.apiMappingFile = android.PathForModuleOut(ctx, String(d.properties.Dex_mapping_filename))
- cmd.FlagWithOutput("-apiMapping ", d.apiMappingFile)
- }
-
- if String(d.properties.Proguard_filename) != "" {
- d.proguardFile = android.PathForModuleOut(ctx, String(d.properties.Proguard_filename))
- cmd.FlagWithOutput("-proguard ", d.proguardFile)
- }
-
if BoolDefault(d.properties.Create_stubs, true) {
cmd.FlagWithArg("-stubs ", stubsDir.String())
}
@@ -1210,14 +1131,9 @@
apiFile android.WritablePath
apiXmlFile android.WritablePath
lastReleasedApiXmlFile android.WritablePath
- dexApiFile android.WritablePath
privateApiFile android.WritablePath
- privateDexApiFile android.WritablePath
removedApiFile android.WritablePath
removedDexApiFile android.WritablePath
- apiMappingFile android.WritablePath
- exactApiFile android.WritablePath
- proguardFile android.WritablePath
nullabilityWarningsFile android.WritablePath
checkCurrentApiTimestamp android.WritablePath
@@ -1322,41 +1238,11 @@
cmd.FlagWithOutput("--removed-api ", d.removedApiFile)
}
- if String(d.properties.Private_api_filename) != "" {
- d.privateApiFile = android.PathForModuleOut(ctx, String(d.properties.Private_api_filename))
- cmd.FlagWithOutput("--private-api ", d.privateApiFile)
- }
-
- if String(d.properties.Dex_api_filename) != "" {
- d.dexApiFile = android.PathForModuleOut(ctx, String(d.properties.Dex_api_filename))
- cmd.FlagWithOutput("--dex-api ", d.dexApiFile)
- }
-
- if String(d.properties.Private_dex_api_filename) != "" {
- d.privateDexApiFile = android.PathForModuleOut(ctx, String(d.properties.Private_dex_api_filename))
- cmd.FlagWithOutput("--private-dex-api ", d.privateDexApiFile)
- }
-
if String(d.properties.Removed_dex_api_filename) != "" {
d.removedDexApiFile = android.PathForModuleOut(ctx, String(d.properties.Removed_dex_api_filename))
cmd.FlagWithOutput("--removed-dex-api ", d.removedDexApiFile)
}
- if String(d.properties.Exact_api_filename) != "" {
- d.exactApiFile = android.PathForModuleOut(ctx, String(d.properties.Exact_api_filename))
- cmd.FlagWithOutput("--exact-api ", d.exactApiFile)
- }
-
- if String(d.properties.Dex_mapping_filename) != "" {
- d.apiMappingFile = android.PathForModuleOut(ctx, String(d.properties.Dex_mapping_filename))
- cmd.FlagWithOutput("--dex-api-mapping ", d.apiMappingFile)
- }
-
- if String(d.properties.Proguard_filename) != "" {
- d.proguardFile = android.PathForModuleOut(ctx, String(d.properties.Proguard_filename))
- cmd.FlagWithOutput("--proguard ", d.proguardFile)
- }
-
if Bool(d.properties.Write_sdk_values) {
d.metadataDir = android.PathForModuleOut(ctx, "metadata")
cmd.FlagWithArg("--sdk-values ", d.metadataDir.String())
diff --git a/rust/config/global.go b/rust/config/global.go
index 690d83e..c0bd0f2 100644
--- a/rust/config/global.go
+++ b/rust/config/global.go
@@ -24,7 +24,7 @@
var pctx = android.NewPackageContext("android/soong/rust/config")
var (
- RustDefaultVersion = "1.40.0"
+ RustDefaultVersion = "1.42.0"
RustDefaultBase = "prebuilts/rust/"
DefaultEdition = "2018"
Stdlibs = []string{
diff --git a/rust/rust.go b/rust/rust.go
index 6fe8871..5cc8845 100644
--- a/rust/rust.go
+++ b/rust/rust.go
@@ -735,13 +735,14 @@
deps := mod.deps(ctx)
commonDepVariations := []blueprint.Variation{}
- commonDepVariations = append(commonDepVariations,
- blueprint.Variation{Mutator: "version", Variation: ""})
+ if cc.VersionVariantAvailable(mod) {
+ commonDepVariations = append(commonDepVariations,
+ blueprint.Variation{Mutator: "version", Variation: ""})
+ }
if !mod.Host() {
commonDepVariations = append(commonDepVariations,
blueprint.Variation{Mutator: "image", Variation: android.CoreVariation})
}
-
actx.AddVariationDependencies(
append(commonDepVariations, []blueprint.Variation{
{Mutator: "rust_libraries", Variation: "rlib"},
diff --git a/scripts/build-mainline-modules.sh b/scripts/build-mainline-modules.sh
index 79e40dd..fc91c3d 100755
--- a/scripts/build-mainline-modules.sh
+++ b/scripts/build-mainline-modules.sh
@@ -18,6 +18,7 @@
art-module-test-exports
conscrypt-module-sdk
conscrypt-module-test-exports
+ conscrypt-module-host-exports
)
# We want to create apex modules for all supported architectures.