Merge "Ensure aconfig generated CustomFeatureFlags is renamed by JarJar" into main
diff --git a/.gitignore b/.gitignore
index 781dd32..89de74e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,4 +2,5 @@
*.iml
*.ipr
*.iws
+*.swp
/.vscode
diff --git a/aconfig/codegen/cc_aconfig_library.go b/aconfig/codegen/cc_aconfig_library.go
index 2d3ee39..d5291fc 100644
--- a/aconfig/codegen/cc_aconfig_library.go
+++ b/aconfig/codegen/cc_aconfig_library.go
@@ -36,7 +36,6 @@
const libBaseDep = "libbase"
const libLogDep = "liblog"
const libAconfigStorageReadApiCcDep = "libaconfig_storage_read_api_cc"
-const libAconfigStorageProtosCcDep = "libaconfig_storage_protos_cc"
type CcAconfigLibraryProperties struct {
// name of the aconfig_declarations module to generate a library for
@@ -88,10 +87,10 @@
if mode != "force-read-only" {
deps.SharedLibs = append(deps.SharedLibs, baseLibDep)
- deps.SharedLibs = append(deps.SharedLibs, libBaseDep)
- deps.SharedLibs = append(deps.SharedLibs, libLogDep)
deps.SharedLibs = append(deps.SharedLibs, libAconfigStorageReadApiCcDep)
- deps.SharedLibs = append(deps.SharedLibs, libAconfigStorageProtosCcDep)
+ deps.SharedLibs = append(deps.SharedLibs, libLogDep)
+
+ deps.StaticLibs = append(deps.StaticLibs, libBaseDep)
}
// TODO: It'd be really nice if we could reexport this library and not make everyone do it.
diff --git a/android/arch.go b/android/arch.go
index 3224c3a..cd8882b 100644
--- a/android/arch.go
+++ b/android/arch.go
@@ -975,12 +975,18 @@
panic(fmt.Errorf("unexpected tag format %q", field.Tag))
}
// these tags don't need to be present in the runtime generated struct type.
- values = RemoveListFromList(values, []string{"arch_variant", "variant_prepend", "path", "replace_instead_of_append"})
+ // However replace_instead_of_append does, because it's read by the blueprint
+ // property extending util functions, which can operate on these generated arch
+ // property structs.
+ values = RemoveListFromList(values, []string{"arch_variant", "variant_prepend", "path"})
if len(values) > 0 {
- panic(fmt.Errorf("unknown tags %q in field %q", values, prefix+field.Name))
+ if values[0] != "replace_instead_of_append" || len(values) > 1 {
+ panic(fmt.Errorf("unknown tags %q in field %q", values, prefix+field.Name))
+ }
+ field.Tag = `android:"replace_instead_of_append"`
+ } else {
+ field.Tag = ``
}
-
- field.Tag = ``
return true, field
}
return false, field
diff --git a/apex/aconfig_test.go b/apex/aconfig_test.go
index 3de9286..726041c 100644
--- a/apex/aconfig_test.go
+++ b/apex/aconfig_test.go
@@ -165,6 +165,9 @@
cc_library {
name: "libbase",
srcs: ["libbase.cc"],
+ apex_available: [
+ "myapex",
+ ],
}
cc_library {
name: "libaconfig_storage_read_api_cc",
@@ -425,6 +428,9 @@
cc_library {
name: "libbase",
srcs: ["libbase.cc"],
+ apex_available: [
+ "myapex",
+ ],
}
cc_library {
name: "libaconfig_storage_read_api_cc",
@@ -487,6 +493,9 @@
cc_library {
name: "libbase",
srcs: ["libbase.cc"],
+ apex_available: [
+ "myapex",
+ ],
}
cc_library {
name: "libaconfig_storage_read_api_cc",
diff --git a/apex/apex_test.go b/apex/apex_test.go
index 8a3735c..3e284b1 100644
--- a/apex/apex_test.go
+++ b/apex/apex_test.go
@@ -10694,6 +10694,9 @@
cc_library {
name: "libbase",
srcs: ["libbase.cc"],
+ apex_available: [
+ "myapex",
+ ],
}
cc_library {
name: "libaconfig_storage_read_api_cc",
diff --git a/cc/Android.bp b/cc/Android.bp
index 5ba9427..9ce8933 100644
--- a/cc/Android.bp
+++ b/cc/Android.bp
@@ -96,7 +96,6 @@
"gen_test.go",
"genrule_test.go",
"library_headers_test.go",
- "library_stub_test.go",
"library_test.go",
"lto_test.go",
"ndk_test.go",
diff --git a/cc/library.go b/cc/library.go
index 5b24809..44bbdfc 100644
--- a/cc/library.go
+++ b/cc/library.go
@@ -1261,6 +1261,18 @@
"34")
}
+func (library *libraryDecorator) linkApexSAbiDumpFiles(ctx ModuleContext,
+ deps PathDeps, sAbiDumpFiles android.Paths, soFile android.Path, libFileName string,
+ excludeSymbolVersions, excludeSymbolTags []string, sdkVersion string) android.Path {
+ return transformDumpToLinkedDump(ctx,
+ sAbiDumpFiles, soFile, libFileName+".apex",
+ library.exportedIncludeDirsForAbiCheck(ctx),
+ android.OptionalPathForModuleSrc(ctx, library.Properties.Stubs.Symbol_file),
+ append([]string{"*_PLATFORM", "*_PRIVATE"}, excludeSymbolVersions...),
+ append([]string{"platform-only"}, excludeSymbolTags...),
+ sdkVersion)
+}
+
func getRefAbiDumpFile(ctx android.ModuleInstallPathContext,
versionedDumpDir, fileName string) android.OptionalPath {
@@ -1276,21 +1288,21 @@
}
// Return the previous and current SDK versions for cross-version ABI diff.
-func crossVersionAbiDiffSdkVersions(ctx ModuleContext, dumpDir string) (string, string) {
+func crossVersionAbiDiffSdkVersions(ctx ModuleContext, dumpDir string) (int, int) {
sdkVersionInt := ctx.Config().PlatformSdkVersion().FinalInt()
- sdkVersionStr := ctx.Config().PlatformSdkVersion().String()
if ctx.Config().PlatformSdkFinal() {
- return strconv.Itoa(sdkVersionInt - 1), sdkVersionStr
+ return sdkVersionInt - 1, sdkVersionInt
} else {
// The platform SDK version can be upgraded before finalization while the corresponding abi dumps hasn't
// been generated. Thus the Cross-Version Check chooses PLATFORM_SDK_VERION - 1 as previous version.
// This situation could be identified by checking the existence of the PLATFORM_SDK_VERION dump directory.
- versionedDumpDir := android.ExistentPathForSource(ctx, dumpDir, sdkVersionStr)
+ versionedDumpDir := android.ExistentPathForSource(ctx,
+ dumpDir, ctx.Config().PlatformSdkVersion().String())
if versionedDumpDir.Valid() {
- return sdkVersionStr, strconv.Itoa(sdkVersionInt + 1)
+ return sdkVersionInt, sdkVersionInt + 1
} else {
- return strconv.Itoa(sdkVersionInt - 1), sdkVersionStr
+ return sdkVersionInt - 1, sdkVersionInt
}
}
}
@@ -1387,7 +1399,7 @@
headerAbiChecker.Exclude_symbol_tags,
currSdkVersion)
- var llndkDump android.Path
+ var llndkDump, apexVariantDump android.Path
tags := classifySourceAbiDump(ctx)
for _, tag := range tags {
if tag == llndkLsdumpTag {
@@ -1399,6 +1411,15 @@
headerAbiChecker.Exclude_symbol_tags)
}
addLsdumpPath(string(tag) + ":" + llndkDump.String())
+ } else if tag == apexLsdumpTag {
+ if apexVariantDump == nil {
+ apexVariantDump = library.linkApexSAbiDumpFiles(ctx,
+ deps, objs.sAbiDumpFiles, soFile, fileName,
+ headerAbiChecker.Exclude_symbol_versions,
+ headerAbiChecker.Exclude_symbol_tags,
+ currSdkVersion)
+ }
+ addLsdumpPath(string(tag) + ":" + apexVariantDump.String())
} else {
addLsdumpPath(string(tag) + ":" + implDump.String())
}
@@ -1412,11 +1433,14 @@
}
dumpDir := filepath.Join("prebuilts", "abi-dumps", dumpDirName)
isLlndk := (tag == llndkLsdumpTag)
+ isApex := (tag == apexLsdumpTag)
isNdk := (tag == ndkLsdumpTag)
binderBitness := ctx.DeviceConfig().BinderBitness()
nameExt := ""
if isLlndk {
nameExt = "llndk"
+ } else if isApex {
+ nameExt = "apex"
}
// Check against the previous version.
var prevVersion, currVersion string
@@ -1430,7 +1454,13 @@
sourceDump = llndkDump
}
} else {
- prevVersion, currVersion = crossVersionAbiDiffSdkVersions(ctx, dumpDir)
+ prevVersionInt, currVersionInt := crossVersionAbiDiffSdkVersions(ctx, dumpDir)
+ prevVersion = strconv.Itoa(prevVersionInt)
+ currVersion = strconv.Itoa(currVersionInt)
+ // APEX dumps are generated by different rules after trunk stable.
+ if isApex && prevVersionInt > 34 {
+ sourceDump = apexVariantDump
+ }
}
prevDumpDir := filepath.Join(dumpDir, prevVersion, binderBitness)
prevDumpFile := getRefAbiDumpFile(ctx, prevDumpDir, fileName)
@@ -1447,6 +1477,10 @@
}
} else {
currVersion = currSdkVersion
+ if isApex && (!ctx.Config().PlatformSdkFinal() ||
+ ctx.Config().PlatformSdkVersion().FinalInt() > 34) {
+ sourceDump = apexVariantDump
+ }
}
currDumpDir := filepath.Join(dumpDir, currVersion, binderBitness)
currDumpFile := getRefAbiDumpFile(ctx, currDumpDir, fileName)
diff --git a/cc/library_stub_test.go b/cc/library_stub_test.go
deleted file mode 100644
index 4df0a41..0000000
--- a/cc/library_stub_test.go
+++ /dev/null
@@ -1,459 +0,0 @@
-// Copyright 2021 Google Inc. All rights reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package cc
-
-import (
- _ "fmt"
- _ "sort"
-
- "testing"
-
- "android/soong/android"
-
- "github.com/google/blueprint"
-)
-
-func hasDirectDependency(t *testing.T, ctx *android.TestResult, from android.Module, to android.Module) bool {
- t.Helper()
- var found bool
- ctx.VisitDirectDeps(from, func(dep blueprint.Module) {
- if dep == to {
- found = true
- }
- })
- return found
-}
-
-func TestApiLibraryReplacesExistingModule(t *testing.T) {
- bp := `
- cc_library {
- name: "libfoo",
- shared_libs: ["libbar"],
- vendor_available: true,
- }
-
- cc_library {
- name: "libbar",
- }
-
- cc_api_library {
- name: "libbar",
- vendor_available: true,
- src: "libbar.so",
- }
-
- api_imports {
- name: "api_imports",
- shared_libs: [
- "libbar",
- ],
- }
- `
-
- ctx := prepareForCcTest.RunTestWithBp(t, bp)
-
- libfoo := ctx.ModuleForTests("libfoo", "android_arm64_armv8-a_shared").Module()
- libbar := ctx.ModuleForTests("libbar", "android_arm64_armv8-a_shared").Module()
- libbarApiImport := ctx.ModuleForTests("libbar.apiimport", "android_arm64_armv8-a_shared").Module()
-
- android.AssertBoolEquals(t, "original library should be linked with non-stub variant", true, hasDirectDependency(t, ctx, libfoo, libbar))
- android.AssertBoolEquals(t, "Stub library from API surface should be not linked with non-stub variant", false, hasDirectDependency(t, ctx, libfoo, libbarApiImport))
-
- libfooVendor := ctx.ModuleForTests("libfoo", "android_vendor_arm64_armv8-a_shared").Module()
- libbarApiImportVendor := ctx.ModuleForTests("libbar.apiimport", "android_vendor_arm64_armv8-a_shared").Module()
-
- android.AssertBoolEquals(t, "original library should not be linked", false, hasDirectDependency(t, ctx, libfooVendor, libbar))
- android.AssertBoolEquals(t, "Stub library from API surface should be linked", true, hasDirectDependency(t, ctx, libfooVendor, libbarApiImportVendor))
-}
-
-func TestApiLibraryDoNotRequireOriginalModule(t *testing.T) {
- bp := `
- cc_library {
- name: "libfoo",
- shared_libs: ["libbar"],
- vendor: true,
- }
-
- cc_api_library {
- name: "libbar",
- src: "libbar.so",
- vendor_available: true,
- }
-
- api_imports {
- name: "api_imports",
- shared_libs: [
- "libbar",
- ],
- }
- `
-
- ctx := prepareForCcTest.RunTestWithBp(t, bp)
-
- libfoo := ctx.ModuleForTests("libfoo", "android_vendor_arm64_armv8-a_shared").Module()
- libbarApiImport := ctx.ModuleForTests("libbar.apiimport", "android_vendor_arm64_armv8-a_shared").Module()
-
- android.AssertBoolEquals(t, "Stub library from API surface should be linked", true, hasDirectDependency(t, ctx, libfoo, libbarApiImport))
-}
-
-func TestApiLibraryShouldNotReplaceWithoutApiImport(t *testing.T) {
- bp := `
- cc_library {
- name: "libfoo",
- shared_libs: ["libbar"],
- vendor_available: true,
- }
-
- cc_library {
- name: "libbar",
- vendor_available: true,
- }
-
- cc_api_library {
- name: "libbar",
- src: "libbar.so",
- vendor_available: true,
- }
-
- api_imports {
- name: "api_imports",
- shared_libs: [],
- }
- `
-
- ctx := prepareForCcTest.RunTestWithBp(t, bp)
-
- libfoo := ctx.ModuleForTests("libfoo", "android_vendor_arm64_armv8-a_shared").Module()
- libbar := ctx.ModuleForTests("libbar", "android_vendor_arm64_armv8-a_shared").Module()
- libbarApiImport := ctx.ModuleForTests("libbar.apiimport", "android_vendor_arm64_armv8-a_shared").Module()
-
- android.AssertBoolEquals(t, "original library should be linked", true, hasDirectDependency(t, ctx, libfoo, libbar))
- android.AssertBoolEquals(t, "Stub library from API surface should not be linked", false, hasDirectDependency(t, ctx, libfoo, libbarApiImport))
-}
-
-func TestExportDirFromStubLibrary(t *testing.T) {
- bp := `
- cc_library {
- name: "libfoo",
- export_include_dirs: ["source_include_dir"],
- export_system_include_dirs: ["source_system_include_dir"],
- vendor_available: true,
- }
- cc_api_library {
- name: "libfoo",
- export_include_dirs: ["stub_include_dir"],
- export_system_include_dirs: ["stub_system_include_dir"],
- vendor_available: true,
- src: "libfoo.so",
- }
- api_imports {
- name: "api_imports",
- shared_libs: [
- "libfoo",
- ],
- header_libs: [],
- }
- // vendor binary
- cc_binary {
- name: "vendorbin",
- vendor: true,
- srcs: ["vendor.cc"],
- shared_libs: ["libfoo"],
- }
- `
- ctx := prepareForCcTest.RunTestWithBp(t, bp)
- vendorCFlags := ctx.ModuleForTests("vendorbin", "android_vendor_arm64_armv8-a").Rule("cc").Args["cFlags"]
- android.AssertStringDoesContain(t, "Vendor binary should compile using headers provided by stub", vendorCFlags, "-Istub_include_dir")
- android.AssertStringDoesNotContain(t, "Vendor binary should not compile using headers of source", vendorCFlags, "-Isource_include_dir")
- android.AssertStringDoesContain(t, "Vendor binary should compile using system headers provided by stub", vendorCFlags, "-isystem stub_system_include_dir")
- android.AssertStringDoesNotContain(t, "Vendor binary should not compile using system headers of source", vendorCFlags, "-isystem source_system_include_dir")
-
- vendorImplicits := ctx.ModuleForTests("vendorbin", "android_vendor_arm64_armv8-a").Rule("cc").OrderOnly.Strings()
- // Building the stub.so file first assembles its .h files in multi-tree out.
- // These header files are required for compiling the other API domain (vendor in this case)
- android.AssertStringListContains(t, "Vendor binary compilation should have an implicit dep on the stub .so file", vendorImplicits, "libfoo.so")
-}
-
-func TestApiLibraryWithLlndkVariant(t *testing.T) {
- bp := `
- cc_binary {
- name: "binfoo",
- vendor: true,
- srcs: ["binfoo.cc"],
- shared_libs: ["libbar"],
- }
-
- cc_api_library {
- name: "libbar",
- // TODO(b/244244438) Remove src property once all variants are implemented.
- src: "libbar.so",
- vendor_available: true,
- variants: [
- "llndk",
- ],
- }
-
- cc_api_variant {
- name: "libbar",
- variant: "llndk",
- src: "libbar_llndk.so",
- export_include_dirs: ["libbar_llndk_include"]
- }
-
- api_imports {
- name: "api_imports",
- shared_libs: [
- "libbar",
- ],
- header_libs: [],
- }
- `
-
- ctx := prepareForCcTest.RunTestWithBp(t, bp)
-
- binfoo := ctx.ModuleForTests("binfoo", "android_vendor_arm64_armv8-a").Module()
- libbarApiImport := ctx.ModuleForTests("libbar.apiimport", "android_vendor_arm64_armv8-a_shared").Module()
- libbarApiVariant := ctx.ModuleForTests("libbar.llndk.apiimport", "android_vendor_arm64_armv8-a").Module()
-
- android.AssertBoolEquals(t, "Stub library from API surface should be linked", true, hasDirectDependency(t, ctx, binfoo, libbarApiImport))
- android.AssertBoolEquals(t, "Stub library variant from API surface should be linked", true, hasDirectDependency(t, ctx, libbarApiImport, libbarApiVariant))
-
- binFooLibFlags := ctx.ModuleForTests("binfoo", "android_vendor_arm64_armv8-a").Rule("ld").Args["libFlags"]
- android.AssertStringDoesContain(t, "Vendor binary should be linked with LLNDK variant source", binFooLibFlags, "libbar.llndk.apiimport.so")
-
- binFooCFlags := ctx.ModuleForTests("binfoo", "android_vendor_arm64_armv8-a").Rule("cc").Args["cFlags"]
- android.AssertStringDoesContain(t, "Vendor binary should include headers from the LLNDK variant source", binFooCFlags, "-Ilibbar_llndk_include")
-}
-
-func TestApiLibraryWithNdkVariant(t *testing.T) {
- bp := `
- cc_binary {
- name: "binfoo",
- sdk_version: "29",
- srcs: ["binfoo.cc"],
- shared_libs: ["libbar"],
- stl: "c++_shared",
- }
-
- cc_binary {
- name: "binbaz",
- sdk_version: "30",
- srcs: ["binbaz.cc"],
- shared_libs: ["libbar"],
- stl: "c++_shared",
- }
-
- cc_binary {
- name: "binqux",
- srcs: ["binfoo.cc"],
- shared_libs: ["libbar"],
- }
-
- cc_library {
- name: "libbar",
- srcs: ["libbar.cc"],
- }
-
- cc_api_library {
- name: "libbar",
- // TODO(b/244244438) Remove src property once all variants are implemented.
- src: "libbar.so",
- variants: [
- "ndk.29",
- "ndk.30",
- "ndk.current",
- ],
- }
-
- cc_api_variant {
- name: "libbar",
- variant: "ndk",
- version: "29",
- src: "libbar_ndk_29.so",
- export_include_dirs: ["libbar_ndk_29_include"]
- }
-
- cc_api_variant {
- name: "libbar",
- variant: "ndk",
- version: "30",
- src: "libbar_ndk_30.so",
- export_include_dirs: ["libbar_ndk_30_include"]
- }
-
- cc_api_variant {
- name: "libbar",
- variant: "ndk",
- version: "current",
- src: "libbar_ndk_current.so",
- export_include_dirs: ["libbar_ndk_current_include"]
- }
-
- api_imports {
- name: "api_imports",
- shared_libs: [
- "libbar",
- ],
- header_libs: [],
- }
- `
-
- ctx := prepareForCcTest.RunTestWithBp(t, bp)
-
- binfoo := ctx.ModuleForTests("binfoo", "android_arm64_armv8-a_sdk").Module()
- libbarApiImportv29 := ctx.ModuleForTests("libbar.apiimport", "android_arm64_armv8-a_sdk_shared_29").Module()
- libbarApiVariantv29 := ctx.ModuleForTests("libbar.ndk.29.apiimport", "android_arm64_armv8-a_sdk").Module()
- libbarApiImportv30 := ctx.ModuleForTests("libbar.apiimport", "android_arm64_armv8-a_sdk_shared_30").Module()
- libbarApiVariantv30 := ctx.ModuleForTests("libbar.ndk.30.apiimport", "android_arm64_armv8-a_sdk").Module()
-
- android.AssertBoolEquals(t, "Stub library from API surface should be linked with target version", true, hasDirectDependency(t, ctx, binfoo, libbarApiImportv29))
- android.AssertBoolEquals(t, "Stub library variant from API surface should be linked with target version", true, hasDirectDependency(t, ctx, libbarApiImportv29, libbarApiVariantv29))
- android.AssertBoolEquals(t, "Stub library from API surface should not be linked with different version", false, hasDirectDependency(t, ctx, binfoo, libbarApiImportv30))
- android.AssertBoolEquals(t, "Stub library variant from API surface should not be linked with different version", false, hasDirectDependency(t, ctx, libbarApiImportv29, libbarApiVariantv30))
-
- binbaz := ctx.ModuleForTests("binbaz", "android_arm64_armv8-a_sdk").Module()
-
- android.AssertBoolEquals(t, "Stub library from API surface should be linked with target version", true, hasDirectDependency(t, ctx, binbaz, libbarApiImportv30))
- android.AssertBoolEquals(t, "Stub library from API surface should not be linked with different version", false, hasDirectDependency(t, ctx, binbaz, libbarApiImportv29))
-
- binFooLibFlags := ctx.ModuleForTests("binfoo", "android_arm64_armv8-a_sdk").Rule("ld").Args["libFlags"]
- android.AssertStringDoesContain(t, "Binary using sdk should be linked with NDK variant source", binFooLibFlags, "libbar.ndk.29.apiimport.so")
-
- binFooCFlags := ctx.ModuleForTests("binfoo", "android_arm64_armv8-a_sdk").Rule("cc").Args["cFlags"]
- android.AssertStringDoesContain(t, "Binary using sdk should include headers from the NDK variant source", binFooCFlags, "-Ilibbar_ndk_29_include")
-
- binQux := ctx.ModuleForTests("binqux", "android_arm64_armv8-a").Module()
- android.AssertBoolEquals(t, "NDK Stub library from API surface should not be linked with nonSdk binary", false,
- (hasDirectDependency(t, ctx, binQux, libbarApiImportv30) || hasDirectDependency(t, ctx, binQux, libbarApiImportv29)))
-}
-
-func TestApiLibraryWithMultipleVariants(t *testing.T) {
- bp := `
- cc_binary {
- name: "binfoo",
- sdk_version: "29",
- srcs: ["binfoo.cc"],
- shared_libs: ["libbar"],
- stl: "c++_shared",
- }
-
- cc_binary {
- name: "binbaz",
- vendor: true,
- srcs: ["binbaz.cc"],
- shared_libs: ["libbar"],
- }
-
- cc_library {
- name: "libbar",
- srcs: ["libbar.cc"],
- }
-
- cc_api_library {
- name: "libbar",
- // TODO(b/244244438) Remove src property once all variants are implemented.
- src: "libbar.so",
- vendor_available: true,
- variants: [
- "llndk",
- "ndk.29",
- "ndk.30",
- "ndk.current",
- "apex.29",
- "apex.30",
- "apex.current",
- ],
- }
-
- cc_api_variant {
- name: "libbar",
- variant: "ndk",
- version: "29",
- src: "libbar_ndk_29.so",
- export_include_dirs: ["libbar_ndk_29_include"]
- }
-
- cc_api_variant {
- name: "libbar",
- variant: "ndk",
- version: "30",
- src: "libbar_ndk_30.so",
- export_include_dirs: ["libbar_ndk_30_include"]
- }
-
- cc_api_variant {
- name: "libbar",
- variant: "ndk",
- version: "current",
- src: "libbar_ndk_current.so",
- export_include_dirs: ["libbar_ndk_current_include"]
- }
-
- cc_api_variant {
- name: "libbar",
- variant: "apex",
- version: "29",
- src: "libbar_apex_29.so",
- export_include_dirs: ["libbar_apex_29_include"]
- }
-
- cc_api_variant {
- name: "libbar",
- variant: "apex",
- version: "30",
- src: "libbar_apex_30.so",
- export_include_dirs: ["libbar_apex_30_include"]
- }
-
- cc_api_variant {
- name: "libbar",
- variant: "apex",
- version: "current",
- src: "libbar_apex_current.so",
- export_include_dirs: ["libbar_apex_current_include"]
- }
-
- cc_api_variant {
- name: "libbar",
- variant: "llndk",
- src: "libbar_llndk.so",
- export_include_dirs: ["libbar_llndk_include"]
- }
-
- api_imports {
- name: "api_imports",
- shared_libs: [
- "libbar",
- ],
- apex_shared_libs: [
- "libbar",
- ],
- }
- `
- ctx := prepareForCcTest.RunTestWithBp(t, bp)
-
- binfoo := ctx.ModuleForTests("binfoo", "android_arm64_armv8-a_sdk").Module()
- libbarApiImportv29 := ctx.ModuleForTests("libbar.apiimport", "android_arm64_armv8-a_sdk_shared_29").Module()
- libbarApiImportLlndk := ctx.ModuleForTests("libbar.apiimport", "android_vendor_arm64_armv8-a_shared").Module()
-
- android.AssertBoolEquals(t, "Binary using SDK should be linked with API library from NDK variant", true, hasDirectDependency(t, ctx, binfoo, libbarApiImportv29))
- android.AssertBoolEquals(t, "Binary using SDK should not be linked with API library from LLNDK variant", false, hasDirectDependency(t, ctx, binfoo, libbarApiImportLlndk))
-
- binbaz := ctx.ModuleForTests("binbaz", "android_vendor_arm64_armv8-a").Module()
-
- android.AssertBoolEquals(t, "Vendor binary should be linked with API library from LLNDK variant", true, hasDirectDependency(t, ctx, binbaz, libbarApiImportLlndk))
- android.AssertBoolEquals(t, "Vendor binary should not be linked with API library from NDK variant", false, hasDirectDependency(t, ctx, binbaz, libbarApiImportv29))
-
-}
diff --git a/cc/sabi.go b/cc/sabi.go
index ef43c8d..cd9bf63 100644
--- a/cc/sabi.go
+++ b/cc/sabi.go
@@ -29,6 +29,7 @@
type lsdumpTag string
const (
+ apexLsdumpTag lsdumpTag = "APEX"
llndkLsdumpTag lsdumpTag = "LLNDK"
ndkLsdumpTag lsdumpTag = "NDK"
platformLsdumpTag lsdumpTag = "PLATFORM"
@@ -39,6 +40,8 @@
// Return the prebuilt ABI dump directory for a tag; an empty string for an opt-in dump.
func (tag *lsdumpTag) dirName() string {
switch *tag {
+ case apexLsdumpTag:
+ return "platform"
case ndkLsdumpTag:
return "ndk"
case llndkLsdumpTag:
@@ -134,11 +137,13 @@
if m.isImplementationForLLNDKPublic() {
result = append(result, llndkLsdumpTag)
}
- // Return NDK if the library is both NDK and APEX.
- // TODO(b/309880485): Split NDK and APEX ABI.
if m.IsNdk(ctx.Config()) {
result = append(result, ndkLsdumpTag)
- } else if m.library.hasStubsVariants() || headerAbiChecker.enabled() {
+ }
+ // APEX and opt-in platform dumps are placed in the same directory.
+ if m.library.hasStubsVariants() {
+ result = append(result, apexLsdumpTag)
+ } else if headerAbiChecker.enabled() {
result = append(result, platformLsdumpTag)
}
} else if headerAbiChecker.enabled() {
diff --git a/cc/sdk.go b/cc/sdk.go
index 736a958..ce0fdc2 100644
--- a/cc/sdk.go
+++ b/cc/sdk.go
@@ -59,35 +59,6 @@
modules[1].(*Module).Properties.PreventInstall = true
}
ctx.AliasVariation("")
- } else if isCcModule && ccModule.isImportedApiLibrary() {
- apiLibrary, _ := ccModule.linker.(*apiLibraryDecorator)
- if apiLibrary.hasNDKStubs() && ccModule.canUseSdk() {
- variations := []string{"sdk"}
- if apiLibrary.hasApexStubs() {
- variations = append(variations, "")
- }
- // Handle cc_api_library module with NDK stubs and variants only which can use SDK
- modules := ctx.CreateVariations(variations...)
- // Mark the SDK variant.
- modules[0].(*Module).Properties.IsSdkVariant = true
- if ctx.Config().UnbundledBuildApps() {
- if apiLibrary.hasApexStubs() {
- // For an unbundled apps build, hide the platform variant from Make.
- modules[1].(*Module).Properties.HideFromMake = true
- }
- modules[1].(*Module).Properties.PreventInstall = true
- } else {
- // For a platform build, mark the SDK variant so that it gets a ".sdk" suffix when
- // exposed to Make.
- modules[0].(*Module).Properties.SdkAndPlatformVariantVisibleToMake = true
- // SDK variant is not supposed to be installed
- modules[0].(*Module).Properties.PreventInstall = true
- }
- } else {
- ccModule.Properties.Sdk_version = nil
- ctx.CreateVariations("")
- ctx.AliasVariation("")
- }
} else {
if isCcModule {
// Clear the sdk_version property for modules that don't have an SDK variant so
diff --git a/cmd/release_config/crunch_flags/main.go b/cmd/release_config/crunch_flags/main.go
index 616674b..69abba2 100644
--- a/cmd/release_config/crunch_flags/main.go
+++ b/cmd/release_config/crunch_flags/main.go
@@ -89,7 +89,10 @@
for _, line := range lines {
if comment := commentRegexp.FindStringSubmatch(commentRegexp.FindString(line)); comment != nil {
// Description is the text from any contiguous series of lines before a `flag()` call.
- description += fmt.Sprintf(" %s", strings.TrimSpace(comment[commentRegexp.SubexpIndex("comment")]))
+ descLine := strings.TrimSpace(comment[commentRegexp.SubexpIndex("comment")])
+ if !strings.HasPrefix(descLine, "keep-sorted") {
+ description += fmt.Sprintf(" %s", descLine)
+ }
continue
}
matches := declRegexp.FindStringSubmatch(declRegexp.FindString(line))
@@ -218,7 +221,7 @@
} else {
fmt.Printf("Processing %s\n", path)
}
- configRegexp, err := regexp.Compile("^..call[[:space:]]+declare-release-config,[[:space:]]+(?<name>[_a-z0-0A-Z]+),[[:space:]]+(?<files>[^,]*)(,[[:space:]]*(?<inherits>.*)|[[:space:]]*)[)]$")
+ configRegexp, err := regexp.Compile("^..call[[:space:]]+declare-release-config,[[:space:]]+(?<name>[_a-z0-9A-Z]+),[[:space:]]+(?<files>[^,]*)(,[[:space:]]*(?<inherits>.*)|[[:space:]]*)[)]$")
if err != nil {
return err
}
diff --git a/cmd/release_config/release_config_lib/flag_artifact.go b/cmd/release_config/release_config_lib/flag_artifact.go
index 4446655..d6a629b 100644
--- a/cmd/release_config/release_config_lib/flag_artifact.go
+++ b/cmd/release_config/release_config_lib/flag_artifact.go
@@ -36,6 +36,10 @@
// The value of the flag.
Value *rc_proto.Value
+
+ // This flag is redacted. Set by UpdateValue when the FlagValue proto
+ // says to redact it.
+ Redacted bool
}
// Key is flag name.
@@ -85,6 +89,11 @@
func (fa *FlagArtifact) UpdateValue(flagValue FlagValue) error {
name := *flagValue.proto.Name
fa.Traces = append(fa.Traces, &rc_proto.Tracepoint{Source: proto.String(flagValue.path), Value: flagValue.proto.Value})
+ if flagValue.proto.GetRedacted() {
+ fa.Redacted = true
+ fmt.Printf("Redacting flag %s in %s\n", name, flagValue.path)
+ return nil
+ }
if fa.Value.GetObsolete() {
return fmt.Errorf("Attempting to set obsolete flag %s. Trace=%v", name, fa.Traces)
}
@@ -111,6 +120,9 @@
// Marshal the FlagArtifact into a flag_artifact message.
func (fa *FlagArtifact) Marshal() (*rc_proto.FlagArtifact, error) {
+ if fa.Redacted {
+ return nil, nil
+ }
return &rc_proto.FlagArtifact{
FlagDeclaration: fa.FlagDeclaration,
Value: fa.Value,
diff --git a/cmd/release_config/release_config_lib/release_config.go b/cmd/release_config/release_config_lib/release_config.go
index c67cee5..b08b6a3 100644
--- a/cmd/release_config/release_config_lib/release_config.go
+++ b/cmd/release_config/release_config_lib/release_config.go
@@ -150,22 +150,26 @@
}
myDirsMap[contrib.DeclarationIndex] = true
for _, value := range contrib.FlagValues {
- fa, ok := myFlags[*value.proto.Name]
+ name := *value.proto.Name
+ fa, ok := myFlags[name]
if !ok {
- return fmt.Errorf("Setting value for undefined flag %s in %s\n", *value.proto.Name, value.path)
+ return fmt.Errorf("Setting value for undefined flag %s in %s\n", name, value.path)
}
myDirsMap[fa.DeclarationIndex] = true
if fa.DeclarationIndex > contrib.DeclarationIndex {
// Setting location is to the left of declaration.
- return fmt.Errorf("Setting value for flag %s not allowed in %s\n", *value.proto.Name, value.path)
+ return fmt.Errorf("Setting value for flag %s not allowed in %s\n", name, value.path)
}
if isRoot && *fa.FlagDeclaration.Workflow != workflowManual {
// The "root" release config can only contain workflow: MANUAL flags.
- return fmt.Errorf("Setting value for non-MANUAL flag %s is not allowed in %s", *value.proto.Name, value.path)
+ return fmt.Errorf("Setting value for non-MANUAL flag %s is not allowed in %s", name, value.path)
}
if err := fa.UpdateValue(*value); err != nil {
return err
}
+ if fa.Redacted {
+ delete(myFlags, name)
+ }
}
}
releaseAconfigValueSets.Value = &rc_proto.Value{Val: &rc_proto.Value_StringValue{strings.Join(myAconfigValueSets, " ")}}
diff --git a/cmd/release_config/release_config_lib/release_configs.go b/cmd/release_config/release_config_lib/release_configs.go
index 6efdb2f..aba8cd2 100644
--- a/cmd/release_config/release_config_lib/release_configs.go
+++ b/cmd/release_config/release_config_lib/release_configs.go
@@ -160,6 +160,9 @@
configs.FlagArtifacts[name].UpdateValue(
FlagValue{path: path, proto: rc_proto.FlagValue{
Name: proto.String(name), Value: flagDeclaration.Value}})
+ if configs.FlagArtifacts[name].Redacted {
+ return fmt.Errorf("%s may not be redacted by default.", *flagDeclaration.Name)
+ }
return nil
})
if err != nil {
diff --git a/cmd/release_config/release_config_proto/build_flags_out.pb.go b/cmd/release_config/release_config_proto/build_flags_out.pb.go
index 0372d63..77e2069 100644
--- a/cmd/release_config/release_config_proto/build_flags_out.pb.go
+++ b/cmd/release_config/release_config_proto/build_flags_out.pb.go
@@ -11,7 +11,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
-// protoc-gen-go v1.33.0
+// protoc-gen-go v1.30.0
// protoc v3.21.12
// source: build_flags_out.proto
diff --git a/cmd/release_config/release_config_proto/build_flags_src.pb.go b/cmd/release_config/release_config_proto/build_flags_src.pb.go
index d0c924d..ca2005c 100644
--- a/cmd/release_config/release_config_proto/build_flags_src.pb.go
+++ b/cmd/release_config/release_config_proto/build_flags_src.pb.go
@@ -11,7 +11,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
-// protoc-gen-go v1.33.0
+// protoc-gen-go v1.30.0
// protoc v3.21.12
// source: build_flags_src.proto
@@ -385,6 +385,9 @@
Name *string `protobuf:"bytes,2,opt,name=name" json:"name,omitempty"`
// Value for the flag
Value *Value `protobuf:"bytes,201,opt,name=value" json:"value,omitempty"`
+ // If true, the flag is completely removed from the release config as if
+ // never declared.
+ Redacted *bool `protobuf:"varint,202,opt,name=redacted" json:"redacted,omitempty"`
}
func (x *FlagValue) Reset() {
@@ -433,6 +436,13 @@
return nil
}
+func (x *FlagValue) GetRedacted() bool {
+ if x != nil && x.Redacted != nil {
+ return *x.Redacted
+ }
+ return false
+}
+
// This replaces $(call declare-release-config).
type ReleaseConfig struct {
state protoimpl.MessageState
@@ -663,52 +673,54 @@
0x64, 0x72, 0x6f, 0x69, 0x64, 0x2e, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x5f, 0x63, 0x6f,
0x6e, 0x66, 0x69, 0x67, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61,
0x69, 0x6e, 0x65, 0x72, 0x52, 0x09, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x4a,
- 0x04, 0x08, 0x04, 0x10, 0x05, 0x4a, 0x06, 0x08, 0xcf, 0x01, 0x10, 0xd0, 0x01, 0x22, 0x5c, 0x0a,
+ 0x04, 0x08, 0x04, 0x10, 0x05, 0x4a, 0x06, 0x08, 0xcf, 0x01, 0x10, 0xd0, 0x01, 0x22, 0x79, 0x0a,
0x0a, 0x66, 0x6c, 0x61, 0x67, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e,
0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12,
0x3a, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0xc9, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32,
0x23, 0x2e, 0x61, 0x6e, 0x64, 0x72, 0x6f, 0x69, 0x64, 0x2e, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73,
0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x76,
- 0x61, 0x6c, 0x75, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x6e, 0x0a, 0x0e, 0x72,
- 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x12, 0x0a,
- 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d,
- 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x6e, 0x68, 0x65, 0x72, 0x69, 0x74, 0x73, 0x18, 0x02, 0x20,
- 0x03, 0x28, 0x09, 0x52, 0x08, 0x69, 0x6e, 0x68, 0x65, 0x72, 0x69, 0x74, 0x73, 0x12, 0x2c, 0x0a,
- 0x12, 0x61, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x5f, 0x73,
- 0x65, 0x74, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x10, 0x61, 0x63, 0x6f, 0x6e, 0x66,
- 0x69, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x53, 0x65, 0x74, 0x73, 0x22, 0x3b, 0x0a, 0x0d, 0x72,
- 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x5f, 0x61, 0x6c, 0x69, 0x61, 0x73, 0x12, 0x12, 0x0a, 0x04,
- 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65,
- 0x12, 0x16, 0x0a, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
- 0x52, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x22, 0xd3, 0x01, 0x0a, 0x12, 0x72, 0x65, 0x6c,
- 0x65, 0x61, 0x73, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f, 0x6d, 0x61, 0x70, 0x12,
- 0x45, 0x0a, 0x07, 0x61, 0x6c, 0x69, 0x61, 0x73, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b,
- 0x32, 0x2b, 0x2e, 0x61, 0x6e, 0x64, 0x72, 0x6f, 0x69, 0x64, 0x2e, 0x72, 0x65, 0x6c, 0x65, 0x61,
+ 0x61, 0x6c, 0x75, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1b, 0x0a, 0x08, 0x72,
+ 0x65, 0x64, 0x61, 0x63, 0x74, 0x65, 0x64, 0x18, 0xca, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08,
+ 0x72, 0x65, 0x64, 0x61, 0x63, 0x74, 0x65, 0x64, 0x22, 0x6e, 0x0a, 0x0e, 0x72, 0x65, 0x6c, 0x65,
+ 0x61, 0x73, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61,
+ 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1a,
+ 0x0a, 0x08, 0x69, 0x6e, 0x68, 0x65, 0x72, 0x69, 0x74, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09,
+ 0x52, 0x08, 0x69, 0x6e, 0x68, 0x65, 0x72, 0x69, 0x74, 0x73, 0x12, 0x2c, 0x0a, 0x12, 0x61, 0x63,
+ 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x5f, 0x73, 0x65, 0x74, 0x73,
+ 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x10, 0x61, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x56,
+ 0x61, 0x6c, 0x75, 0x65, 0x53, 0x65, 0x74, 0x73, 0x22, 0x3b, 0x0a, 0x0d, 0x72, 0x65, 0x6c, 0x65,
+ 0x61, 0x73, 0x65, 0x5f, 0x61, 0x6c, 0x69, 0x61, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d,
+ 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a,
+ 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x74,
+ 0x61, 0x72, 0x67, 0x65, 0x74, 0x22, 0xd3, 0x01, 0x0a, 0x12, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73,
+ 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f, 0x6d, 0x61, 0x70, 0x12, 0x45, 0x0a, 0x07,
+ 0x61, 0x6c, 0x69, 0x61, 0x73, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2b, 0x2e,
+ 0x61, 0x6e, 0x64, 0x72, 0x6f, 0x69, 0x64, 0x2e, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x5f,
+ 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x72, 0x65, 0x6c,
+ 0x65, 0x61, 0x73, 0x65, 0x5f, 0x61, 0x6c, 0x69, 0x61, 0x73, 0x52, 0x07, 0x61, 0x6c, 0x69, 0x61,
+ 0x73, 0x65, 0x73, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69,
+ 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69,
+ 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x54, 0x0a, 0x11, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74,
+ 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e,
+ 0x32, 0x27, 0x2e, 0x61, 0x6e, 0x64, 0x72, 0x6f, 0x69, 0x64, 0x2e, 0x72, 0x65, 0x6c, 0x65, 0x61,
0x73, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e,
- 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x5f, 0x61, 0x6c, 0x69, 0x61, 0x73, 0x52, 0x07, 0x61,
- 0x6c, 0x69, 0x61, 0x73, 0x65, 0x73, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69,
- 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73,
- 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x54, 0x0a, 0x11, 0x64, 0x65, 0x66, 0x61,
- 0x75, 0x6c, 0x74, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x18, 0x03, 0x20,
- 0x01, 0x28, 0x0e, 0x32, 0x27, 0x2e, 0x61, 0x6e, 0x64, 0x72, 0x6f, 0x69, 0x64, 0x2e, 0x72, 0x65,
+ 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x52, 0x10, 0x64, 0x65, 0x66, 0x61, 0x75,
+ 0x6c, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2a, 0x4a, 0x0a, 0x08, 0x77,
+ 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x12, 0x18, 0x0a, 0x14, 0x55, 0x4e, 0x53, 0x50, 0x45,
+ 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x5f, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x10,
+ 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x4c, 0x41, 0x55, 0x4e, 0x43, 0x48, 0x10, 0x01, 0x12, 0x0c, 0x0a,
+ 0x08, 0x50, 0x52, 0x45, 0x42, 0x55, 0x49, 0x4c, 0x54, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x4d,
+ 0x41, 0x4e, 0x55, 0x41, 0x4c, 0x10, 0x03, 0x2a, 0x64, 0x0a, 0x09, 0x63, 0x6f, 0x6e, 0x74, 0x61,
+ 0x69, 0x6e, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x15, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46,
+ 0x49, 0x45, 0x44, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x10, 0x00, 0x12,
+ 0x07, 0x0a, 0x03, 0x41, 0x4c, 0x4c, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x50, 0x52, 0x4f, 0x44,
+ 0x55, 0x43, 0x54, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x53, 0x59, 0x53, 0x54, 0x45, 0x4d, 0x10,
+ 0x03, 0x12, 0x0e, 0x0a, 0x0a, 0x53, 0x59, 0x53, 0x54, 0x45, 0x4d, 0x5f, 0x45, 0x58, 0x54, 0x10,
+ 0x04, 0x12, 0x0a, 0x0a, 0x06, 0x56, 0x45, 0x4e, 0x44, 0x4f, 0x52, 0x10, 0x05, 0x42, 0x33, 0x5a,
+ 0x31, 0x61, 0x6e, 0x64, 0x72, 0x6f, 0x69, 0x64, 0x2f, 0x73, 0x6f, 0x6f, 0x6e, 0x67, 0x2f, 0x72,
+ 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x72, 0x65,
0x6c, 0x65, 0x61, 0x73, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f, 0x70, 0x72, 0x6f,
- 0x74, 0x6f, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x52, 0x10, 0x64, 0x65,
- 0x66, 0x61, 0x75, 0x6c, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2a, 0x4a,
- 0x0a, 0x08, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x12, 0x18, 0x0a, 0x14, 0x55, 0x4e,
- 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x5f, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c,
- 0x6f, 0x77, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x4c, 0x41, 0x55, 0x4e, 0x43, 0x48, 0x10, 0x01,
- 0x12, 0x0c, 0x0a, 0x08, 0x50, 0x52, 0x45, 0x42, 0x55, 0x49, 0x4c, 0x54, 0x10, 0x02, 0x12, 0x0a,
- 0x0a, 0x06, 0x4d, 0x41, 0x4e, 0x55, 0x41, 0x4c, 0x10, 0x03, 0x2a, 0x64, 0x0a, 0x09, 0x63, 0x6f,
- 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x15, 0x55, 0x4e, 0x53, 0x50, 0x45,
- 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72,
- 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x41, 0x4c, 0x4c, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x50,
- 0x52, 0x4f, 0x44, 0x55, 0x43, 0x54, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x53, 0x59, 0x53, 0x54,
- 0x45, 0x4d, 0x10, 0x03, 0x12, 0x0e, 0x0a, 0x0a, 0x53, 0x59, 0x53, 0x54, 0x45, 0x4d, 0x5f, 0x45,
- 0x58, 0x54, 0x10, 0x04, 0x12, 0x0a, 0x0a, 0x06, 0x56, 0x45, 0x4e, 0x44, 0x4f, 0x52, 0x10, 0x05,
- 0x42, 0x33, 0x5a, 0x31, 0x61, 0x6e, 0x64, 0x72, 0x6f, 0x69, 0x64, 0x2f, 0x73, 0x6f, 0x6f, 0x6e,
- 0x67, 0x2f, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67,
- 0x2f, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f,
- 0x70, 0x72, 0x6f, 0x74, 0x6f,
+ 0x74, 0x6f,
}
var (
diff --git a/cmd/release_config/release_config_proto/build_flags_src.proto b/cmd/release_config/release_config_proto/build_flags_src.proto
index c077f5c..92edc2a 100644
--- a/cmd/release_config/release_config_proto/build_flags_src.proto
+++ b/cmd/release_config/release_config_proto/build_flags_src.proto
@@ -114,6 +114,10 @@
// Value for the flag
optional value value = 201;
+
+ // If true, the flag is completely removed from the release config as if
+ // never declared.
+ optional bool redacted = 202;
}
// This replaces $(call declare-release-config).
diff --git a/java/aar.go b/java/aar.go
index 0a91ff4..47c64bf 100644
--- a/java/aar.go
+++ b/java/aar.go
@@ -971,6 +971,9 @@
// will be passed transitively through android_libraries to an android_app.
//TODO(b/241138093) evaluate whether we can have this flag default to true for Bazel conversion
Extract_jni *bool
+
+ // If set, overrides the manifest extracted from the AAR with the provided path.
+ Manifest *string `android:"path"`
}
type AARImport struct {
@@ -993,7 +996,7 @@
exportPackage android.WritablePath
transitiveAaptResourcePackagesFile android.Path
extraAaptPackagesFile android.WritablePath
- manifest android.WritablePath
+ manifest android.Path
assetsPackage android.WritablePath
rTxt android.WritablePath
rJar android.WritablePath
@@ -1169,7 +1172,15 @@
jarName := ctx.ModuleName() + ".jar"
extractedAARDir := android.PathForModuleOut(ctx, "aar")
classpathFile := extractedAARDir.Join(ctx, jarName)
- a.manifest = extractedAARDir.Join(ctx, "AndroidManifest.xml")
+
+ extractedManifest := extractedAARDir.Join(ctx, "AndroidManifest.xml")
+ providedManifest := android.OptionalPathForModuleSrc(ctx, a.properties.Manifest)
+ if providedManifest.Valid() {
+ a.manifest = providedManifest.Path()
+ } else {
+ a.manifest = extractedManifest
+ }
+
a.rTxt = extractedAARDir.Join(ctx, "R.txt")
a.assetsPackage = android.PathForModuleOut(ctx, "assets.zip")
a.proguardFlags = extractedAARDir.Join(ctx, "proguard.txt")
@@ -1190,7 +1201,7 @@
ctx.Build(pctx, android.BuildParams{
Rule: unzipAAR,
Input: a.aarPath,
- Outputs: android.WritablePaths{classpathFile, a.proguardFlags, a.manifest, a.assetsPackage, a.rTxt},
+ Outputs: android.WritablePaths{classpathFile, a.proguardFlags, extractedManifest, a.assetsPackage, a.rTxt},
Description: "unzip AAR",
Args: map[string]string{
"outDir": extractedAARDir.String(),
diff --git a/java/robolectric.go b/java/robolectric.go
index 9e8850c..18386c9 100644
--- a/java/robolectric.go
+++ b/java/robolectric.go
@@ -46,6 +46,7 @@
var (
roboCoverageLibsTag = dependencyTag{name: "roboCoverageLibs"}
roboRuntimesTag = dependencyTag{name: "roboRuntimes"}
+ roboRuntimeOnlyTag = dependencyTag{name: "roboRuntimeOnlyTag"}
)
type robolectricProperties struct {
@@ -70,6 +71,9 @@
// Use /external/robolectric rather than /external/robolectric-shadows as the version of robolectric
// to use. /external/robolectric closely tracks github's master, and will fully replace /external/robolectric-shadows
Upstream *bool
+
+ // Use strict mode to limit access of Robolectric API directly. See go/roboStrictMode
+ Strict_mode *bool
}
type robolectricTest struct {
@@ -112,7 +116,7 @@
if v := String(r.robolectricProperties.Robolectric_prebuilt_version); v != "" {
ctx.AddVariationDependencies(nil, libTag, fmt.Sprintf(robolectricPrebuiltLibPattern, v))
- } else {
+ } else if !proptools.Bool(r.robolectricProperties.Strict_mode) {
if proptools.Bool(r.robolectricProperties.Upstream) {
ctx.AddVariationDependencies(nil, libTag, robolectricCurrentLib+"_upstream")
} else {
@@ -120,6 +124,10 @@
}
}
+ if proptools.Bool(r.robolectricProperties.Strict_mode) {
+ ctx.AddVariationDependencies(nil, roboRuntimeOnlyTag, robolectricCurrentLib+"_upstream")
+ }
+
ctx.AddVariationDependencies(nil, libTag, robolectricDefaultLibs...)
ctx.AddVariationDependencies(nil, roboCoverageLibsTag, r.robolectricProperties.Coverage_libs...)
@@ -192,19 +200,25 @@
combinedJarJars = append(combinedJarJars, instrumentedApp.implementationAndResourcesJar)
}
- handleLibDeps := func(dep android.Module) {
+ handleLibDeps := func(dep android.Module, runtimeOnly bool) {
m, _ := android.OtherModuleProvider(ctx, dep, JavaInfoProvider)
- r.libs = append(r.libs, ctx.OtherModuleName(dep))
+ if !runtimeOnly {
+ r.libs = append(r.libs, ctx.OtherModuleName(dep))
+ }
if !android.InList(ctx.OtherModuleName(dep), config.FrameworkLibraries) {
combinedJarJars = append(combinedJarJars, m.ImplementationAndResourcesJars...)
}
}
for _, dep := range ctx.GetDirectDepsWithTag(libTag) {
- handleLibDeps(dep)
+ handleLibDeps(dep, false)
}
for _, dep := range ctx.GetDirectDepsWithTag(sdkLibTag) {
- handleLibDeps(dep)
+ handleLibDeps(dep, false)
+ }
+ // handle the runtimeOnly tag for strict_mode
+ for _, dep := range ctx.GetDirectDepsWithTag(roboRuntimeOnlyTag) {
+ handleLibDeps(dep, true)
}
r.combinedJar = android.PathForModuleOut(ctx, "robolectric_combined", r.outputFile.Base())
diff --git a/rust/coverage.go b/rust/coverage.go
index bc6504d..91a7806 100644
--- a/rust/coverage.go
+++ b/rust/coverage.go
@@ -39,9 +39,11 @@
func (cov *coverage) deps(ctx DepsContext, deps Deps) Deps {
if cov.Properties.NeedCoverageVariant {
- ctx.AddVariationDependencies([]blueprint.Variation{
- {Mutator: "link", Variation: "static"},
- }, cc.CoverageDepTag, CovLibraryName)
+ if ctx.Device() {
+ ctx.AddVariationDependencies([]blueprint.Variation{
+ {Mutator: "link", Variation: "static"},
+ }, cc.CoverageDepTag, CovLibraryName)
+ }
// no_std modules are missing libprofiler_builtins which provides coverage, so we need to add it as a dependency.
if rustModule, ok := ctx.Module().(*Module); ok && rustModule.compiler.noStdlibs() {
@@ -60,12 +62,14 @@
if cov.Properties.CoverageEnabled {
flags.Coverage = true
- coverage := ctx.GetDirectDepWithTag(CovLibraryName, cc.CoverageDepTag).(cc.LinkableInterface)
flags.RustFlags = append(flags.RustFlags,
"-C instrument-coverage", "-g")
- flags.LinkFlags = append(flags.LinkFlags,
- profileInstrFlag, "-g", coverage.OutputFile().Path().String(), "-Wl,--wrap,open")
- deps.StaticLibs = append(deps.StaticLibs, coverage.OutputFile().Path())
+ if ctx.Device() {
+ coverage := ctx.GetDirectDepWithTag(CovLibraryName, cc.CoverageDepTag).(cc.LinkableInterface)
+ flags.LinkFlags = append(flags.LinkFlags,
+ profileInstrFlag, "-g", coverage.OutputFile().Path().String(), "-Wl,--wrap,open")
+ deps.StaticLibs = append(deps.StaticLibs, coverage.OutputFile().Path())
+ }
// no_std modules are missing libprofiler_builtins which provides coverage, so we need to add it as a dependency.
if rustModule, ok := ctx.Module().(*Module); ok && rustModule.compiler.noStdlibs() {
diff --git a/rust/protobuf.go b/rust/protobuf.go
index 0b26b80..fab5259 100644
--- a/rust/protobuf.go
+++ b/rust/protobuf.go
@@ -16,6 +16,7 @@
import (
"fmt"
+ "strconv"
"strings"
"android/soong/android"
@@ -122,41 +123,65 @@
// stemFile must be first here as the first path in BaseSourceProvider.OutputFiles is the library entry-point.
var outputs android.WritablePaths
- rule := android.NewRuleBuilder(pctx, ctx)
+ for i, shard := range android.ShardPaths(protoFiles, 50) {
+ rule := android.NewRuleBuilder(pctx, ctx)
- for _, protoFile := range protoFiles {
- // Since we're iterating over the protoFiles already, make sure they're not redeclared in grpcFiles
- if android.InList(protoFile.String(), grpcFiles.Strings()) {
- ctx.PropertyErrorf("protos",
- "A proto can only be added once to either grpc_protos or protos. %q is declared in both properties",
- protoFile.String())
+ for _, protoFile := range shard {
+ // Since we're iterating over the protoFiles already, make sure they're not redeclared in grpcFiles
+ if android.InList(protoFile.String(), grpcFiles.Strings()) {
+ ctx.PropertyErrorf("protos",
+ "A proto can only be added once to either grpc_protos or protos. %q is declared in both properties",
+ protoFile.String())
+ }
+
+ protoName := strings.TrimSuffix(protoFile.Base(), ".proto")
+ proto.protoNames = append(proto.protoNames, protoName)
+
+ protoOut := android.PathForModuleOut(ctx, protoName+".rs")
+ depFile := android.PathForModuleOut(ctx, protoName+".d")
+
+ ruleOutputs := android.WritablePaths{protoOut, depFile}
+
+ android.ProtoRule(rule, protoFile, protoFlags, protoFlags.Deps, outDir, depFile, ruleOutputs)
+ outputs = append(outputs, ruleOutputs...)
}
- protoName := strings.TrimSuffix(protoFile.Base(), ".proto")
- proto.protoNames = append(proto.protoNames, protoName)
+ ruleName := "protoc"
+ ruleDesc := "protoc"
+ if i > 0 {
+ ruleName += "_" + strconv.Itoa(i+1)
+ ruleDesc += " " + strconv.Itoa(i+1)
+ }
- protoOut := android.PathForModuleOut(ctx, protoName+".rs")
- depFile := android.PathForModuleOut(ctx, protoName+".d")
-
- ruleOutputs := android.WritablePaths{protoOut, depFile}
-
- android.ProtoRule(rule, protoFile, protoFlags, protoFlags.Deps, outDir, depFile, ruleOutputs)
- outputs = append(outputs, ruleOutputs...)
+ rule.Build(ruleName, ruleDesc)
}
- for _, grpcFile := range grpcFiles {
- grpcName := strings.TrimSuffix(grpcFile.Base(), ".proto")
- proto.grpcNames = append(proto.grpcNames, grpcName)
+ for i, shard := range android.ShardPaths(grpcFiles, 50) {
+ rule := android.NewRuleBuilder(pctx, ctx)
- // GRPC protos produce two files, a proto.rs and a proto_grpc.rs
- protoOut := android.WritablePath(android.PathForModuleOut(ctx, grpcName+".rs"))
- grpcOut := android.WritablePath(android.PathForModuleOut(ctx, grpcName+grpcSuffix+".rs"))
- depFile := android.PathForModuleOut(ctx, grpcName+".d")
+ for _, grpcFile := range shard {
+ grpcName := strings.TrimSuffix(grpcFile.Base(), ".proto")
+ proto.grpcNames = append(proto.grpcNames, grpcName)
- ruleOutputs := android.WritablePaths{protoOut, grpcOut, depFile}
+ // GRPC protos produce two files, a proto.rs and a proto_grpc.rs
+ protoOut := android.WritablePath(android.PathForModuleOut(ctx, grpcName+".rs"))
+ grpcOut := android.WritablePath(android.PathForModuleOut(ctx, grpcName+grpcSuffix+".rs"))
+ depFile := android.PathForModuleOut(ctx, grpcName+".d")
- android.ProtoRule(rule, grpcFile, grpcProtoFlags, grpcProtoFlags.Deps, outDir, depFile, ruleOutputs)
- outputs = append(outputs, ruleOutputs...)
+ ruleOutputs := android.WritablePaths{protoOut, grpcOut, depFile}
+
+ android.ProtoRule(rule, grpcFile, grpcProtoFlags, grpcProtoFlags.Deps, outDir, depFile, ruleOutputs)
+ outputs = append(outputs, ruleOutputs...)
+ }
+
+ ruleName := "protoc_grpc"
+ ruleDesc := "protoc grpc"
+ if i > 0 {
+ ruleName += "_" + strconv.Itoa(i+1)
+ ruleDesc += " " + strconv.Itoa(i+1)
+ }
+
+ rule.Build(ruleName, ruleDesc)
}
// Check that all proto base filenames are unique as outputs are written to the same directory.
@@ -168,8 +193,6 @@
android.WriteFileRule(ctx, stemFile, proto.genModFileContents())
- rule.Build("protoc_"+ctx.ModuleName(), "protoc "+ctx.ModuleName())
-
// stemFile must be first here as the first path in BaseSourceProvider.OutputFiles is the library entry-point.
proto.BaseSourceProvider.OutputFiles = append(android.Paths{stemFile}, outputs.Paths()...)