Merge "bp2build: convert apex.logging_parent."
This commit is contained in:
commit
c90a3cd6f6
2 changed files with 86 additions and 3 deletions
12
apex/apex.go
12
apex/apex.go
|
@ -2548,6 +2548,11 @@ func (o *OverrideApex) ConvertWithBp2build(ctx android.TopDownMutatorContext) {
|
|||
if overridableProperties.Package_name != "" {
|
||||
attrs.Package_name = &overridableProperties.Package_name
|
||||
}
|
||||
|
||||
// Logging parent
|
||||
if overridableProperties.Logging_parent != "" {
|
||||
attrs.Logging_parent = &overridableProperties.Logging_parent
|
||||
}
|
||||
}
|
||||
|
||||
ctx.CreateBazelTargetModule(props, android.CommonAttributes{Name: o.Name()}, &attrs)
|
||||
|
@ -3490,6 +3495,7 @@ type bazelApexBundleAttributes struct {
|
|||
Native_shared_libs_64 bazel.LabelListAttribute
|
||||
Compressible bazel.BoolAttribute
|
||||
Package_name *string
|
||||
Logging_parent *string
|
||||
}
|
||||
|
||||
type convertedNativeSharedLibs struct {
|
||||
|
@ -3589,6 +3595,11 @@ func convertWithBp2build(a *apexBundle, ctx android.TopDownMutatorContext) (baze
|
|||
packageName = &a.overridableProperties.Package_name
|
||||
}
|
||||
|
||||
var loggingParent *string
|
||||
if a.overridableProperties.Logging_parent != "" {
|
||||
loggingParent = &a.overridableProperties.Logging_parent
|
||||
}
|
||||
|
||||
attrs := bazelApexBundleAttributes{
|
||||
Manifest: manifestLabelAttribute,
|
||||
Android_manifest: androidManifestLabelAttribute,
|
||||
|
@ -3604,6 +3615,7 @@ func convertWithBp2build(a *apexBundle, ctx android.TopDownMutatorContext) (baze
|
|||
Prebuilts: prebuiltsLabelListAttribute,
|
||||
Compressible: compressibleAttribute,
|
||||
Package_name: packageName,
|
||||
Logging_parent: loggingParent,
|
||||
}
|
||||
|
||||
props := bazel.BazelTargetModuleProperties{
|
||||
|
|
|
@ -137,6 +137,7 @@ apex {
|
|||
"prebuilt_2",
|
||||
],
|
||||
package_name: "com.android.apogee.test.package",
|
||||
logging_parent: "logging.parent",
|
||||
}
|
||||
`,
|
||||
expectedBazelTargets: []string{
|
||||
|
@ -174,6 +175,7 @@ apex {
|
|||
"updatable": "False",
|
||||
"compressible": "False",
|
||||
"package_name": `"com.android.apogee.test.package"`,
|
||||
"logging_parent": `"logging.parent"`,
|
||||
}),
|
||||
}})
|
||||
}
|
||||
|
@ -945,3 +947,72 @@ override_apex {
|
|||
}),
|
||||
}})
|
||||
}
|
||||
|
||||
func TestApexBundleSimple_NoLoggingParentOverride(t *testing.T) {
|
||||
runOverrideApexTestCase(t, bp2buildTestCase{
|
||||
description: "override_apex - logging_parent - no override",
|
||||
moduleTypeUnderTest: "override_apex",
|
||||
moduleTypeUnderTestFactory: apex.OverrideApexFactory,
|
||||
filesystem: map[string]string{
|
||||
"system/sepolicy/apex/Android.bp": `
|
||||
filegroup {
|
||||
name: "com.android.apogee-file_contexts",
|
||||
srcs: [ "apogee-file_contexts", ],
|
||||
bazel_module: { bp2build_available: false },
|
||||
}`,
|
||||
},
|
||||
blueprint: `
|
||||
apex {
|
||||
name: "com.android.apogee",
|
||||
bazel_module: { bp2build_available: false },
|
||||
logging_parent: "foo.bar.baz",
|
||||
}
|
||||
|
||||
override_apex {
|
||||
name: "com.google.android.apogee",
|
||||
base: ":com.android.apogee",
|
||||
}
|
||||
`,
|
||||
expectedBazelTargets: []string{
|
||||
makeBazelTarget("apex", "com.google.android.apogee", attrNameToString{
|
||||
"file_contexts": `"//system/sepolicy/apex:com.android.apogee-file_contexts"`,
|
||||
"manifest": `"apex_manifest.json"`,
|
||||
"logging_parent": `"foo.bar.baz"`,
|
||||
}),
|
||||
}})
|
||||
}
|
||||
|
||||
func TestApexBundleSimple_LoggingParentOverride(t *testing.T) {
|
||||
runOverrideApexTestCase(t, bp2buildTestCase{
|
||||
description: "override_apex - logging_parent - override",
|
||||
moduleTypeUnderTest: "override_apex",
|
||||
moduleTypeUnderTestFactory: apex.OverrideApexFactory,
|
||||
filesystem: map[string]string{
|
||||
"system/sepolicy/apex/Android.bp": `
|
||||
filegroup {
|
||||
name: "com.android.apogee-file_contexts",
|
||||
srcs: [ "apogee-file_contexts", ],
|
||||
bazel_module: { bp2build_available: false },
|
||||
}`,
|
||||
},
|
||||
blueprint: `
|
||||
apex {
|
||||
name: "com.android.apogee",
|
||||
bazel_module: { bp2build_available: false },
|
||||
logging_parent: "foo.bar.baz",
|
||||
}
|
||||
|
||||
override_apex {
|
||||
name: "com.google.android.apogee",
|
||||
base: ":com.android.apogee",
|
||||
logging_parent: "foo.bar.baz.override",
|
||||
}
|
||||
`,
|
||||
expectedBazelTargets: []string{
|
||||
makeBazelTarget("apex", "com.google.android.apogee", attrNameToString{
|
||||
"file_contexts": `"//system/sepolicy/apex:com.android.apogee-file_contexts"`,
|
||||
"manifest": `"apex_manifest.json"`,
|
||||
"logging_parent": `"foo.bar.baz.override"`,
|
||||
}),
|
||||
}})
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue