Merge "Add StringAttribute for bp2building"
diff --git a/android/defs.go b/android/defs.go
index 362b382..2a28e98 100644
--- a/android/defs.go
+++ b/android/defs.go
@@ -68,7 +68,7 @@
CpExecutable = pctx.AndroidStaticRule("CpExecutable",
blueprint.RuleParams{
- Command: "rm -f $out && cp $cpPreserveSymlinks $cpFlags $in $out && chmod +x $out$extraCmds",
+ Command: "rm -f $out && cp $cpFlags $in $out && chmod +x $out$extraCmds",
Description: "cp $out",
},
"cpFlags", "extraCmds")
diff --git a/android_sdk/sdk_repo_host.go b/android_sdk/sdk_repo_host.go
index 280dae8..f646742 100644
--- a/android_sdk/sdk_repo_host.go
+++ b/android_sdk/sdk_repo_host.go
@@ -166,9 +166,10 @@
}
} else {
llvmStrip := config.ClangPath(ctx, "bin/llvm-strip")
- llvmLib := config.ClangPath(ctx, "lib64/libc++.so.1")
+ llvmLib64 := config.ClangPath(ctx, "lib64/libc++.so.1")
+ llvmLib := config.ClangPath(ctx, "lib/libc++.so.1")
for _, strip := range s.properties.Strip_files {
- cmd := builder.Command().Tool(llvmStrip).ImplicitTool(llvmLib)
+ cmd := builder.Command().Tool(llvmStrip).ImplicitTool(llvmLib64).ImplicitTool(llvmLib)
if !ctx.Windows() {
cmd.Flag("-x")
}
diff --git a/cc/androidmk.go b/cc/androidmk.go
index ff5ba45..47fb919 100644
--- a/cc/androidmk.go
+++ b/cc/androidmk.go
@@ -226,17 +226,27 @@
}
}
-func (library *libraryDecorator) androidMkEntriesWriteAdditionalDependenciesForSourceAbiDiff(entries *android.AndroidMkEntries) {
- if library.sAbiDiff.Valid() && !library.static() {
- entries.AddStrings("LOCAL_ADDITIONAL_DEPENDENCIES", library.sAbiDiff.String())
+func (library *libraryDecorator) getAbiDiffsForAndroidMkDeps() []string {
+ if library.static() {
+ return nil
}
+ var abiDiffs []string
+ if library.sAbiDiff.Valid() {
+ abiDiffs = append(abiDiffs, library.sAbiDiff.String())
+ }
+ if library.prevSAbiDiff.Valid() {
+ abiDiffs = append(abiDiffs, library.prevSAbiDiff.String())
+ }
+ return abiDiffs
+}
+
+func (library *libraryDecorator) androidMkEntriesWriteAdditionalDependenciesForSourceAbiDiff(entries *android.AndroidMkEntries) {
+ entries.AddStrings("LOCAL_ADDITIONAL_DEPENDENCIES", library.getAbiDiffsForAndroidMkDeps()...)
}
// TODO(ccross): remove this once apex/androidmk.go is converted to AndroidMkEntries
func (library *libraryDecorator) androidMkWriteAdditionalDependenciesForSourceAbiDiff(w io.Writer) {
- if library.sAbiDiff.Valid() && !library.static() {
- fmt.Fprintln(w, "LOCAL_ADDITIONAL_DEPENDENCIES +=", library.sAbiDiff.String())
- }
+ fmt.Fprintln(w, "LOCAL_ADDITIONAL_DEPENDENCIES +=", strings.Join(library.getAbiDiffsForAndroidMkDeps(), " "))
}
func (library *libraryDecorator) AndroidMkEntries(ctx AndroidMkContext, entries *android.AndroidMkEntries) {
diff --git a/cc/builder.go b/cc/builder.go
index ab2b80a..f3faca8 100644
--- a/cc/builder.go
+++ b/cc/builder.go
@@ -920,10 +920,15 @@
// sourceAbiDiff registers a build statement to compare linked sAbi dump files (.lsdump).
func sourceAbiDiff(ctx android.ModuleContext, inputDump android.Path, referenceDump android.Path,
- baseName, exportedHeaderFlags string, diffFlags []string,
- checkAllApis, isLlndk, isNdk, isVndkExt bool) android.OptionalPath {
+ baseName, prevVersion, exportedHeaderFlags string, diffFlags []string,
+ checkAllApis, isLlndk, isNdk, isVndkExt, previousVersionDiff bool) android.OptionalPath {
- outputFile := android.PathForModuleOut(ctx, baseName+".abidiff")
+ var outputFile android.ModuleOutPath
+ if prevVersion == "" {
+ outputFile = android.PathForModuleOut(ctx, baseName+".abidiff")
+ } else {
+ outputFile = android.PathForModuleOut(ctx, baseName+"."+prevVersion+".abidiff")
+ }
libName := strings.TrimSuffix(baseName, filepath.Ext(baseName))
var extraFlags []string
@@ -935,10 +940,15 @@
"-allow-unreferenced-elf-symbol-changes")
}
+ // TODO(b/241496591): Remove -advice-only after b/239792343 and b/239790286 are reolved.
+ if previousVersionDiff {
+ extraFlags = append(extraFlags, "-advice-only")
+ }
+
if isLlndk || isNdk {
extraFlags = append(extraFlags, "-consider-opaque-types-different")
}
- if isVndkExt {
+ if isVndkExt || previousVersionDiff {
extraFlags = append(extraFlags, "-allow-extensions")
}
// TODO(b/232891473): Simplify the above logic with diffFlags.
diff --git a/cc/config/global.go b/cc/config/global.go
index 4fcef9d..357ea44 100644
--- a/cc/config/global.go
+++ b/cc/config/global.go
@@ -290,11 +290,7 @@
"-Wno-deprecated-non-prototype",
}
- llvmNextExtraCommonGlobalCflags = []string{
- "-Wno-error=array-parameter", // http://b/241941550
- "-Wno-error=deprecated-builtins", // http://b/241601211
- "-Wno-error=deprecated", // in external/googletest/googletest
- }
+ llvmNextExtraCommonGlobalCflags = []string{}
IllegalFlags = []string{
"-w",
diff --git a/cc/library.go b/cc/library.go
index d74b3ac..897b572 100644
--- a/cc/library.go
+++ b/cc/library.go
@@ -613,6 +613,9 @@
// Source Abi Diff
sAbiDiff android.OptionalPath
+ // Source Abi Diff against previous SDK version
+ prevSAbiDiff android.OptionalPath
+
// Location of the static library in the sysroot. Empty if the library is
// not included in the NDK.
ndkSysrootPath android.Path
@@ -1620,9 +1623,39 @@
return nil
}
+func prevDumpRefVersion(ctx ModuleContext) string {
+ sdkVersionInt := ctx.Config().PlatformSdkVersion().FinalInt()
+ sdkVersionStr := ctx.Config().PlatformSdkVersion().String()
+
+ if ctx.Config().PlatformSdkFinal() {
+ return strconv.Itoa(sdkVersionInt - 1)
+ } else {
+ var dirName string
+
+ isNdk := ctx.isNdk(ctx.Config())
+ if isNdk {
+ dirName = "ndk"
+ } else {
+ dirName = "platform"
+ }
+
+ // 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.
+ refDumpDir := android.ExistentPathForSource(ctx, "prebuilts", "abi-dumps", dirName, sdkVersionStr)
+ if refDumpDir.Valid() {
+ return sdkVersionStr
+ } else {
+ return strconv.Itoa(sdkVersionInt - 1)
+ }
+ }
+}
+
func (library *libraryDecorator) linkSAbiDumpFiles(ctx ModuleContext, objs Objects, fileName string, soFile android.Path) {
if library.sabi.shouldCreateSourceAbiDump() {
var version string
+ var prevVersion string
+
if ctx.useVndk() {
// For modules linking against vndk, follow its vndk version
version = ctx.Module().(*Module).VndkVersion()
@@ -1634,6 +1667,7 @@
} else {
version = "current"
}
+ prevVersion = prevDumpRefVersion(ctx)
}
exportIncludeDirs := library.flagExporter.exportedIncludes(ctx)
@@ -1652,13 +1686,24 @@
addLsdumpPath(classifySourceAbiDump(ctx) + ":" + library.sAbiOutputFile.String())
+ if prevVersion != "" {
+ prevRefAbiDumpFile := getRefAbiDumpFile(ctx, prevVersion, fileName)
+ if prevRefAbiDumpFile != nil {
+ library.prevSAbiDiff = sourceAbiDiff(ctx, library.sAbiOutputFile.Path(),
+ prevRefAbiDumpFile, fileName, prevVersion, exportedHeaderFlags,
+ library.Properties.Header_abi_checker.Diff_flags,
+ Bool(library.Properties.Header_abi_checker.Check_all_apis),
+ ctx.IsLlndk(), ctx.isNdk(ctx.Config()), ctx.IsVndkExt(), true)
+ }
+ }
+
refAbiDumpFile := getRefAbiDumpFile(ctx, version, fileName)
if refAbiDumpFile != nil {
library.sAbiDiff = sourceAbiDiff(ctx, library.sAbiOutputFile.Path(),
- refAbiDumpFile, fileName, exportedHeaderFlags,
+ refAbiDumpFile, fileName, "", exportedHeaderFlags,
library.Properties.Header_abi_checker.Diff_flags,
Bool(library.Properties.Header_abi_checker.Check_all_apis),
- ctx.IsLlndk(), ctx.isNdk(ctx.Config()), ctx.IsVndkExt())
+ ctx.IsLlndk(), ctx.isNdk(ctx.Config()), ctx.IsVndkExt(), false)
}
}
}
diff --git a/tests/lib.sh b/tests/lib.sh
index 69ad201..6210e77 100644
--- a/tests/lib.sh
+++ b/tests/lib.sh
@@ -111,7 +111,7 @@
# shellcheck disable=SC2120
function run_soong {
- build/soong/soong_ui.bash --make-mode --skip-ninja --skip-config --soong-only --skip-soong-tests "$@"
+ USE_RBE=false build/soong/soong_ui.bash --make-mode --skip-ninja --skip-config --soong-only --skip-soong-tests "$@"
}
function create_mock_bazel {