Ignore some properties for T and above.

As requested by reminv@, their team wants the source code in
sc-mainline-prod to be strictly the same as the code in AOSP. Therefore,
we need to ignore `standalone_contents` in the
`systemserverclasspath_fragment` module and
`systemserverclasspath_fragments` in the `sdk` module in order to merge
aosp/1925682 into sc-mainline-prod.

- `standalone_contents` in the `systemserverclasspath_fragment` module
  does nothing but adds its contents as dependencies of the APEX.
- `systemserverclasspath_fragments` in the `sdk` module does nothing.

Bug: 203198541
Test: TARGET_BUILD_APPS=com.android.tethering vendor/google/build/mainline_modules_bundles.sh
Change-Id: I56ca22aa91a807cd113dfda2fabaeb49ecabe289
Merged-In: I09a6fd1d3db85c194330da9b751702a9bf069e26
This commit is contained in:
Jiakai Zhang
2022-01-19 19:37:39 +00:00
parent 6320efb56e
commit 9d92964ddd
4 changed files with 36 additions and 6 deletions

View File

@@ -72,10 +72,15 @@ func (s *SystemServerClasspathModule) ShouldSupportSdkVersion(ctx android.BaseMo
}
type systemServerClasspathFragmentProperties struct {
// The contents of this systemserverclasspath_fragment, could be either java_library, or java_sdk_library.
// List of system_server classpath jars, could be either java_library, or java_sdk_library.
//
// The order of this list matters as it is the order that is used in the SYSTEMSERVERCLASSPATH.
Contents []string
// List of jars that system_server loads dynamically using separate classloaders.
//
// The order does not matter.
Standalone_contents []string
}
func systemServerClasspathFactory() android.Module {
@@ -88,8 +93,12 @@ func systemServerClasspathFactory() android.Module {
}
func (s *SystemServerClasspathModule) GenerateAndroidBuildActions(ctx android.ModuleContext) {
if len(s.properties.Contents) == 0 {
ctx.PropertyErrorf("contents", "empty contents are not allowed")
if len(s.properties.Contents) == 0 && len(s.properties.Standalone_contents) == 0 {
ctx.PropertyErrorf("contents", "Either contents or standalone_contents needs to be non-empty")
}
if s.ShouldIgnore() {
return
}
configuredJars := s.configuredJars(ctx)
@@ -128,8 +137,17 @@ func IsSystemServerClasspathFragmentContentDepTag(tag blueprint.DependencyTag) b
func (s *SystemServerClasspathModule) ComponentDepsMutator(ctx android.BottomUpMutatorContext) {
module := ctx.Module()
var deps []string
deps = append(deps, s.properties.Contents...)
deps = append(deps, s.properties.Standalone_contents...)
for _, name := range s.properties.Contents {
for _, name := range deps {
ctx.AddDependency(module, systemServerClasspathFragmentContentDepTag, name)
}
}
func (s *SystemServerClasspathModule) ShouldIgnore() bool {
// Ignore this `systemserverclasspath_fragment` if it only contains `standalone_contents` because
// it is for T and above.
return len(s.properties.Contents) == 0
}