Merge changes Iefcf4fbe,I450d4769,I1ffc7e7b

* changes:
  Prepend default to allow overriding in the bp file.
  Do not follow SDK member dependencies for APEX payloads.
  Do not follow prebuiltDependencyTags in APEX payload walks.
This commit is contained in:
Treehugger Robot 2020-07-09 12:32:31 +00:00 committed by Gerrit Code Review
commit 2c79c871d9
5 changed files with 89 additions and 11 deletions

View File

@ -1750,9 +1750,15 @@ func (a *apexBundle) WalkPayloadDeps(ctx android.ModuleContext, do android.Paylo
return false
}
dt := ctx.OtherModuleDependencyTag(child)
if _, ok := dt.(android.ExcludeFromApexContentsTag); ok {
return false
}
// Check for the direct dependencies that contribute to the payload
if dt, ok := ctx.OtherModuleDependencyTag(child).(dependencyTag); ok {
if dt.payload {
if adt, ok := dt.(dependencyTag); ok {
if adt.payload {
return do(ctx, parent, am, false /* externalDep */)
}
// As soon as the dependency graph crosses the APEX boundary, don't go further.

View File

@ -5791,6 +5791,41 @@ func TestAllowedFiles(t *testing.T) {
}
}
func TestNonPreferredPrebuiltDependency(t *testing.T) {
_, _ = testApex(t, `
apex {
name: "myapex",
key: "myapex.key",
native_shared_libs: ["mylib"],
}
apex_key {
name: "myapex.key",
public_key: "testkey.avbpubkey",
private_key: "testkey.pem",
}
cc_library {
name: "mylib",
srcs: ["mylib.cpp"],
stubs: {
versions: ["10000"],
},
apex_available: ["myapex"],
}
cc_prebuilt_library_shared {
name: "mylib",
prefer: false,
srcs: ["prebuilt.so"],
stubs: {
versions: ["10000"],
},
apex_available: ["myapex"],
}
`)
}
func TestMain(m *testing.M) {
run := func() int {
setUp()

View File

@ -69,6 +69,28 @@ func TestSdkIsCompileMultilibBoth(t *testing.T) {
ensureListContains(t, inputs, arm64Output.String())
}
func TestSdkCompileMultilibOverride(t *testing.T) {
result := testSdkWithCc(t, `
sdk {
name: "mysdk",
native_shared_libs: ["sdkmember"],
compile_multilib: "64",
}
cc_library_shared {
name: "sdkmember",
srcs: ["Test.cpp"],
stl: "none",
compile_multilib: "64",
}
`)
result.CheckSnapshot("mysdk", "",
checkAllCopyRules(`
.intermediates/sdkmember/android_arm64_armv8-a_shared/sdkmember.so -> arm64/lib/sdkmember.so
`))
}
func TestBasicSdkWithCc(t *testing.T) {
result := testSdkWithCc(t, `
sdk {
@ -79,6 +101,8 @@ func TestBasicSdkWithCc(t *testing.T) {
cc_library_shared {
name: "sdkmember",
system_shared_libs: [],
stl: "none",
apex_available: ["mysdkapex"],
}
sdk_snapshot {
@ -152,6 +176,13 @@ func TestBasicSdkWithCc(t *testing.T) {
key: "myapex.key",
certificate: ":myapex.cert",
}
apex {
name: "mysdkapex",
native_shared_libs: ["sdkmember"],
key: "myapex.key",
certificate: ":myapex.cert",
}
`)
sdkMemberV1 := result.ModuleForTests("sdkmember_mysdk_1", "android_arm64_armv8-a_shared_myapex").Rule("toc").Output

View File

@ -218,7 +218,7 @@ func newSdkModule(moduleExports bool) *sdk {
Compile_multilib *string
}
p := &props{Compile_multilib: proptools.StringPtr("both")}
ctx.AppendProperties(p)
ctx.PrependProperties(p)
})
return s
}
@ -330,6 +330,11 @@ type dependencyTag struct {
blueprint.BaseDependencyTag
}
// Mark this tag so dependencies that use it are excluded from APEX contents.
func (t dependencyTag) ExcludeFromApexContents() {}
var _ android.ExcludeFromApexContentsTag = dependencyTag{}
// For dependencies from an in-development version of an SDK member to frozen versions of the same member
// e.g. libfoo -> libfoo.mysdk.11 and libfoo.mysdk.12
type sdkMemberVersionedDepTag struct {

View File

@ -44,14 +44,15 @@ func testSdkContext(bp string, fs map[string][]byte) (*android.TestContext, andr
` + cc.GatherRequiredDepsForTest(android.Android, android.Windows)
mockFS := map[string][]byte{
"build/make/target/product/security": nil,
"apex_manifest.json": nil,
"system/sepolicy/apex/myapex-file_contexts": nil,
"system/sepolicy/apex/myapex2-file_contexts": nil,
"myapex.avbpubkey": nil,
"myapex.pem": nil,
"myapex.x509.pem": nil,
"myapex.pk8": nil,
"build/make/target/product/security": nil,
"apex_manifest.json": nil,
"system/sepolicy/apex/myapex-file_contexts": nil,
"system/sepolicy/apex/myapex2-file_contexts": nil,
"system/sepolicy/apex/mysdkapex-file_contexts": nil,
"myapex.avbpubkey": nil,
"myapex.pem": nil,
"myapex.x509.pem": nil,
"myapex.pk8": nil,
}
cc.GatherRequiredFilesForTest(mockFS)