Merge "Fix the condition for LLNDK ABI diff"
diff --git a/android/allowlists/allowlists.go b/android/allowlists/allowlists.go
index a1b7dbf..16f144e 100644
--- a/android/allowlists/allowlists.go
+++ b/android/allowlists/allowlists.go
@@ -49,9 +49,9 @@
"art/runtime": Bp2BuildDefaultTrueRecursively,
"art/tools": Bp2BuildDefaultTrue,
"bionic": Bp2BuildDefaultTrueRecursively,
+ "bootable/recovery/applypatch": Bp2BuildDefaultTrue,
"bootable/recovery/minadbd": Bp2BuildDefaultTrue,
"bootable/recovery/minui": Bp2BuildDefaultTrue,
- "bootable/recovery/applypatch": Bp2BuildDefaultTrue,
"bootable/recovery/recovery_utils": Bp2BuildDefaultTrue,
"bootable/recovery/tools/recovery_l10n": Bp2BuildDefaultTrue,
@@ -69,6 +69,9 @@
"build/soong/scripts": Bp2BuildDefaultTrueRecursively,
"cts/common/device-side/nativetesthelper/jni": Bp2BuildDefaultTrueRecursively,
+
+ "dalvik/tools/dexdeps": Bp2BuildDefaultTrueRecursively,
+
"development/apps/DevelopmentSettings": Bp2BuildDefaultTrue,
"development/apps/Fallback": Bp2BuildDefaultTrue,
"development/apps/WidgetPreview": Bp2BuildDefaultTrue,
@@ -108,8 +111,8 @@
"external/aac": Bp2BuildDefaultTrueRecursively,
"external/arm-optimized-routines": Bp2BuildDefaultTrueRecursively,
- "external/auto/android-annotation-stubs": Bp2BuildDefaultTrueRecursively,
"external/auto": Bp2BuildDefaultTrue,
+ "external/auto/android-annotation-stubs": Bp2BuildDefaultTrueRecursively,
"external/auto/common": Bp2BuildDefaultTrueRecursively,
"external/auto/service": Bp2BuildDefaultTrueRecursively,
"external/boringssl": Bp2BuildDefaultTrueRecursively,
@@ -176,19 +179,19 @@
"external/zopfli": Bp2BuildDefaultTrueRecursively,
"external/zstd": Bp2BuildDefaultTrueRecursively,
- "frameworks/av": Bp2BuildDefaultTrue,
- "frameworks/av/media/codecs": Bp2BuildDefaultTrueRecursively,
+ "frameworks/av": Bp2BuildDefaultTrue,
"frameworks/av/media/codec2/components/aom": Bp2BuildDefaultTrueRecursively,
+ "frameworks/av/media/codecs": Bp2BuildDefaultTrueRecursively,
"frameworks/av/media/liberror": Bp2BuildDefaultTrueRecursively,
- "frameworks/av/services/minijail": Bp2BuildDefaultTrueRecursively,
"frameworks/av/media/module/minijail": Bp2BuildDefaultTrueRecursively,
+ "frameworks/av/services/minijail": Bp2BuildDefaultTrueRecursively,
"frameworks/base/libs/androidfw": Bp2BuildDefaultTrue,
"frameworks/base/media/tests/MediaDump": Bp2BuildDefaultTrue,
"frameworks/base/services/tests/servicestests/aidl": Bp2BuildDefaultTrue,
"frameworks/base/startop/apps/test": Bp2BuildDefaultTrue,
"frameworks/base/tests/appwidgets/AppWidgetHostTest": Bp2BuildDefaultTrueRecursively,
- "frameworks/base/tools/streaming_proto": Bp2BuildDefaultTrueRecursively,
"frameworks/base/tools/aapt2": Bp2BuildDefaultTrue,
+ "frameworks/base/tools/streaming_proto": Bp2BuildDefaultTrueRecursively,
"frameworks/native/libs/adbd_auth": Bp2BuildDefaultTrueRecursively,
"frameworks/native/libs/arect": Bp2BuildDefaultTrueRecursively,
"frameworks/native/libs/gui": Bp2BuildDefaultTrue,
@@ -208,10 +211,10 @@
"hardware/interfaces/configstore/1.0": Bp2BuildDefaultTrue,
"hardware/interfaces/configstore/1.1": Bp2BuildDefaultTrue,
"hardware/interfaces/configstore/utils": Bp2BuildDefaultTrue,
- "hardware/interfaces/graphics/allocator/aidl": Bp2BuildDefaultTrue,
"hardware/interfaces/graphics/allocator/2.0": Bp2BuildDefaultTrue,
"hardware/interfaces/graphics/allocator/3.0": Bp2BuildDefaultTrue,
"hardware/interfaces/graphics/allocator/4.0": Bp2BuildDefaultTrue,
+ "hardware/interfaces/graphics/allocator/aidl": Bp2BuildDefaultTrue,
"hardware/interfaces/graphics/bufferqueue/1.0": Bp2BuildDefaultTrue,
"hardware/interfaces/graphics/bufferqueue/2.0": Bp2BuildDefaultTrue,
"hardware/interfaces/graphics/common/1.0": Bp2BuildDefaultTrue,
@@ -249,6 +252,7 @@
"packages/apps/Protips": Bp2BuildDefaultTrue,
"packages/apps/SafetyRegulatoryInfo": Bp2BuildDefaultTrue,
"packages/apps/WallpaperPicker": Bp2BuildDefaultTrue,
+ "packages/modules/NeuralNetworks/driver/cache": Bp2BuildDefaultTrueRecursively,
"packages/modules/StatsD/lib/libstatssocket": Bp2BuildDefaultTrueRecursively,
"packages/modules/adb": Bp2BuildDefaultTrue,
"packages/modules/adb/apex": Bp2BuildDefaultTrue,
@@ -259,7 +263,6 @@
"packages/modules/adb/proto": Bp2BuildDefaultTrueRecursively,
"packages/modules/adb/tls": Bp2BuildDefaultTrueRecursively,
"packages/providers/MediaProvider/tools/dialogs": Bp2BuildDefaultFalse, // TODO(b/242834374)
- "packages/modules/NeuralNetworks/driver/cache": Bp2BuildDefaultTrueRecursively,
"packages/screensavers/Basic": Bp2BuildDefaultTrue,
"packages/services/Car/tests/SampleRearViewCamera": Bp2BuildDefaultFalse, // TODO(b/242834321)
@@ -272,8 +275,8 @@
"prebuilts/tools": Bp2BuildDefaultTrue,
"prebuilts/tools/common/m2": Bp2BuildDefaultTrue,
- "sdk/eventanalyzer": Bp2BuildDefaultTrue,
"sdk/dumpeventlog": Bp2BuildDefaultTrue,
+ "sdk/eventanalyzer": Bp2BuildDefaultTrue,
"system/apex": Bp2BuildDefaultFalse, // TODO(b/207466993): flaky failures
"system/apex/apexer": Bp2BuildDefaultTrue,
@@ -1339,9 +1342,12 @@
"prebuilt_currysrc_org.eclipse",
}
+ // Bazel prod-mode allowlist. Modules in this list are built by Bazel
+ // in either prod mode or staging mode.
ProdMixedBuildsEnabledList = []string{}
- // Staging builds should be entirely prod, plus some near-ready ones. Add the
- // new ones to the first argument as needed.
- StagingMixedBuildsEnabledList = append([]string{}, ProdMixedBuildsEnabledList...)
+ // Staging-mode allowlist. Modules in this list are only built
+ // by Bazel with --bazel-mode-staging. This list should contain modules
+ // which will soon be added to the prod allowlist.
+ StagingMixedBuildsEnabledList = []string{"com.android.tzdata"}
)
diff --git a/android/bazel_handler.go b/android/bazel_handler.go
index d4af70b..eec78d2 100644
--- a/android/bazel_handler.go
+++ b/android/bazel_handler.go
@@ -317,7 +317,7 @@
func (bazelCtx *bazelContext) GetApexInfo(label string, cfgKey configKey) (cquery.ApexInfo, error) {
key := makeCqueryKey(label, cquery.GetApexInfo, cfgKey)
if rawString, ok := bazelCtx.results[key]; ok {
- return cquery.GetApexInfo.ParseResult(strings.TrimSpace(rawString)), nil
+ return cquery.GetApexInfo.ParseResult(strings.TrimSpace(rawString))
}
return cquery.ApexInfo{}, fmt.Errorf("no bazel response found for %v", key)
}
@@ -325,7 +325,7 @@
func (bazelCtx *bazelContext) GetCcUnstrippedInfo(label string, cfgKey configKey) (cquery.CcUnstrippedInfo, error) {
key := makeCqueryKey(label, cquery.GetCcUnstrippedInfo, cfgKey)
if rawString, ok := bazelCtx.results[key]; ok {
- return cquery.GetCcUnstrippedInfo.ParseResult(strings.TrimSpace(rawString)), nil
+ return cquery.GetCcUnstrippedInfo.ParseResult(strings.TrimSpace(rawString))
}
return cquery.CcUnstrippedInfo{}, fmt.Errorf("no bazel response for %s", key)
}
@@ -389,9 +389,12 @@
}
case BazelStagingMode:
modulesDefaultToBazel = false
+ // Staging mode includes all prod modules plus all staging modules.
+ for _, enabledProdModule := range allowlists.ProdMixedBuildsEnabledList {
+ enabledModules[enabledProdModule] = true
+ }
for _, enabledStagingMode := range allowlists.StagingMixedBuildsEnabledList {
enabledModules[enabledStagingMode] = true
-
}
case BazelDevMode:
modulesDefaultToBazel = true
@@ -568,7 +571,9 @@
// Suppress noise
"--ui_event_filters=-INFO",
- "--noshow_progress"}
+ "--noshow_progress",
+ "--norun_validations",
+ }
cmdFlags = append(cmdFlags, extraFlags...)
bazelCmd := exec.Command(paths.bazelPath, cmdFlags...)
diff --git a/android/config.go b/android/config.go
index 50f63ea..0c3e2d1 100644
--- a/android/config.go
+++ b/android/config.go
@@ -536,7 +536,7 @@
// Returns true if "Bazel builds" is enabled. In this mode, part of build
// analysis is handled by Bazel.
func (c *config) IsMixedBuildsEnabled() bool {
- return c.BuildMode == BazelProdMode || c.BuildMode == BazelDevMode
+ return c.BuildMode == BazelProdMode || c.BuildMode == BazelDevMode || c.BuildMode == BazelStagingMode
}
func (c *config) SetAllowMissingDependencies() {
diff --git a/apex/apex.go b/apex/apex.go
index ff0f504..72403f9 100644
--- a/apex/apex.go
+++ b/apex/apex.go
@@ -1903,15 +1903,14 @@
apexType := a.properties.ApexType
switch apexType {
case imageApex:
+
// TODO(b/190817312): Generate the notice file from the apex rule.
a.htmlGzNotice = android.PathForBazelOut(ctx, "NOTICE.html.gz")
- // TODO(b/239081457): Generate the bazel bundle module file from the apex rule.
- a.bundleModuleFile = android.PathForBazelOut(ctx, a.Name()+apexType.suffix()+"-base.zip")
+ a.bundleModuleFile = android.PathForBazelOut(ctx, outputs.BundleFile)
a.nativeApisUsedByModuleFile = android.ModuleOutPath(android.PathForBazelOut(ctx, outputs.SymbolsUsedByApex))
- // TODO(b/239081456): Generate the backing.txt file from Bazel.
- a.nativeApisBackedByModuleFile = android.ModuleOutPath(android.PathForBazelOut(ctx, a.Name()+"_backing.txt"))
+ a.nativeApisBackedByModuleFile = android.ModuleOutPath(android.PathForBazelOut(ctx, outputs.BackingLibs))
// TODO(b/239084755): Generate the java api using.xml file from Bazel.
- a.javaApisUsedByModuleFile = android.ModuleOutPath(android.PathForBazelOut(ctx, a.Name()+"_using.xml"))
+ a.javaApisUsedByModuleFile = android.ModuleOutPath(android.PathForBazelOut(ctx, outputs.JavaSymbolsUsedByApex))
installSuffix := imageApexSuffix
if a.isCompressed {
installSuffix = imageCapexSuffix
diff --git a/apex/apex_test.go b/apex/apex_test.go
index 48ad024..985ad59 100644
--- a/apex/apex_test.go
+++ b/apex/apex_test.go
@@ -9768,11 +9768,13 @@
OutputBaseDir: outputBaseDir,
LabelToApexInfo: map[string]cquery.ApexInfo{
"//:foo": cquery.ApexInfo{
- SignedOutput: "signed_out.apex",
- UnsignedOutput: "unsigned_out.apex",
- BundleKeyInfo: []string{"public_key", "private_key"},
- ContainerKeyInfo: []string{"container_cert", "container_private"},
- SymbolsUsedByApex: "foo_using.txt",
+ SignedOutput: "signed_out.apex",
+ UnsignedOutput: "unsigned_out.apex",
+ BundleKeyInfo: []string{"public_key", "private_key"},
+ ContainerKeyInfo: []string{"container_cert", "container_private"},
+ SymbolsUsedByApex: "foo_using.txt",
+ JavaSymbolsUsedByApex: "foo_using.xml",
+ BundleFile: "apex_bundle.zip",
// unused
PackageName: "pkg_name",
@@ -9813,4 +9815,17 @@
if w, g := "out/bazel/execroot/__main__/foo_using.txt", ab.nativeApisUsedByModuleFile.String(); w != g {
t.Errorf("Expected output file %q, got %q", w, g)
}
+
+ if w, g := "out/bazel/execroot/__main__/foo_using.xml", ab.javaApisUsedByModuleFile.String(); w != g {
+ t.Errorf("Expected output file %q, got %q", w, g)
+ }
+
+ mkData := android.AndroidMkDataForTest(t, result.TestContext, m)
+ var builder strings.Builder
+ mkData.Custom(&builder, "foo", "BAZEL_TARGET_", "", mkData)
+
+ data := builder.String()
+ if w := "ALL_MODULES.$(my_register_name).BUNDLE := out/bazel/execroot/__main__/apex_bundle.zip"; !strings.Contains(data, w) {
+ t.Errorf("Expected %q in androidmk data, but did not find %q", w, data)
+ }
}
diff --git a/bazel/cquery/request_type.go b/bazel/cquery/request_type.go
index 572bbd1..eb44dd1 100644
--- a/bazel/cquery/request_type.go
+++ b/bazel/cquery/request_type.go
@@ -30,6 +30,7 @@
// be a subset of OutputFiles. (or shared libraries, this will be equal to OutputFiles,
// but general cc_library will also have dynamic libraries in output files).
RootDynamicLibraries []string
+ TidyFiles []string
TocFile string
UnstrippedOutput string
}
@@ -165,6 +166,12 @@
# NOTE: It's OK if there's no ToC, as Soong just uses it for optimization
pass
+tidy_files = []
+p = providers(target)
+clang_tidy_info = p.get("//build/bazel/rules/cc:clang_tidy.bzl%ClangTidyInfo")
+if clang_tidy_info:
+ tidy_files = [v.path for v in clang_tidy_info.tidy_files.to_list()]
+
return json_encode({
"OutputFiles": outputFiles,
"CcObjectFiles": ccObjectFiles,
@@ -175,6 +182,7 @@
"Headers": headers,
"RootStaticArchives": rootStaticArchives,
"RootDynamicLibraries": rootSharedLibraries,
+ "TidyFiles": tidy_files,
"TocFile": toc_file,
"UnstrippedOutput": unstripped,
})`
@@ -186,7 +194,9 @@
// Starlark given in StarlarkFunctionBody.
func (g getCcInfoType) ParseResult(rawString string) (CcInfo, error) {
var ccInfo CcInfo
- parseJson(rawString, &ccInfo)
+ if err := parseJson(rawString, &ccInfo); err != nil {
+ return ccInfo, err
+ }
return ccInfo, nil
}
@@ -219,27 +229,33 @@
"container_key_info": [container_key_info.pem.path, container_key_info.pk8.path, container_key_info.key_name],
"package_name": info.package_name,
"symbols_used_by_apex": info.symbols_used_by_apex.path,
+ "java_symbols_used_by_apex": info.java_symbols_used_by_apex.path,
+ "backing_libs": info.backing_libs.path,
+ "bundle_file": info.base_with_config_zip.path,
})`
}
type ApexInfo struct {
- SignedOutput string `json:"signed_output"`
- UnsignedOutput string `json:"unsigned_output"`
- ProvidesLibs []string `json:"provides_native_libs"`
- RequiresLibs []string `json:"requires_native_libs"`
- BundleKeyInfo []string `json:"bundle_key_info"`
- ContainerKeyInfo []string `json:"container_key_info"`
- PackageName string `json:"package_name"`
- SymbolsUsedByApex string `json:"symbols_used_by_apex"`
+ SignedOutput string `json:"signed_output"`
+ UnsignedOutput string `json:"unsigned_output"`
+ ProvidesLibs []string `json:"provides_native_libs"`
+ RequiresLibs []string `json:"requires_native_libs"`
+ BundleKeyInfo []string `json:"bundle_key_info"`
+ ContainerKeyInfo []string `json:"container_key_info"`
+ PackageName string `json:"package_name"`
+ SymbolsUsedByApex string `json:"symbols_used_by_apex"`
+ JavaSymbolsUsedByApex string `json:"java_symbols_used_by_apex"`
+ BackingLibs string `json:"backing_libs"`
+ BundleFile string `json:"bundle_file"`
}
// ParseResult returns a value obtained by parsing the result of the request's Starlark function.
// The given rawString must correspond to the string output which was created by evaluating the
// Starlark given in StarlarkFunctionBody.
-func (g getApexInfoType) ParseResult(rawString string) ApexInfo {
+func (g getApexInfoType) ParseResult(rawString string) (ApexInfo, error) {
var info ApexInfo
- parseJson(rawString, &info)
- return info
+ err := parseJson(rawString, &info)
+ return info, err
}
// getCcUnstrippedInfoType implements cqueryRequest interface. It handles the
@@ -268,10 +284,10 @@
// ParseResult returns a value obtained by parsing the result of the request's Starlark function.
// The given rawString must correspond to the string output which was created by evaluating the
// Starlark given in StarlarkFunctionBody.
-func (g getCcUnstippedInfoType) ParseResult(rawString string) CcUnstrippedInfo {
+func (g getCcUnstippedInfoType) ParseResult(rawString string) (CcUnstrippedInfo, error) {
var info CcUnstrippedInfo
- parseJson(rawString, &info)
- return info
+ err := parseJson(rawString, &info)
+ return info, err
}
type CcUnstrippedInfo struct {
@@ -291,10 +307,12 @@
// parseJson decodes json string into the fields of the receiver.
// Unknown attribute name causes panic.
-func parseJson(jsonString string, info interface{}) {
+func parseJson(jsonString string, info interface{}) error {
decoder := json.NewDecoder(strings.NewReader(jsonString))
decoder.DisallowUnknownFields() //useful to detect typos, e.g. in unit tests
- if err := decoder.Decode(info); err != nil {
- panic(fmt.Errorf("cannot parse cquery result '%s': %s", jsonString, err))
+ err := decoder.Decode(info)
+ if err != nil {
+ return fmt.Errorf("cannot parse cquery result '%s': %s", jsonString, err)
}
+ return nil
}
diff --git a/bazel/cquery/request_type_test.go b/bazel/cquery/request_type_test.go
index c7eb84e..a0a993f 100644
--- a/bazel/cquery/request_type_test.go
+++ b/bazel/cquery/request_type_test.go
@@ -3,10 +3,12 @@
import (
"encoding/json"
"reflect"
+ "strings"
"testing"
)
func TestGetOutputFilesParseResults(t *testing.T) {
+ t.Parallel()
testCases := []struct {
description string
input string
@@ -29,14 +31,17 @@
},
}
for _, tc := range testCases {
- actualOutput := GetOutputFiles.ParseResult(tc.input)
- if !reflect.DeepEqual(tc.expectedOutput, actualOutput) {
- t.Errorf("%q: expected %#v != actual %#v", tc.description, tc.expectedOutput, actualOutput)
- }
+ t.Run(tc.description, func(t *testing.T) {
+ actualOutput := GetOutputFiles.ParseResult(tc.input)
+ if !reflect.DeepEqual(tc.expectedOutput, actualOutput) {
+ t.Errorf("expected %#v != actual %#v", tc.expectedOutput, actualOutput)
+ }
+ })
}
}
func TestGetPythonBinaryParseResults(t *testing.T) {
+ t.Parallel()
testCases := []struct {
description string
input string
@@ -54,14 +59,17 @@
},
}
for _, tc := range testCases {
- actualOutput := GetPythonBinary.ParseResult(tc.input)
- if !reflect.DeepEqual(tc.expectedOutput, actualOutput) {
- t.Errorf("%q: expected %#v != actual %#v", tc.description, tc.expectedOutput, actualOutput)
- }
+ t.Run(tc.description, func(t *testing.T) {
+ actualOutput := GetPythonBinary.ParseResult(tc.input)
+ if !reflect.DeepEqual(tc.expectedOutput, actualOutput) {
+ t.Errorf("expected %#v != actual %#v", tc.expectedOutput, actualOutput)
+ }
+ })
}
}
func TestGetCcInfoParseResults(t *testing.T) {
+ t.Parallel()
testCases := []struct {
description string
inputCcInfo CcInfo
@@ -73,24 +81,6 @@
expectedOutput: CcInfo{},
},
{
- description: "only output",
- inputCcInfo: CcInfo{
- OutputFiles: []string{"test", "test3"},
- },
- expectedOutput: CcInfo{
- OutputFiles: []string{"test", "test3"},
- },
- },
- {
- description: "only ToC",
- inputCcInfo: CcInfo{
- TocFile: "test",
- },
- expectedOutput: CcInfo{
- TocFile: "test",
- },
- },
- {
description: "all items set",
inputCcInfo: CcInfo{
OutputFiles: []string{"out1", "out2"},
@@ -119,17 +109,51 @@
},
}
for _, tc := range testCases {
- jsonInput, _ := json.Marshal(tc.inputCcInfo)
- actualOutput, err := GetCcInfo.ParseResult(string(jsonInput))
- if err != nil {
- t.Errorf("%q:\n test case get error: %q", tc.description, err)
- } else if err == nil && !reflect.DeepEqual(tc.expectedOutput, actualOutput) {
- t.Errorf("%q:\n expected %#v\n!= actual %#v", tc.description, tc.expectedOutput, actualOutput)
- }
+ t.Run(tc.description, func(t *testing.T) {
+ jsonInput, _ := json.Marshal(tc.inputCcInfo)
+ actualOutput, err := GetCcInfo.ParseResult(string(jsonInput))
+ if err != nil {
+ t.Errorf("error parsing result: %q", err)
+ } else if err == nil && !reflect.DeepEqual(tc.expectedOutput, actualOutput) {
+ t.Errorf("expected %#v\n!= actual %#v", tc.expectedOutput, actualOutput)
+ }
+ })
+ }
+}
+
+func TestGetCcInfoParseResultsError(t *testing.T) {
+ t.Parallel()
+ testCases := []struct {
+ description string
+ input string
+ expectedError string
+ }{
+ {
+ description: "not json",
+ input: ``,
+ expectedError: `cannot parse cquery result '': EOF`,
+ },
+ {
+ description: "invalid field",
+ input: `{
+ "toc_file": "dir/file.so.toc"
+}`,
+ expectedError: `json: unknown field "toc_file"`,
+ },
+ }
+
+ for _, tc := range testCases {
+ t.Run(tc.description, func(t *testing.T) {
+ _, err := GetCcInfo.ParseResult(tc.input)
+ if !strings.Contains(err.Error(), tc.expectedError) {
+ t.Errorf("expected string %q in error message, got %q", tc.expectedError, err)
+ }
+ })
}
}
func TestGetApexInfoParseResults(t *testing.T) {
+ t.Parallel()
testCases := []struct {
description string
input string
@@ -142,14 +166,18 @@
},
{
description: "one result",
- input: `{"signed_output":"my.apex",` +
- `"unsigned_output":"my.apex.unsigned",` +
- `"requires_native_libs":["//bionic/libc:libc","//bionic/libdl:libdl"],` +
- `"bundle_key_info":["foo.pem", "foo.privkey"],` +
- `"container_key_info":["foo.x509.pem", "foo.pk8", "foo"],` +
- `"package_name":"package.name",` +
- `"symbols_used_by_apex": "path/to/my.apex_using.txt",` +
- `"provides_native_libs":[]}`,
+ input: `{
+ "signed_output":"my.apex",
+ "unsigned_output":"my.apex.unsigned",
+ "requires_native_libs":["//bionic/libc:libc","//bionic/libdl:libdl"],
+ "bundle_key_info":["foo.pem", "foo.privkey"],
+ "container_key_info":["foo.x509.pem", "foo.pk8", "foo"],
+ "package_name":"package.name",
+ "symbols_used_by_apex": "path/to/my.apex_using.txt",
+ "backing_libs":"path/to/backing.txt",
+ "bundle_file": "dir/bundlefile.zip",
+ "provides_native_libs":[]
+}`,
expectedOutput: ApexInfo{
SignedOutput: "my.apex",
UnsignedOutput: "my.apex.unsigned",
@@ -159,18 +187,57 @@
ContainerKeyInfo: []string{"foo.x509.pem", "foo.pk8", "foo"},
PackageName: "package.name",
SymbolsUsedByApex: "path/to/my.apex_using.txt",
+ BackingLibs: "path/to/backing.txt",
+ BundleFile: "dir/bundlefile.zip",
},
},
}
for _, tc := range testCases {
- actualOutput := GetApexInfo.ParseResult(tc.input)
- if !reflect.DeepEqual(tc.expectedOutput, actualOutput) {
- t.Errorf("%q: expected %#v != actual %#v", tc.description, tc.expectedOutput, actualOutput)
- }
+ t.Run(tc.description, func(t *testing.T) {
+ actualOutput, err := GetApexInfo.ParseResult(tc.input)
+ if err != nil {
+ t.Errorf("Unexpected error %q", err)
+ }
+ if !reflect.DeepEqual(tc.expectedOutput, actualOutput) {
+ t.Errorf("expected %#v != actual %#v", tc.expectedOutput, actualOutput)
+ }
+ })
+ }
+}
+
+func TestGetApexInfoParseResultsError(t *testing.T) {
+ t.Parallel()
+ testCases := []struct {
+ description string
+ input string
+ expectedError string
+ }{
+ {
+ description: "not json",
+ input: ``,
+ expectedError: `cannot parse cquery result '': EOF`,
+ },
+ {
+ description: "invalid field",
+ input: `{
+ "fake_field": "path/to/file"
+}`,
+ expectedError: `json: unknown field "fake_field"`,
+ },
+ }
+
+ for _, tc := range testCases {
+ t.Run(tc.description, func(t *testing.T) {
+ _, err := GetApexInfo.ParseResult(tc.input)
+ if !strings.Contains(err.Error(), tc.expectedError) {
+ t.Errorf("expected string %q in error message, got %q", tc.expectedError, err)
+ }
+ })
}
}
func TestGetCcUnstrippedParseResults(t *testing.T) {
+ t.Parallel()
testCases := []struct {
description string
input string
@@ -191,9 +258,45 @@
},
}
for _, tc := range testCases {
- actualOutput := GetCcUnstrippedInfo.ParseResult(tc.input)
- if !reflect.DeepEqual(tc.expectedOutput, actualOutput) {
- t.Errorf("%q: expected %#v != actual %#v", tc.description, tc.expectedOutput, actualOutput)
- }
+ t.Run(tc.description, func(t *testing.T) {
+ actualOutput, err := GetCcUnstrippedInfo.ParseResult(tc.input)
+ if err != nil {
+ t.Errorf("Unexpected error %q", err)
+ }
+ if !reflect.DeepEqual(tc.expectedOutput, actualOutput) {
+ t.Errorf("expected %#v != actual %#v", tc.expectedOutput, actualOutput)
+ }
+ })
+ }
+}
+
+func TestGetCcUnstrippedParseResultsErrors(t *testing.T) {
+ t.Parallel()
+ testCases := []struct {
+ description string
+ input string
+ expectedError string
+ }{
+ {
+ description: "not json",
+ input: ``,
+ expectedError: `cannot parse cquery result '': EOF`,
+ },
+ {
+ description: "invalid field",
+ input: `{
+ "fake_field": "path/to/file"
+}`,
+ expectedError: `json: unknown field "fake_field"`,
+ },
+ }
+
+ for _, tc := range testCases {
+ t.Run(tc.description, func(t *testing.T) {
+ _, err := GetCcUnstrippedInfo.ParseResult(tc.input)
+ if !strings.Contains(err.Error(), tc.expectedError) {
+ t.Errorf("expected string %q in error message, got %q", tc.expectedError, err)
+ }
+ })
}
}
diff --git a/bp2build/cc_library_conversion_test.go b/bp2build/cc_library_conversion_test.go
index 0d6d5b8..4c86374 100644
--- a/bp2build/cc_library_conversion_test.go
+++ b/bp2build/cc_library_conversion_test.go
@@ -3508,3 +3508,38 @@
},
})
}
+
+func TestCcLibraryWithTidy(t *testing.T) {
+ runCcLibraryTestCase(t, Bp2buildTestCase{
+ Description: "cc_library uses tidy properties",
+ ModuleTypeUnderTest: "cc_library",
+ ModuleTypeUnderTestFactory: cc.LibraryFactory,
+ Blueprint: `
+cc_library_static {
+ name: "foo",
+ srcs: ["foo.cpp"],
+ tidy: true,
+ tidy_checks: ["check1", "check2"],
+ tidy_checks_as_errors: ["check1error", "check2error"],
+ tidy_disabled_srcs: ["bar.cpp"],
+ tidy_timeout_srcs: ["baz.cpp"],
+}`,
+ ExpectedBazelTargets: []string{
+ MakeBazelTarget("cc_library_static", "foo", AttrNameToString{
+ "local_includes": `["."]`,
+ "srcs": `["foo.cpp"]`,
+ "tidy": `True`,
+ "tidy_checks": `[
+ "check1",
+ "check2",
+ ]`,
+ "tidy_checks_as_errors": `[
+ "check1error",
+ "check2error",
+ ]`,
+ "tidy_disabled_srcs": `["bar.cpp"]`,
+ "tidy_timeout_srcs": `["baz.cpp"]`,
+ }),
+ },
+ })
+}
diff --git a/bpf/bpf.go b/bpf/bpf.go
index 60a410d..7376750 100644
--- a/bpf/bpf.go
+++ b/bpf/bpf.go
@@ -18,6 +18,7 @@
"fmt"
"io"
"path/filepath"
+ "runtime"
"strings"
"android/soong/android"
@@ -31,6 +32,9 @@
func init() {
registerBpfBuildComponents(android.InitRegistrationContext)
pctx.Import("android/soong/cc/config")
+ if runtime.GOOS != "darwin" {
+ pctx.StaticVariable("relPwd", "PWD=/proc/self/cwd")
+ }
}
var (
@@ -40,7 +44,7 @@
blueprint.RuleParams{
Depfile: "${out}.d",
Deps: blueprint.DepsGCC,
- Command: "$ccCmd --target=bpf -c $cFlags -MD -MF ${out}.d -o $out $in",
+ Command: "$relPwd $ccCmd --target=bpf -c $cFlags -MD -MF ${out}.d -o $out $in",
CommandDeps: []string{"$ccCmd"},
},
"ccCmd", "cFlags")
@@ -164,6 +168,9 @@
if proptools.Bool(bpf.properties.Btf) {
cflags = append(cflags, "-g")
+ if runtime.GOOS != "darwin" {
+ cflags = append(cflags, "-fdebug-prefix-map=/proc/self/cwd=")
+ }
}
srcs := android.PathsForModuleSrc(ctx, bpf.properties.Srcs)
diff --git a/cc/binary.go b/cc/binary.go
index d09e744..c2868e7 100644
--- a/cc/binary.go
+++ b/cc/binary.go
@@ -646,7 +646,7 @@
sdkAttributes: bp2BuildParseSdkAttributes(m),
}
- m.convertTidyAttributes(&attrs.tidyAttributes)
+ m.convertTidyAttributes(ctx, &attrs.tidyAttributes)
return attrs
}
diff --git a/cc/bp2build.go b/cc/bp2build.go
index 2f79cae..6caa854 100644
--- a/cc/bp2build.go
+++ b/cc/bp2build.go
@@ -75,9 +75,11 @@
Tidy_flags []string
Tidy_checks []string
Tidy_checks_as_errors []string
+ Tidy_disabled_srcs bazel.LabelListAttribute
+ Tidy_timeout_srcs bazel.LabelListAttribute
}
-func (m *Module) convertTidyAttributes(moduleAttrs *tidyAttributes) {
+func (m *Module) convertTidyAttributes(ctx android.BaseMutatorContext, moduleAttrs *tidyAttributes) {
for _, f := range m.features {
if tidy, ok := f.(*tidyFeature); ok {
moduleAttrs.Tidy = tidy.Properties.Tidy
@@ -85,6 +87,18 @@
moduleAttrs.Tidy_checks = tidy.Properties.Tidy_checks
moduleAttrs.Tidy_checks_as_errors = tidy.Properties.Tidy_checks_as_errors
}
+
+ }
+ archVariantProps := m.GetArchVariantProperties(ctx, &BaseCompilerProperties{})
+ for axis, configToProps := range archVariantProps {
+ for config, _props := range configToProps {
+ if archProps, ok := _props.(*BaseCompilerProperties); ok {
+ archDisabledSrcs := android.BazelLabelForModuleSrc(ctx, archProps.Tidy_disabled_srcs)
+ moduleAttrs.Tidy_disabled_srcs.SetSelectValue(axis, config, archDisabledSrcs)
+ archTimeoutSrcs := android.BazelLabelForModuleSrc(ctx, archProps.Tidy_timeout_srcs)
+ moduleAttrs.Tidy_timeout_srcs.SetSelectValue(axis, config, archTimeoutSrcs)
+ }
+ }
}
}
diff --git a/cc/cc.go b/cc/cc.go
index a8011b8..306e483 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -1853,6 +1853,11 @@
func (c *Module) ProcessBazelQueryResponse(ctx android.ModuleContext) {
bazelModuleLabel := c.getBazelModuleLabel(ctx)
+ bazelCtx := ctx.Config().BazelContext
+ if ccInfo, err := bazelCtx.GetCcInfo(bazelModuleLabel, android.GetConfigKey(ctx)); err == nil {
+ c.tidyFiles = android.PathsForBazelOut(ctx, ccInfo.TidyFiles)
+ }
+
c.bazelHandler.ProcessBazelQueryResponse(ctx, bazelModuleLabel)
c.Properties.SubName = GetSubnameProperty(ctx, c)
@@ -2540,6 +2545,8 @@
}, vndkExtDepTag, GetReplaceModuleName(vndkdep.getVndkExtendsModuleName(), GetSnapshot(c, &snapshotInfo, actx).SharedLibs))
}
}
+
+ updateImportedLibraryDependency(ctx)
}
func BeginMutator(ctx android.BottomUpMutatorContext) {
diff --git a/cc/config/arm_device.go b/cc/config/arm_device.go
index b53a097..981d1ea 100644
--- a/cc/config/arm_device.go
+++ b/cc/config/arm_device.go
@@ -222,6 +222,7 @@
"": "${config.ArmGenericCflags}",
"cortex-a7": "${config.ArmCortexA7Cflags}",
"cortex-a8": "${config.ArmCortexA8Cflags}",
+ "cortex-a9": "${config.ArmGenericCflags}",
"cortex-a15": "${config.ArmCortexA15Cflags}",
"cortex-a53": "${config.ArmCortexA53Cflags}",
"cortex-a53.a57": "${config.ArmCortexA53Cflags}",
diff --git a/cc/library.go b/cc/library.go
index 65c6b6d..897f3c7 100644
--- a/cc/library.go
+++ b/cc/library.go
@@ -956,7 +956,7 @@
for _, path := range paths {
dir := path.String()
// Skip if dir is for generated headers
- if strings.HasPrefix(dir, android.PathForOutput(ctx).String()) {
+ if strings.HasPrefix(dir, ctx.Config().OutDir()) {
continue
}
@@ -2599,11 +2599,12 @@
m := mctx.Module().(*Module)
isLLNDK := m.IsLlndk()
isVendorPublicLibrary := m.IsVendorPublicLibrary()
+ isImportedApiLibrary := m.isImportedApiLibrary()
modules := mctx.CreateLocalVariations(variants...)
for i, m := range modules {
- if variants[i] != "" || isLLNDK || isVendorPublicLibrary {
+ if variants[i] != "" || isLLNDK || isVendorPublicLibrary || isImportedApiLibrary {
// A stubs or LLNDK stubs variant.
c := m.(*Module)
c.sanitize = nil
@@ -2793,7 +2794,7 @@
Runtime_deps: linkerAttrs.runtimeDeps,
}
- module.convertTidyAttributes(&commonAttrs.tidyAttributes)
+ module.convertTidyAttributes(ctx, &commonAttrs.tidyAttributes)
var attrs interface{}
if isStatic {
diff --git a/cc/library_stub.go b/cc/library_stub.go
index 760d36a..2fb21a3 100644
--- a/cc/library_stub.go
+++ b/cc/library_stub.go
@@ -15,6 +15,10 @@
package cc
import (
+ "strings"
+
+ "github.com/google/blueprint/proptools"
+
"android/soong/android"
"android/soong/multitree"
)
@@ -26,6 +30,30 @@
func RegisterLibraryStubBuildComponents(ctx android.RegistrationContext) {
ctx.RegisterModuleType("cc_api_library", CcApiLibraryFactory)
ctx.RegisterModuleType("cc_api_headers", CcApiHeadersFactory)
+ ctx.RegisterModuleType("cc_api_variant", CcApiVariantFactory)
+}
+
+func updateImportedLibraryDependency(ctx android.BottomUpMutatorContext) {
+ m, ok := ctx.Module().(*Module)
+ if !ok {
+ return
+ }
+
+ apiLibrary, ok := m.linker.(*apiLibraryDecorator)
+ if !ok {
+ return
+ }
+
+ if m.UseVndk() && apiLibrary.hasLLNDKStubs() {
+ // Add LLNDK dependencies
+ for _, variant := range apiLibrary.properties.Variants {
+ if variant == "llndk" {
+ variantName := BuildApiVariantName(m.BaseModuleName(), "llndk", "")
+ ctx.AddDependency(m, nil, variantName)
+ break
+ }
+ }
+ }
}
// 'cc_api_library' is a module type which is from the exported API surface
@@ -33,7 +61,8 @@
// offer a link to the module that generates shared library object from the
// map file.
type apiLibraryProperties struct {
- Src *string `android:"arch_variant"`
+ Src *string `android:"arch_variant"`
+ Variants []string
}
type apiLibraryDecorator struct {
@@ -55,11 +84,9 @@
module.compiler = nil
module.linker = apiLibraryDecorator
module.installer = nil
+ module.library = apiLibraryDecorator
module.AddProperties(&module.Properties, &apiLibraryDecorator.properties)
- // Mark module as stub, so APEX would not include this stub in the package.
- module.library.setBuildStubs(true)
-
// Prevent default system libs (libc, libm, and libdl) from being linked
if apiLibraryDecorator.baseLinker.Properties.System_shared_libs == nil {
apiLibraryDecorator.baseLinker.Properties.System_shared_libs = []string{}
@@ -91,12 +118,45 @@
}
func (d *apiLibraryDecorator) link(ctx ModuleContext, flags Flags, deps PathDeps, objects Objects) android.Path {
- // Export headers as system include dirs if specified. Mostly for libc
- if Bool(d.libraryDecorator.Properties.Llndk.Export_headers_as_system) {
- d.libraryDecorator.flagExporter.Properties.Export_system_include_dirs = append(
- d.libraryDecorator.flagExporter.Properties.Export_system_include_dirs,
- d.libraryDecorator.flagExporter.Properties.Export_include_dirs...)
- d.libraryDecorator.flagExporter.Properties.Export_include_dirs = nil
+ m, _ := ctx.Module().(*Module)
+
+ var in android.Path
+
+ if src := proptools.String(d.properties.Src); src != "" {
+ in = android.PathForModuleSrc(ctx, src)
+ }
+
+ // LLNDK variant
+ if m.UseVndk() && d.hasLLNDKStubs() {
+ apiVariantModule := BuildApiVariantName(m.BaseModuleName(), "llndk", "")
+
+ var mod android.Module
+
+ ctx.VisitDirectDeps(func(depMod android.Module) {
+ if depMod.Name() == apiVariantModule {
+ mod = depMod
+ }
+ })
+
+ if mod != nil {
+ variantMod, ok := mod.(*CcApiVariant)
+ if ok {
+ in = variantMod.Src()
+
+ // Copy LLDNK properties to cc_api_library module
+ d.libraryDecorator.flagExporter.Properties.Export_include_dirs = append(
+ d.libraryDecorator.flagExporter.Properties.Export_include_dirs,
+ variantMod.exportProperties.Export_headers...)
+
+ // Export headers as system include dirs if specified. Mostly for libc
+ if proptools.Bool(variantMod.exportProperties.Export_headers_as_system) {
+ d.libraryDecorator.flagExporter.Properties.Export_system_include_dirs = append(
+ d.libraryDecorator.flagExporter.Properties.Export_system_include_dirs,
+ d.libraryDecorator.flagExporter.Properties.Export_include_dirs...)
+ d.libraryDecorator.flagExporter.Properties.Export_include_dirs = nil
+ }
+ }
+ }
}
// Flags reexported from dependencies. (e.g. vndk_prebuilt_shared)
@@ -107,13 +167,10 @@
d.libraryDecorator.reexportDeps(deps.ReexportedDeps...)
d.libraryDecorator.addExportedGeneratedHeaders(deps.ReexportedGeneratedHeaders...)
- if d.properties.Src == nil {
- ctx.PropertyErrorf("src", "src is a required property")
+ if in == nil {
+ ctx.PropertyErrorf("src", "Unable to locate source property")
+ return nil
}
- // Skip the existence check of the stub prebuilt file.
- // The file is not guaranteed to exist during Soong analysis.
- // Build orchestrator will be responsible for creating a connected ninja graph.
- in := android.MaybeExistentPathForSource(ctx, ctx.ModuleDir(), *d.properties.Src)
// Make the _compilation_ of rdeps have an order-only dep on cc_api_library.src (an .so file)
// The .so file itself has an order-only dependency on the headers contributed by this library.
@@ -143,6 +200,43 @@
return true
}
+func (d *apiLibraryDecorator) stubsVersions(ctx android.BaseMutatorContext) []string {
+ m, ok := ctx.Module().(*Module)
+
+ if !ok {
+ return nil
+ }
+
+ if d.hasLLNDKStubs() && m.UseVndk() {
+ // LLNDK libraries only need a single stubs variant.
+ return []string{android.FutureApiLevel.String()}
+ }
+
+ // TODO(b/244244438) Create more version information for NDK and APEX variations
+ // NDK variants
+ if m.MinSdkVersion() == "" {
+ return nil
+ }
+
+ firstVersion, err := nativeApiLevelFromUser(ctx,
+ m.MinSdkVersion())
+
+ if err != nil {
+ return nil
+ }
+
+ return ndkLibraryVersions(ctx, firstVersion)
+}
+
+func (d *apiLibraryDecorator) hasLLNDKStubs() bool {
+ for _, variant := range d.properties.Variants {
+ if strings.Contains(variant, "llndk") {
+ return true
+ }
+ }
+ return false
+}
+
// 'cc_api_headers' is similar with 'cc_api_library', but which replaces
// header libraries. The module will replace any dependencies to existing
// original header libraries.
@@ -165,9 +259,6 @@
module.linker = apiHeadersDecorator
module.installer = nil
- // Mark module as stub, so APEX would not include this stub in the package.
- module.library.setBuildStubs(true)
-
// Prevent default system libs (libc, libm, and libdl) from being linked
if apiHeadersDecorator.baseLinker.Properties.System_shared_libs == nil {
apiHeadersDecorator.baseLinker.Properties.System_shared_libs = []string{}
@@ -189,3 +280,91 @@
// Stub from API surface should be available for any APEX.
return true
}
+
+type ccApiexportProperties struct {
+ Src *string `android:"arch_variant"`
+ Variant *string
+ Version *string
+}
+
+type variantExporterProperties struct {
+ // Header directory or library to export
+ Export_headers []string
+
+ // Export all headers as system include
+ Export_headers_as_system *bool
+}
+
+type CcApiVariant struct {
+ android.ModuleBase
+
+ properties ccApiexportProperties
+ exportProperties variantExporterProperties
+
+ src android.Path
+}
+
+var _ android.Module = (*CcApiVariant)(nil)
+var _ android.ImageInterface = (*CcApiVariant)(nil)
+
+func CcApiVariantFactory() android.Module {
+ module := &CcApiVariant{}
+
+ module.AddProperties(&module.properties)
+ module.AddProperties(&module.exportProperties)
+
+ android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibBoth)
+ return module
+}
+
+func (v *CcApiVariant) GenerateAndroidBuildActions(ctx android.ModuleContext) {
+ // No need to build
+
+ if proptools.String(v.properties.Src) == "" {
+ ctx.PropertyErrorf("src", "src is a required property")
+ }
+
+ // Skip the existence check of the stub prebuilt file.
+ // The file is not guaranteed to exist during Soong analysis.
+ // Build orchestrator will be responsible for creating a connected ninja graph.
+ v.src = android.MaybeExistentPathForSource(ctx, ctx.ModuleDir(), proptools.String(v.properties.Src))
+}
+
+func (v *CcApiVariant) Name() string {
+ version := proptools.String(v.properties.Version)
+ return BuildApiVariantName(v.BaseModuleName(), *v.properties.Variant, version)
+}
+
+func (v *CcApiVariant) Src() android.Path {
+ return v.src
+}
+
+func BuildApiVariantName(baseName string, variant string, version string) string {
+ names := []string{baseName, variant}
+ if version != "" {
+ names = append(names, version)
+ }
+
+ return strings.Join(names[:], ".") + multitree.GetApiImportSuffix()
+}
+
+// Implement ImageInterface to generate image variants
+func (v *CcApiVariant) ImageMutatorBegin(ctx android.BaseModuleContext) {}
+func (v *CcApiVariant) CoreVariantNeeded(ctx android.BaseModuleContext) bool { return false }
+func (v *CcApiVariant) RamdiskVariantNeeded(ctx android.BaseModuleContext) bool { return false }
+func (v *CcApiVariant) VendorRamdiskVariantNeeded(ctx android.BaseModuleContext) bool { return false }
+func (v *CcApiVariant) DebugRamdiskVariantNeeded(ctx android.BaseModuleContext) bool { return false }
+func (v *CcApiVariant) RecoveryVariantNeeded(ctx android.BaseModuleContext) bool { return false }
+func (v *CcApiVariant) ExtraImageVariations(ctx android.BaseModuleContext) []string {
+ var variations []string
+ platformVndkVersion := ctx.DeviceConfig().PlatformVndkVersion()
+
+ if proptools.String(v.properties.Variant) == "llndk" {
+ variations = append(variations, VendorVariationPrefix+platformVndkVersion)
+ variations = append(variations, ProductVariationPrefix+platformVndkVersion)
+ }
+
+ return variations
+}
+func (v *CcApiVariant) SetImageVariation(ctx android.BaseModuleContext, variation string, module android.Module) {
+}
diff --git a/cc/library_stub_test.go b/cc/library_stub_test.go
index 54b0ba6..8ce74c4 100644
--- a/cc/library_stub_test.go
+++ b/cc/library_stub_test.go
@@ -284,3 +284,54 @@
// 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_headers: ["libbar_llndk_include"]
+ }
+
+ api_imports {
+ name: "api_imports",
+ shared_libs: [
+ "libbar",
+ ],
+ header_libs: [],
+ }
+ `
+
+ ctx := prepareForCcTest.RunTestWithBp(t, bp)
+
+ libfoo := ctx.ModuleForTests("binfoo", "android_vendor.29_arm64_armv8-a").Module()
+ libbarApiImport := ctx.ModuleForTests("libbar.apiimport", "android_vendor.29_arm64_armv8-a_shared").Module()
+ libbarApiVariant := ctx.ModuleForTests("libbar.llndk.apiimport", "android_vendor.29_arm64_armv8-a").Module()
+
+ android.AssertBoolEquals(t, "Stub library from API surface should be linked", true, hasDirectDependency(t, ctx, libfoo, libbarApiImport))
+ android.AssertBoolEquals(t, "Stub library variant from API surface should be linked", true, hasDirectDependency(t, ctx, libbarApiImport, libbarApiVariant))
+
+ libFooLibFlags := ctx.ModuleForTests("binfoo", "android_vendor.29_arm64_armv8-a").Rule("ld").Args["libFlags"]
+ android.AssertStringDoesContain(t, "Vendor binary should be linked with LLNDK variant source", libFooLibFlags, "libbar_llndk.so")
+
+ libFooCFlags := ctx.ModuleForTests("binfoo", "android_vendor.29_arm64_armv8-a").Rule("cc").Args["cFlags"]
+ android.AssertStringDoesContain(t, "Vendor binary should include headers from the LLNDK variant source", libFooCFlags, "-Ilibbar_llndk_include")
+}
diff --git a/cc/sanitize_test.go b/cc/sanitize_test.go
index 48ac650..2393f3e 100644
--- a/cc/sanitize_test.go
+++ b/cc/sanitize_test.go
@@ -41,6 +41,7 @@
static_libs: [
"libstatic",
"libnoasan",
+ "libstatic_asan",
],
sanitize: {
address: true,
@@ -57,6 +58,7 @@
static_libs: [
"libstatic",
"libnoasan",
+ "libstatic_asan",
],
}
@@ -92,6 +94,15 @@
address: false,
}
}
+
+ cc_library_static {
+ name: "libstatic_asan",
+ host_supported: true,
+ sanitize: {
+ address: true,
+ }
+ }
+
`
result := android.GroupFixturePreparers(
@@ -125,6 +136,10 @@
// Static library that never uses asan.
libNoAsan := result.ModuleForTests("libnoasan", staticVariant)
+ // Static library that specifies asan
+ libStaticAsan := result.ModuleForTests("libstatic_asan", staticAsanVariant)
+ libStaticAsanNoAsanVariant := result.ModuleForTests("libstatic_asan", staticVariant)
+
// expectSharedLinkDep verifies that the from module links against the to module as a
// shared library.
expectSharedLinkDep := func(from, to android.TestingModule) {
@@ -176,6 +191,7 @@
expectStaticLinkDep(binWithAsan, libStaticAsanVariant)
expectStaticLinkDep(binWithAsan, libNoAsan)
+ expectStaticLinkDep(binWithAsan, libStaticAsan)
expectInstallDep(binWithAsan, libShared)
expectInstallDep(binWithAsan, libAsan)
@@ -190,6 +206,7 @@
expectStaticLinkDep(binNoAsan, libStaticNoAsanVariant)
expectStaticLinkDep(binNoAsan, libNoAsan)
+ expectStaticLinkDep(binNoAsan, libStaticAsanNoAsanVariant)
expectInstallDep(binNoAsan, libShared)
expectInstallDep(binNoAsan, libAsan)
diff --git a/cc/sdk.go b/cc/sdk.go
index a83e5ad..a0d196b 100644
--- a/cc/sdk.go
+++ b/cc/sdk.go
@@ -78,5 +78,7 @@
}
case *snapshotModule:
ctx.CreateVariations("")
+ case *CcApiVariant:
+ ctx.CreateVariations("")
}
}
diff --git a/cc/test.go b/cc/test.go
index 92055fa..536210b 100644
--- a/cc/test.go
+++ b/cc/test.go
@@ -678,7 +678,7 @@
}
}
- m.convertTidyAttributes(&testBinaryAttrs.tidyAttributes)
+ m.convertTidyAttributes(ctx, &testBinaryAttrs.tidyAttributes)
for _, propIntf := range m.GetProperties() {
if testLinkerProps, ok := propIntf.(*TestLinkerProperties); ok {