Merge changes I000b45dc,I8a0304fd into main
* changes:
Make `runDepmod` behave more like `build-image-kernel-modules`
Make `runDepmod` behave more like `build-image-kernel-modules`
diff --git a/android/apex.go b/android/apex.go
index e73b3e6..3486350 100644
--- a/android/apex.go
+++ b/android/apex.go
@@ -160,14 +160,6 @@
reflect.DeepEqual(i.InApexModules, otherApexInfo.InApexModules)
}
-// ApexTestForInfo stores the contents of APEXes for which this module is a test - although this
-// module is not part of the APEX - and thus has access to APEX internals.
-type ApexTestForInfo struct {
- ApexContents []*ApexContents
-}
-
-var ApexTestForInfoProvider = blueprint.NewMutatorProvider[ApexTestForInfo]("apex_test_for")
-
// ApexBundleInfo contains information about the dependencies of an apex
type ApexBundleInfo struct {
Contents *ApexContents
@@ -269,12 +261,6 @@
// check-platform-availability mutator in the apex package.
SetNotAvailableForPlatform()
- // Returns the list of APEXes that this module is a test for. The module has access to the
- // private part of the listed APEXes even when it is not included in the APEXes. This by
- // default returns nil. A module type should override the default implementation. For
- // example, cc_test module type returns the value of test_for here.
- TestFor() []string
-
// Returns nil (success) if this module should support the given sdk version. Returns an
// error if not. No default implementation is provided for this method. A module type
// implementing this interface should provide an implementation. A module supports an sdk
@@ -457,13 +443,6 @@
return false
}
-// Implements ApexModule
-func (m *ApexModuleBase) TestFor() []string {
- // If needed, this will be overridden by concrete types inheriting
- // ApexModuleBase
- return nil
-}
-
// Returns the test apexes that this module is included in.
func (m *ApexModuleBase) TestApexes() []string {
return m.ApexProperties.TestApexes
@@ -1062,12 +1041,6 @@
return apiLevel
}
-// Implemented by apexBundle.
-type ApexTestInterface interface {
- // Return true if the apex bundle is an apex_test
- IsTestApex() bool
-}
-
var ApexExportsInfoProvider = blueprint.NewProvider[ApexExportsInfo]()
// ApexExportsInfo contains information about the artifacts provided by apexes to dexpreopt and hiddenapi
diff --git a/android/config.go b/android/config.go
index 10bddf7..27d3b87 100644
--- a/android/config.go
+++ b/android/config.go
@@ -1834,10 +1834,6 @@
return Bool(c.productVariables.CompressedApex) && !c.UnbundledBuildApps()
}
-func (c *config) ApexTrimEnabled() bool {
- return Bool(c.productVariables.TrimmedApex)
-}
-
func (c *config) UseSoongSystemImage() bool {
return Bool(c.productVariables.UseSoongSystemImage)
}
diff --git a/android/testing.go b/android/testing.go
index 23aadda..f243e81 100644
--- a/android/testing.go
+++ b/android/testing.go
@@ -1132,11 +1132,6 @@
config.katiEnabled = true
}
-func SetTrimmedApexEnabledForTests(config Config) {
- config.productVariables.TrimmedApex = new(bool)
- *config.productVariables.TrimmedApex = true
-}
-
func AndroidMkEntriesForTest(t *testing.T, ctx *TestContext, mod blueprint.Module) []AndroidMkEntries {
t.Helper()
var p AndroidMkEntriesProvider
diff --git a/android/variable.go b/android/variable.go
index 037037d..6e4a4f7 100644
--- a/android/variable.go
+++ b/android/variable.go
@@ -408,7 +408,6 @@
Ndk_abis *bool `json:",omitempty"`
- TrimmedApex *bool `json:",omitempty"`
ForceApexSymlinkOptimization *bool `json:",omitempty"`
CompressedApex *bool `json:",omitempty"`
Aml_abis *bool `json:",omitempty"`
@@ -680,7 +679,6 @@
Malloc_zero_contents: boolPtr(true),
Malloc_pattern_fill_contents: boolPtr(false),
Safestack: boolPtr(false),
- TrimmedApex: boolPtr(false),
Build_from_text_stub: boolPtr(false),
BootJars: ConfiguredJarList{apexes: []string{}, jars: []string{}},
diff --git a/apex/apex.go b/apex/apex.go
index 587f63f..a1879f5 100644
--- a/apex/apex.go
+++ b/apex/apex.go
@@ -63,14 +63,11 @@
func RegisterPostDepsMutators(ctx android.RegisterMutatorsContext) {
ctx.TopDown("apex_info", apexInfoMutator)
ctx.BottomUp("apex_unique", apexUniqueVariationsMutator)
- ctx.BottomUp("apex_test_for_deps", apexTestForDepsMutator)
- ctx.BottomUp("apex_test_for", apexTestForMutator)
// Run mark_platform_availability before the apexMutator as the apexMutator needs to know whether
// it should create a platform variant.
ctx.BottomUp("mark_platform_availability", markPlatformAvailability)
ctx.Transition("apex", &apexTransitionMutator{})
ctx.BottomUp("apex_directly_in_any", apexDirectlyInAnyMutator).MutatesDependencies()
- ctx.BottomUp("apex_dcla_deps", apexDCLADepsMutator)
}
type apexBundleProperties struct {
@@ -734,7 +731,6 @@
androidAppTag = &dependencyTag{name: "androidApp", payload: true}
bpfTag = &dependencyTag{name: "bpf", payload: true}
certificateTag = &dependencyTag{name: "certificate"}
- dclaTag = &dependencyTag{name: "dcla"}
executableTag = &dependencyTag{name: "executable", payload: true}
fsTag = &dependencyTag{name: "filesystem", payload: true}
bcpfTag = &dependencyTag{name: "bootclasspathFragment", payload: true, sourceOnly: true, memberType: java.BootclasspathFragmentSdkMemberType}
@@ -747,7 +743,6 @@
prebuiltTag = &dependencyTag{name: "prebuilt", payload: true}
rroTag = &dependencyTag{name: "rro", payload: true}
sharedLibTag = &dependencyTag{name: "sharedLib", payload: true}
- testForTag = &dependencyTag{name: "test for"}
testTag = &dependencyTag{name: "test", payload: true}
shBinaryTag = &dependencyTag{name: "shBinary", payload: true}
)
@@ -952,33 +947,6 @@
}
}
-func apexDCLADepsMutator(mctx android.BottomUpMutatorContext) {
- if !mctx.Config().ApexTrimEnabled() {
- return
- }
- if a, ok := mctx.Module().(*apexBundle); ok && a.overridableProperties.Trim_against != nil {
- commonVariation := mctx.Config().AndroidCommonTarget.Variations()
- mctx.AddFarVariationDependencies(commonVariation, dclaTag, String(a.overridableProperties.Trim_against))
- } else if o, ok := mctx.Module().(*OverrideApex); ok {
- for _, p := range o.GetProperties() {
- properties, ok := p.(*overridableProperties)
- if !ok {
- continue
- }
- if properties.Trim_against != nil {
- commonVariation := mctx.Config().AndroidCommonTarget.Variations()
- mctx.AddFarVariationDependencies(commonVariation, dclaTag, String(properties.Trim_against))
- }
- }
- }
-}
-
-type DCLAInfo struct {
- ProvidedLibs []string
-}
-
-var DCLAInfoProvider = blueprint.NewMutatorProvider[DCLAInfo]("apex_info")
-
var _ ApexInfoMutator = (*apexBundle)(nil)
func (a *apexBundle) ApexVariationName() string {
@@ -1087,12 +1055,6 @@
child.(android.ApexModule).BuildForApex(apexInfo) // leave a mark!
return true
})
-
- if a.dynamic_common_lib_apex() {
- android.SetProvider(mctx, DCLAInfoProvider, DCLAInfo{
- ProvidedLibs: a.properties.Native_shared_libs.GetOrDefault(mctx, nil),
- })
- }
}
type ApexInfoMutator interface {
@@ -1185,40 +1147,6 @@
}
}
-// apexTestForDepsMutator checks if this module is a test for an apex. If so, add a dependency on
-// the apex in order to retrieve its contents later.
-// TODO(jiyong): move this to android/apex.go?
-func apexTestForDepsMutator(mctx android.BottomUpMutatorContext) {
- if !mctx.Module().Enabled(mctx) {
- return
- }
- if am, ok := mctx.Module().(android.ApexModule); ok {
- if testFor := am.TestFor(); len(testFor) > 0 {
- mctx.AddFarVariationDependencies([]blueprint.Variation{
- {Mutator: "os", Variation: am.Target().OsVariation()},
- {"arch", "common"},
- }, testForTag, testFor...)
- }
- }
-}
-
-// TODO(jiyong): move this to android/apex.go?
-func apexTestForMutator(mctx android.BottomUpMutatorContext) {
- if !mctx.Module().Enabled(mctx) {
- return
- }
- if _, ok := mctx.Module().(android.ApexModule); ok {
- var contents []*android.ApexContents
- for _, testFor := range mctx.GetDirectDepsWithTag(testForTag) {
- abInfo, _ := android.OtherModuleProvider(mctx, testFor, android.ApexBundleInfoProvider)
- contents = append(contents, abInfo.Contents)
- }
- android.SetProvider(mctx, android.ApexTestForInfoProvider, android.ApexTestForInfo{
- ApexContents: contents,
- })
- }
-}
-
// markPlatformAvailability marks whether or not a module can be available to platform. A module
// cannot be available to platform if 1) it is explicitly marked as not available (i.e.
// "//apex_available:platform" is absent) or 2) it depends on another module that isn't (or can't
@@ -1442,19 +1370,6 @@
return proptools.BoolDefault(a.properties.Dynamic_common_lib_apex, false)
}
-// See the list of libs to trim
-func (a *apexBundle) libs_to_trim(ctx android.ModuleContext) []string {
- dclaModules := ctx.GetDirectDepsWithTag(dclaTag)
- if len(dclaModules) > 1 {
- panic(fmt.Errorf("expected exactly at most one dcla dependency, got %d", len(dclaModules)))
- }
- if len(dclaModules) > 0 {
- DCLAInfo, _ := android.OtherModuleProvider(ctx, dclaModules[0], DCLAInfoProvider)
- return DCLAInfo.ProvidedLibs
- }
- return []string{}
-}
-
// These functions are interfacing with cc/sanitizer.go. The entire APEX (along with all of its
// members) can be sanitized, either forcibly, or by the global configuration. For some of the
// sanitizers, extra dependencies can be forcibly added as well.
@@ -2941,10 +2856,6 @@
}
}
-func (a *apexBundle) IsTestApex() bool {
- return a.testApex
-}
-
// verifyNativeImplementationLibs compares the list of transitive implementation libraries used to link native
// libraries in the apex against the list of implementation libraries in the apex, ensuring that none of the
// libraries in the apex have references to private APIs from outside the apex.
diff --git a/apex/apex_test.go b/apex/apex_test.go
index 4e6aa13..8c17afe 100644
--- a/apex/apex_test.go
+++ b/apex/apex_test.go
@@ -10053,61 +10053,6 @@
RunTestWithBp(t, bp)
}
-func TestTrimmedApex(t *testing.T) {
- t.Parallel()
- bp := `
- apex {
- name: "myapex",
- key: "myapex.key",
- native_shared_libs: ["libfoo","libbaz"],
- min_sdk_version: "29",
- trim_against: "mydcla",
- }
- apex {
- name: "mydcla",
- key: "myapex.key",
- native_shared_libs: ["libfoo","libbar"],
- min_sdk_version: "29",
- file_contexts: ":myapex-file_contexts",
- dynamic_common_lib_apex: true,
- }
- apex_key {
- name: "myapex.key",
- }
- cc_library {
- name: "libfoo",
- shared_libs: ["libc"],
- apex_available: ["myapex","mydcla"],
- min_sdk_version: "29",
- }
- cc_library {
- name: "libbar",
- shared_libs: ["libc"],
- apex_available: ["myapex","mydcla"],
- min_sdk_version: "29",
- }
- cc_library {
- name: "libbaz",
- shared_libs: ["libc"],
- apex_available: ["myapex","mydcla"],
- min_sdk_version: "29",
- }
- `
- ctx := testApex(t, bp)
- module := ctx.ModuleForTests("myapex", "android_common_myapex")
- apexRule := module.MaybeRule("apexRule")
- if apexRule.Rule == nil {
- t.Errorf("Expecting regular apex rule but a non regular apex rule found")
- }
-
- ctx = testApex(t, bp, android.FixtureModifyConfig(android.SetTrimmedApexEnabledForTests))
- trimmedApexRule := ctx.ModuleForTests("myapex", "android_common_myapex").Rule("TrimmedApexRule")
- libs_to_trim := trimmedApexRule.Args["libs_to_trim"]
- android.AssertStringDoesContain(t, "missing lib to trim", libs_to_trim, "libfoo")
- android.AssertStringDoesContain(t, "missing lib to trim", libs_to_trim, "libbar")
- android.AssertStringDoesNotContain(t, "unexpected libs in the libs to trim", libs_to_trim, "libbaz")
-}
-
func TestCannedFsConfig(t *testing.T) {
t.Parallel()
ctx := testApex(t, `
diff --git a/apex/builder.go b/apex/builder.go
index 20b4dbe..305d509 100644
--- a/apex/builder.go
+++ b/apex/builder.go
@@ -43,7 +43,6 @@
pctx.Import("android/soong/java")
pctx.HostBinToolVariable("apexer", "apexer")
pctx.HostBinToolVariable("apexer_with_DCLA_preprocessing", "apexer_with_DCLA_preprocessing")
- pctx.HostBinToolVariable("apexer_with_trim_preprocessing", "apexer_with_trim_preprocessing")
// ART minimal builds (using the master-art manifest) do not have the "frameworks/base"
// projects, and hence cannot build 'aapt2'. Use the SDK prebuilt instead.
@@ -173,34 +172,6 @@
}, "tool_path", "image_dir", "copy_commands", "file_contexts", "canned_fs_config", "key",
"opt_flags", "manifest", "is_DCLA")
- TrimmedApexRule = pctx.StaticRule("TrimmedApexRule", blueprint.RuleParams{
- Command: `rm -rf ${image_dir} && mkdir -p ${image_dir} && ` +
- `(. ${out}.copy_commands) && ` +
- `APEXER_TOOL_PATH=${tool_path} ` +
- `${apexer_with_trim_preprocessing} ` +
- `--apexer ${apexer} ` +
- `--canned_fs_config ${canned_fs_config} ` +
- `--manifest ${manifest} ` +
- `--libs_to_trim ${libs_to_trim} ` +
- `${image_dir} ` +
- `${out} ` +
- `-- ` +
- `--include_build_info ` +
- `--force ` +
- `--payload_type image ` +
- `--key ${key} ` +
- `--file_contexts ${file_contexts} ` +
- `${opt_flags} `,
- CommandDeps: []string{"${apexer_with_trim_preprocessing}", "${apexer}", "${avbtool}", "${e2fsdroid}",
- "${merge_zips}", "${mke2fs}", "${resize2fs}", "${sefcontext_compile}", "${make_f2fs}",
- "${sload_f2fs}", "${make_erofs}", "${soong_zip}", "${zipalign}", "${aapt2}",
- "prebuilts/sdk/current/public/android.jar"},
- Rspfile: "${out}.copy_commands",
- RspfileContent: "${copy_commands}",
- Description: "APEX ${image_dir} => ${out}",
- }, "tool_path", "image_dir", "copy_commands", "file_contexts", "canned_fs_config", "key",
- "opt_flags", "manifest", "libs_to_trim")
-
apexProtoConvertRule = pctx.AndroidStaticRule("apexProtoConvertRule",
blueprint.RuleParams{
Command: `${aapt2} convert --output-format proto $in -o $out`,
@@ -831,24 +802,6 @@
"opt_flags": strings.Join(optFlags, " "),
},
})
- } else if ctx.Config().ApexTrimEnabled() && len(a.libs_to_trim(ctx)) > 0 {
- ctx.Build(pctx, android.BuildParams{
- Rule: TrimmedApexRule,
- Implicits: implicitInputs,
- Output: unsignedOutputFile,
- Description: "apex",
- Args: map[string]string{
- "tool_path": outHostBinDir + ":" + prebuiltSdkToolsBinDir,
- "image_dir": imageDir.String(),
- "copy_commands": strings.Join(copyCommands, " && "),
- "manifest": a.manifestPbOut.String(),
- "file_contexts": fileContexts.String(),
- "canned_fs_config": cannedFsConfig.String(),
- "key": a.privateKeyFile.String(),
- "opt_flags": strings.Join(optFlags, " "),
- "libs_to_trim": strings.Join(a.libs_to_trim(ctx), ","),
- },
- })
} else {
ctx.Build(pctx, android.BuildParams{
Rule: apexRule,
diff --git a/cc/cc.go b/cc/cc.go
index 45b201c..60cf011 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -410,11 +410,6 @@
// variant to have a ".sdk" suffix.
SdkAndPlatformVariantVisibleToMake bool `blueprint:"mutated"`
- // List of APEXes that this module has private access to for testing purpose. The module
- // can depend on libraries that are not exported by the APEXes and use private symbols
- // from the exported libraries.
- Test_for []string `android:"arch_variant"`
-
Target struct {
Platform struct {
// List of modules required by the core variant.
@@ -965,7 +960,6 @@
"IsLlndk": c.IsLlndk(),
"IsVendorPublicLibrary": c.IsVendorPublicLibrary(),
"ApexSdkVersion": c.apexSdkVersion,
- "TestFor": c.TestFor(),
"AidlSrcs": c.hasAidl,
"LexSrcs": c.hasLex,
"ProtoSrcs": c.hasProto,
@@ -3690,10 +3684,6 @@
}
}
-func (c *Module) TestFor() []string {
- return c.Properties.Test_for
-}
-
func (c *Module) EverInstallable() bool {
return c.installer != nil &&
// Check to see whether the module is actually ever installable.
diff --git a/cmd/find_input_delta/find_input_delta/Android.bp b/cmd/find_input_delta/find_input_delta/Android.bp
index 6b2dbc7..93a7708 100644
--- a/cmd/find_input_delta/find_input_delta/Android.bp
+++ b/cmd/find_input_delta/find_input_delta/Android.bp
@@ -2,15 +2,15 @@
default_applicable_licenses: ["Android-Apache-2.0"],
}
-bootstrap_go_package {
- name: "soong-cmd-find_input_delta-find_input_delta",
- pkgPath: "android/soong/cmd/find_input_delta/find_input_delta",
+blueprint_go_binary {
+ name: "find_input_delta",
deps: [
"golang-protobuf-encoding-prototext",
"golang-protobuf-reflect-protoreflect",
"golang-protobuf-runtime-protoimpl",
- "soong-cmd-find_input_delta-proto",
"soong-cmd-find_input_delta-lib",
+ "soong-cmd-find_input_delta-proto",
+ "soong-cmd-find_input_delta-proto_internal",
],
srcs: [
"main.go",
diff --git a/cmd/find_input_delta/find_input_delta_lib/Android.bp b/cmd/find_input_delta/find_input_delta_lib/Android.bp
index 795b140..95bdba8 100644
--- a/cmd/find_input_delta/find_input_delta_lib/Android.bp
+++ b/cmd/find_input_delta/find_input_delta_lib/Android.bp
@@ -24,6 +24,7 @@
"golang-protobuf-reflect-protoreflect",
"golang-protobuf-runtime-protoimpl",
"soong-cmd-find_input_delta-proto",
+ "soong-cmd-find_input_delta-proto_internal",
"blueprint-pathtools",
],
srcs: [
diff --git a/cmd/find_input_delta/find_input_delta_proto/Android.bp b/cmd/find_input_delta/find_input_delta_proto/Android.bp
index 18eba6b..1a05b9e 100644
--- a/cmd/find_input_delta/find_input_delta_proto/Android.bp
+++ b/cmd/find_input_delta/find_input_delta_proto/Android.bp
@@ -24,6 +24,6 @@
"golang-protobuf-runtime-protoimpl",
],
srcs: [
- "target_delta_files.pb.go",
+ "file_list.pb.go",
],
}