Merge "Use OutputFilesProvider on some android test modules" into main
diff --git a/android/buildinfo_prop.go b/android/buildinfo_prop.go
index defbff0..bba4c0d 100644
--- a/android/buildinfo_prop.go
+++ b/android/buildinfo_prop.go
@@ -15,8 +15,6 @@
package android
import (
- "fmt"
-
"github.com/google/blueprint/proptools"
)
@@ -41,20 +39,10 @@
installPath InstallPath
}
-var _ OutputFileProducer = (*buildinfoPropModule)(nil)
-
func (p *buildinfoPropModule) installable() bool {
return proptools.BoolDefault(p.properties.Installable, true)
}
-// OutputFileProducer
-func (p *buildinfoPropModule) OutputFiles(tag string) (Paths, error) {
- if tag != "" {
- return nil, fmt.Errorf("unsupported tag %q", tag)
- }
- return Paths{p.outputFilePath}, nil
-}
-
func shouldAddBuildThumbprint(config Config) bool {
knownOemProperties := []string{
"ro.product.brand",
@@ -76,6 +64,8 @@
return
}
p.outputFilePath = PathForModuleOut(ctx, p.Name()).OutputPath
+ ctx.SetOutputFiles(Paths{p.outputFilePath}, "")
+
if !ctx.Config().KatiEnabled() {
WriteFileRule(ctx, p.outputFilePath, "# no buildinfo.prop if kati is disabled")
return
diff --git a/cc/afdo.go b/cc/afdo.go
index 00b2245..6921edf 100644
--- a/cc/afdo.go
+++ b/cc/afdo.go
@@ -176,6 +176,9 @@
func (a *afdoTransitionMutator) Mutate(ctx android.BottomUpMutatorContext, variation string) {
if m, ok := ctx.Module().(*Module); ok && m.afdo != nil {
+ if !m.Enabled(ctx) {
+ return
+ }
if variation == "" {
// The empty variation is either a module that has enabled AFDO for itself, or the non-AFDO
// variant of a dependency.
diff --git a/cc/cmake_ext_add_aidl_library.txt b/cc/cmake_ext_add_aidl_library.txt
index aa3235e3..d5c134e 100644
--- a/cc/cmake_ext_add_aidl_library.txt
+++ b/cc/cmake_ext_add_aidl_library.txt
@@ -1,3 +1,12 @@
+if ("${CMAKE_HOST_SYSTEM_PROCESSOR}" MATCHES "^(arm|aarch)")
+ set(PREBUILTS_BIN_DIR "${CMAKE_CURRENT_SOURCE_DIR}/prebuilts/host/linux_musl-arm64/bin")
+else()
+ set(PREBUILTS_BIN_DIR "${CMAKE_CURRENT_SOURCE_DIR}/prebuilts/host/linux-x86/bin")
+endif()
+if (NOT AIDL_BIN)
+ find_program(AIDL_BIN aidl REQUIRED HINTS "${PREBUILTS_BIN_DIR}")
+endif()
+
function(add_aidl_library NAME LANG AIDLROOT SOURCES AIDLFLAGS)
if (${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.20")
cmake_policy(SET CMP0116 NEW)
diff --git a/cc/cmake_main.txt b/cc/cmake_main.txt
index f6e21a6..eeabf53 100644
--- a/cc/cmake_main.txt
+++ b/cc/cmake_main.txt
@@ -6,20 +6,12 @@
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
include(AddAidlLibrary)
include(AppendCxxFlagsIfSupported)
+include(FindThreads)
if (NOT ANDROID_BUILD_TOP)
set(ANDROID_BUILD_TOP "${CMAKE_CURRENT_SOURCE_DIR}")
endif()
-if ("${CMAKE_HOST_SYSTEM_PROCESSOR}" MATCHES "^(arm|aarch)")
- set(PREBUILTS_BIN_DIR "${CMAKE_CURRENT_SOURCE_DIR}/prebuilts/host/linux_musl-arm64/bin")
-else()
- set(PREBUILTS_BIN_DIR "${CMAKE_CURRENT_SOURCE_DIR}/prebuilts/host/linux-x86/bin")
-endif()
-if (NOT AIDL_BIN)
- find_program(AIDL_BIN aidl REQUIRED HINTS "${PREBUILTS_BIN_DIR}")
-endif()
-
<<cflagsList .M.Name "_CFLAGS" .M.Properties.Cflags .M.Properties.Unportable_flags .M.Properties.Cflags_ignored>>
<<range .Pprop.SystemPackages ->>
@@ -29,6 +21,7 @@
add_subdirectory("${ANDROID_BUILD_TOP}/<<.>>" "<<.>>/build" EXCLUDE_FROM_ALL)
<<end>>
add_compile_options(${<<.M.Name>>_CFLAGS})
+link_libraries(${CMAKE_THREAD_LIBS_INIT})
<<range $moduleDir, $value := .ModuleDirs ->>
add_subdirectory(<<$moduleDir>>)
<<end>>
diff --git a/cc/cmake_snapshot.go b/cc/cmake_snapshot.go
index a5f8708..c1df0e9 100644
--- a/cc/cmake_snapshot.go
+++ b/cc/cmake_snapshot.go
@@ -51,8 +51,10 @@
var cmakeExtAppendFlags string
var defaultUnportableFlags []string = []string{
+ "-Wno-c99-designator",
"-Wno-class-memaccess",
"-Wno-exit-time-destructors",
+ "-Winconsistent-missing-override",
"-Wno-inconsistent-missing-override",
"-Wreorder-init-list",
"-Wno-reorder-init-list",
@@ -67,6 +69,11 @@
"libc",
"libc++",
"libc++_static",
+ "libc_musl",
+ "libc_musl_crtbegin_so",
+ "libc_musl_crtbegin_static",
+ "libc_musl_crtend",
+ "libc_musl_crtend_so",
"libdl",
"libm",
"prebuilt_libclang_rt.builtins",
diff --git a/java/droidstubs.go b/java/droidstubs.go
index b32b754..0157185 100644
--- a/java/droidstubs.go
+++ b/java/droidstubs.go
@@ -1453,17 +1453,6 @@
stubsSrcJar android.Path
}
-func (p *PrebuiltStubsSources) OutputFiles(tag string) (android.Paths, error) {
- switch tag {
- // prebuilt droidstubs does not output "exportable" stubs.
- // Output the "everything" stubs srcjar file if the tag is ".exportable".
- case "", ".exportable":
- return android.Paths{p.stubsSrcJar}, nil
- default:
- return nil, fmt.Errorf("unsupported module reference tag %q", tag)
- }
-}
-
func (d *PrebuiltStubsSources) StubsSrcJar(_ StubsType) (android.Path, error) {
return d.stubsSrcJar, nil
}
@@ -1502,6 +1491,11 @@
rule.Build("zip src", "Create srcjar from prebuilt source")
p.stubsSrcJar = outPath
}
+
+ ctx.SetOutputFiles(android.Paths{p.stubsSrcJar}, "")
+ // prebuilt droidstubs does not output "exportable" stubs.
+ // Output the "everything" stubs srcjar file if the tag is ".exportable".
+ ctx.SetOutputFiles(android.Paths{p.stubsSrcJar}, ".exportable")
}
func (p *PrebuiltStubsSources) Prebuilt() *android.Prebuilt {
diff --git a/ui/build/config.go b/ui/build/config.go
index c4a6797..1d5269c 100644
--- a/ui/build/config.go
+++ b/ui/build/config.go
@@ -99,9 +99,10 @@
// Autodetected
totalRAM uint64
- brokenDupRules bool
- brokenUsesNetwork bool
- brokenNinjaEnvVars []string
+ brokenDupRules bool
+ brokenUsesNetwork bool
+ brokenNinjaEnvVars []string
+ brokenMissingOutputs bool
pathReplaced bool
@@ -1608,6 +1609,14 @@
return c.brokenNinjaEnvVars
}
+func (c *configImpl) SetBuildBrokenMissingOutputs(val bool) {
+ c.brokenMissingOutputs = val
+}
+
+func (c *configImpl) BuildBrokenMissingOutputs() bool {
+ return c.brokenMissingOutputs
+}
+
func (c *configImpl) SetTargetDeviceDir(dir string) {
c.targetDeviceDir = dir
}
diff --git a/ui/build/dumpvars.go b/ui/build/dumpvars.go
index eba86a0..e77df44 100644
--- a/ui/build/dumpvars.go
+++ b/ui/build/dumpvars.go
@@ -235,6 +235,11 @@
"BUILD_BROKEN_SRC_DIR_IS_WRITABLE",
"BUILD_BROKEN_SRC_DIR_RW_ALLOWLIST",
+ // Whether missing outputs should be treated as warnings
+ // instead of errors.
+ // `true` will relegate missing outputs to warnings.
+ "BUILD_BROKEN_MISSING_OUTPUTS",
+
// Not used, but useful to be in the soong.log
"TARGET_BUILD_TYPE",
"HOST_ARCH",
@@ -301,4 +306,5 @@
config.SetBuildBrokenUsesNetwork(makeVars["BUILD_BROKEN_USES_NETWORK"] == "true")
config.SetBuildBrokenNinjaUsesEnvVars(strings.Fields(makeVars["BUILD_BROKEN_NINJA_USES_ENV_VARS"]))
config.SetSourceRootDirs(strings.Fields(makeVars["PRODUCT_SOURCE_ROOT_DIRS"]))
+ config.SetBuildBrokenMissingOutputs(makeVars["BUILD_BROKEN_MISSING_OUTPUTS"] == "true")
}
diff --git a/ui/build/ninja.go b/ui/build/ninja.go
index 551b8ab..ae27330 100644
--- a/ui/build/ninja.go
+++ b/ui/build/ninja.go
@@ -77,6 +77,14 @@
"-w", "dupbuild=err",
"-w", "missingdepfile=err")
+ if !config.BuildBrokenMissingOutputs() {
+ // Missing outputs will be treated as errors.
+ // BUILD_BROKEN_MISSING_OUTPUTS can be used to bypass this check.
+ args = append(args,
+ "-w", "missingoutfile=err",
+ )
+ }
+
cmd := Command(ctx, config, "ninja", executable, args...)
// Set up the nsjail sandbox Ninja runs in.