Merge "Merge Android 14 QPR3 to AOSP main" into main
This commit is contained in:
@@ -1314,10 +1314,6 @@ func (c *config) PrebuiltHiddenApiDir(_ PathContext) string {
|
||||
return String(c.productVariables.PrebuiltHiddenApiDir)
|
||||
}
|
||||
|
||||
func (c *config) IsVndkDeprecated() bool {
|
||||
return !Bool(c.productVariables.KeepVndk)
|
||||
}
|
||||
|
||||
func (c *config) VendorApiLevel() string {
|
||||
return String(c.productVariables.VendorApiLevel)
|
||||
}
|
||||
|
@@ -33,4 +33,4 @@ package android
|
||||
// * AOSP - xx9990000
|
||||
// * x-mainline-prod - xx9990000
|
||||
// * master - 990090000
|
||||
const DefaultUpdatableModuleVersion = "990090000"
|
||||
const DefaultUpdatableModuleVersion = "350090000"
|
||||
|
@@ -490,8 +490,6 @@ type ProductVariables struct {
|
||||
|
||||
ReleaseDefaultModuleBuildFromSource *bool `json:",omitempty"`
|
||||
|
||||
KeepVndk *bool `json:",omitempty"`
|
||||
|
||||
CheckVendorSeappViolations *bool `json:",omitempty"`
|
||||
|
||||
BuildFlags map[string]string `json:",omitempty"`
|
||||
|
36
apex/apex.go
36
apex/apex.go
@@ -18,7 +18,6 @@ package apex
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
"sort"
|
||||
@@ -954,7 +953,6 @@ func (a *apexBundle) ApexInfoMutator(mctx android.TopDownMutatorContext) {
|
||||
// the non-system APEXes because the VNDK libraries won't be included (and duped) in the
|
||||
// APEX, but shared across APEXes via the VNDK APEX.
|
||||
useVndk := a.SocSpecific() || a.DeviceSpecific() || (a.ProductSpecific() && mctx.Config().EnforceProductPartitionInterface())
|
||||
excludeVndkLibs := useVndk && a.useVndkAsStable(mctx)
|
||||
if proptools.Bool(a.properties.Use_vndk_as_stable) {
|
||||
if !useVndk {
|
||||
mctx.PropertyErrorf("use_vndk_as_stable", "not supported for system/system_ext APEXes")
|
||||
@@ -962,11 +960,6 @@ func (a *apexBundle) ApexInfoMutator(mctx android.TopDownMutatorContext) {
|
||||
if a.minSdkVersionValue(mctx) != "" {
|
||||
mctx.PropertyErrorf("use_vndk_as_stable", "not supported when min_sdk_version is set")
|
||||
}
|
||||
mctx.VisitDirectDepsWithTag(sharedLibTag, func(dep android.Module) {
|
||||
if c, ok := dep.(*cc.Module); ok && c.IsVndk() {
|
||||
mctx.PropertyErrorf("use_vndk_as_stable", "Trying to include a VNDK library(%s) while use_vndk_as_stable is true.", dep.Name())
|
||||
}
|
||||
})
|
||||
if mctx.Failed() {
|
||||
return
|
||||
}
|
||||
@@ -988,16 +981,9 @@ func (a *apexBundle) ApexInfoMutator(mctx android.TopDownMutatorContext) {
|
||||
if !android.IsDepInSameApex(mctx, parent, child) {
|
||||
return false
|
||||
}
|
||||
if excludeVndkLibs {
|
||||
if c, ok := child.(*cc.Module); ok && c.IsVndk() {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
//TODO: b/296491928 Vendor APEX should use libbinder.ndk instead of libbinder once VNDK is fully deprecated.
|
||||
if useVndk && mctx.Config().IsVndkDeprecated() && child.Name() == "libbinder" {
|
||||
log.Print("Libbinder is linked from Vendor APEX ", a.Name(), " with module ", parent.Name())
|
||||
return false
|
||||
if useVndk && child.Name() == "libbinder" {
|
||||
mctx.ModuleErrorf("Module %s in the vendor APEX %s should not use libbinder. Use libbinder_ndk instead.", parent.Name(), a.Name())
|
||||
}
|
||||
|
||||
// By default, all the transitive dependencies are collected, unless filtered out
|
||||
@@ -2195,15 +2181,6 @@ func (a *apexBundle) depVisitor(vctx *visitorContext, ctx android.ModuleContext,
|
||||
// tags used below are private (e.g. `cc.sharedDepTag`).
|
||||
if cc.IsSharedDepTag(depTag) || cc.IsRuntimeDepTag(depTag) {
|
||||
if ch, ok := child.(*cc.Module); ok {
|
||||
if ch.UseVndk() && a.useVndkAsStable(ctx) && ch.IsVndk() {
|
||||
vctx.requireNativeLibs = append(vctx.requireNativeLibs, ":vndk")
|
||||
return false
|
||||
}
|
||||
|
||||
//TODO: b/296491928 Vendor APEX should use libbinder.ndk instead of libbinder once VNDK is fully deprecated.
|
||||
if ch.InVendorOrProduct() && ctx.Config().IsVndkDeprecated() && child.Name() == "libbinder" {
|
||||
return false
|
||||
}
|
||||
af := apexFileForNativeLibrary(ctx, ch, vctx.handleSpecialLibs)
|
||||
af.transitiveDep = true
|
||||
|
||||
@@ -3024,12 +3001,3 @@ func rBcpPackages() map[string][]string {
|
||||
func (a *apexBundle) IsTestApex() bool {
|
||||
return a.testApex
|
||||
}
|
||||
|
||||
func (a *apexBundle) useVndkAsStable(ctx android.BaseModuleContext) bool {
|
||||
// VNDK cannot be linked if it is deprecated
|
||||
if ctx.Config().IsVndkDeprecated() {
|
||||
return false
|
||||
}
|
||||
|
||||
return proptools.Bool(a.properties.Use_vndk_as_stable)
|
||||
}
|
||||
|
@@ -3785,32 +3785,31 @@ func TestVndkApexNameRule(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestVndkApexDoesntSupportNativeBridgeSupported(t *testing.T) {
|
||||
testApexError(t, `module "com.android.vndk.current" .*: native_bridge_supported: .* doesn't support native bridge binary`, `
|
||||
testApexError(t, `module "com.android.vndk.v30" .*: native_bridge_supported: .* doesn't support native bridge binary`, `
|
||||
apex_vndk {
|
||||
name: "com.android.vndk.current",
|
||||
key: "com.android.vndk.current.key",
|
||||
name: "com.android.vndk.v30",
|
||||
key: "com.android.vndk.v30.key",
|
||||
file_contexts: ":myapex-file_contexts",
|
||||
native_bridge_supported: true,
|
||||
}
|
||||
|
||||
apex_key {
|
||||
name: "com.android.vndk.current.key",
|
||||
name: "com.android.vndk.v30.key",
|
||||
public_key: "testkey.avbpubkey",
|
||||
private_key: "testkey.pem",
|
||||
}
|
||||
|
||||
cc_library {
|
||||
vndk_prebuilt_shared {
|
||||
name: "libvndk",
|
||||
version: "30",
|
||||
target_arch: "arm",
|
||||
srcs: ["mylib.cpp"],
|
||||
vendor_available: true,
|
||||
product_available: true,
|
||||
native_bridge_supported: true,
|
||||
host_supported: true,
|
||||
vndk: {
|
||||
enabled: true,
|
||||
},
|
||||
system_shared_libs: [],
|
||||
stl: "none",
|
||||
}
|
||||
`)
|
||||
}
|
||||
@@ -9807,188 +9806,196 @@ func ensureDoesNotContainRequiredDeps(t *testing.T, ctx *android.TestContext, mo
|
||||
}
|
||||
}
|
||||
|
||||
// TODO(b/193460475): Re-enable this test
|
||||
//func TestApexStrictUpdtabilityLint(t *testing.T) {
|
||||
// bpTemplate := `
|
||||
// apex {
|
||||
// name: "myapex",
|
||||
// key: "myapex.key",
|
||||
// java_libs: ["myjavalib"],
|
||||
// updatable: %v,
|
||||
// min_sdk_version: "29",
|
||||
// }
|
||||
// apex_key {
|
||||
// name: "myapex.key",
|
||||
// }
|
||||
// java_library {
|
||||
// name: "myjavalib",
|
||||
// srcs: ["MyClass.java"],
|
||||
// apex_available: [ "myapex" ],
|
||||
// lint: {
|
||||
// strict_updatability_linting: %v,
|
||||
// },
|
||||
// sdk_version: "current",
|
||||
// min_sdk_version: "29",
|
||||
// }
|
||||
// `
|
||||
// fs := android.MockFS{
|
||||
// "lint-baseline.xml": nil,
|
||||
// }
|
||||
//
|
||||
// testCases := []struct {
|
||||
// testCaseName string
|
||||
// apexUpdatable bool
|
||||
// javaStrictUpdtabilityLint bool
|
||||
// lintFileExists bool
|
||||
// disallowedFlagExpected bool
|
||||
// }{
|
||||
// {
|
||||
// testCaseName: "lint-baseline.xml does not exist, no disallowed flag necessary in lint cmd",
|
||||
// apexUpdatable: true,
|
||||
// javaStrictUpdtabilityLint: true,
|
||||
// lintFileExists: false,
|
||||
// disallowedFlagExpected: false,
|
||||
// },
|
||||
// {
|
||||
// testCaseName: "non-updatable apex respects strict_updatability of javalib",
|
||||
// apexUpdatable: false,
|
||||
// javaStrictUpdtabilityLint: false,
|
||||
// lintFileExists: true,
|
||||
// disallowedFlagExpected: false,
|
||||
// },
|
||||
// {
|
||||
// testCaseName: "non-updatable apex respects strict updatability of javalib",
|
||||
// apexUpdatable: false,
|
||||
// javaStrictUpdtabilityLint: true,
|
||||
// lintFileExists: true,
|
||||
// disallowedFlagExpected: true,
|
||||
// },
|
||||
// {
|
||||
// testCaseName: "updatable apex sets strict updatability of javalib to true",
|
||||
// apexUpdatable: true,
|
||||
// javaStrictUpdtabilityLint: false, // will be set to true by mutator
|
||||
// lintFileExists: true,
|
||||
// disallowedFlagExpected: true,
|
||||
// },
|
||||
// }
|
||||
//
|
||||
// for _, testCase := range testCases {
|
||||
// bp := fmt.Sprintf(bpTemplate, testCase.apexUpdatable, testCase.javaStrictUpdtabilityLint)
|
||||
// fixtures := []android.FixturePreparer{}
|
||||
// if testCase.lintFileExists {
|
||||
// fixtures = append(fixtures, fs.AddToFixture())
|
||||
// }
|
||||
//
|
||||
// result := testApex(t, bp, fixtures...)
|
||||
// myjavalib := result.ModuleForTests("myjavalib", "android_common_apex29")
|
||||
// sboxProto := android.RuleBuilderSboxProtoForTests(t, myjavalib.Output("lint.sbox.textproto"))
|
||||
// disallowedFlagActual := strings.Contains(*sboxProto.Commands[0].Command, "--baseline lint-baseline.xml --disallowed_issues NewApi")
|
||||
//
|
||||
// if disallowedFlagActual != testCase.disallowedFlagExpected {
|
||||
// t.Errorf("Failed testcase: %v \nActual lint cmd: %v", testCase.testCaseName, *sboxProto.Commands[0].Command)
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
//
|
||||
//func TestUpdatabilityLintSkipLibcore(t *testing.T) {
|
||||
// bp := `
|
||||
// apex {
|
||||
// name: "myapex",
|
||||
// key: "myapex.key",
|
||||
// java_libs: ["myjavalib"],
|
||||
// updatable: true,
|
||||
// min_sdk_version: "29",
|
||||
// }
|
||||
// apex_key {
|
||||
// name: "myapex.key",
|
||||
// }
|
||||
// java_library {
|
||||
// name: "myjavalib",
|
||||
// srcs: ["MyClass.java"],
|
||||
// apex_available: [ "myapex" ],
|
||||
// sdk_version: "current",
|
||||
// min_sdk_version: "29",
|
||||
// }
|
||||
// `
|
||||
//
|
||||
// testCases := []struct {
|
||||
// testCaseName string
|
||||
// moduleDirectory string
|
||||
// disallowedFlagExpected bool
|
||||
// }{
|
||||
// {
|
||||
// testCaseName: "lintable module defined outside libcore",
|
||||
// moduleDirectory: "",
|
||||
// disallowedFlagExpected: true,
|
||||
// },
|
||||
// {
|
||||
// testCaseName: "lintable module defined in libcore root directory",
|
||||
// moduleDirectory: "libcore/",
|
||||
// disallowedFlagExpected: false,
|
||||
// },
|
||||
// {
|
||||
// testCaseName: "lintable module defined in libcore child directory",
|
||||
// moduleDirectory: "libcore/childdir/",
|
||||
// disallowedFlagExpected: true,
|
||||
// },
|
||||
// }
|
||||
//
|
||||
// for _, testCase := range testCases {
|
||||
// lintFileCreator := android.FixtureAddTextFile(testCase.moduleDirectory+"lint-baseline.xml", "")
|
||||
// bpFileCreator := android.FixtureAddTextFile(testCase.moduleDirectory+"Android.bp", bp)
|
||||
// result := testApex(t, "", lintFileCreator, bpFileCreator)
|
||||
// myjavalib := result.ModuleForTests("myjavalib", "android_common_apex29")
|
||||
// sboxProto := android.RuleBuilderSboxProtoForTests(t, myjavalib.Output("lint.sbox.textproto"))
|
||||
// cmdFlags := fmt.Sprintf("--baseline %vlint-baseline.xml --disallowed_issues NewApi", testCase.moduleDirectory)
|
||||
// disallowedFlagActual := strings.Contains(*sboxProto.Commands[0].Command, cmdFlags)
|
||||
//
|
||||
// if disallowedFlagActual != testCase.disallowedFlagExpected {
|
||||
// t.Errorf("Failed testcase: %v \nActual lint cmd: %v", testCase.testCaseName, *sboxProto.Commands[0].Command)
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
//
|
||||
//// checks transtive deps of an apex coming from bootclasspath_fragment
|
||||
//func TestApexStrictUpdtabilityLintBcpFragmentDeps(t *testing.T) {
|
||||
// bp := `
|
||||
// apex {
|
||||
// name: "myapex",
|
||||
// key: "myapex.key",
|
||||
// bootclasspath_fragments: ["mybootclasspathfragment"],
|
||||
// updatable: true,
|
||||
// min_sdk_version: "29",
|
||||
// }
|
||||
// apex_key {
|
||||
// name: "myapex.key",
|
||||
// }
|
||||
// bootclasspath_fragment {
|
||||
// name: "mybootclasspathfragment",
|
||||
// contents: ["myjavalib"],
|
||||
// apex_available: ["myapex"],
|
||||
// hidden_api: {
|
||||
// split_packages: ["*"],
|
||||
// },
|
||||
// }
|
||||
// java_library {
|
||||
// name: "myjavalib",
|
||||
// srcs: ["MyClass.java"],
|
||||
// apex_available: [ "myapex" ],
|
||||
// sdk_version: "current",
|
||||
// min_sdk_version: "29",
|
||||
// compile_dex: true,
|
||||
// }
|
||||
// `
|
||||
// fs := android.MockFS{
|
||||
// "lint-baseline.xml": nil,
|
||||
// }
|
||||
//
|
||||
// result := testApex(t, bp, dexpreopt.FixtureSetApexBootJars("myapex:myjavalib"), fs.AddToFixture())
|
||||
// myjavalib := result.ModuleForTests("myjavalib", "android_common_apex29")
|
||||
// sboxProto := android.RuleBuilderSboxProtoForTests(t, myjavalib.Output("lint.sbox.textproto"))
|
||||
// if !strings.Contains(*sboxProto.Commands[0].Command, "--baseline lint-baseline.xml --disallowed_issues NewApi") {
|
||||
// t.Errorf("Strict updabality lint missing in myjavalib coming from bootclasspath_fragment mybootclasspath-fragment\nActual lint cmd: %v", *sboxProto.Commands[0].Command)
|
||||
// }
|
||||
//}
|
||||
func TestApexStrictUpdtabilityLint(t *testing.T) {
|
||||
bpTemplate := `
|
||||
apex {
|
||||
name: "myapex",
|
||||
key: "myapex.key",
|
||||
java_libs: ["myjavalib"],
|
||||
updatable: %v,
|
||||
min_sdk_version: "29",
|
||||
}
|
||||
apex_key {
|
||||
name: "myapex.key",
|
||||
}
|
||||
java_library {
|
||||
name: "myjavalib",
|
||||
srcs: ["MyClass.java"],
|
||||
apex_available: [ "myapex" ],
|
||||
lint: {
|
||||
strict_updatability_linting: %v,
|
||||
%s
|
||||
},
|
||||
sdk_version: "current",
|
||||
min_sdk_version: "29",
|
||||
}
|
||||
`
|
||||
fs := android.MockFS{
|
||||
"lint-baseline.xml": nil,
|
||||
}
|
||||
|
||||
testCases := []struct {
|
||||
testCaseName string
|
||||
apexUpdatable bool
|
||||
javaStrictUpdtabilityLint bool
|
||||
lintFileExists bool
|
||||
disallowedFlagExpected bool
|
||||
}{
|
||||
{
|
||||
testCaseName: "lint-baseline.xml does not exist, no disallowed flag necessary in lint cmd",
|
||||
apexUpdatable: true,
|
||||
javaStrictUpdtabilityLint: true,
|
||||
lintFileExists: false,
|
||||
disallowedFlagExpected: false,
|
||||
},
|
||||
{
|
||||
testCaseName: "non-updatable apex respects strict_updatability of javalib",
|
||||
apexUpdatable: false,
|
||||
javaStrictUpdtabilityLint: false,
|
||||
lintFileExists: true,
|
||||
disallowedFlagExpected: false,
|
||||
},
|
||||
{
|
||||
testCaseName: "non-updatable apex respects strict updatability of javalib",
|
||||
apexUpdatable: false,
|
||||
javaStrictUpdtabilityLint: true,
|
||||
lintFileExists: true,
|
||||
disallowedFlagExpected: true,
|
||||
},
|
||||
{
|
||||
testCaseName: "updatable apex sets strict updatability of javalib to true",
|
||||
apexUpdatable: true,
|
||||
javaStrictUpdtabilityLint: false, // will be set to true by mutator
|
||||
lintFileExists: true,
|
||||
disallowedFlagExpected: true,
|
||||
},
|
||||
}
|
||||
|
||||
for _, testCase := range testCases {
|
||||
fixtures := []android.FixturePreparer{}
|
||||
baselineProperty := ""
|
||||
if testCase.lintFileExists {
|
||||
fixtures = append(fixtures, fs.AddToFixture())
|
||||
baselineProperty = "baseline_filename: \"lint-baseline.xml\""
|
||||
}
|
||||
bp := fmt.Sprintf(bpTemplate, testCase.apexUpdatable, testCase.javaStrictUpdtabilityLint, baselineProperty)
|
||||
|
||||
result := testApex(t, bp, fixtures...)
|
||||
myjavalib := result.ModuleForTests("myjavalib", "android_common_apex29")
|
||||
sboxProto := android.RuleBuilderSboxProtoForTests(t, result, myjavalib.Output("lint.sbox.textproto"))
|
||||
disallowedFlagActual := strings.Contains(*sboxProto.Commands[0].Command, "--baseline lint-baseline.xml --disallowed_issues NewApi")
|
||||
|
||||
if disallowedFlagActual != testCase.disallowedFlagExpected {
|
||||
t.Errorf("Failed testcase: %v \nActual lint cmd: %v", testCase.testCaseName, *sboxProto.Commands[0].Command)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestUpdatabilityLintSkipLibcore(t *testing.T) {
|
||||
bp := `
|
||||
apex {
|
||||
name: "myapex",
|
||||
key: "myapex.key",
|
||||
java_libs: ["myjavalib"],
|
||||
updatable: true,
|
||||
min_sdk_version: "29",
|
||||
}
|
||||
apex_key {
|
||||
name: "myapex.key",
|
||||
}
|
||||
java_library {
|
||||
name: "myjavalib",
|
||||
srcs: ["MyClass.java"],
|
||||
apex_available: [ "myapex" ],
|
||||
sdk_version: "current",
|
||||
min_sdk_version: "29",
|
||||
lint: {
|
||||
baseline_filename: "lint-baseline.xml",
|
||||
}
|
||||
}
|
||||
`
|
||||
|
||||
testCases := []struct {
|
||||
testCaseName string
|
||||
moduleDirectory string
|
||||
disallowedFlagExpected bool
|
||||
}{
|
||||
{
|
||||
testCaseName: "lintable module defined outside libcore",
|
||||
moduleDirectory: "",
|
||||
disallowedFlagExpected: true,
|
||||
},
|
||||
{
|
||||
testCaseName: "lintable module defined in libcore root directory",
|
||||
moduleDirectory: "libcore/",
|
||||
disallowedFlagExpected: false,
|
||||
},
|
||||
{
|
||||
testCaseName: "lintable module defined in libcore child directory",
|
||||
moduleDirectory: "libcore/childdir/",
|
||||
disallowedFlagExpected: true,
|
||||
},
|
||||
}
|
||||
|
||||
for _, testCase := range testCases {
|
||||
lintFileCreator := android.FixtureAddTextFile(testCase.moduleDirectory+"lint-baseline.xml", "")
|
||||
bpFileCreator := android.FixtureAddTextFile(testCase.moduleDirectory+"Android.bp", bp)
|
||||
result := testApex(t, "", lintFileCreator, bpFileCreator)
|
||||
myjavalib := result.ModuleForTests("myjavalib", "android_common_apex29")
|
||||
sboxProto := android.RuleBuilderSboxProtoForTests(t, result, myjavalib.Output("lint.sbox.textproto"))
|
||||
cmdFlags := fmt.Sprintf("--baseline %vlint-baseline.xml --disallowed_issues NewApi", testCase.moduleDirectory)
|
||||
disallowedFlagActual := strings.Contains(*sboxProto.Commands[0].Command, cmdFlags)
|
||||
|
||||
if disallowedFlagActual != testCase.disallowedFlagExpected {
|
||||
t.Errorf("Failed testcase: %v \nActual lint cmd: %v", testCase.testCaseName, *sboxProto.Commands[0].Command)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// checks transtive deps of an apex coming from bootclasspath_fragment
|
||||
func TestApexStrictUpdtabilityLintBcpFragmentDeps(t *testing.T) {
|
||||
bp := `
|
||||
apex {
|
||||
name: "myapex",
|
||||
key: "myapex.key",
|
||||
bootclasspath_fragments: ["mybootclasspathfragment"],
|
||||
updatable: true,
|
||||
min_sdk_version: "29",
|
||||
}
|
||||
apex_key {
|
||||
name: "myapex.key",
|
||||
}
|
||||
bootclasspath_fragment {
|
||||
name: "mybootclasspathfragment",
|
||||
contents: ["myjavalib"],
|
||||
apex_available: ["myapex"],
|
||||
hidden_api: {
|
||||
split_packages: ["*"],
|
||||
},
|
||||
}
|
||||
java_library {
|
||||
name: "myjavalib",
|
||||
srcs: ["MyClass.java"],
|
||||
apex_available: [ "myapex" ],
|
||||
sdk_version: "current",
|
||||
min_sdk_version: "29",
|
||||
compile_dex: true,
|
||||
lint: {
|
||||
baseline_filename: "lint-baseline.xml",
|
||||
}
|
||||
}
|
||||
`
|
||||
fs := android.MockFS{
|
||||
"lint-baseline.xml": nil,
|
||||
}
|
||||
|
||||
result := testApex(t, bp, dexpreopt.FixtureSetApexBootJars("myapex:myjavalib"), fs.AddToFixture())
|
||||
myjavalib := result.ModuleForTests("myjavalib", "android_common_apex29")
|
||||
sboxProto := android.RuleBuilderSboxProtoForTests(t, result, myjavalib.Output("lint.sbox.textproto"))
|
||||
if !strings.Contains(*sboxProto.Commands[0].Command, "--baseline lint-baseline.xml --disallowed_issues NewApi") {
|
||||
t.Errorf("Strict updabality lint missing in myjavalib coming from bootclasspath_fragment mybootclasspath-fragment\nActual lint cmd: %v", *sboxProto.Commands[0].Command)
|
||||
}
|
||||
}
|
||||
|
||||
// updatable apexes should propagate updatable=true to its apps
|
||||
func TestUpdatableApexEnforcesAppUpdatability(t *testing.T) {
|
||||
|
@@ -104,16 +104,6 @@ func (c *Module) AndroidMkEntries() []android.AndroidMkEntries {
|
||||
entries.AddStrings("LOCAL_RUNTIME_LIBRARIES", c.Properties.AndroidMkRuntimeLibs...)
|
||||
}
|
||||
entries.SetString("LOCAL_SOONG_LINK_TYPE", c.makeLinkType)
|
||||
if c.InVendorOrProduct() {
|
||||
if c.IsVndk() && !c.static() {
|
||||
entries.SetString("LOCAL_SOONG_VNDK_VERSION", c.VndkVersion())
|
||||
// VNDK libraries available to vendor are not installed because
|
||||
// they are packaged in VNDK APEX and installed by APEX packages (apex/apex.go)
|
||||
if !c.IsVndkExt() {
|
||||
entries.SetBool("LOCAL_UNINSTALLABLE_MODULE", true)
|
||||
}
|
||||
}
|
||||
}
|
||||
if c.InVendor() {
|
||||
entries.SetBool("LOCAL_IN_VENDOR", true)
|
||||
} else if c.InProduct() {
|
||||
|
158
cc/cc.go
158
cc/cc.go
@@ -49,7 +49,6 @@ func RegisterCCBuildComponents(ctx android.RegistrationContext) {
|
||||
|
||||
ctx.PreDepsMutators(func(ctx android.RegisterMutatorsContext) {
|
||||
ctx.BottomUp("sdk", sdkMutator).Parallel()
|
||||
ctx.BottomUp("vndk", VndkMutator).Parallel()
|
||||
ctx.BottomUp("llndk", llndkMutator).Parallel()
|
||||
ctx.BottomUp("link", LinkageMutator).Parallel()
|
||||
ctx.BottomUp("test_per_src", TestPerSrcMutator).Parallel()
|
||||
@@ -480,19 +479,6 @@ type VendorProperties struct {
|
||||
// IsLLNDK is set to true for the vendor variant of a cc_library module that has LLNDK stubs.
|
||||
IsLLNDK bool `blueprint:"mutated"`
|
||||
|
||||
// IsVNDKCore is set if a VNDK module does not set the vndk.support_system_process property.
|
||||
IsVNDKCore bool `blueprint:"mutated"`
|
||||
|
||||
// IsVNDKSP is set if a VNDK module sets the vndk.support_system_process property.
|
||||
IsVNDKSP bool `blueprint:"mutated"`
|
||||
|
||||
// IsVNDKPrivate is set if a VNDK module sets the vndk.private property or an LLNDK
|
||||
// module sets the llndk.private property.
|
||||
IsVNDKPrivate bool `blueprint:"mutated"`
|
||||
|
||||
// IsVNDKProduct is set if a VNDK module sets the product_available property.
|
||||
IsVNDKProduct bool `blueprint:"mutated"`
|
||||
|
||||
// IsVendorPublicLibrary is set for the core and product variants of a library that has
|
||||
// vendor_public_library stubs.
|
||||
IsVendorPublicLibrary bool `blueprint:"mutated"`
|
||||
@@ -519,12 +505,7 @@ type ModuleContextIntf interface {
|
||||
useVndk() bool
|
||||
isNdk(config android.Config) bool
|
||||
IsLlndk() bool
|
||||
IsLlndkPublic() bool
|
||||
isImplementationForLLNDKPublic() bool
|
||||
IsVndkPrivate() bool
|
||||
isVndk() bool
|
||||
isVndkSp() bool
|
||||
IsVndkExt() bool
|
||||
IsVendorPublicLibrary() bool
|
||||
inProduct() bool
|
||||
inVendor() bool
|
||||
@@ -534,7 +515,6 @@ type ModuleContextIntf interface {
|
||||
InVendorOrProduct() bool
|
||||
selectedStl() string
|
||||
baseModuleName() string
|
||||
getVndkExtendsModuleName() string
|
||||
isAfdoCompile(ctx ModuleContext) bool
|
||||
isOrderfileCompile() bool
|
||||
isCfi() bool
|
||||
@@ -900,7 +880,6 @@ type Module struct {
|
||||
coverage *coverage
|
||||
fuzzer *fuzzer
|
||||
sabi *sabi
|
||||
vndkdep *vndkdep
|
||||
lto *lto
|
||||
afdo *afdo
|
||||
orderfile *orderfile
|
||||
@@ -974,12 +953,7 @@ func (c *Module) AddJSONData(d *map[string]interface{}) {
|
||||
"InstallInVendorRamdisk": c.InstallInVendorRamdisk(),
|
||||
"InstallInRecovery": c.InstallInRecovery(),
|
||||
"InstallInRoot": c.InstallInRoot(),
|
||||
"IsVndk": c.IsVndk(),
|
||||
"IsVndkExt": c.IsVndkExt(),
|
||||
"IsVndkPrivate": c.IsVndkPrivate(),
|
||||
"IsVndkSp": c.IsVndkSp(),
|
||||
"IsLlndk": c.IsLlndk(),
|
||||
"IsLlndkPublic": c.IsLlndkPublic(),
|
||||
"IsVendorPublicLibrary": c.IsVendorPublicLibrary(),
|
||||
"ApexSdkVersion": c.apexSdkVersion,
|
||||
"TestFor": c.TestFor(),
|
||||
@@ -1289,9 +1263,6 @@ func (c *Module) Init() android.Module {
|
||||
if c.sabi != nil {
|
||||
c.AddProperties(c.sabi.props()...)
|
||||
}
|
||||
if c.vndkdep != nil {
|
||||
c.AddProperties(c.vndkdep.props()...)
|
||||
}
|
||||
if c.lto != nil {
|
||||
c.AddProperties(c.lto.props()...)
|
||||
}
|
||||
@@ -1346,10 +1317,6 @@ func (c *Module) IsLlndk() bool {
|
||||
return c.VendorProperties.IsLLNDK
|
||||
}
|
||||
|
||||
func (c *Module) IsLlndkPublic() bool {
|
||||
return c.VendorProperties.IsLLNDK && !c.VendorProperties.IsVNDKPrivate
|
||||
}
|
||||
|
||||
func (m *Module) NeedsLlndkVariants() bool {
|
||||
lib := moduleLibraryInterface(m)
|
||||
return lib != nil && (lib.hasLLNDKStubs() || lib.hasLLNDKHeaders())
|
||||
@@ -1396,31 +1363,6 @@ func (c *Module) isImplementationForLLNDKPublic() bool {
|
||||
!Bool(library.Properties.Llndk.Private)
|
||||
}
|
||||
|
||||
// Returns true for LLNDK-private, VNDK-SP-private, and VNDK-core-private.
|
||||
func (c *Module) IsVndkPrivate() bool {
|
||||
// Check if VNDK-core-private or VNDK-SP-private
|
||||
if c.IsVndk() {
|
||||
return Bool(c.vndkdep.Properties.Vndk.Private)
|
||||
}
|
||||
|
||||
// Check if LLNDK-private
|
||||
if library, ok := c.library.(*libraryDecorator); ok && c.IsLlndk() {
|
||||
return Bool(library.Properties.Llndk.Private)
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
// IsVndk() returns true if this module has a vndk variant.
|
||||
// Note that IsVndk() returns true for all variants of vndk-enabled libraries. Not only vendor variant,
|
||||
// but also platform and product variants of vndk-enabled libraries return true for IsVndk().
|
||||
func (c *Module) IsVndk() bool {
|
||||
if vndkdep := c.vndkdep; vndkdep != nil {
|
||||
return vndkdep.isVndk()
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (c *Module) isAfdoCompile(ctx ModuleContext) bool {
|
||||
if afdo := c.afdo; afdo != nil {
|
||||
return afdo.isAfdoCompile(ctx)
|
||||
@@ -1456,31 +1398,10 @@ func (c *Module) isNDKStubLibrary() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (c *Module) IsVndkSp() bool {
|
||||
if vndkdep := c.vndkdep; vndkdep != nil {
|
||||
return vndkdep.isVndkSp()
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (c *Module) IsVndkExt() bool {
|
||||
if vndkdep := c.vndkdep; vndkdep != nil {
|
||||
return vndkdep.isVndkExt()
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (c *Module) SubName() string {
|
||||
return c.Properties.SubName
|
||||
}
|
||||
|
||||
func (c *Module) getVndkExtendsModuleName() string {
|
||||
if vndkdep := c.vndkdep; vndkdep != nil {
|
||||
return vndkdep.getVndkExtendsModuleName()
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (c *Module) IsStubs() bool {
|
||||
if lib := c.library; lib != nil {
|
||||
return lib.buildStubs()
|
||||
@@ -1638,14 +1559,6 @@ func (ctx *moduleContextImpl) useSdk() bool {
|
||||
|
||||
func (ctx *moduleContextImpl) sdkVersion() string {
|
||||
if ctx.ctx.Device() {
|
||||
config := ctx.ctx.Config()
|
||||
if !config.IsVndkDeprecated() && ctx.useVndk() {
|
||||
vndkVer := ctx.mod.VndkVersion()
|
||||
if inList(vndkVer, config.PlatformVersionActiveCodenames()) {
|
||||
return "current"
|
||||
}
|
||||
return vndkVer
|
||||
}
|
||||
return String(ctx.mod.Properties.Sdk_version)
|
||||
}
|
||||
return ""
|
||||
@@ -1662,7 +1575,7 @@ func (ctx *moduleContextImpl) minSdkVersion() string {
|
||||
|
||||
if ctx.ctx.Device() {
|
||||
config := ctx.ctx.Config()
|
||||
if config.IsVndkDeprecated() && ctx.inVendor() {
|
||||
if ctx.inVendor() {
|
||||
// If building for vendor with final API, then use the latest _stable_ API as "current".
|
||||
if config.VendorApiLevelFrozen() && (ver == "" || ver == "current") {
|
||||
ver = config.PlatformSdkVersion().String()
|
||||
@@ -1722,22 +1635,10 @@ func (ctx *moduleContextImpl) IsLlndk() bool {
|
||||
return ctx.mod.IsLlndk()
|
||||
}
|
||||
|
||||
func (ctx *moduleContextImpl) IsLlndkPublic() bool {
|
||||
return ctx.mod.IsLlndkPublic()
|
||||
}
|
||||
|
||||
func (ctx *moduleContextImpl) isImplementationForLLNDKPublic() bool {
|
||||
return ctx.mod.isImplementationForLLNDKPublic()
|
||||
}
|
||||
|
||||
func (ctx *moduleContextImpl) IsVndkPrivate() bool {
|
||||
return ctx.mod.IsVndkPrivate()
|
||||
}
|
||||
|
||||
func (ctx *moduleContextImpl) isVndk() bool {
|
||||
return ctx.mod.IsVndk()
|
||||
}
|
||||
|
||||
func (ctx *moduleContextImpl) isAfdoCompile(mctx ModuleContext) bool {
|
||||
return ctx.mod.isAfdoCompile(mctx)
|
||||
}
|
||||
@@ -1758,14 +1659,6 @@ func (ctx *moduleContextImpl) isNDKStubLibrary() bool {
|
||||
return ctx.mod.isNDKStubLibrary()
|
||||
}
|
||||
|
||||
func (ctx *moduleContextImpl) isVndkSp() bool {
|
||||
return ctx.mod.IsVndkSp()
|
||||
}
|
||||
|
||||
func (ctx *moduleContextImpl) IsVndkExt() bool {
|
||||
return ctx.mod.IsVndkExt()
|
||||
}
|
||||
|
||||
func (ctx *moduleContextImpl) IsVendorPublicLibrary() bool {
|
||||
return ctx.mod.IsVendorPublicLibrary()
|
||||
}
|
||||
@@ -1785,10 +1678,6 @@ func (ctx *moduleContextImpl) baseModuleName() string {
|
||||
return ctx.mod.BaseModuleName()
|
||||
}
|
||||
|
||||
func (ctx *moduleContextImpl) getVndkExtendsModuleName() string {
|
||||
return ctx.mod.getVndkExtendsModuleName()
|
||||
}
|
||||
|
||||
func (ctx *moduleContextImpl) isForPlatform() bool {
|
||||
apexInfo, _ := android.ModuleProvider(ctx.ctx, android.ApexInfoProvider)
|
||||
return apexInfo.IsForPlatform()
|
||||
@@ -1853,7 +1742,6 @@ func newModule(hod android.HostOrDeviceSupported, multilib android.Multilib) *Mo
|
||||
module.coverage = &coverage{}
|
||||
module.fuzzer = &fuzzer{}
|
||||
module.sabi = &sabi{}
|
||||
module.vndkdep = &vndkdep{}
|
||||
module.lto = <o{}
|
||||
module.afdo = &afdo{}
|
||||
module.orderfile = &orderfile{}
|
||||
@@ -2785,15 +2673,6 @@ func (c *Module) DepsMutator(actx android.BottomUpMutatorContext) {
|
||||
{Mutator: "link", Variation: "shared"},
|
||||
}, ndkLateStubDepTag, apiLateNdkLibs...)
|
||||
|
||||
if vndkdep := c.vndkdep; vndkdep != nil {
|
||||
if vndkdep.isVndkExt() {
|
||||
actx.AddVariationDependencies([]blueprint.Variation{
|
||||
c.ImageVariation(),
|
||||
{Mutator: "link", Variation: "shared"},
|
||||
}, vndkExtDepTag, vndkdep.getVndkExtendsModuleName())
|
||||
}
|
||||
}
|
||||
|
||||
if len(deps.AidlLibs) > 0 {
|
||||
actx.AddDependency(
|
||||
c,
|
||||
@@ -2831,20 +2710,6 @@ func checkLinkType(ctx android.BaseModuleContext, from LinkableInterface, to Lin
|
||||
return
|
||||
}
|
||||
|
||||
// VNDK is cc.Module supported only for now.
|
||||
if ccFrom, ok := from.(*Module); ok && from.UseVndk() {
|
||||
// Though allowed dependency is limited by the image mutator,
|
||||
// each vendor and product module needs to check link-type
|
||||
// for VNDK.
|
||||
if ccTo, ok := to.(*Module); ok {
|
||||
if ccFrom.vndkdep != nil {
|
||||
ccFrom.vndkdep.vndkCheckLinkType(ctx, ccTo, tag)
|
||||
}
|
||||
} else if _, ok := to.(LinkableInterface); !ok {
|
||||
ctx.ModuleErrorf("Attempting to link VNDK cc.Module with unsupported module type")
|
||||
}
|
||||
return
|
||||
}
|
||||
// TODO(b/244244438) : Remove this once all variants are implemented
|
||||
if ccFrom, ok := from.(*Module); ok && ccFrom.isImportedApiLibrary() {
|
||||
return
|
||||
@@ -2999,7 +2864,7 @@ func checkDoubleLoadableLibraries(ctx android.TopDownMutatorContext) {
|
||||
return true
|
||||
}
|
||||
|
||||
if to.IsVndkSp() || to.IsLlndk() {
|
||||
if to.IsLlndk() {
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -3833,15 +3698,6 @@ func (m *Module) Rlib() bool {
|
||||
func GetMakeLinkType(actx android.ModuleContext, c LinkableInterface) string {
|
||||
if c.InVendorOrProduct() {
|
||||
if c.IsLlndk() {
|
||||
if !c.IsLlndkPublic() {
|
||||
return "native:vndk_private"
|
||||
}
|
||||
return "native:vndk"
|
||||
}
|
||||
if c.IsVndk() && !c.IsVndkExt() {
|
||||
if c.IsVndkPrivate() {
|
||||
return "native:vndk_private"
|
||||
}
|
||||
return "native:vndk"
|
||||
}
|
||||
if c.InProduct() {
|
||||
@@ -4043,15 +3899,6 @@ func (c *Module) AlwaysRequiresPlatformApexVariant() bool {
|
||||
return c.IsStubs() || c.Target().NativeBridge == android.NativeBridgeEnabled
|
||||
}
|
||||
|
||||
// Overrides android.ApexModuleBase.UniqueApexVariations
|
||||
func (c *Module) UniqueApexVariations() bool {
|
||||
// When a vendor APEX needs a VNDK lib in it (use_vndk_as_stable: false), it should be a unique
|
||||
// APEX variation. Otherwise, another vendor APEX with use_vndk_as_stable:true may use a wrong
|
||||
// variation of the VNDK lib because APEX variations are merged/grouped.
|
||||
// TODO(b/274401041) Find a way to merge APEX variations for vendor apexes.
|
||||
return c.UseVndk() && c.IsVndk()
|
||||
}
|
||||
|
||||
func (c *Module) overriddenModules() []string {
|
||||
if o, ok := c.linker.(overridable); ok {
|
||||
return o.overriddenModules()
|
||||
@@ -4159,7 +4006,6 @@ func DefaultsFactory(props ...interface{}) android.Module {
|
||||
&TidyProperties{},
|
||||
&CoverageProperties{},
|
||||
&SAbiProperties{},
|
||||
&VndkProperties{},
|
||||
<OProperties{},
|
||||
&AfdoProperties{},
|
||||
&OrderfileProperties{},
|
||||
|
@@ -658,7 +658,7 @@ func TestMakeLinkType(t *testing.T) {
|
||||
}{
|
||||
{vendorVariant, "libvendor", "native:vendor"},
|
||||
{vendorVariant, "libllndk", "native:vndk"},
|
||||
{vendorVariant27, "prevndk.vndk.27.arm.binder32", "native:vndk"},
|
||||
{vendorVariant27, "prevndk.vndk.27.arm.binder32", "native:vendor"},
|
||||
{coreVariant, "libllndk", "native:platform"},
|
||||
}
|
||||
for _, test := range tests {
|
||||
|
103
cc/image.go
103
cc/image.go
@@ -17,8 +17,6 @@ package cc
|
||||
// functions to determine where a module is installed, etc.
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"reflect"
|
||||
"strings"
|
||||
|
||||
"android/soong/android"
|
||||
@@ -157,52 +155,6 @@ func (c *Module) OnlyInRecovery() bool {
|
||||
return c.ModuleBase.InstallInRecovery()
|
||||
}
|
||||
|
||||
func visitPropsAndCompareVendorAndProductProps(v reflect.Value) bool {
|
||||
if v.Kind() != reflect.Struct {
|
||||
return true
|
||||
}
|
||||
for i := 0; i < v.NumField(); i++ {
|
||||
prop := v.Field(i)
|
||||
if prop.Kind() == reflect.Struct && v.Type().Field(i).Name == "Target" {
|
||||
vendor_prop := prop.FieldByName("Vendor")
|
||||
product_prop := prop.FieldByName("Product")
|
||||
if vendor_prop.Kind() != reflect.Struct && product_prop.Kind() != reflect.Struct {
|
||||
// Neither Target.Vendor nor Target.Product is defined
|
||||
continue
|
||||
}
|
||||
if vendor_prop.Kind() != reflect.Struct || product_prop.Kind() != reflect.Struct ||
|
||||
!reflect.DeepEqual(vendor_prop.Interface(), product_prop.Interface()) {
|
||||
// If only one of either Target.Vendor or Target.Product is
|
||||
// defined or they have different values, it fails the build
|
||||
// since VNDK must have the same properties for both vendor
|
||||
// and product variants.
|
||||
return false
|
||||
}
|
||||
} else if !visitPropsAndCompareVendorAndProductProps(prop) {
|
||||
// Visit the substructures to find Target.Vendor and Target.Product
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// In the case of VNDK, vendor and product variants must have the same properties.
|
||||
// VNDK installs only one file and shares it for both vendor and product modules on
|
||||
// runtime. We may not define different versions of a VNDK lib for each partition.
|
||||
// This function is used only for the VNDK modules that is available to both vendor
|
||||
// and product partitions.
|
||||
func (c *Module) compareVendorAndProductProps() bool {
|
||||
if !c.IsVndk() && !Bool(c.VendorProperties.Product_available) {
|
||||
panic(fmt.Errorf("This is only for product available VNDK libs. %q is not a VNDK library or not product available", c.Name()))
|
||||
}
|
||||
for _, properties := range c.GetProperties() {
|
||||
if !visitPropsAndCompareVendorAndProductProps(reflect.ValueOf(properties).Elem()) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// ImageMutatableModule provides a common image mutation interface for LinkableInterface modules.
|
||||
type ImageMutatableModule interface {
|
||||
android.Module
|
||||
@@ -260,62 +212,9 @@ type ImageMutatableModule interface {
|
||||
var _ ImageMutatableModule = (*Module)(nil)
|
||||
|
||||
func (m *Module) ImageMutatorBegin(mctx android.BaseModuleContext) {
|
||||
m.CheckVndkProperties(mctx)
|
||||
MutateImage(mctx, m)
|
||||
}
|
||||
|
||||
// CheckVndkProperties checks whether the VNDK-related properties are set correctly.
|
||||
// If properties are not set correctly, results in a module context property error.
|
||||
func (m *Module) CheckVndkProperties(mctx android.BaseModuleContext) {
|
||||
vendorSpecific := mctx.SocSpecific() || mctx.DeviceSpecific()
|
||||
productSpecific := mctx.ProductSpecific()
|
||||
|
||||
if vndkdep := m.vndkdep; vndkdep != nil {
|
||||
if vndkdep.isVndk() {
|
||||
if vendorSpecific || productSpecific {
|
||||
if !vndkdep.isVndkExt() {
|
||||
mctx.PropertyErrorf("vndk",
|
||||
"must set `extends: \"...\"` to vndk extension")
|
||||
} else if Bool(m.VendorProperties.Vendor_available) {
|
||||
mctx.PropertyErrorf("vendor_available",
|
||||
"must not set at the same time as `vndk: {extends: \"...\"}`")
|
||||
} else if Bool(m.VendorProperties.Product_available) {
|
||||
mctx.PropertyErrorf("product_available",
|
||||
"must not set at the same time as `vndk: {extends: \"...\"}`")
|
||||
}
|
||||
} else {
|
||||
if vndkdep.isVndkExt() {
|
||||
mctx.PropertyErrorf("vndk",
|
||||
"must set `vendor: true` or `product_specific: true` to set `extends: %q`",
|
||||
m.getVndkExtendsModuleName())
|
||||
}
|
||||
if !Bool(m.VendorProperties.Vendor_available) {
|
||||
mctx.PropertyErrorf("vndk",
|
||||
"vendor_available must be set to true when `vndk: {enabled: true}`")
|
||||
}
|
||||
if Bool(m.VendorProperties.Product_available) {
|
||||
// If a VNDK module creates both product and vendor variants, they
|
||||
// must have the same properties since they share a single VNDK
|
||||
// library on runtime.
|
||||
if !m.compareVendorAndProductProps() {
|
||||
mctx.ModuleErrorf("product properties must have the same values with the vendor properties for VNDK modules")
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if vndkdep.isVndkSp() {
|
||||
mctx.PropertyErrorf("vndk",
|
||||
"must set `enabled: true` to set `support_system_process: true`")
|
||||
}
|
||||
if vndkdep.isVndkExt() {
|
||||
mctx.PropertyErrorf("vndk",
|
||||
"must set `enabled: true` to set `extends: %q`",
|
||||
m.getVndkExtendsModuleName())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (m *Module) VendorAvailable() bool {
|
||||
return Bool(m.VendorProperties.Vendor_available)
|
||||
}
|
||||
@@ -456,7 +355,7 @@ func MutateImage(mctx android.BaseModuleContext, m ImageMutatableModule) {
|
||||
} else {
|
||||
vendorVariants = append(vendorVariants, m.SnapshotVersion(mctx))
|
||||
}
|
||||
} else if m.HasNonSystemVariants() && !m.IsVndkExt() {
|
||||
} else if m.HasNonSystemVariants() {
|
||||
// This will be available to /system unless it is product_specific
|
||||
// which will be handled later.
|
||||
coreVariantNeeded = true
|
||||
|
@@ -1762,22 +1762,7 @@ func (library *libraryDecorator) installSymlinkToRuntimeApex(ctx ModuleContext,
|
||||
|
||||
func (library *libraryDecorator) install(ctx ModuleContext, file android.Path) {
|
||||
if library.shared() {
|
||||
if ctx.Device() && ctx.useVndk() {
|
||||
// set subDir for VNDK extensions
|
||||
if ctx.IsVndkExt() {
|
||||
if ctx.isVndkSp() {
|
||||
library.baseInstaller.subDir = "vndk-sp"
|
||||
} else {
|
||||
library.baseInstaller.subDir = "vndk"
|
||||
}
|
||||
}
|
||||
|
||||
// do not install vndk libs
|
||||
// vndk libs are packaged into VNDK APEX
|
||||
if ctx.isVndk() && !ctx.IsVndkExt() && !ctx.Config().IsVndkDeprecated() && !ctx.inProduct() {
|
||||
return
|
||||
}
|
||||
} else if library.hasStubsVariants() && !ctx.Host() && ctx.directlyInAnyApex() {
|
||||
if library.hasStubsVariants() && !ctx.Host() && ctx.directlyInAnyApex() {
|
||||
// Bionic libraries (e.g. libc.so) is installed to the bootstrap subdirectory.
|
||||
// The original path becomes a symlink to the corresponding file in the
|
||||
// runtime APEX.
|
||||
|
@@ -136,9 +136,6 @@ type LinkableInterface interface {
|
||||
// IsLlndk returns true for both LLNDK (public) and LLNDK-private libs.
|
||||
IsLlndk() bool
|
||||
|
||||
// IsLlndkPublic returns true only for LLNDK (public) libs.
|
||||
IsLlndkPublic() bool
|
||||
|
||||
// HasLlndkStubs returns true if this library has a variant that will build LLNDK stubs.
|
||||
HasLlndkStubs() bool
|
||||
|
||||
@@ -162,12 +159,6 @@ type LinkableInterface interface {
|
||||
// Bootstrap tests if this module is allowed to use non-APEX version of libraries.
|
||||
Bootstrap() bool
|
||||
|
||||
// IsVndkSp returns true if this is a VNDK-SP module.
|
||||
IsVndkSp() bool
|
||||
|
||||
IsVndk() bool
|
||||
IsVndkExt() bool
|
||||
IsVndkPrivate() bool
|
||||
IsVendorPublicLibrary() bool
|
||||
IsVndkPrebuiltLibrary() bool
|
||||
HasVendorVariant() bool
|
||||
|
@@ -15,6 +15,7 @@
|
||||
package cc
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"android/soong/android"
|
||||
@@ -122,6 +123,16 @@ func (txt *llndkLibrariesTxtModule) GenerateAndroidBuildActions(ctx android.Modu
|
||||
ctx.SetOutputFiles(android.Paths{txt.outputFile}, "")
|
||||
}
|
||||
|
||||
func getVndkFileName(m *Module) (string, error) {
|
||||
if library, ok := m.linker.(*libraryDecorator); ok {
|
||||
return library.getLibNameHelper(m.BaseModuleName(), true, false) + ".so", nil
|
||||
}
|
||||
if prebuilt, ok := m.linker.(*prebuiltLibraryLinker); ok {
|
||||
return prebuilt.libraryDecorator.getLibNameHelper(m.BaseModuleName(), true, false) + ".so", nil
|
||||
}
|
||||
return "", fmt.Errorf("VNDK library should have libraryDecorator or prebuiltLibraryLinker as linker: %T", m.linker)
|
||||
}
|
||||
|
||||
func (txt *llndkLibrariesTxtModule) GenerateSingletonBuildActions(ctx android.SingletonContext) {
|
||||
if txt.outputFile.String() == "" {
|
||||
// Skip if target file path is empty
|
||||
@@ -197,8 +208,10 @@ func llndkMutator(mctx android.BottomUpMutatorContext) {
|
||||
m.VendorProperties.IsLLNDK = true
|
||||
}
|
||||
|
||||
if m.IsVndkPrebuiltLibrary() && !m.IsVndk() {
|
||||
m.VendorProperties.IsLLNDK = true
|
||||
if vndkprebuilt, ok := m.linker.(*vndkPrebuiltLibraryDecorator); ok {
|
||||
if !Bool(vndkprebuilt.properties.Vndk.Enabled) {
|
||||
m.VendorProperties.IsLLNDK = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -681,12 +681,6 @@ func (sanitize *sanitize) begin(ctx BaseModuleContext) {
|
||||
s.Integer_overflow = nil
|
||||
}
|
||||
|
||||
// Also disable CFI for VNDK variants of components
|
||||
if ctx.isVndk() && ctx.useVndk() {
|
||||
s.Cfi = nil
|
||||
s.Diag.Cfi = nil
|
||||
}
|
||||
|
||||
if ctx.inRamdisk() || ctx.inVendorRamdisk() || ctx.inRecovery() {
|
||||
// HWASan ramdisk (which is built from recovery) goes over some bootloader limit.
|
||||
// Keep libc instrumented so that ramdisk / vendor_ramdisk / recovery can run hwasan-instrumented code if necessary.
|
||||
|
@@ -555,7 +555,6 @@ var PrepareForTestWithCcBuildComponents = android.GroupFixturePreparers(
|
||||
ctx.RegisterModuleType("cc_test_library", TestLibraryFactory)
|
||||
ctx.RegisterModuleType("vndk_prebuilt_shared", VndkPrebuiltSharedFactory)
|
||||
|
||||
RegisterVndkLibraryTxtTypes(ctx)
|
||||
RegisterLlndkLibraryTxtType(ctx)
|
||||
}),
|
||||
|
||||
@@ -704,7 +703,6 @@ func CreateTestContext(config android.Config) *android.TestContext {
|
||||
ctx.RegisterModuleType("filegroup", android.FileGroupFactory)
|
||||
ctx.RegisterModuleType("vndk_prebuilt_shared", VndkPrebuiltSharedFactory)
|
||||
|
||||
RegisterVndkLibraryTxtTypes(ctx)
|
||||
RegisterLlndkLibraryTxtType(ctx)
|
||||
|
||||
ctx.PreArchMutators(android.RegisterDefaultsPreArchMutators)
|
||||
|
449
cc/vndk.go
449
cc/vndk.go
@@ -15,25 +15,17 @@
|
||||
package cc
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"android/soong/android"
|
||||
"android/soong/etc"
|
||||
|
||||
"github.com/google/blueprint"
|
||||
"github.com/google/blueprint/proptools"
|
||||
)
|
||||
|
||||
const (
|
||||
llndkLibrariesTxt = "llndk.libraries.txt"
|
||||
llndkLibrariesTxtForApex = "llndk.libraries.txt.apex"
|
||||
vndkCoreLibrariesTxt = "vndkcore.libraries.txt"
|
||||
vndkSpLibrariesTxt = "vndksp.libraries.txt"
|
||||
vndkPrivateLibrariesTxt = "vndkprivate.libraries.txt"
|
||||
vndkProductLibrariesTxt = "vndkproduct.libraries.txt"
|
||||
vndkUsingCoreVariantLibrariesTxt = "vndkcorevariant.libraries.txt"
|
||||
llndkLibrariesTxt = "llndk.libraries.txt"
|
||||
vndkCoreLibrariesTxt = "vndkcore.libraries.txt"
|
||||
vndkSpLibrariesTxt = "vndksp.libraries.txt"
|
||||
vndkPrivateLibrariesTxt = "vndkprivate.libraries.txt"
|
||||
vndkProductLibrariesTxt = "vndkproduct.libraries.txt"
|
||||
)
|
||||
|
||||
func VndkLibrariesTxtModules(vndkVersion string, ctx android.BaseModuleContext) []string {
|
||||
@@ -83,440 +75,9 @@ type VndkProperties struct {
|
||||
}
|
||||
}
|
||||
|
||||
type vndkdep struct {
|
||||
Properties VndkProperties
|
||||
}
|
||||
|
||||
func (vndk *vndkdep) props() []interface{} {
|
||||
return []interface{}{&vndk.Properties}
|
||||
}
|
||||
|
||||
func (vndk *vndkdep) isVndk() bool {
|
||||
return Bool(vndk.Properties.Vndk.Enabled)
|
||||
}
|
||||
|
||||
func (vndk *vndkdep) isVndkSp() bool {
|
||||
return Bool(vndk.Properties.Vndk.Support_system_process)
|
||||
}
|
||||
|
||||
func (vndk *vndkdep) isVndkExt() bool {
|
||||
return vndk.Properties.Vndk.Extends != nil
|
||||
}
|
||||
|
||||
func (vndk *vndkdep) getVndkExtendsModuleName() string {
|
||||
return String(vndk.Properties.Vndk.Extends)
|
||||
}
|
||||
|
||||
func (vndk *vndkdep) typeName() string {
|
||||
if !vndk.isVndk() {
|
||||
return "native:vendor"
|
||||
}
|
||||
if !vndk.isVndkExt() {
|
||||
if !vndk.isVndkSp() {
|
||||
return "native:vendor:vndk"
|
||||
}
|
||||
return "native:vendor:vndksp"
|
||||
}
|
||||
if !vndk.isVndkSp() {
|
||||
return "native:vendor:vndkext"
|
||||
}
|
||||
return "native:vendor:vndkspext"
|
||||
}
|
||||
|
||||
// VNDK link type check from a module with UseVndk() == true.
|
||||
func (vndk *vndkdep) vndkCheckLinkType(ctx android.BaseModuleContext, to *Module, tag blueprint.DependencyTag) {
|
||||
if to.linker == nil {
|
||||
return
|
||||
}
|
||||
if !vndk.isVndk() {
|
||||
// Non-VNDK modules those installed to /vendor, /system/vendor,
|
||||
// /product or /system/product cannot depend on VNDK-private modules
|
||||
// that include VNDK-core-private, VNDK-SP-private and LLNDK-private.
|
||||
if to.IsVndkPrivate() {
|
||||
ctx.ModuleErrorf("non-VNDK module should not link to %q which has `private: true`", to.Name())
|
||||
}
|
||||
}
|
||||
if lib, ok := to.linker.(*libraryDecorator); !ok || !lib.shared() {
|
||||
// Check only shared libraries.
|
||||
// Other (static) libraries are allowed to link.
|
||||
return
|
||||
}
|
||||
|
||||
if to.IsLlndk() {
|
||||
// LL-NDK libraries are allowed to link
|
||||
return
|
||||
}
|
||||
|
||||
if !to.UseVndk() {
|
||||
ctx.ModuleErrorf("(%s) should not link to %q which is not a vendor-available library",
|
||||
vndk.typeName(), to.Name())
|
||||
return
|
||||
}
|
||||
if tag == vndkExtDepTag {
|
||||
// Ensure `extends: "name"` property refers a vndk module that has vendor_available
|
||||
// and has identical vndk properties.
|
||||
if to.vndkdep == nil || !to.vndkdep.isVndk() {
|
||||
ctx.ModuleErrorf("`extends` refers a non-vndk module %q", to.Name())
|
||||
return
|
||||
}
|
||||
if vndk.isVndkSp() != to.vndkdep.isVndkSp() {
|
||||
ctx.ModuleErrorf(
|
||||
"`extends` refers a module %q with mismatched support_system_process",
|
||||
to.Name())
|
||||
return
|
||||
}
|
||||
if to.IsVndkPrivate() {
|
||||
ctx.ModuleErrorf(
|
||||
"`extends` refers module %q which has `private: true`",
|
||||
to.Name())
|
||||
return
|
||||
}
|
||||
}
|
||||
if to.vndkdep == nil {
|
||||
return
|
||||
}
|
||||
|
||||
// Check the dependencies of VNDK shared libraries.
|
||||
if err := vndkIsVndkDepAllowed(vndk, to.vndkdep); err != nil {
|
||||
ctx.ModuleErrorf("(%s) should not link to %q (%s): %v",
|
||||
vndk.typeName(), to.Name(), to.vndkdep.typeName(), err)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
func vndkIsVndkDepAllowed(from *vndkdep, to *vndkdep) error {
|
||||
// Check the dependencies of VNDK, VNDK-Ext, VNDK-SP, VNDK-SP-Ext and vendor modules.
|
||||
if from.isVndkExt() {
|
||||
if from.isVndkSp() {
|
||||
if to.isVndk() && !to.isVndkSp() {
|
||||
return errors.New("VNDK-SP extensions must not depend on VNDK or VNDK extensions")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
// VNDK-Ext may depend on VNDK, VNDK-Ext, VNDK-SP, VNDK-SP-Ext, or vendor libs.
|
||||
return nil
|
||||
}
|
||||
if from.isVndk() {
|
||||
if to.isVndkExt() {
|
||||
return errors.New("VNDK-core and VNDK-SP must not depend on VNDK extensions")
|
||||
}
|
||||
if from.isVndkSp() {
|
||||
if !to.isVndkSp() {
|
||||
return errors.New("VNDK-SP must only depend on VNDK-SP")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
if !to.isVndk() {
|
||||
return errors.New("VNDK-core must only depend on VNDK-core or VNDK-SP")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
// Vendor modules may depend on VNDK, VNDK-Ext, VNDK-SP, VNDK-SP-Ext, or vendor libs.
|
||||
return nil
|
||||
}
|
||||
|
||||
type moduleListerFunc func(ctx android.SingletonContext) (moduleNames, fileNames []string)
|
||||
|
||||
var (
|
||||
vndkSPLibraries = vndkModuleLister(func(m *Module) bool { return m.VendorProperties.IsVNDKSP })
|
||||
vndkCoreLibraries = vndkModuleLister(func(m *Module) bool { return m.VendorProperties.IsVNDKCore })
|
||||
vndkPrivateLibraries = vndkModuleLister(func(m *Module) bool { return m.VendorProperties.IsVNDKPrivate })
|
||||
vndkProductLibraries = vndkModuleLister(func(m *Module) bool { return m.VendorProperties.IsVNDKProduct })
|
||||
)
|
||||
|
||||
// vndkModuleLister takes a predicate that operates on a Module and returns a moduleListerFunc
|
||||
// that produces a list of module names and output file names for which the predicate returns true.
|
||||
func vndkModuleLister(predicate func(*Module) bool) moduleListerFunc {
|
||||
return func(ctx android.SingletonContext) (moduleNames, fileNames []string) {
|
||||
ctx.VisitAllModules(func(m android.Module) {
|
||||
if c, ok := m.(*Module); ok && predicate(c) && !c.IsVndkPrebuiltLibrary() {
|
||||
filename, err := getVndkFileName(c)
|
||||
if err != nil {
|
||||
ctx.ModuleErrorf(m, "%s", err)
|
||||
}
|
||||
moduleNames = append(moduleNames, ctx.ModuleName(m))
|
||||
fileNames = append(fileNames, filename)
|
||||
}
|
||||
})
|
||||
moduleNames = android.SortedUniqueStrings(moduleNames)
|
||||
fileNames = android.SortedUniqueStrings(fileNames)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// vndkModuleListRemover takes a moduleListerFunc and a prefix and returns a moduleListerFunc
|
||||
// that returns the same lists as the input moduleListerFunc, but with modules with the
|
||||
// given prefix removed.
|
||||
func vndkModuleListRemover(lister moduleListerFunc, prefix string) moduleListerFunc {
|
||||
return func(ctx android.SingletonContext) (moduleNames, fileNames []string) {
|
||||
moduleNames, fileNames = lister(ctx)
|
||||
filter := func(in []string) []string {
|
||||
out := make([]string, 0, len(in))
|
||||
for _, lib := range in {
|
||||
if strings.HasPrefix(lib, prefix) {
|
||||
continue
|
||||
}
|
||||
out = append(out, lib)
|
||||
}
|
||||
return out
|
||||
}
|
||||
return filter(moduleNames), filter(fileNames)
|
||||
}
|
||||
}
|
||||
|
||||
func processVndkLibrary(mctx android.BottomUpMutatorContext, m *Module) {
|
||||
if m.InProduct() {
|
||||
// We may skip the steps for the product variants because they
|
||||
// are already covered by the vendor variants.
|
||||
return
|
||||
}
|
||||
|
||||
name := m.BaseModuleName()
|
||||
|
||||
if lib := m.library; lib != nil && lib.hasStubsVariants() && name != "libz" {
|
||||
// b/155456180 libz is the ONLY exception here. We don't want to make
|
||||
// libz an LLNDK library because we in general can't guarantee that
|
||||
// libz will behave consistently especially about the compression.
|
||||
// i.e. the compressed output might be different across releases.
|
||||
// As the library is an external one, it's risky to keep the compatibility
|
||||
// promise if it becomes an LLNDK.
|
||||
mctx.PropertyErrorf("vndk.enabled", "This library provides stubs. Shouldn't be VNDK. Consider making it as LLNDK")
|
||||
}
|
||||
|
||||
if m.vndkdep.isVndkSp() {
|
||||
m.VendorProperties.IsVNDKSP = true
|
||||
} else {
|
||||
m.VendorProperties.IsVNDKCore = true
|
||||
}
|
||||
if m.IsVndkPrivate() {
|
||||
m.VendorProperties.IsVNDKPrivate = true
|
||||
}
|
||||
if Bool(m.VendorProperties.Product_available) {
|
||||
m.VendorProperties.IsVNDKProduct = true
|
||||
}
|
||||
}
|
||||
|
||||
// Check for modules that mustn't be VNDK
|
||||
func shouldSkipVndkMutator(ctx android.ConfigAndErrorContext, m *Module) bool {
|
||||
if !m.Enabled(ctx) {
|
||||
return true
|
||||
}
|
||||
if !m.Device() {
|
||||
// Skip non-device modules
|
||||
return true
|
||||
}
|
||||
if m.Target().NativeBridge == android.NativeBridgeEnabled {
|
||||
// Skip native_bridge modules
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func IsForVndkApex(mctx android.BottomUpMutatorContext, m *Module) bool {
|
||||
if shouldSkipVndkMutator(mctx, m) {
|
||||
return false
|
||||
}
|
||||
|
||||
// TODO(b/142675459): Use enabled: to select target device in vndk_prebuilt_shared
|
||||
// When b/142675459 is landed, remove following check
|
||||
if p, ok := m.linker.(*vndkPrebuiltLibraryDecorator); ok {
|
||||
// prebuilt vndk modules should match with device
|
||||
if !p.MatchesWithDevice(mctx.DeviceConfig()) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
if lib, ok := m.linker.(libraryInterface); ok {
|
||||
// VNDK APEX doesn't need stub variants
|
||||
if lib.buildStubs() {
|
||||
return false
|
||||
}
|
||||
return lib.shared() && m.InVendor() && m.IsVndk() && !m.IsVndkExt()
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// gather list of vndk-core, vndk-sp, and ll-ndk libs
|
||||
func VndkMutator(mctx android.BottomUpMutatorContext) {
|
||||
m, ok := mctx.Module().(*Module)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
|
||||
if shouldSkipVndkMutator(mctx, m) {
|
||||
return
|
||||
}
|
||||
|
||||
lib, isLib := m.linker.(*libraryDecorator)
|
||||
prebuiltLib, isPrebuiltLib := m.linker.(*prebuiltLibraryLinker)
|
||||
|
||||
if m.InVendorOrProduct() && isLib && lib.hasLLNDKStubs() {
|
||||
m.VendorProperties.IsVNDKPrivate = Bool(lib.Properties.Llndk.Private)
|
||||
}
|
||||
if m.InVendorOrProduct() && isPrebuiltLib && prebuiltLib.hasLLNDKStubs() {
|
||||
m.VendorProperties.IsVNDKPrivate = Bool(prebuiltLib.Properties.Llndk.Private)
|
||||
}
|
||||
|
||||
if (isLib && lib.buildShared()) || (isPrebuiltLib && prebuiltLib.buildShared()) {
|
||||
if m.vndkdep != nil && m.vndkdep.isVndk() && !m.vndkdep.isVndkExt() {
|
||||
processVndkLibrary(mctx, m)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func init() {
|
||||
RegisterVndkLibraryTxtTypes(android.InitRegistrationContext)
|
||||
}
|
||||
|
||||
func RegisterVndkLibraryTxtTypes(ctx android.RegistrationContext) {
|
||||
ctx.RegisterParallelSingletonModuleType("vndksp_libraries_txt", vndkSPLibrariesTxtFactory)
|
||||
ctx.RegisterParallelSingletonModuleType("vndkcore_libraries_txt", vndkCoreLibrariesTxtFactory)
|
||||
ctx.RegisterParallelSingletonModuleType("vndkprivate_libraries_txt", vndkPrivateLibrariesTxtFactory)
|
||||
ctx.RegisterParallelSingletonModuleType("vndkproduct_libraries_txt", vndkProductLibrariesTxtFactory)
|
||||
}
|
||||
|
||||
type vndkLibrariesTxt struct {
|
||||
android.SingletonModuleBase
|
||||
|
||||
lister moduleListerFunc
|
||||
makeVarName string
|
||||
filterOutFromMakeVar string
|
||||
|
||||
properties VndkLibrariesTxtProperties
|
||||
|
||||
outputFile android.OutputPath
|
||||
moduleNames []string
|
||||
fileNames []string
|
||||
}
|
||||
|
||||
type VndkLibrariesTxtProperties struct {
|
||||
Insert_vndk_version *bool
|
||||
Stem *string
|
||||
}
|
||||
|
||||
var _ etc.PrebuiltEtcModule = &vndkLibrariesTxt{}
|
||||
|
||||
// vndksp_libraries_txt is a singleton module whose content is a list of VNDKSP libraries
|
||||
// generated by Soong but can be referenced by other modules.
|
||||
// For example, apex_vndk can depend on these files as prebuilt.
|
||||
func vndkSPLibrariesTxtFactory() android.SingletonModule {
|
||||
return newVndkLibrariesTxt(vndkSPLibraries, "VNDK_SAMEPROCESS_LIBRARIES")
|
||||
}
|
||||
|
||||
// vndkcore_libraries_txt is a singleton module whose content is a list of VNDK core libraries
|
||||
// generated by Soong but can be referenced by other modules.
|
||||
// For example, apex_vndk can depend on these files as prebuilt.
|
||||
func vndkCoreLibrariesTxtFactory() android.SingletonModule {
|
||||
return newVndkLibrariesTxt(vndkCoreLibraries, "VNDK_CORE_LIBRARIES")
|
||||
}
|
||||
|
||||
// vndkprivate_libraries_txt is a singleton module whose content is a list of VNDK private libraries
|
||||
// generated by Soong but can be referenced by other modules.
|
||||
// For example, apex_vndk can depend on these files as prebuilt.
|
||||
func vndkPrivateLibrariesTxtFactory() android.SingletonModule {
|
||||
return newVndkLibrariesTxt(vndkPrivateLibraries, "VNDK_PRIVATE_LIBRARIES")
|
||||
}
|
||||
|
||||
// vndkproduct_libraries_txt is a singleton module whose content is a list of VNDK product libraries
|
||||
// generated by Soong but can be referenced by other modules.
|
||||
// For example, apex_vndk can depend on these files as prebuilt.
|
||||
func vndkProductLibrariesTxtFactory() android.SingletonModule {
|
||||
return newVndkLibrariesTxt(vndkProductLibraries, "VNDK_PRODUCT_LIBRARIES")
|
||||
}
|
||||
|
||||
func newVndkLibrariesWithMakeVarFilter(lister moduleListerFunc, makeVarName string, filter string) android.SingletonModule {
|
||||
m := &vndkLibrariesTxt{
|
||||
lister: lister,
|
||||
makeVarName: makeVarName,
|
||||
filterOutFromMakeVar: filter,
|
||||
}
|
||||
m.AddProperties(&m.properties)
|
||||
android.InitAndroidArchModule(m, android.DeviceSupported, android.MultilibCommon)
|
||||
return m
|
||||
}
|
||||
|
||||
func newVndkLibrariesTxt(lister moduleListerFunc, makeVarName string) android.SingletonModule {
|
||||
return newVndkLibrariesWithMakeVarFilter(lister, makeVarName, "")
|
||||
}
|
||||
|
||||
func insertVndkVersion(filename string, vndkVersion string) string {
|
||||
if index := strings.LastIndex(filename, "."); index != -1 {
|
||||
return filename[:index] + "." + vndkVersion + filename[index:]
|
||||
}
|
||||
return filename
|
||||
}
|
||||
|
||||
func (txt *vndkLibrariesTxt) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
||||
filename := proptools.StringDefault(txt.properties.Stem, txt.Name())
|
||||
|
||||
txt.outputFile = android.PathForModuleOut(ctx, filename).OutputPath
|
||||
|
||||
installPath := android.PathForModuleInstall(ctx, "etc")
|
||||
ctx.InstallFile(installPath, filename, txt.outputFile)
|
||||
|
||||
ctx.SetOutputFiles(android.Paths{txt.outputFile}, "")
|
||||
}
|
||||
|
||||
func (txt *vndkLibrariesTxt) GenerateSingletonBuildActions(ctx android.SingletonContext) {
|
||||
txt.moduleNames, txt.fileNames = txt.lister(ctx)
|
||||
android.WriteFileRule(ctx, txt.outputFile, strings.Join(txt.fileNames, "\n"))
|
||||
}
|
||||
|
||||
func (txt *vndkLibrariesTxt) AndroidMkEntries() []android.AndroidMkEntries {
|
||||
return []android.AndroidMkEntries{android.AndroidMkEntries{
|
||||
Class: "ETC",
|
||||
OutputFile: android.OptionalPathForPath(txt.outputFile),
|
||||
ExtraEntries: []android.AndroidMkExtraEntriesFunc{
|
||||
func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
|
||||
entries.SetString("LOCAL_MODULE_STEM", txt.outputFile.Base())
|
||||
},
|
||||
},
|
||||
}}
|
||||
}
|
||||
|
||||
func (txt *vndkLibrariesTxt) MakeVars(ctx android.MakeVarsContext) {
|
||||
if txt.makeVarName == "" {
|
||||
return
|
||||
}
|
||||
|
||||
filter := func(modules []string, prefix string) []string {
|
||||
if prefix == "" {
|
||||
return modules
|
||||
}
|
||||
var result []string
|
||||
for _, module := range modules {
|
||||
if strings.HasPrefix(module, prefix) {
|
||||
continue
|
||||
} else {
|
||||
result = append(result, module)
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
ctx.Strict(txt.makeVarName, strings.Join(filter(txt.moduleNames, txt.filterOutFromMakeVar), " "))
|
||||
}
|
||||
|
||||
// PrebuiltEtcModule interface
|
||||
func (txt *vndkLibrariesTxt) BaseDir() string {
|
||||
return "etc"
|
||||
}
|
||||
|
||||
// PrebuiltEtcModule interface
|
||||
func (txt *vndkLibrariesTxt) SubDir() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func (txt *vndkLibrariesTxt) OutputFiles(tag string) (android.Paths, error) {
|
||||
return android.Paths{txt.outputFile}, nil
|
||||
}
|
||||
|
||||
func getVndkFileName(m *Module) (string, error) {
|
||||
if library, ok := m.linker.(*libraryDecorator); ok {
|
||||
return library.getLibNameHelper(m.BaseModuleName(), true, false) + ".so", nil
|
||||
}
|
||||
if prebuilt, ok := m.linker.(*prebuiltLibraryLinker); ok {
|
||||
return prebuilt.libraryDecorator.getLibNameHelper(m.BaseModuleName(), true, false) + ".so", nil
|
||||
}
|
||||
return "", fmt.Errorf("VNDK library should have libraryDecorator or prebuiltLibraryLinker as linker: %T", m.linker)
|
||||
}
|
||||
|
@@ -49,6 +49,8 @@ var (
|
||||
// },
|
||||
// }
|
||||
type vndkPrebuiltProperties struct {
|
||||
VndkProperties
|
||||
|
||||
// VNDK snapshot version.
|
||||
Version *string
|
||||
|
||||
@@ -268,3 +270,14 @@ func VndkPrebuiltSharedFactory() android.Module {
|
||||
func init() {
|
||||
android.RegisterModuleType("vndk_prebuilt_shared", VndkPrebuiltSharedFactory)
|
||||
}
|
||||
|
||||
func IsForVndkApex(mctx android.BottomUpMutatorContext, m *Module) bool {
|
||||
if !m.Enabled(mctx) {
|
||||
return true
|
||||
}
|
||||
|
||||
if p, ok := m.linker.(*vndkPrebuiltLibraryDecorator); ok {
|
||||
return p.MatchesWithDevice(mctx.DeviceConfig()) && Bool(p.properties.Vndk.Enabled)
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
15
java/base.go
15
java/base.go
@@ -94,6 +94,9 @@ type CommonProperties struct {
|
||||
// if not blank, used as prefix to generate repackage rule
|
||||
Jarjar_prefix *string
|
||||
|
||||
// if set to true, skip the jarjar repackaging
|
||||
Skip_jarjar_repackage *bool
|
||||
|
||||
// If not blank, set the java version passed to javac as -source and -target
|
||||
Java_version *string
|
||||
|
||||
@@ -1109,11 +1112,13 @@ func (j *Module) compile(ctx android.ModuleContext, extraSrcJars, extraClasspath
|
||||
jarjarProviderData := j.collectJarJarRules(ctx)
|
||||
if jarjarProviderData != nil {
|
||||
android.SetProvider(ctx, JarJarProvider, *jarjarProviderData)
|
||||
text := getJarJarRuleText(jarjarProviderData)
|
||||
if text != "" {
|
||||
ruleTextFile := android.PathForModuleOut(ctx, "repackaged-jarjar", "repackaging.txt")
|
||||
android.WriteFileRule(ctx, ruleTextFile, text)
|
||||
j.repackageJarjarRules = ruleTextFile
|
||||
if !proptools.Bool(j.properties.Skip_jarjar_repackage) {
|
||||
text := getJarJarRuleText(jarjarProviderData)
|
||||
if text != "" {
|
||||
ruleTextFile := android.PathForModuleOut(ctx, "repackaged-jarjar", "repackaging.txt")
|
||||
android.WriteFileRule(ctx, ruleTextFile, text)
|
||||
j.repackageJarjarRules = ruleTextFile
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
22
java/lint.go
22
java/lint.go
@@ -319,25 +319,19 @@ func (l *linter) writeLintProjectXML(ctx android.ModuleContext, rule *android.Ru
|
||||
cmd.FlagWithInput("@",
|
||||
android.PathForSource(ctx, "build/soong/java/lint_defaults.txt"))
|
||||
|
||||
if l.compileSdkKind == android.SdkPublic {
|
||||
cmd.FlagForEachArg("--error_check ", l.extraMainlineLintErrors)
|
||||
} else {
|
||||
// TODO(b/268261262): Remove this branch. We're demoting NewApi to a warning due to pre-existing issues that need to be fixed.
|
||||
cmd.FlagForEachArg("--warning_check ", l.extraMainlineLintErrors)
|
||||
}
|
||||
cmd.FlagForEachArg("--error_check ", l.extraMainlineLintErrors)
|
||||
cmd.FlagForEachArg("--disable_check ", l.properties.Lint.Disabled_checks)
|
||||
cmd.FlagForEachArg("--warning_check ", l.properties.Lint.Warning_checks)
|
||||
cmd.FlagForEachArg("--error_check ", l.properties.Lint.Error_checks)
|
||||
cmd.FlagForEachArg("--fatal_check ", l.properties.Lint.Fatal_checks)
|
||||
|
||||
// TODO(b/193460475): Re-enable strict updatability linting
|
||||
//if l.GetStrictUpdatabilityLinting() {
|
||||
// // Verify the module does not baseline issues that endanger safe updatability.
|
||||
// if baselinePath := l.getBaselineFilepath(ctx); baselinePath.Valid() {
|
||||
// cmd.FlagWithInput("--baseline ", baselinePath.Path())
|
||||
// cmd.FlagForEachArg("--disallowed_issues ", updatabilityChecks)
|
||||
// }
|
||||
//}
|
||||
if l.GetStrictUpdatabilityLinting() {
|
||||
// Verify the module does not baseline issues that endanger safe updatability.
|
||||
if l.properties.Lint.Baseline_filename != nil {
|
||||
cmd.FlagWithInput("--baseline ", android.PathForModuleSrc(ctx, *l.properties.Lint.Baseline_filename))
|
||||
cmd.FlagForEachArg("--disallowed_issues ", updatabilityChecks)
|
||||
}
|
||||
}
|
||||
|
||||
return lintPaths{
|
||||
projectXML: projectXMLPath,
|
||||
|
@@ -91,9 +91,8 @@ func TestJavaLintUsesCorrectBpConfig(t *testing.T) {
|
||||
t.Error("did not use the correct file for baseline")
|
||||
}
|
||||
|
||||
if !strings.Contains(*sboxProto.Commands[0].Command, "--warning_check NewApi") {
|
||||
// TODO(b/268261262): Change this to check for --error_check
|
||||
t.Error("should check NewApi warnings")
|
||||
if !strings.Contains(*sboxProto.Commands[0].Command, "--error_check NewApi") {
|
||||
t.Error("should check NewApi errors")
|
||||
}
|
||||
|
||||
if !strings.Contains(*sboxProto.Commands[0].Command, "--error_check SomeCheck") {
|
||||
@@ -153,52 +152,55 @@ func TestJavaLintBypassUpdatableChecks(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// TODO(b/193460475): Re-enable this test
|
||||
//func TestJavaLintStrictUpdatabilityLinting(t *testing.T) {
|
||||
// bp := `
|
||||
// java_library {
|
||||
// name: "foo",
|
||||
// srcs: [
|
||||
// "a.java",
|
||||
// ],
|
||||
// static_libs: ["bar"],
|
||||
// min_sdk_version: "29",
|
||||
// sdk_version: "current",
|
||||
// lint: {
|
||||
// strict_updatability_linting: true,
|
||||
// },
|
||||
// }
|
||||
//
|
||||
// java_library {
|
||||
// name: "bar",
|
||||
// srcs: [
|
||||
// "a.java",
|
||||
// ],
|
||||
// min_sdk_version: "29",
|
||||
// sdk_version: "current",
|
||||
// }
|
||||
// `
|
||||
// fs := android.MockFS{
|
||||
// "lint-baseline.xml": nil,
|
||||
// }
|
||||
//
|
||||
// result := android.GroupFixturePreparers(PrepareForTestWithJavaDefaultModules, fs.AddToFixture()).
|
||||
// RunTestWithBp(t, bp)
|
||||
//
|
||||
// foo := result.ModuleForTests("foo", "android_common")
|
||||
// sboxProto := android.RuleBuilderSboxProtoForTests(t, foo.Output("lint.sbox.textproto"))
|
||||
// if !strings.Contains(*sboxProto.Commands[0].Command,
|
||||
// "--baseline lint-baseline.xml --disallowed_issues NewApi") {
|
||||
// t.Error("did not restrict baselining NewApi")
|
||||
// }
|
||||
//
|
||||
// bar := result.ModuleForTests("bar", "android_common")
|
||||
// sboxProto = android.RuleBuilderSboxProtoForTests(t, bar.Output("lint.sbox.textproto"))
|
||||
// if !strings.Contains(*sboxProto.Commands[0].Command,
|
||||
// "--baseline lint-baseline.xml --disallowed_issues NewApi") {
|
||||
// t.Error("did not restrict baselining NewApi")
|
||||
// }
|
||||
//}
|
||||
func TestJavaLintStrictUpdatabilityLinting(t *testing.T) {
|
||||
bp := `
|
||||
java_library {
|
||||
name: "foo",
|
||||
srcs: [
|
||||
"a.java",
|
||||
],
|
||||
static_libs: ["bar"],
|
||||
min_sdk_version: "29",
|
||||
sdk_version: "current",
|
||||
lint: {
|
||||
strict_updatability_linting: true,
|
||||
baseline_filename: "lint-baseline.xml",
|
||||
},
|
||||
}
|
||||
|
||||
java_library {
|
||||
name: "bar",
|
||||
srcs: [
|
||||
"a.java",
|
||||
],
|
||||
min_sdk_version: "29",
|
||||
sdk_version: "current",
|
||||
lint: {
|
||||
baseline_filename: "lint-baseline.xml",
|
||||
}
|
||||
}
|
||||
`
|
||||
fs := android.MockFS{
|
||||
"lint-baseline.xml": nil,
|
||||
}
|
||||
|
||||
result := android.GroupFixturePreparers(PrepareForTestWithJavaDefaultModules, fs.AddToFixture()).
|
||||
RunTestWithBp(t, bp)
|
||||
|
||||
foo := result.ModuleForTests("foo", "android_common")
|
||||
sboxProto := android.RuleBuilderSboxProtoForTests(t, result.TestContext, foo.Output("lint.sbox.textproto"))
|
||||
if !strings.Contains(*sboxProto.Commands[0].Command,
|
||||
"--baseline lint-baseline.xml --disallowed_issues NewApi") {
|
||||
t.Error("did not restrict baselining NewApi")
|
||||
}
|
||||
|
||||
bar := result.ModuleForTests("bar", "android_common")
|
||||
sboxProto = android.RuleBuilderSboxProtoForTests(t, result.TestContext, bar.Output("lint.sbox.textproto"))
|
||||
if !strings.Contains(*sboxProto.Commands[0].Command,
|
||||
"--baseline lint-baseline.xml --disallowed_issues NewApi") {
|
||||
t.Error("did not restrict baselining NewApi")
|
||||
}
|
||||
}
|
||||
|
||||
func TestJavaLintDatabaseSelectionFull(t *testing.T) {
|
||||
testCases := []struct {
|
||||
|
17
rust/rust.go
17
rust/rust.go
@@ -345,19 +345,6 @@ func (mod *Module) SubName() string {
|
||||
return mod.Properties.SubName
|
||||
}
|
||||
|
||||
func (mod *Module) IsVndk() bool {
|
||||
// TODO(b/165791368)
|
||||
return false
|
||||
}
|
||||
|
||||
func (mod *Module) IsVndkExt() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (mod *Module) IsVndkSp() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (mod *Module) IsVndkPrebuiltLibrary() bool {
|
||||
// Rust modules do not provide VNDK prebuilts
|
||||
return false
|
||||
@@ -380,10 +367,6 @@ func (c *Module) IsLlndk() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (c *Module) IsLlndkPublic() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (mod *Module) KernelHeadersDecorator() bool {
|
||||
return false
|
||||
}
|
||||
|
Reference in New Issue
Block a user