Merge "Clean up minSdkVersionAllowlist"
diff --git a/android/apex.go b/android/apex.go
index 75d1f51..555cbb5 100644
--- a/android/apex.go
+++ b/android/apex.go
@@ -58,9 +58,6 @@
// to true.
UsePlatformApis bool
- // The list of SDK modules that the containing apexBundle depends on.
- RequiredSdks SdkRefs
-
// List of Apex variant names that this module is associated with. This initially is the
// same as the `ApexVariationName` field. Then when multiple apex variants are merged in
// mergeApexVariations, ApexInfo struct of the merged variant holds the list of apexBundles
@@ -110,9 +107,6 @@
// thus wouldn't be merged.
func (i ApexInfo) mergedName(ctx PathContext) string {
name := "apex" + strconv.Itoa(i.MinSdkVersion.FinalOrFutureInt())
- for _, sdk := range i.RequiredSdks {
- name += "_" + sdk.Name + "_" + sdk.Version
- }
return name
}
diff --git a/android/apex_test.go b/android/apex_test.go
index 1e2f3bd..0bf4c9c 100644
--- a/android/apex_test.go
+++ b/android/apex_test.go
@@ -33,10 +33,10 @@
{
name: "single",
in: []ApexInfo{
- {"foo", FutureApiLevel, false, false, nil, []string{"foo"}, []string{"foo"}, nil, NotForPrebuiltApex},
+ {"foo", FutureApiLevel, false, false, []string{"foo"}, []string{"foo"}, nil, NotForPrebuiltApex},
},
wantMerged: []ApexInfo{
- {"apex10000", FutureApiLevel, false, false, nil, []string{"foo"}, []string{"foo"}, nil, NotForPrebuiltApex},
+ {"apex10000", FutureApiLevel, false, false, []string{"foo"}, []string{"foo"}, nil, NotForPrebuiltApex},
},
wantAliases: [][2]string{
{"foo", "apex10000"},
@@ -45,25 +45,25 @@
{
name: "merge",
in: []ApexInfo{
- {"foo", FutureApiLevel, false, false, SdkRefs{{"baz", "1"}}, []string{"foo"}, []string{"foo"}, nil, NotForPrebuiltApex},
- {"bar", FutureApiLevel, false, false, SdkRefs{{"baz", "1"}}, []string{"bar"}, []string{"bar"}, nil, NotForPrebuiltApex},
+ {"foo", FutureApiLevel, false, false, []string{"foo"}, []string{"foo"}, nil, NotForPrebuiltApex},
+ {"bar", FutureApiLevel, false, false, []string{"bar"}, []string{"bar"}, nil, NotForPrebuiltApex},
},
wantMerged: []ApexInfo{
- {"apex10000_baz_1", FutureApiLevel, false, false, SdkRefs{{"baz", "1"}}, []string{"bar", "foo"}, []string{"bar", "foo"}, nil, false}},
+ {"apex10000", FutureApiLevel, false, false, []string{"bar", "foo"}, []string{"bar", "foo"}, nil, false}},
wantAliases: [][2]string{
- {"bar", "apex10000_baz_1"},
- {"foo", "apex10000_baz_1"},
+ {"bar", "apex10000"},
+ {"foo", "apex10000"},
},
},
{
name: "don't merge version",
in: []ApexInfo{
- {"foo", FutureApiLevel, false, false, nil, []string{"foo"}, []string{"foo"}, nil, NotForPrebuiltApex},
- {"bar", uncheckedFinalApiLevel(30), false, false, nil, []string{"bar"}, []string{"bar"}, nil, NotForPrebuiltApex},
+ {"foo", FutureApiLevel, false, false, []string{"foo"}, []string{"foo"}, nil, NotForPrebuiltApex},
+ {"bar", uncheckedFinalApiLevel(30), false, false, []string{"bar"}, []string{"bar"}, nil, NotForPrebuiltApex},
},
wantMerged: []ApexInfo{
- {"apex30", uncheckedFinalApiLevel(30), false, false, nil, []string{"bar"}, []string{"bar"}, nil, NotForPrebuiltApex},
- {"apex10000", FutureApiLevel, false, false, nil, []string{"foo"}, []string{"foo"}, nil, NotForPrebuiltApex},
+ {"apex30", uncheckedFinalApiLevel(30), false, false, []string{"bar"}, []string{"bar"}, nil, NotForPrebuiltApex},
+ {"apex10000", FutureApiLevel, false, false, []string{"foo"}, []string{"foo"}, nil, NotForPrebuiltApex},
},
wantAliases: [][2]string{
{"bar", "apex30"},
@@ -73,11 +73,11 @@
{
name: "merge updatable",
in: []ApexInfo{
- {"foo", FutureApiLevel, false, false, nil, []string{"foo"}, []string{"foo"}, nil, NotForPrebuiltApex},
- {"bar", FutureApiLevel, true, false, nil, []string{"bar"}, []string{"bar"}, nil, NotForPrebuiltApex},
+ {"foo", FutureApiLevel, false, false, []string{"foo"}, []string{"foo"}, nil, NotForPrebuiltApex},
+ {"bar", FutureApiLevel, true, false, []string{"bar"}, []string{"bar"}, nil, NotForPrebuiltApex},
},
wantMerged: []ApexInfo{
- {"apex10000", FutureApiLevel, true, false, nil, []string{"bar", "foo"}, []string{"bar", "foo"}, nil, NotForPrebuiltApex},
+ {"apex10000", FutureApiLevel, true, false, []string{"bar", "foo"}, []string{"bar", "foo"}, nil, NotForPrebuiltApex},
},
wantAliases: [][2]string{
{"bar", "apex10000"},
@@ -85,32 +85,17 @@
},
},
{
- name: "don't merge sdks",
- in: []ApexInfo{
- {"foo", FutureApiLevel, false, false, SdkRefs{{"baz", "1"}}, []string{"foo"}, []string{"foo"}, nil, NotForPrebuiltApex},
- {"bar", FutureApiLevel, false, false, SdkRefs{{"baz", "2"}}, []string{"bar"}, []string{"bar"}, nil, NotForPrebuiltApex},
- },
- wantMerged: []ApexInfo{
- {"apex10000_baz_2", FutureApiLevel, false, false, SdkRefs{{"baz", "2"}}, []string{"bar"}, []string{"bar"}, nil, NotForPrebuiltApex},
- {"apex10000_baz_1", FutureApiLevel, false, false, SdkRefs{{"baz", "1"}}, []string{"foo"}, []string{"foo"}, nil, NotForPrebuiltApex},
- },
- wantAliases: [][2]string{
- {"bar", "apex10000_baz_2"},
- {"foo", "apex10000_baz_1"},
- },
- },
- {
name: "don't merge when for prebuilt_apex",
in: []ApexInfo{
- {"foo", FutureApiLevel, false, false, nil, []string{"foo"}, []string{"foo"}, nil, NotForPrebuiltApex},
- {"bar", FutureApiLevel, true, false, nil, []string{"bar"}, []string{"bar"}, nil, NotForPrebuiltApex},
+ {"foo", FutureApiLevel, false, false, []string{"foo"}, []string{"foo"}, nil, NotForPrebuiltApex},
+ {"bar", FutureApiLevel, true, false, []string{"bar"}, []string{"bar"}, nil, NotForPrebuiltApex},
// This one should not be merged in with the others because it is for
// a prebuilt_apex.
- {"baz", FutureApiLevel, true, false, nil, []string{"baz"}, []string{"baz"}, nil, ForPrebuiltApex},
+ {"baz", FutureApiLevel, true, false, []string{"baz"}, []string{"baz"}, nil, ForPrebuiltApex},
},
wantMerged: []ApexInfo{
- {"apex10000", FutureApiLevel, true, false, nil, []string{"bar", "foo"}, []string{"bar", "foo"}, nil, NotForPrebuiltApex},
- {"baz", FutureApiLevel, true, false, nil, []string{"baz"}, []string{"baz"}, nil, ForPrebuiltApex},
+ {"apex10000", FutureApiLevel, true, false, []string{"bar", "foo"}, []string{"bar", "foo"}, nil, NotForPrebuiltApex},
+ {"baz", FutureApiLevel, true, false, []string{"baz"}, []string{"baz"}, nil, ForPrebuiltApex},
},
wantAliases: [][2]string{
{"bar", "apex10000"},
@@ -120,11 +105,11 @@
{
name: "merge different UsePlatformApis but don't allow using platform api",
in: []ApexInfo{
- {"foo", FutureApiLevel, false, false, nil, []string{"foo"}, []string{"foo"}, nil, NotForPrebuiltApex},
- {"bar", FutureApiLevel, false, true, nil, []string{"bar"}, []string{"bar"}, nil, NotForPrebuiltApex},
+ {"foo", FutureApiLevel, false, false, []string{"foo"}, []string{"foo"}, nil, NotForPrebuiltApex},
+ {"bar", FutureApiLevel, false, true, []string{"bar"}, []string{"bar"}, nil, NotForPrebuiltApex},
},
wantMerged: []ApexInfo{
- {"apex10000", FutureApiLevel, false, false, nil, []string{"bar", "foo"}, []string{"bar", "foo"}, nil, NotForPrebuiltApex},
+ {"apex10000", FutureApiLevel, false, false, []string{"bar", "foo"}, []string{"bar", "foo"}, nil, NotForPrebuiltApex},
},
wantAliases: [][2]string{
{"bar", "apex10000"},
@@ -134,11 +119,11 @@
{
name: "merge same UsePlatformApis and allow using platform api",
in: []ApexInfo{
- {"foo", FutureApiLevel, false, true, nil, []string{"foo"}, []string{"foo"}, nil, NotForPrebuiltApex},
- {"bar", FutureApiLevel, false, true, nil, []string{"bar"}, []string{"bar"}, nil, NotForPrebuiltApex},
+ {"foo", FutureApiLevel, false, true, []string{"foo"}, []string{"foo"}, nil, NotForPrebuiltApex},
+ {"bar", FutureApiLevel, false, true, []string{"bar"}, []string{"bar"}, nil, NotForPrebuiltApex},
},
wantMerged: []ApexInfo{
- {"apex10000", FutureApiLevel, false, true, nil, []string{"bar", "foo"}, []string{"bar", "foo"}, nil, NotForPrebuiltApex},
+ {"apex10000", FutureApiLevel, false, true, []string{"bar", "foo"}, []string{"bar", "foo"}, nil, NotForPrebuiltApex},
},
wantAliases: [][2]string{
{"bar", "apex10000"},
diff --git a/android/sdk.go b/android/sdk.go
index 1d63d7a..3a56240 100644
--- a/android/sdk.go
+++ b/android/sdk.go
@@ -23,24 +23,8 @@
"github.com/google/blueprint/proptools"
)
-// RequiredSdks provides access to the set of SDKs required by an APEX and its contents.
-//
-// Extracted from SdkAware to make it easier to define custom subsets of the
-// SdkAware interface and improve code navigation within the IDE.
-//
-// In addition to its use in SdkAware this interface must also be implemented by
-// APEX to specify the SDKs required by that module and its contents. e.g. APEX
-// is expected to implement RequiredSdks() by reading its own properties like
-// `uses_sdks`.
-type RequiredSdks interface {
- // RequiredSdks returns the set of SDKs required by an APEX and its contents.
- RequiredSdks() SdkRefs
-}
-
// sdkAwareWithoutModule is provided simply to improve code navigation with the IDE.
type sdkAwareWithoutModule interface {
- RequiredSdks
-
// SdkMemberComponentName will return the name to use for a component of this module based on the
// base name of this module.
//
@@ -81,7 +65,6 @@
ContainingSdk() SdkRef
MemberName() string
- BuildWithSdks(sdks SdkRefs)
}
// SdkAware is the interface that must be supported by any module to become a member of SDK or to be
@@ -150,9 +133,6 @@
// The SDK that this module is a member of. nil if it is not a member of any SDK
ContainingSdk *SdkRef `blueprint:"mutated"`
- // The list of SDK names and versions that are used to build this module
- RequiredSdks SdkRefs `blueprint:"mutated"`
-
// Name of the module that this sdk member is representing
Sdk_member_name *string
}
@@ -208,16 +188,6 @@
return proptools.String(s.properties.Sdk_member_name)
}
-// BuildWithSdks is used to mark that this module has to be built with the given SDK(s).
-func (s *SdkBase) BuildWithSdks(sdks SdkRefs) {
- s.properties.RequiredSdks = sdks
-}
-
-// RequiredSdks returns the SDK(s) that this module has to be built with
-func (s *SdkBase) RequiredSdks() SdkRefs {
- return s.properties.RequiredSdks
-}
-
// InitSdkAwareModule initializes the SdkBase struct. This must be called by all modules including
// SdkBase.
func InitSdkAwareModule(m SdkAware) {
diff --git a/apex/apex.go b/apex/apex.go
index c779868..73a3fc2 100644
--- a/apex/apex.go
+++ b/apex/apex.go
@@ -159,12 +159,6 @@
// or else conflicting build rules may be created.
Multi_install_skip_symbol_files *bool
- // List of SDKs that are used to build this APEX. A reference to an SDK should be either
- // `name#version` or `name` which is an alias for `name#current`. If left empty,
- // `platform#current` is implied. This value affects all modules included in this APEX. In
- // other words, they are also built with the SDKs specified here.
- Uses_sdks []string
-
// The type of APEX to build. Controls what the APEX payload is. Either 'image', 'zip' or
// 'both'. When set to image, contents are stored in a filesystem image inside a zip
// container. When set to zip, contents are stored in a zip container directly. This type is
@@ -791,19 +785,6 @@
commonVariation := ctx.Config().AndroidCommonTarget.Variations()
ctx.AddFarVariationDependencies(commonVariation, fsTag, a.properties.Filesystems...)
ctx.AddFarVariationDependencies(commonVariation, compatConfigTag, a.properties.Compat_configs...)
-
- // Marks that this APEX (in fact all the modules in it) has to be built with the given SDKs.
- // This field currently isn't used.
- // TODO(jiyong): consider dropping this feature
- // TODO(jiyong): ensure that all apexes are with non-empty uses_sdks
- if len(a.properties.Uses_sdks) > 0 {
- sdkRefs := []android.SdkRef{}
- for _, str := range a.properties.Uses_sdks {
- parsed := android.ParseSdkRef(ctx, str, "uses_sdks")
- sdkRefs = append(sdkRefs, parsed)
- }
- a.BuildWithSdks(sdkRefs)
- }
}
// DepsMutator for the overridden properties.
@@ -968,7 +949,6 @@
apexInfo := android.ApexInfo{
ApexVariationName: apexVariationName,
MinSdkVersion: minSdkVersion,
- RequiredSdks: a.RequiredSdks(),
Updatable: a.Updatable(),
UsePlatformApis: a.UsePlatformApis(),
InApexVariants: []string{apexVariationName},
diff --git a/cc/cc.go b/cc/cc.go
index c2d0f6e..31eae60 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -48,7 +48,6 @@
ctx.BottomUp("vndk", VndkMutator).Parallel()
ctx.BottomUp("link", LinkageMutator).Parallel()
ctx.BottomUp("test_per_src", TestPerSrcMutator).Parallel()
- ctx.BottomUp("version_selector", versionSelectorMutator).Parallel()
ctx.BottomUp("version", versionMutator).Parallel()
ctx.BottomUp("begin", BeginMutator).Parallel()
ctx.BottomUp("sysprop_cc", SyspropMutator).Parallel()
@@ -2117,7 +2116,7 @@
variations = append([]blueprint.Variation(nil), variations...)
- if version != "" && CanBeOrLinkAgainstVersionVariants(mod) {
+ if version != "" && canBeOrLinkAgainstVersionVariants(mod) {
// Version is explicitly specified. i.e. libFoo#30
variations = append(variations, blueprint.Variation{Mutator: "version", Variation: version})
if tag, ok := depTag.(libraryDependencyTag); ok {
diff --git a/cc/config/global.go b/cc/config/global.go
index dc6310c..3caf327 100644
--- a/cc/config/global.go
+++ b/cc/config/global.go
@@ -286,8 +286,8 @@
// prebuilts/clang default settings.
ClangDefaultBase = "prebuilts/clang/host"
- ClangDefaultVersion = "clang-r450784e"
- ClangDefaultShortVersion = "14.0.7"
+ ClangDefaultVersion = "clang-r450784d"
+ ClangDefaultShortVersion = "14.0.6"
// Directories with warnings from Android.bp files.
WarningAllowedProjects = []string{
diff --git a/cc/library.go b/cc/library.go
index 0abcb6f..fdbbccb 100644
--- a/cc/library.go
+++ b/cc/library.go
@@ -2344,7 +2344,7 @@
}
}
-func CanBeOrLinkAgainstVersionVariants(module interface {
+func canBeOrLinkAgainstVersionVariants(module interface {
Host() bool
InRamdisk() bool
InVendorRamdisk() bool
@@ -2352,15 +2352,14 @@
return !module.Host() && !module.InRamdisk() && !module.InVendorRamdisk()
}
-func CanBeVersionVariant(module interface {
+func canBeVersionVariant(module interface {
Host() bool
InRamdisk() bool
InVendorRamdisk() bool
- InRecovery() bool
CcLibraryInterface() bool
Shared() bool
}) bool {
- return CanBeOrLinkAgainstVersionVariants(module) &&
+ return canBeOrLinkAgainstVersionVariants(module) &&
module.CcLibraryInterface() && module.Shared()
}
@@ -2371,37 +2370,41 @@
return nil
}
-// versionSelector normalizes the versions in the Stubs.Versions property into MutatedProperties.AllStubsVersions.
-func versionSelectorMutator(mctx android.BottomUpMutatorContext) {
- if library := moduleLibraryInterface(mctx.Module()); library != nil && CanBeVersionVariant(mctx.Module().(*Module)) {
- if library.buildShared() {
- versions := library.stubsVersions(mctx)
- if len(versions) > 0 {
- normalizeVersions(mctx, versions)
- if mctx.Failed() {
- return
- }
- // Set the versions on the pre-mutated module so they can be read by any llndk modules that
- // depend on the implementation library and haven't been mutated yet.
- library.setAllStubsVersions(versions)
- }
- }
+// setStubsVersions normalizes the versions in the Stubs.Versions property into MutatedProperties.AllStubsVersions.
+func setStubsVersions(mctx android.BottomUpMutatorContext, library libraryInterface, module *Module) {
+ if !library.buildShared() || !canBeVersionVariant(module) {
+ return
}
+ versions := library.stubsVersions(mctx)
+ if len(versions) <= 0 {
+ return
+ }
+ normalizeVersions(mctx, versions)
+ if mctx.Failed() {
+ return
+ }
+ // Set the versions on the pre-mutated module so they can be read by any llndk modules that
+ // depend on the implementation library and haven't been mutated yet.
+ library.setAllStubsVersions(versions)
}
// 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 := moduleLibraryInterface(mctx.Module()); library != nil && CanBeVersionVariant(mctx.Module().(*Module)) {
+ if mctx.Os() != android.Android {
+ return
+ }
+
+ m, ok := mctx.Module().(*Module)
+ if library := moduleLibraryInterface(mctx.Module()); library != nil && canBeVersionVariant(m) {
+ setStubsVersions(mctx, library, m)
+
createVersionVariations(mctx, library.allStubsVersions())
return
}
- if m, ok := mctx.Module().(*Module); ok {
+ if ok {
if m.SplitPerApiLevel() && m.IsSdkVariant() {
- if mctx.Os() != android.Android {
- return
- }
createPerApiVersionVariations(mctx, m.MinSdkVersion())
}
}
diff --git a/java/kotlin.go b/java/kotlin.go
index eff5bb5..903c624 100644
--- a/java/kotlin.go
+++ b/java/kotlin.go
@@ -175,6 +175,7 @@
var deps android.Paths
deps = append(deps, flags.kotlincClasspath...)
+ deps = append(deps, flags.kotlincDeps...)
deps = append(deps, srcJars...)
deps = append(deps, flags.processorPath...)
deps = append(deps, commonSrcFiles...)
diff --git a/java/kotlin_test.go b/java/kotlin_test.go
index f9ff982..435d782 100644
--- a/java/kotlin_test.go
+++ b/java/kotlin_test.go
@@ -325,6 +325,7 @@
java_library {
name: "withcompose",
srcs: ["a.kt"],
+ plugins: ["plugin"],
static_libs: ["androidx.compose.runtime_runtime"],
}
@@ -332,6 +333,10 @@
name: "nocompose",
srcs: ["a.kt"],
}
+
+ java_plugin {
+ name: "plugin",
+ }
`)
buildOS := result.Config.BuildOS.String()
@@ -346,6 +351,9 @@
android.AssertStringDoesContain(t, "missing compose compiler plugin",
withCompose.VariablesForTestsRelativeToTop()["kotlincFlags"], "-Xplugin="+composeCompiler.String())
+ android.AssertStringListContains(t, "missing kapt compose compiler dependency",
+ withCompose.Rule("kapt").Implicits.Strings(), composeCompiler.String())
+
android.AssertStringListDoesNotContain(t, "unexpected compose compiler dependency",
noCompose.Rule("kotlinc").Implicits.Strings(), composeCompiler.String())
diff --git a/rust/bindgen.go b/rust/bindgen.go
index c2b0512..b4626a0 100644
--- a/rust/bindgen.go
+++ b/rust/bindgen.go
@@ -30,7 +30,7 @@
defaultBindgenFlags = []string{""}
// bindgen should specify its own Clang revision so updating Clang isn't potentially blocked on bindgen failures.
- bindgenClangVersion = "clang-r445002"
+ bindgenClangVersion = "clang-r450784d"
_ = pctx.VariableFunc("bindgenClangVersion", func(ctx android.PackageVarContext) string {
if override := ctx.Config().Getenv("LLVM_BINDGEN_PREBUILTS_VERSION"); override != "" {
diff --git a/rust/config/global.go b/rust/config/global.go
index 6bfa9cf..d11665c 100644
--- a/rust/config/global.go
+++ b/rust/config/global.go
@@ -50,6 +50,7 @@
"-C force-unwind-tables=yes",
// Use v0 mangling to distinguish from C++ symbols
"-C symbol-mangling-version=v0",
+ "--color always",
}
deviceGlobalRustFlags = []string{
diff --git a/sdk/cc_sdk_test.go b/sdk/cc_sdk_test.go
index cd63dac..571d214 100644
--- a/sdk/cc_sdk_test.go
+++ b/sdk/cc_sdk_test.go
@@ -193,114 +193,6 @@
`))
}
-func TestBasicSdkWithCc(t *testing.T) {
- result := testSdkWithCc(t, `
- sdk {
- name: "mysdk",
- native_shared_libs: ["sdkmember"],
- }
-
- cc_library_shared {
- name: "sdkmember",
- system_shared_libs: [],
- stl: "none",
- apex_available: ["mysdkapex"],
- }
-
- sdk_snapshot {
- name: "mysdk@1",
- native_shared_libs: ["sdkmember_mysdk@1"],
- }
-
- sdk_snapshot {
- name: "mysdk@2",
- native_shared_libs: ["sdkmember_mysdk@2"],
- }
-
- cc_prebuilt_library_shared {
- name: "sdkmember",
- srcs: ["libfoo.so"],
- prefer: false,
- system_shared_libs: [],
- stl: "none",
- }
-
- cc_prebuilt_library_shared {
- name: "sdkmember_mysdk@1",
- sdk_member_name: "sdkmember",
- srcs: ["libfoo.so"],
- system_shared_libs: [],
- stl: "none",
- // TODO: remove //apex_available:platform
- apex_available: [
- "//apex_available:platform",
- "myapex",
- ],
- }
-
- cc_prebuilt_library_shared {
- name: "sdkmember_mysdk@2",
- sdk_member_name: "sdkmember",
- srcs: ["libfoo.so"],
- system_shared_libs: [],
- stl: "none",
- // TODO: remove //apex_available:platform
- apex_available: [
- "//apex_available:platform",
- "myapex2",
- ],
- }
-
- cc_library_shared {
- name: "mycpplib",
- srcs: ["Test.cpp"],
- shared_libs: ["sdkmember"],
- system_shared_libs: [],
- stl: "none",
- apex_available: [
- "myapex",
- "myapex2",
- ],
- }
-
- apex {
- name: "myapex",
- native_shared_libs: ["mycpplib"],
- uses_sdks: ["mysdk@1"],
- key: "myapex.key",
- certificate: ":myapex.cert",
- updatable: false,
- }
-
- apex {
- name: "myapex2",
- native_shared_libs: ["mycpplib"],
- uses_sdks: ["mysdk@2"],
- key: "myapex.key",
- certificate: ":myapex.cert",
- updatable: false,
- }
-
- apex {
- name: "mysdkapex",
- native_shared_libs: ["sdkmember"],
- key: "myapex.key",
- certificate: ":myapex.cert",
- updatable: false,
- }
- `)
-
- sdkMemberV1 := result.ModuleForTests("sdkmember_mysdk@1", "android_arm64_armv8-a_shared_apex10000_mysdk_1").Rule("toc").Output
- sdkMemberV2 := result.ModuleForTests("sdkmember_mysdk@2", "android_arm64_armv8-a_shared_apex10000_mysdk_2").Rule("toc").Output
-
- cpplibForMyApex := result.ModuleForTests("mycpplib", "android_arm64_armv8-a_shared_apex10000_mysdk_1")
- cpplibForMyApex2 := result.ModuleForTests("mycpplib", "android_arm64_armv8-a_shared_apex10000_mysdk_2")
-
- // Depending on the uses_sdks value, different libs are linked
- ensureListContains(t, pathsToStrings(cpplibForMyApex.Rule("ld").Implicits), sdkMemberV1.String())
- ensureListContains(t, pathsToStrings(cpplibForMyApex2.Rule("ld").Implicits), sdkMemberV2.String())
-}
-
// Make sure the sdk can use host specific cc libraries static/shared and both.
func TestHostSdkWithCc(t *testing.T) {
testSdkWithCc(t, `
@@ -2835,11 +2727,6 @@
}
`)
- // Mixing the snapshot with the source (irrespective of which one is preferred) causes a problem
- // due to missing variants.
- // TODO(b/183204176): Remove this and fix the cause.
- snapshotWithSourceErrorHandler := android.FixtureExpectsAtLeastOneErrorMatchingPattern(`\QReplaceDependencies could not find identical variant {os:android,image:,arch:arm64_armv8-a,sdk:,link:shared,version:} for module mynativelib\E`)
-
CheckSnapshot(t, result, "mysdk", "",
checkUnversionedAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
@@ -2866,7 +2753,5 @@
arm64/include/Arm64Test.h -> arm64/include/arm64/include/Arm64Test.h
.intermediates/mynativelib/android_arm_armv7-a-neon_shared/mynativelib.so -> arm/lib/mynativelib.so
`),
- snapshotTestErrorHandler(checkSnapshotWithSourcePreferred, snapshotWithSourceErrorHandler),
- snapshotTestErrorHandler(checkSnapshotPreferredWithSource, snapshotWithSourceErrorHandler),
)
}
diff --git a/sdk/java_sdk_test.go b/sdk/java_sdk_test.go
index f0d3b35..a99fa1f 100644
--- a/sdk/java_sdk_test.go
+++ b/sdk/java_sdk_test.go
@@ -71,90 +71,6 @@
)
}
-func TestBasicSdkWithJavaLibrary(t *testing.T) {
- result := android.GroupFixturePreparers(
- prepareForSdkTestWithJava,
- prepareForSdkTestWithApex,
- ).RunTestWithBp(t, `
- sdk {
- name: "mysdk",
- java_header_libs: ["sdkmember"],
- }
-
- sdk_snapshot {
- name: "mysdk@1",
- java_header_libs: ["sdkmember_mysdk@1"],
- }
-
- sdk_snapshot {
- name: "mysdk@2",
- java_header_libs: ["sdkmember_mysdk@2"],
- }
-
- java_library {
- name: "sdkmember",
- srcs: ["Test.java"],
- system_modules: "none",
- sdk_version: "none",
- host_supported: true,
- }
-
- java_import {
- name: "sdkmember_mysdk@1",
- sdk_member_name: "sdkmember",
- host_supported: true,
- }
-
- java_import {
- name: "sdkmember_mysdk@2",
- sdk_member_name: "sdkmember",
- host_supported: true,
- }
-
- java_library {
- name: "myjavalib",
- srcs: ["Test.java"],
- libs: ["sdkmember"],
- system_modules: "none",
- sdk_version: "none",
- compile_dex: true,
- host_supported: true,
- apex_available: [
- "myapex",
- "myapex2",
- ],
- }
-
- apex {
- name: "myapex",
- java_libs: ["myjavalib"],
- uses_sdks: ["mysdk@1"],
- key: "myapex.key",
- certificate: ":myapex.cert",
- updatable: false,
- }
-
- apex {
- name: "myapex2",
- java_libs: ["myjavalib"],
- uses_sdks: ["mysdk@2"],
- key: "myapex.key",
- certificate: ":myapex.cert",
- updatable: false,
- }
- `)
-
- sdkMemberV1 := result.ModuleForTests("sdkmember_mysdk@1", "android_common").Rule("combineJar").Output
- sdkMemberV2 := result.ModuleForTests("sdkmember_mysdk@2", "android_common").Rule("combineJar").Output
-
- javalibForMyApex := result.ModuleForTests("myjavalib", "android_common_apex10000_mysdk_1")
- javalibForMyApex2 := result.ModuleForTests("myjavalib", "android_common_apex10000_mysdk_2")
-
- // Depending on the uses_sdks value, different libs are linked
- ensureListContains(t, pathsToStrings(javalibForMyApex.Rule("javac").Implicits), sdkMemberV1.String())
- ensureListContains(t, pathsToStrings(javalibForMyApex2.Rule("javac").Implicits), sdkMemberV2.String())
-}
-
func TestSnapshotWithJavaHeaderLibrary(t *testing.T) {
result := android.GroupFixturePreparers(
prepareForSdkTestWithJava,
diff --git a/sdk/sdk.go b/sdk/sdk.go
index 84c9a96..c8c7b79 100644
--- a/sdk/sdk.go
+++ b/sdk/sdk.go
@@ -39,7 +39,6 @@
ctx.RegisterModuleType("sdk", SdkModuleFactory)
ctx.RegisterModuleType("sdk_snapshot", SnapshotModuleFactory)
ctx.PreDepsMutators(RegisterPreDepsMutators)
- ctx.PostDepsMutators(RegisterPostDepsMutators)
}
type sdk struct {
@@ -278,20 +277,6 @@
ctx.BottomUp("SdkMemberInterVersion", memberInterVersionMutator).Parallel()
}
-// RegisterPostDepsMutators registers post-deps mutators to support modules implementing SdkAware
-// interface and the sdk module type. This function has been made public to be called by tests
-// outside of the sdk package
-func RegisterPostDepsMutators(ctx android.RegisterMutatorsContext) {
- // These must run AFTER apexMutator. Note that the apex package is imported even though there is
- // no direct dependency to the package here. sdkDepsMutator sets the SDK requirements from an
- // APEX to its dependents. Since different versions of the same SDK can be used by different
- // APEXes, the apex and its dependents (which includes the dependencies to the sdk members)
- // should have been mutated for the apex before the SDK requirements are set.
- ctx.TopDown("SdkDepsMutator", sdkDepsMutator).Parallel()
- ctx.BottomUp("SdkDepsReplaceMutator", sdkDepsReplaceMutator).Parallel()
- ctx.TopDown("SdkRequirementCheck", sdkRequirementsMutator).Parallel()
-}
-
type dependencyTag struct {
blueprint.BaseDependencyTag
}
@@ -413,103 +398,4 @@
type sdkAndApexModule interface {
android.Module
android.DepIsInSameApex
- android.RequiredSdks
-}
-
-// Step 4: transitively ripple down the SDK requirements from the root modules like APEX to its
-// descendants
-func sdkDepsMutator(mctx android.TopDownMutatorContext) {
- if parent, ok := mctx.Module().(sdkAndApexModule); ok {
- // Module types for Mainline modules (e.g. APEX) are expected to implement RequiredSdks()
- // by reading its own properties like `uses_sdks`.
- requiredSdks := parent.RequiredSdks()
- if len(requiredSdks) > 0 {
- mctx.VisitDirectDeps(func(m android.Module) {
- // Only propagate required sdks from the apex onto its contents.
- if dep, ok := m.(android.SdkAware); ok && android.IsDepInSameApex(mctx, parent, dep) {
- dep.BuildWithSdks(requiredSdks)
- }
- })
- }
- }
-}
-
-// Step 5: if libfoo.mysdk.11 is in the context where version 11 of mysdk is requested, the
-// versioned module is used instead of the un-versioned (in-development) module libfoo
-func sdkDepsReplaceMutator(mctx android.BottomUpMutatorContext) {
- if versionedSdkMember, ok := mctx.Module().(android.SdkAware); ok && versionedSdkMember.IsInAnySdk() && versionedSdkMember.IsVersioned() {
- if sdk := versionedSdkMember.ContainingSdk(); !sdk.Unversioned() {
- // Only replace dependencies to <sdkmember> with <sdkmember@required-version>
- // if the depending module requires it. e.g.
- // foo -> sdkmember
- // will be transformed to:
- // foo -> sdkmember@1
- // if and only if foo is a member of an APEX that requires version 1 of the
- // sdk containing sdkmember.
- memberName := versionedSdkMember.MemberName()
-
- // Convert a panic into a normal error to allow it to be more easily tested for. This is a
- // temporary workaround, once http://b/183204176 has been fixed this can be removed.
- // TODO(b/183204176): Remove this after fixing.
- defer func() {
- if r := recover(); r != nil {
- mctx.ModuleErrorf("sdkDepsReplaceMutator %s", r)
- }
- }()
-
- // Replace dependencies on sdkmember with a dependency on the current module which
- // is a versioned prebuilt of the sdkmember if required.
- mctx.ReplaceDependenciesIf(memberName, func(from blueprint.Module, tag blueprint.DependencyTag, to blueprint.Module) bool {
- // from - foo
- // to - sdkmember
- replace := false
- if parent, ok := from.(android.RequiredSdks); ok {
- replace = parent.RequiredSdks().Contains(sdk)
- }
- return replace
- })
- }
- }
-}
-
-// Step 6: ensure that the dependencies outside of the APEX are all from the required SDKs
-func sdkRequirementsMutator(mctx android.TopDownMutatorContext) {
- if m, ok := mctx.Module().(sdkAndApexModule); ok {
- requiredSdks := m.RequiredSdks()
- if len(requiredSdks) == 0 {
- return
- }
- mctx.VisitDirectDeps(func(dep android.Module) {
- tag := mctx.OtherModuleDependencyTag(dep)
- if tag == android.DefaultsDepTag {
- // dependency to defaults is always okay
- return
- }
-
- // Ignore the dependency from the unversioned member to any versioned members as an
- // apex that depends on the unversioned member will not also be depending on a versioned
- // member.
- if _, ok := tag.(sdkMemberVersionedDepTag); ok {
- return
- }
-
- // If the dep is outside of the APEX, but is not in any of the required SDKs, we know that the
- // dep is a violation.
- if sa, ok := dep.(android.SdkAware); ok {
- // It is not an error if a dependency that is excluded from the apex due to the tag is not
- // in one of the required SDKs. That is because all of the existing tags that implement it
- // do not depend on modules which can or should belong to an sdk_snapshot.
- if _, ok := tag.(android.ExcludeFromApexContentsTag); ok {
- // The tag defines a dependency that never requires the child module to be part of the
- // same apex.
- return
- }
-
- if !m.DepIsInSameApex(mctx, dep) && !requiredSdks.Contains(sa.ContainingSdk()) {
- mctx.ModuleErrorf("depends on %q (in SDK %q) that isn't part of the required SDKs: %v",
- sa.Name(), sa.ContainingSdk(), requiredSdks)
- }
- }
- })
- }
}
diff --git a/sdk/sdk_test.go b/sdk/sdk_test.go
index 83294f6..40de150 100644
--- a/sdk/sdk_test.go
+++ b/sdk/sdk_test.go
@@ -37,64 +37,6 @@
os.Exit(m.Run())
}
-func TestDepNotInRequiredSdks(t *testing.T) {
- testSdkError(t, `module "myjavalib".*depends on "otherlib".*that isn't part of the required SDKs:.*`, `
- sdk {
- name: "mysdk",
- java_header_libs: ["sdkmember"],
- }
-
- sdk_snapshot {
- name: "mysdk@1",
- java_header_libs: ["sdkmember_mysdk_1"],
- }
-
- java_import {
- name: "sdkmember",
- prefer: false,
- host_supported: true,
- }
-
- java_import {
- name: "sdkmember_mysdk_1",
- sdk_member_name: "sdkmember",
- host_supported: true,
- }
-
- java_library {
- name: "myjavalib",
- srcs: ["Test.java"],
- libs: [
- "sdkmember",
- "otherlib",
- ],
- system_modules: "none",
- sdk_version: "none",
- compile_dex: true,
- host_supported: true,
- apex_available: ["myapex"],
- }
-
- // this lib is no in mysdk
- java_library {
- name: "otherlib",
- srcs: ["Test.java"],
- system_modules: "none",
- sdk_version: "none",
- compile_dex: true,
- host_supported: true,
- }
-
- apex {
- name: "myapex",
- java_libs: ["myjavalib"],
- uses_sdks: ["mysdk@1"],
- key: "myapex.key",
- certificate: ":myapex.cert",
- }
- `)
-}
-
// Ensure that prebuilt modules have the same effective visibility as the source
// modules.
func TestSnapshotVisibility(t *testing.T) {