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:
@@ -2348,6 +2348,12 @@ func (a *apexBundle) checkUpdatable(ctx android.ModuleContext) {
|
|||||||
func (a *apexBundle) checkClasspathFragments(ctx android.ModuleContext) {
|
func (a *apexBundle) checkClasspathFragments(ctx android.ModuleContext) {
|
||||||
ctx.VisitDirectDeps(func(module android.Module) {
|
ctx.VisitDirectDeps(func(module android.Module) {
|
||||||
if tag := ctx.OtherModuleDependencyTag(module); tag == bcpfTag || tag == sscpfTag {
|
if tag := ctx.OtherModuleDependencyTag(module); tag == bcpfTag || tag == sscpfTag {
|
||||||
|
if tag == sscpfTag {
|
||||||
|
sscpf := module.(*java.SystemServerClasspathModule)
|
||||||
|
if sscpf.ShouldIgnore() {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
info := ctx.OtherModuleProvider(module, java.ClasspathFragmentProtoContentInfoProvider).(java.ClasspathFragmentProtoContentInfo)
|
info := ctx.OtherModuleProvider(module, java.ClasspathFragmentProtoContentInfoProvider).(java.ClasspathFragmentProtoContentInfo)
|
||||||
if !info.ClasspathFragmentProtoGenerated {
|
if !info.ClasspathFragmentProtoGenerated {
|
||||||
ctx.OtherModuleErrorf(module, "is included in updatable apex %v, it must not set generate_classpaths_proto to false", ctx.ModuleName())
|
ctx.OtherModuleErrorf(module, "is included in updatable apex %v, it must not set generate_classpaths_proto to false", ctx.ModuleName())
|
||||||
|
@@ -72,10 +72,15 @@ func (s *SystemServerClasspathModule) ShouldSupportSdkVersion(ctx android.BaseMo
|
|||||||
}
|
}
|
||||||
|
|
||||||
type systemServerClasspathFragmentProperties struct {
|
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.
|
// The order of this list matters as it is the order that is used in the SYSTEMSERVERCLASSPATH.
|
||||||
Contents []string
|
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 {
|
func systemServerClasspathFactory() android.Module {
|
||||||
@@ -88,8 +93,12 @@ func systemServerClasspathFactory() android.Module {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *SystemServerClasspathModule) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
func (s *SystemServerClasspathModule) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
||||||
if len(s.properties.Contents) == 0 {
|
if len(s.properties.Contents) == 0 && len(s.properties.Standalone_contents) == 0 {
|
||||||
ctx.PropertyErrorf("contents", "empty contents are not allowed")
|
ctx.PropertyErrorf("contents", "Either contents or standalone_contents needs to be non-empty")
|
||||||
|
}
|
||||||
|
|
||||||
|
if s.ShouldIgnore() {
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
configuredJars := s.configuredJars(ctx)
|
configuredJars := s.configuredJars(ctx)
|
||||||
@@ -128,8 +137,17 @@ func IsSystemServerClasspathFragmentContentDepTag(tag blueprint.DependencyTag) b
|
|||||||
|
|
||||||
func (s *SystemServerClasspathModule) ComponentDepsMutator(ctx android.BottomUpMutatorContext) {
|
func (s *SystemServerClasspathModule) ComponentDepsMutator(ctx android.BottomUpMutatorContext) {
|
||||||
module := ctx.Module()
|
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)
|
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
|
||||||
|
}
|
||||||
|
@@ -99,7 +99,7 @@ func TestPlatformSystemServerClasspathModule_AndroidMkEntries(t *testing.T) {
|
|||||||
func TestSystemServerClasspathFragmentWithoutContents(t *testing.T) {
|
func TestSystemServerClasspathFragmentWithoutContents(t *testing.T) {
|
||||||
prepareForTestWithSystemServerClasspath.
|
prepareForTestWithSystemServerClasspath.
|
||||||
ExtendWithErrorHandler(android.FixtureExpectsAtLeastOneErrorMatchingPattern(
|
ExtendWithErrorHandler(android.FixtureExpectsAtLeastOneErrorMatchingPattern(
|
||||||
`\Qempty contents are not allowed\E`)).
|
`\QEither contents or standalone_contents needs to be non-empty\E`)).
|
||||||
RunTestWithBp(t, `
|
RunTestWithBp(t, `
|
||||||
systemserverclasspath_fragment {
|
systemserverclasspath_fragment {
|
||||||
name: "systemserverclasspath-fragment",
|
name: "systemserverclasspath-fragment",
|
||||||
|
@@ -257,7 +257,13 @@ func newSdkModule(moduleExports bool) *sdk {
|
|||||||
// Create an instance of the dynamically created struct that contains all the
|
// Create an instance of the dynamically created struct that contains all the
|
||||||
// properties for the member type specific list properties.
|
// properties for the member type specific list properties.
|
||||||
s.dynamicMemberTypeListProperties = s.dynamicSdkMemberTypes.createMemberListProperties()
|
s.dynamicMemberTypeListProperties = s.dynamicSdkMemberTypes.createMemberListProperties()
|
||||||
s.AddProperties(&s.properties, s.dynamicMemberTypeListProperties)
|
|
||||||
|
ignoredProperties := struct {
|
||||||
|
// `systemserverclasspath_fragments` is for T and above.
|
||||||
|
Systemserverclasspath_fragments []string
|
||||||
|
}{}
|
||||||
|
|
||||||
|
s.AddProperties(&s.properties, s.dynamicMemberTypeListProperties, &ignoredProperties)
|
||||||
|
|
||||||
// Make sure that the prebuilt visibility property is verified for errors.
|
// Make sure that the prebuilt visibility property is verified for errors.
|
||||||
android.AddVisibilityProperty(s, "prebuilt_visibility", &s.properties.Prebuilt_visibility)
|
android.AddVisibilityProperty(s, "prebuilt_visibility", &s.properties.Prebuilt_visibility)
|
||||||
|
Reference in New Issue
Block a user