Dedup generating xml file for java_sdk_library
Permission XML file for java_sdk_library is generated by
java_sdk_library itself now.
And, build rule is switched to android.WriteFile since "echo -e" is
not supported from build server. (-e is printed to output)
Bug: 145474221
Test: m com.android.cronet and check its permissions xml file
also, m org.chromium.net.cronet.xml (created dynamically)
Change-Id: Iffb119151c49bc4fe6c4386fa267cca193f37dbc
This commit is contained in:
@@ -1024,12 +1024,12 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
||||
}
|
||||
filesInfo = append(filesInfo, af)
|
||||
|
||||
pf := sdkLib.PermissionFile()
|
||||
if pf == nil {
|
||||
pf, _ := sdkLib.OutputFiles(".xml")
|
||||
if len(pf) != 1 {
|
||||
ctx.PropertyErrorf("java_libs", "%q failed to generate permission XML", depName)
|
||||
return false
|
||||
}
|
||||
filesInfo = append(filesInfo, newApexFile(ctx, pf, pf.Base(), "etc/permissions", etc, nil))
|
||||
filesInfo = append(filesInfo, newApexFile(ctx, pf[0], pf[0].Base(), "etc/permissions", etc, nil))
|
||||
return true // track transitive dependencies
|
||||
} else {
|
||||
ctx.PropertyErrorf("java_libs", "%q of type %q is not supported", depName, ctx.OtherModuleType(child))
|
||||
|
||||
@@ -3288,8 +3288,8 @@ func TestJavaSDKLibrary(t *testing.T) {
|
||||
"etc/permissions/foo.xml",
|
||||
})
|
||||
// Permission XML should point to the activated path of impl jar of java_sdk_library
|
||||
genXMLCommand := ctx.ModuleForTests("foo", "android_common_myapex").Output("foo.xml").RuleParams.Command
|
||||
ensureContains(t, genXMLCommand, `<library name="foo" file="/apex/myapex/javalib/foo.jar"`)
|
||||
xml := ctx.ModuleForTests("foo", "android_common_myapex").Output("foo.xml")
|
||||
ensureContains(t, xml.Args["content"], `<library name="foo" file="/apex/myapex/javalib/foo.jar"`)
|
||||
}
|
||||
|
||||
func TestRejectNonInstallableJavaLibrary(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user