Merge "sysprop_library: Rename system scope to public"

This commit is contained in:
Treehugger Robot 2019-06-16 06:08:14 +00:00 committed by Gerrit Code Review
commit b1856799b1
3 changed files with 17 additions and 17 deletions

View File

@ -39,11 +39,11 @@ var (
sysprop = pctx.AndroidStaticRule("sysprop",
blueprint.RuleParams{
Command: "$syspropCmd --header-dir=$headerOutDir --system-header-dir=$systemOutDir " +
Command: "$syspropCmd --header-dir=$headerOutDir --public-header-dir=$publicOutDir " +
"--source-dir=$srcOutDir --include-name=$includeName $in",
CommandDeps: []string{"$syspropCmd"},
},
"headerOutDir", "systemOutDir", "srcOutDir", "includeName")
"headerOutDir", "publicOutDir", "srcOutDir", "includeName")
windmc = pctx.AndroidStaticRule("windmc",
blueprint.RuleParams{
@ -150,7 +150,7 @@ func genLex(ctx android.ModuleContext, lexFile android.Path, outFile android.Mod
func genSysprop(ctx android.ModuleContext, syspropFile android.Path) (android.Path, android.Path) {
headerFile := android.PathForModuleGen(ctx, "sysprop", "include", syspropFile.Rel()+".h")
systemHeaderFile := android.PathForModuleGen(ctx, "sysprop/system", "include", syspropFile.Rel()+".h")
publicHeaderFile := android.PathForModuleGen(ctx, "sysprop/public", "include", syspropFile.Rel()+".h")
cppFile := android.PathForModuleGen(ctx, "sysprop", syspropFile.Rel()+".cpp")
ctx.Build(pctx, android.BuildParams{
@ -161,7 +161,7 @@ func genSysprop(ctx android.ModuleContext, syspropFile android.Path) (android.Pa
Input: syspropFile,
Args: map[string]string{
"headerOutDir": filepath.Dir(headerFile.String()),
"systemOutDir": filepath.Dir(systemHeaderFile.String()),
"publicOutDir": filepath.Dir(publicHeaderFile.String()),
"srcOutDir": filepath.Dir(cppFile.String()),
"includeName": syspropFile.Rel() + ".h",
},

View File

@ -882,10 +882,10 @@ func (library *libraryDecorator) link(ctx ModuleContext,
isVendor := ctx.useVndk()
isOwnerPlatform := Bool(library.Properties.Sysprop.Platform)
useSystem := isProduct || (isOwnerPlatform == isVendor)
usePublic := isProduct || (isOwnerPlatform == isVendor)
if useSystem {
dir = android.PathForModuleGen(ctx, "sysprop/system", "include").String()
if usePublic {
dir = android.PathForModuleGen(ctx, "sysprop/public", "include").String()
}
}

View File

@ -313,13 +313,13 @@ func TestSyspropLibrary(t *testing.T) {
vendorVariant := "android_arm64_armv8-a_vendor_static"
platformInternalPath := "libsysprop-platform/android_arm64_armv8-a_core_static/gen/sysprop/include"
platformSystemCorePath := "libsysprop-platform/android_arm64_armv8-a_core_static/gen/sysprop/system/include"
platformSystemVendorPath := "libsysprop-platform/android_arm64_armv8-a_vendor_static/gen/sysprop/system/include"
platformPublicCorePath := "libsysprop-platform/android_arm64_armv8-a_core_static/gen/sysprop/public/include"
platformPublicVendorPath := "libsysprop-platform/android_arm64_armv8-a_vendor_static/gen/sysprop/public/include"
platformOnProductPath := "libsysprop-platform-on-product/android_arm64_armv8-a_core_static/gen/sysprop/system/include"
platformOnProductPath := "libsysprop-platform-on-product/android_arm64_armv8-a_core_static/gen/sysprop/public/include"
vendorInternalPath := "libsysprop-vendor/android_arm64_armv8-a_vendor_static/gen/sysprop/include"
vendorSystemPath := "libsysprop-vendor/android_arm64_armv8-a_core_static/gen/sysprop/system/include"
vendorPublicPath := "libsysprop-vendor/android_arm64_armv8-a_core_static/gen/sysprop/public/include"
platformClient := ctx.ModuleForTests("cc-client-platform", coreVariant)
platformFlags := platformClient.Rule("cc").Args["cFlags"]
@ -342,20 +342,20 @@ func TestSyspropLibrary(t *testing.T) {
productClient := ctx.ModuleForTests("cc-client-product", coreVariant)
productFlags := productClient.Rule("cc").Args["cFlags"]
// Product should use platform's and vendor's system headers
// Product should use platform's and vendor's public headers
if !strings.Contains(productFlags, platformOnProductPath) ||
!strings.Contains(productFlags, vendorSystemPath) {
!strings.Contains(productFlags, vendorPublicPath) {
t.Errorf("flags for product must contain %#v and %#v, but was %#v.",
platformSystemCorePath, vendorSystemPath, productFlags)
platformPublicCorePath, vendorPublicPath, productFlags)
}
vendorClient := ctx.ModuleForTests("cc-client-vendor", vendorVariant)
vendorFlags := vendorClient.Rule("cc").Args["cFlags"]
// Vendor should use platform's system header and vendor's internal header
if !strings.Contains(vendorFlags, platformSystemVendorPath) ||
// Vendor should use platform's public header and vendor's internal header
if !strings.Contains(vendorFlags, platformPublicVendorPath) ||
!strings.Contains(vendorFlags, vendorInternalPath) {
t.Errorf("flags for vendor must contain %#v and %#v, but was %#v.",
platformSystemVendorPath, vendorInternalPath, vendorFlags)
platformPublicVendorPath, vendorInternalPath, vendorFlags)
}
}