Merge "cc: Make generated_headers configurable" into main
diff --git a/Android.bp b/Android.bp
index b1db8e9..2c0ef47 100644
--- a/Android.bp
+++ b/Android.bp
@@ -104,6 +104,7 @@
// Instantiate the dex_bootjars singleton module.
dex_bootjars {
name: "dex_bootjars",
+ no_full_install: true,
}
// Pseudo-test that's run on checkbuilds to ensure that get_clang_version can
diff --git a/aconfig/aconfig_declarations.go b/aconfig/aconfig_declarations.go
index 71a64dd..dac0ae3 100644
--- a/aconfig/aconfig_declarations.go
+++ b/aconfig/aconfig_declarations.go
@@ -15,7 +15,6 @@
package aconfig
import (
- "fmt"
"strings"
"android/soong/android"
@@ -44,8 +43,6 @@
// The flags will only be repackaged if this prop is true.
Exportable bool
}
-
- intermediatePath android.WritablePath
}
func DeclarationsFactory() android.Module {
@@ -86,18 +83,6 @@
}
}
-func (module *DeclarationsModule) OutputFiles(tag string) (android.Paths, error) {
- switch tag {
- case "":
- // The default output of this module is the intermediates format, which is
- // not installable and in a private format that no other rules can handle
- // correctly.
- return []android.Path{module.intermediatePath}, nil
- default:
- return nil, fmt.Errorf("unsupported aconfig_declarations module reference tag %q", tag)
- }
-}
-
func joinAndPrefix(prefix string, values []string) string {
var sb strings.Builder
for _, v := range values {
@@ -171,5 +156,4 @@
IntermediateCacheOutputPath: intermediateCacheFilePath,
IntermediateDumpOutputPath: intermediateDumpFilePath,
})
-
}
diff --git a/aconfig/build_flags/declarations.go b/aconfig/build_flags/declarations.go
index f6a6ee1..e927db2 100644
--- a/aconfig/build_flags/declarations.go
+++ b/aconfig/build_flags/declarations.go
@@ -15,7 +15,6 @@
package build_flags
import (
- "fmt"
"strings"
"android/soong/android"
@@ -39,8 +38,6 @@
// aconfig files, relative to this Android.bp file
Srcs []string `android:"path"`
}
-
- intermediatePath android.WritablePath
}
func DeclarationsFactory() android.Module {
@@ -53,18 +50,6 @@
return module
}
-func (module *DeclarationsModule) OutputFiles(tag string) (android.Paths, error) {
- switch tag {
- case "":
- // The default output of this module is the intermediates format, which is
- // not installable and in a private format that no other rules can handle
- // correctly.
- return []android.Path{module.intermediatePath}, nil
- default:
- return nil, fmt.Errorf("unsupported build_flags_declarations module reference tag %q", tag)
- }
-}
-
func joinAndPrefix(prefix string, values []string) string {
var sb strings.Builder
for _, v := range values {
diff --git a/aconfig/codegen/aconfig_declarations_group.go b/aconfig/codegen/aconfig_declarations_group.go
index 1c91bee..33c20cd 100644
--- a/aconfig/codegen/aconfig_declarations_group.go
+++ b/aconfig/codegen/aconfig_declarations_group.go
@@ -15,7 +15,6 @@
package codegen
import (
- "fmt"
"maps"
"android/soong/android"
@@ -115,19 +114,9 @@
Srcjars: adg.javaSrcjars,
ModeInfos: adg.modeInfos,
})
-}
-var _ android.OutputFileProducer = (*AconfigDeclarationsGroup)(nil)
-
-func (adg *AconfigDeclarationsGroup) OutputFiles(tag string) (android.Paths, error) {
- switch tag {
- case "":
- return adg.intermediateCacheOutputPaths, nil
- case ".srcjars":
- return adg.javaSrcjars, nil
- default:
- return nil, fmt.Errorf("unsupported module reference tag %s", tag)
- }
+ ctx.SetOutputFiles(adg.intermediateCacheOutputPaths, "")
+ ctx.SetOutputFiles(adg.javaSrcjars, ".srcjars")
}
func (adg *AconfigDeclarationsGroup) Srcjars() android.Paths {
diff --git a/android/api_levels.go b/android/api_levels.go
index fab5fc7..dc17238 100644
--- a/android/api_levels.go
+++ b/android/api_levels.go
@@ -291,6 +291,8 @@
var ApiLevelUpsideDownCake = uncheckedFinalApiLevel(34)
+var ApiLevelVanillaIceCream = uncheckedFinalApiLevel(35)
+
// ReplaceFinalizedCodenames returns the API level number associated with that API level
// if the `raw` input is the codename of an API level has been finalized.
// If the input is *not* a finalized codename, the input is returned unmodified.
diff --git a/android/image.go b/android/image.go
index bc6b8cd..9cad056 100644
--- a/android/image.go
+++ b/android/image.go
@@ -44,9 +44,8 @@
ExtraImageVariations(ctx BaseModuleContext) []string
// SetImageVariation is called for each newly created image variant. The receiver is the original
- // module, "variation" is the name of the newly created variant and "module" is the newly created
- // variant itself.
- SetImageVariation(ctx BaseModuleContext, variation string, module Module)
+ // module, "variation" is the name of the newly created variant. "variation" is set on the receiver.
+ SetImageVariation(ctx BaseModuleContext, variation string)
}
const (
@@ -106,7 +105,7 @@
mod := ctx.CreateVariations(variations...)
for i, v := range variations {
mod[i].base().setImageVariation(v)
- m.SetImageVariation(ctx, v, mod[i])
+ mod[i].(ImageInterface).SetImageVariation(ctx, v)
}
}
}
diff --git a/apex/apex.go b/apex/apex.go
index e79afad..dc9b236 100644
--- a/apex/apex.go
+++ b/apex/apex.go
@@ -1677,12 +1677,12 @@
var _ javaModule = (*java.SdkLibraryImport)(nil)
// apexFileForJavaModule creates an apexFile for a java module's dex implementation jar.
-func apexFileForJavaModule(ctx android.BaseModuleContext, module javaModule) apexFile {
+func apexFileForJavaModule(ctx android.ModuleContext, module javaModule) apexFile {
return apexFileForJavaModuleWithFile(ctx, module, module.DexJarBuildPath(ctx).PathOrNil())
}
// apexFileForJavaModuleWithFile creates an apexFile for a java module with the supplied file.
-func apexFileForJavaModuleWithFile(ctx android.BaseModuleContext, module javaModule, dexImplementationJar android.Path) apexFile {
+func apexFileForJavaModuleWithFile(ctx android.ModuleContext, module javaModule, dexImplementationJar android.Path) apexFile {
dirInApex := "javalib"
af := newApexFile(ctx, dexImplementationJar, module.BaseModuleName(), dirInApex, javaSharedLib, module)
af.jacocoReportClassesFile = module.JacocoReportClassesFile()
@@ -1693,10 +1693,12 @@
if sdkLib, ok := module.(*java.SdkLibrary); ok {
for _, install := range sdkLib.BuiltInstalledForApex() {
af.requiredModuleNames = append(af.requiredModuleNames, install.FullModuleName())
+ install.PackageFile(ctx)
}
} else if dexpreopter, ok := module.(java.DexpreopterInterface); ok {
for _, install := range dexpreopter.DexpreoptBuiltInstalledForApex() {
af.requiredModuleNames = append(af.requiredModuleNames, install.FullModuleName())
+ install.PackageFile(ctx)
}
}
return af
@@ -2128,7 +2130,7 @@
}
case prebuiltTag:
if prebuilt, ok := child.(prebuilt_etc.PrebuiltEtcModule); ok {
- filesToCopy, _ := prebuilt.OutputFiles("")
+ filesToCopy := android.OutputFilesForModule(ctx, prebuilt, "")
for _, etcFile := range filesToCopy {
vctx.filesInfo = append(vctx.filesInfo, apexFileForPrebuiltEtc(ctx, prebuilt, etcFile))
}
@@ -2274,7 +2276,7 @@
// Because APK-in-APEX embeds jni_libs transitively, we don't need to track transitive deps
} else if java.IsXmlPermissionsFileDepTag(depTag) {
if prebuilt, ok := child.(prebuilt_etc.PrebuiltEtcModule); ok {
- filesToCopy, _ := prebuilt.OutputFiles("")
+ filesToCopy := android.OutputFilesForModule(ctx, prebuilt, "")
for _, etcFile := range filesToCopy {
vctx.filesInfo = append(vctx.filesInfo, apexFileForPrebuiltEtc(ctx, prebuilt, etcFile))
}
diff --git a/apex/bootclasspath_fragment_test.go b/apex/bootclasspath_fragment_test.go
index af9123e..919cb01 100644
--- a/apex/bootclasspath_fragment_test.go
+++ b/apex/bootclasspath_fragment_test.go
@@ -1366,4 +1366,89 @@
android.AssertStringDoesContain(t, "test", command, "--test-stub-classpath="+nonUpdatableTestStubs)
}
+func TestBootclasspathFragmentProtoContainsMinSdkVersion(t *testing.T) {
+ result := android.GroupFixturePreparers(
+ prepareForTestWithBootclasspathFragment,
+ prepareForTestWithMyapex,
+ // Configure bootclasspath jars to ensure that hidden API encoding is performed on them.
+ java.FixtureConfigureApexBootJars("myapex:foo", "myapex:bar"),
+ // Make sure that the frameworks/base/Android.bp file exists as otherwise hidden API encoding
+ // is disabled.
+ android.FixtureAddTextFile("frameworks/base/Android.bp", ""),
+
+ java.PrepareForTestWithJavaSdkLibraryFiles,
+ java.FixtureWithLastReleaseApis("foo", "bar"),
+ ).RunTestWithBp(t, `
+ apex {
+ name: "myapex",
+ key: "myapex.key",
+ bootclasspath_fragments: [
+ "mybootclasspathfragment",
+ ],
+ updatable: false,
+ }
+
+ apex_key {
+ name: "myapex.key",
+ public_key: "testkey.avbpubkey",
+ private_key: "testkey.pem",
+ }
+
+ java_sdk_library {
+ name: "foo",
+ srcs: ["b.java"],
+ shared_library: false,
+ public: {enabled: true},
+ apex_available: [
+ "myapex",
+ ],
+ min_sdk_version: "33",
+ }
+
+ java_sdk_library {
+ name: "bar",
+ srcs: ["b.java"],
+ shared_library: false,
+ public: {enabled: true},
+ apex_available: [
+ "myapex",
+ ],
+ min_sdk_version: "34",
+ }
+
+ bootclasspath_fragment {
+ name: "mybootclasspathfragment",
+ contents: [
+ "foo",
+ "bar",
+ ],
+ apex_available: [
+ "myapex",
+ ],
+ hidden_api: {
+ split_packages: ["*"],
+ },
+ }
+ `)
+
+ fragment := result.ModuleForTests("mybootclasspathfragment", "android_common_apex10000")
+ classPathProtoContent := android.ContentFromFileRuleForTests(t, result.TestContext, fragment.Output("bootclasspath.pb.textproto"))
+ // foo
+ ensureContains(t, classPathProtoContent, `jars {
+path: "/apex/myapex/javalib/foo.jar"
+classpath: BOOTCLASSPATH
+min_sdk_version: "33"
+max_sdk_version: ""
+}
+`)
+ // bar
+ ensureContains(t, classPathProtoContent, `jars {
+path: "/apex/myapex/javalib/bar.jar"
+classpath: BOOTCLASSPATH
+min_sdk_version: "34"
+max_sdk_version: ""
+}
+`)
+}
+
// TODO(b/177892522) - add test for host apex.
diff --git a/apex/prebuilt.go b/apex/prebuilt.go
index 9ad5159..d91943f 100644
--- a/apex/prebuilt.go
+++ b/apex/prebuilt.go
@@ -197,6 +197,7 @@
// If this apex contains a system server jar, then the dexpreopt artifacts should be added as required
for _, install := range p.Dexpreopter.DexpreoptBuiltInstalledForApex() {
p.requiredModuleNames = append(p.requiredModuleNames, install.FullModuleName())
+ install.PackageFile(ctx)
}
}
diff --git a/bpf/bpf.go b/bpf/bpf.go
index 2eb869e..ce00b5b 100644
--- a/bpf/bpf.go
+++ b/bpf/bpf.go
@@ -131,7 +131,7 @@
return nil
}
-func (bpf *bpf) SetImageVariation(ctx android.BaseModuleContext, variation string, module android.Module) {
+func (bpf *bpf) SetImageVariation(ctx android.BaseModuleContext, variation string) {
bpf.properties.VendorInternal = variation == "vendor"
}
diff --git a/cc/builder.go b/cc/builder.go
index 7a3394a..8719d4f 100644
--- a/cc/builder.go
+++ b/cc/builder.go
@@ -485,7 +485,7 @@
coverageFiles = make(android.Paths, 0, len(srcFiles))
}
var kytheFiles android.Paths
- if flags.emitXrefs {
+ if flags.emitXrefs && ctx.Module() == ctx.PrimaryModule() {
kytheFiles = make(android.Paths, 0, len(srcFiles))
}
@@ -664,7 +664,7 @@
})
// Register post-process build statements (such as for tidy or kythe).
- if emitXref {
+ if emitXref && ctx.Module() == ctx.PrimaryModule() {
kytheFile := android.ObjPathWithExt(ctx, subdir, srcFile, "kzip")
ctx.Build(pctx, android.BuildParams{
Rule: kytheExtract,
diff --git a/cc/cc.go b/cc/cc.go
index cb82f86..0db1bd6 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -286,6 +286,11 @@
// Deprecated. true is the default, false is invalid.
Clang *bool `android:"arch_variant"`
+ // Aggresively trade performance for smaller binary size.
+ // This should only be used for on-device binaries that are rarely executed and not
+ // performance critical.
+ Optimize_for_size *bool `android:"arch_variant"`
+
// The API level that this module is built against. The APIs of this API level will be
// visible at build time, but use of any APIs newer than min_sdk_version will render the
// module unloadable on older devices. In the future it will be possible to weakly-link new
@@ -546,6 +551,7 @@
isCfiAssemblySupportEnabled() bool
getSharedFlags() *SharedFlags
notInPlatform() bool
+ optimizeForSize() bool
}
type SharedFlags struct {
@@ -985,6 +991,7 @@
"WinMsgSrcs": hasWinMsg,
"YaccSrsc": hasYacc,
"OnlyCSrcs": !(hasAidl || hasLex || hasProto || hasRenderscript || hasSysprop || hasWinMsg || hasYacc),
+ "OptimizeForSize": c.OptimizeForSize(),
}
}
@@ -1070,6 +1077,10 @@
return false
}
+func (c *Module) OptimizeForSize() bool {
+ return Bool(c.Properties.Optimize_for_size)
+}
+
func (c *Module) SdkVersion() string {
return String(c.Properties.Sdk_version)
}
@@ -1613,6 +1624,10 @@
return ctx.mod.Object()
}
+func (ctx *moduleContextImpl) optimizeForSize() bool {
+ return ctx.mod.OptimizeForSize()
+}
+
func (ctx *moduleContextImpl) canUseSdk() bool {
return ctx.mod.canUseSdk()
}
diff --git a/cc/cmake_main.txt b/cc/cmake_main.txt
index deb1de1..e9177d6 100644
--- a/cc/cmake_main.txt
+++ b/cc/cmake_main.txt
@@ -1,6 +1,7 @@
cmake_minimum_required(VERSION 3.18)
project(<<.M.Name>> CXX)
set(CMAKE_CXX_STANDARD 20)
+enable_testing()
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
include(AddAidlLibrary)
diff --git a/cc/cmake_module_cc.txt b/cc/cmake_module_cc.txt
index 488e5e1..0dc45ae 100644
--- a/cc/cmake_module_cc.txt
+++ b/cc/cmake_module_cc.txt
@@ -1,6 +1,6 @@
<<$srcs := getSources .M>>
<<$includeDirs := getIncludeDirs .Ctx .M>>
-<<$cflags := (getCompilerProperties .M).Cflags>>
+<<$cflags := getCflagsProperty .Ctx .M>>
<<$deps := mapLibraries .Ctx .M (concat5
(getLinkerProperties .M).Whole_static_libs
(getLinkerProperties .M).Static_libs
@@ -8,15 +8,24 @@
(getLinkerProperties .M).Header_libs
(getExtraLibs .M)
) .Pprop.LibraryMapping>>
+<<$moduleType := getModuleType .M>>
+<<$moduleTypeCmake := "executable">>
+<<if eq $moduleType "library">>
+<<$moduleTypeCmake = "library">>
+<<end>>
# <<.M.Name>>
<<if $srcs>>
<<setList .M.Name "_SRCS" "${ANDROID_BUILD_TOP}/" (toStrings $srcs)>>
-add_<<getModuleType .M>>(<<.M.Name>> ${<<.M.Name>>_SRCS})
+add_<<$moduleTypeCmake>>(<<.M.Name>> ${<<.M.Name>>_SRCS})
<<- else>>
-add_<<getModuleType .M>>(<<.M.Name>> INTERFACE)
+add_<<$moduleTypeCmake>>(<<.M.Name>> INTERFACE)
<<- end>>
-add_<<getModuleType .M>>(android::<<.M.Name>> ALIAS <<.M.Name>>)
+<<- if eq $moduleType "library">>
+add_library(android::<<.M.Name>> ALIAS <<.M.Name>>)
+<<- else if eq $moduleType "test">>
+add_test(NAME <<.M.Name>> COMMAND <<.M.Name>>)
+<<- end>>
<<print "">>
<<- if $includeDirs>>
diff --git a/cc/cmake_snapshot.go b/cc/cmake_snapshot.go
index c21a46f..b4d1268 100644
--- a/cc/cmake_snapshot.go
+++ b/cc/cmake_snapshot.go
@@ -187,6 +187,10 @@
"getCompilerProperties": func(m *Module) BaseCompilerProperties {
return m.compiler.baseCompilerProps()
},
+ "getCflagsProperty": func(ctx android.ModuleContext, m *Module) []string {
+ cflags := m.compiler.baseCompilerProps().Cflags
+ return cflags.GetOrDefault(ctx, nil)
+ },
"getLinkerProperties": func(m *Module) BaseLinkerProperties {
return m.linker.baseLinkerProps()
},
@@ -488,17 +492,24 @@
case *libraryDecorator:
return "library"
case *testBinary:
- return "executable"
+ return "test"
+ case *benchmarkDecorator:
+ return "test"
}
- panic(fmt.Sprintf("Unexpected module type: %T", m.compiler))
+ panic(fmt.Sprintf("Unexpected module type: %T", m.linker))
}
func getExtraLibs(m *Module) []string {
switch decorator := m.linker.(type) {
case *testBinary:
if decorator.testDecorator.gtest() {
- return []string{"libgtest"}
+ return []string{
+ "libgtest",
+ "libgtest_main",
+ }
}
+ case *benchmarkDecorator:
+ return []string{"libgoogle-benchmark"}
}
return nil
}
@@ -507,7 +518,7 @@
moduleDir := ctx.OtherModuleDir(m) + string(filepath.Separator)
switch decorator := m.compiler.(type) {
case *libraryDecorator:
- return sliceWithPrefix(moduleDir, decorator.flagExporter.Properties.Export_include_dirs)
+ return sliceWithPrefix(moduleDir, decorator.flagExporter.Properties.Export_include_dirs.GetOrDefault(ctx, nil))
}
return nil
}
diff --git a/cc/compiler.go b/cc/compiler.go
index 157c2df..6916394 100644
--- a/cc/compiler.go
+++ b/cc/compiler.go
@@ -50,7 +50,7 @@
Exclude_srcs []string `android:"path,arch_variant"`
// list of module-specific flags that will be used for C and C++ compiles.
- Cflags []string `android:"arch_variant"`
+ Cflags proptools.Configurable[[]string] `android:"arch_variant"`
// list of module-specific flags that will be used for C++ compiles
Cppflags []string `android:"arch_variant"`
@@ -101,7 +101,7 @@
Generated_headers proptools.Configurable[[]string] `android:"arch_variant,variant_prepend"`
// pass -frtti instead of -fno-rtti
- Rtti *bool
+ Rtti *bool `android:"arch_variant"`
// C standard version to use. Can be a specific version (such as "gnu11"),
// "experimental" (which will use draft versions like C1x when available),
@@ -274,7 +274,7 @@
}
func (compiler *baseCompiler) appendCflags(flags []string) {
- compiler.Properties.Cflags = append(compiler.Properties.Cflags, flags...)
+ compiler.Properties.Cflags.AppendSimpleValue(flags)
}
func (compiler *baseCompiler) appendAsflags(flags []string) {
@@ -372,7 +372,8 @@
compiler.srcsBeforeGen = android.PathsForModuleSrcExcludes(ctx, compiler.Properties.Srcs, compiler.Properties.Exclude_srcs)
compiler.srcsBeforeGen = append(compiler.srcsBeforeGen, deps.GeneratedSources...)
- CheckBadCompilerFlags(ctx, "cflags", compiler.Properties.Cflags)
+ cflags := compiler.Properties.Cflags.GetOrDefault(ctx, nil)
+ CheckBadCompilerFlags(ctx, "cflags", cflags)
CheckBadCompilerFlags(ctx, "cppflags", compiler.Properties.Cppflags)
CheckBadCompilerFlags(ctx, "conlyflags", compiler.Properties.Conlyflags)
CheckBadCompilerFlags(ctx, "asflags", compiler.Properties.Asflags)
@@ -385,7 +386,7 @@
esc := proptools.NinjaAndShellEscapeList
- flags.Local.CFlags = append(flags.Local.CFlags, esc(compiler.Properties.Cflags)...)
+ flags.Local.CFlags = append(flags.Local.CFlags, esc(cflags)...)
flags.Local.CppFlags = append(flags.Local.CppFlags, esc(compiler.Properties.Cppflags)...)
flags.Local.ConlyFlags = append(flags.Local.ConlyFlags, esc(compiler.Properties.Conlyflags)...)
flags.Local.AsFlags = append(flags.Local.AsFlags, esc(compiler.Properties.Asflags)...)
@@ -693,6 +694,11 @@
flags.Local.CFlags = append(flags.Local.CFlags, "-fopenmp")
}
+ if ctx.optimizeForSize() {
+ flags.Local.CFlags = append(flags.Local.CFlags, "-Oz")
+ flags.Local.LdFlags = append(flags.Local.LdFlags, "-Wl,-mllvm,-enable-ml-inliner=release")
+ }
+
// Exclude directories from manual binder interface allowed list.
//TODO(b/145621474): Move this check into IInterface.h when clang-tidy no longer uses absolute paths.
if android.HasAnyPrefix(ctx.ModuleDir(), allowedManualInterfacePaths) {
@@ -814,7 +820,7 @@
Header_libs []string `android:"arch_variant,variant_prepend"`
// list of clang flags required to correctly interpret the headers.
- Cflags []string `android:"arch_variant"`
+ Cflags proptools.Configurable[[]string] `android:"arch_variant"`
// list of c++ specific clang flags required to correctly interpret the headers.
// This is provided primarily to make sure cppflags defined in cc_defaults are pulled in.
diff --git a/cc/config/darwin_host.go b/cc/config/darwin_host.go
index 47c61b0..4856669 100644
--- a/cc/config/darwin_host.go
+++ b/cc/config/darwin_host.go
@@ -50,6 +50,8 @@
darwinSupportedSdkVersions = []string{
"11",
"12",
+ "13",
+ "14",
}
darwinAvailableLibraries = append(
diff --git a/cc/config/global.go b/cc/config/global.go
index 290a27d..62a4765 100644
--- a/cc/config/global.go
+++ b/cc/config/global.go
@@ -300,6 +300,9 @@
// New warnings to be fixed after clang-r475365
"-Wno-error=single-bit-bitfield-constant-conversion", // http://b/243965903
"-Wno-error=enum-constexpr-conversion", // http://b/243964282
+ // New warnings to be fixed after clang-r522817
+ "-Wno-error=invalid-offsetof",
+ "-Wno-error=thread-safety-reference-return",
// Irrelevant on Android because _we_ don't use exceptions, but causes
// lots of build noise because libcxx/libcxxabi do. This can probably
@@ -307,6 +310,9 @@
// until then because it causes warnings in the _callers_, not the
// project itself.
"-Wno-deprecated-dynamic-exception-spec",
+
+ // Allow using VLA CXX extension.
+ "-Wno-vla-cxx-extension",
}
noOverride64GlobalCflags = []string{}
@@ -391,7 +397,7 @@
// prebuilts/clang default settings.
ClangDefaultBase = "prebuilts/clang/host"
- ClangDefaultVersion = "clang-r510928"
+ ClangDefaultVersion = "clang-r522817"
ClangDefaultShortVersion = "18"
// Directories with warnings from Android.bp files.
diff --git a/cc/genrule.go b/cc/genrule.go
index 431a01c..cabf787 100644
--- a/cc/genrule.go
+++ b/cc/genrule.go
@@ -62,6 +62,8 @@
android.InitApexModule(module)
+ android.InitDefaultableModule(module)
+
return module
}
@@ -114,5 +116,5 @@
return variants
}
-func (g *GenruleExtraProperties) SetImageVariation(ctx android.BaseModuleContext, variation string, module android.Module) {
+func (g *GenruleExtraProperties) SetImageVariation(ctx android.BaseModuleContext, variation string) {
}
diff --git a/cc/image.go b/cc/image.go
index f8c5ca5..28692d8 100644
--- a/cc/image.go
+++ b/cc/image.go
@@ -628,30 +628,29 @@
}
}
-func (c *Module) SetImageVariation(ctx android.BaseModuleContext, variant string, module android.Module) {
- m := module.(*Module)
+func (c *Module) SetImageVariation(ctx android.BaseModuleContext, variant string) {
if variant == android.RamdiskVariation {
- m.MakeAsPlatform()
- squashRamdiskSrcs(m)
+ c.MakeAsPlatform()
+ squashRamdiskSrcs(c)
} else if variant == android.VendorRamdiskVariation {
- m.MakeAsPlatform()
- squashVendorRamdiskSrcs(m)
+ c.MakeAsPlatform()
+ squashVendorRamdiskSrcs(c)
} else if variant == android.RecoveryVariation {
- m.MakeAsPlatform()
- squashRecoverySrcs(m)
+ c.MakeAsPlatform()
+ squashRecoverySrcs(c)
} else if strings.HasPrefix(variant, VendorVariation) {
- m.Properties.ImageVariation = VendorVariation
+ c.Properties.ImageVariation = VendorVariation
if strings.HasPrefix(variant, VendorVariationPrefix) {
- m.Properties.VndkVersion = strings.TrimPrefix(variant, VendorVariationPrefix)
+ c.Properties.VndkVersion = strings.TrimPrefix(variant, VendorVariationPrefix)
}
- squashVendorSrcs(m)
+ squashVendorSrcs(c)
} else if strings.HasPrefix(variant, ProductVariation) {
- m.Properties.ImageVariation = ProductVariation
+ c.Properties.ImageVariation = ProductVariation
if strings.HasPrefix(variant, ProductVariationPrefix) {
- m.Properties.VndkVersion = strings.TrimPrefix(variant, ProductVariationPrefix)
+ c.Properties.VndkVersion = strings.TrimPrefix(variant, ProductVariationPrefix)
}
- squashProductSrcs(m)
+ squashProductSrcs(c)
}
if c.NeedsVendorPublicLibraryVariants() &&
diff --git a/cc/library.go b/cc/library.go
index b9c1466..d692b40 100644
--- a/cc/library.go
+++ b/cc/library.go
@@ -149,7 +149,7 @@
Sanitized Sanitized `android:"arch_variant"`
- Cflags []string `android:"arch_variant"`
+ Cflags proptools.Configurable[[]string] `android:"arch_variant"`
Enabled *bool `android:"arch_variant"`
Whole_static_libs []string `android:"arch_variant"`
@@ -190,7 +190,7 @@
// be added to the include path (using -I) for this module and any module that links
// against this module. Directories listed in export_include_dirs do not need to be
// listed in local_include_dirs.
- Export_include_dirs []string `android:"arch_variant,variant_prepend"`
+ Export_include_dirs proptools.Configurable[[]string] `android:"arch_variant,variant_prepend"`
// list of directories that will be added to the system include path
// using -isystem for this module and any module that links against this module.
@@ -292,7 +292,7 @@
if ctx.inProduct() && f.Properties.Target.Product.Override_export_include_dirs != nil {
return android.PathsForModuleSrc(ctx, f.Properties.Target.Product.Override_export_include_dirs)
}
- return android.PathsForModuleSrc(ctx, f.Properties.Export_include_dirs)
+ return android.PathsForModuleSrc(ctx, f.Properties.Export_include_dirs.GetOrDefault(ctx, nil))
}
func (f *flagExporter) exportedSystemIncludes(ctx ModuleContext) android.Paths {
@@ -464,9 +464,9 @@
}
if library.static() {
- flags.Local.CFlags = append(flags.Local.CFlags, library.StaticProperties.Static.Cflags...)
+ flags.Local.CFlags = append(flags.Local.CFlags, library.StaticProperties.Static.Cflags.GetOrDefault(ctx, nil)...)
} else if library.shared() {
- flags.Local.CFlags = append(flags.Local.CFlags, library.SharedProperties.Shared.Cflags...)
+ flags.Local.CFlags = append(flags.Local.CFlags, library.SharedProperties.Shared.Cflags.GetOrDefault(ctx, nil)...)
}
if library.shared() {
@@ -1588,14 +1588,19 @@
// override the module's export_include_dirs with llndk.override_export_include_dirs
// if it is set.
if override := library.Properties.Llndk.Override_export_include_dirs; override != nil {
- library.flagExporter.Properties.Export_include_dirs = override
+ library.flagExporter.Properties.Export_include_dirs = proptools.NewConfigurable[[]string](
+ nil,
+ []proptools.ConfigurableCase[[]string]{
+ proptools.NewConfigurableCase[[]string](nil, &override),
+ },
+ )
}
if Bool(library.Properties.Llndk.Export_headers_as_system) {
library.flagExporter.Properties.Export_system_include_dirs = append(
library.flagExporter.Properties.Export_system_include_dirs,
- library.flagExporter.Properties.Export_include_dirs...)
- library.flagExporter.Properties.Export_include_dirs = nil
+ library.flagExporter.Properties.Export_include_dirs.GetOrDefault(ctx, nil)...)
+ library.flagExporter.Properties.Export_include_dirs = proptools.NewConfigurable[[]string](nil, nil)
}
}
@@ -1603,7 +1608,12 @@
// override the module's export_include_dirs with vendor_public_library.override_export_include_dirs
// if it is set.
if override := library.Properties.Vendor_public_library.Override_export_include_dirs; override != nil {
- library.flagExporter.Properties.Export_include_dirs = override
+ library.flagExporter.Properties.Export_include_dirs = proptools.NewConfigurable[[]string](
+ nil,
+ []proptools.ConfigurableCase[[]string]{
+ proptools.NewConfigurableCase[[]string](nil, &override),
+ },
+ )
}
}
@@ -2071,8 +2081,8 @@
// Check libraries in addition to cflags, since libraries may be exporting different
// include directories.
- if len(staticCompiler.StaticProperties.Static.Cflags) == 0 &&
- len(sharedCompiler.SharedProperties.Shared.Cflags) == 0 &&
+ if len(staticCompiler.StaticProperties.Static.Cflags.GetOrDefault(mctx, nil)) == 0 &&
+ len(sharedCompiler.SharedProperties.Shared.Cflags.GetOrDefault(mctx, nil)) == 0 &&
len(staticCompiler.StaticProperties.Static.Whole_static_libs) == 0 &&
len(sharedCompiler.SharedProperties.Shared.Whole_static_libs) == 0 &&
len(staticCompiler.StaticProperties.Static.Static_libs) == 0 &&
diff --git a/cc/library_stub.go b/cc/library_stub.go
index cddb1b5..9643ec2 100644
--- a/cc/library_stub.go
+++ b/cc/library_stub.go
@@ -20,6 +20,8 @@
"android/soong/android"
"android/soong/multitree"
+
+ "github.com/google/blueprint/proptools"
)
var (
@@ -122,7 +124,7 @@
// The directories are not guaranteed to exist during Soong analysis.
func (d *apiLibraryDecorator) exportIncludes(ctx ModuleContext) {
exporterProps := d.flagExporter.Properties
- for _, dir := range exporterProps.Export_include_dirs {
+ for _, dir := range exporterProps.Export_include_dirs.GetOrDefault(ctx, nil) {
d.dirs = append(d.dirs, android.MaybeExistentPathForSource(ctx, ctx.ModuleDir(), dir))
}
// system headers
@@ -178,16 +180,21 @@
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,
+ exportIncludeDirs := append(d.libraryDecorator.flagExporter.Properties.Export_include_dirs.GetOrDefault(ctx, nil),
variantMod.exportProperties.Export_include_dirs...)
+ d.libraryDecorator.flagExporter.Properties.Export_include_dirs = proptools.NewConfigurable[[]string](
+ nil,
+ []proptools.ConfigurableCase[[]string]{
+ proptools.NewConfigurableCase[[]string](nil, &exportIncludeDirs),
+ },
+ )
// Export headers as system include dirs if specified. Mostly for libc
if 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
+ d.libraryDecorator.flagExporter.Properties.Export_include_dirs.GetOrDefault(ctx, nil)...)
+ d.libraryDecorator.flagExporter.Properties.Export_include_dirs = proptools.NewConfigurable[[]string](nil, nil)
}
}
}
@@ -504,5 +511,5 @@
return variations
}
-func (v *CcApiVariant) SetImageVariation(ctx android.BaseModuleContext, variation string, module android.Module) {
+func (v *CcApiVariant) SetImageVariation(ctx android.BaseModuleContext, variation string) {
}
diff --git a/cc/llndk_library.go b/cc/llndk_library.go
index 5b86c64..d612e9e 100644
--- a/cc/llndk_library.go
+++ b/cc/llndk_library.go
@@ -15,9 +15,10 @@
package cc
import (
+ "strings"
+
"android/soong/android"
"android/soong/etc"
- "strings"
)
var (
@@ -96,7 +97,6 @@
}
var _ etc.PrebuiltEtcModule = &llndkLibrariesTxtModule{}
-var _ android.OutputFileProducer = &llndkLibrariesTxtModule{}
// llndk_libraries_txt is a singleton module whose content is a list of LLNDK libraries
// generated by Soong but can be referenced by other modules.
@@ -118,6 +118,8 @@
installPath := android.PathForModuleInstall(ctx, "etc")
ctx.InstallFile(installPath, filename, txt.outputFile)
+
+ ctx.SetOutputFiles(android.Paths{txt.outputFile}, "")
}
func (txt *llndkLibrariesTxtModule) GenerateSingletonBuildActions(ctx android.SingletonContext) {
@@ -162,11 +164,6 @@
}
// PrebuiltEtcModule interface
-func (txt *llndkLibrariesTxtModule) OutputFile() android.OutputPath {
- return txt.outputFile
-}
-
-// PrebuiltEtcModule interface
func (txt *llndkLibrariesTxtModule) BaseDir() string {
return "etc"
}
diff --git a/cc/lto.go b/cc/lto.go
index a084db7..60eb4d6 100644
--- a/cc/lto.go
+++ b/cc/lto.go
@@ -144,7 +144,7 @@
if !ctx.Config().IsEnvFalse("THINLTO_USE_MLGO") {
// Register allocation MLGO flags for ARM64.
- if ctx.Arch().ArchType == android.Arm64 {
+ if ctx.Arch().ArchType == android.Arm64 && !ctx.optimizeForSize() {
ltoLdFlags = append(ltoLdFlags, "-Wl,-mllvm,-regalloc-enable-advisor=release")
}
// Flags for training MLGO model.
diff --git a/cc/sanitize.go b/cc/sanitize.go
index e6075ad..3abba80 100644
--- a/cc/sanitize.go
+++ b/cc/sanitize.go
@@ -1798,7 +1798,6 @@
}
var _ etc.PrebuiltEtcModule = (*sanitizerLibrariesTxtModule)(nil)
-var _ android.OutputFileProducer = (*sanitizerLibrariesTxtModule)(nil)
func RegisterSanitizerLibrariesTxtType(ctx android.RegistrationContext) {
ctx.RegisterModuleType("sanitizer_libraries_txt", sanitizerLibrariesTxtFactory)
@@ -1886,6 +1885,8 @@
installPath := android.PathForModuleInstall(ctx, "etc")
ctx.InstallFile(installPath, filename, txt.outputFile)
+
+ ctx.SetOutputFiles(android.Paths{txt.outputFile}, "")
}
func (txt *sanitizerLibrariesTxtModule) AndroidMkEntries() []android.AndroidMkEntries {
@@ -1896,11 +1897,6 @@
}
// PrebuiltEtcModule interface
-func (txt *sanitizerLibrariesTxtModule) OutputFile() android.OutputPath {
- return txt.outputFile
-}
-
-// PrebuiltEtcModule interface
func (txt *sanitizerLibrariesTxtModule) BaseDir() string {
return "etc"
}
diff --git a/cc/vndk.go b/cc/vndk.go
index ea55835..7141ea8 100644
--- a/cc/vndk.go
+++ b/cc/vndk.go
@@ -396,7 +396,6 @@
}
var _ etc.PrebuiltEtcModule = &vndkLibrariesTxt{}
-var _ android.OutputFileProducer = &vndkLibrariesTxt{}
// vndksp_libraries_txt is a singleton module whose content is a list of VNDKSP libraries
// generated by Soong but can be referenced by other modules.
@@ -455,6 +454,8 @@
installPath := android.PathForModuleInstall(ctx, "etc")
ctx.InstallFile(installPath, filename, txt.outputFile)
+
+ ctx.SetOutputFiles(android.Paths{txt.outputFile}, "")
}
func (txt *vndkLibrariesTxt) GenerateSingletonBuildActions(ctx android.SingletonContext) {
@@ -497,11 +498,6 @@
}
// PrebuiltEtcModule interface
-func (txt *vndkLibrariesTxt) OutputFile() android.OutputPath {
- return txt.outputFile
-}
-
-// PrebuiltEtcModule interface
func (txt *vndkLibrariesTxt) BaseDir() string {
return "etc"
}
diff --git a/cmd/release_config/build_flag/main.go b/cmd/release_config/build_flag/main.go
index f74784b..5d183ee 100644
--- a/cmd/release_config/build_flag/main.go
+++ b/cmd/release_config/build_flag/main.go
@@ -163,6 +163,7 @@
for _, fa := range configs.FlagArtifacts {
args = append(args, *fa.FlagDeclaration.Name)
}
+ slices.Sort(args)
}
var maxVariableNameLen, maxReleaseNameLen int
@@ -232,7 +233,7 @@
} else {
outputOneLine(arg, config.Name, "REDACTED", "%s")
}
- if isTrace {
+ if err == nil && isTrace {
for _, trace := range config.FlagArtifacts[arg].Traces {
fmt.Printf(" => \"%s\" in %s\n", rc_lib.MarshalValue(trace.Value), *trace.Source)
}
@@ -244,6 +245,8 @@
func SetCommand(configs *rc_lib.ReleaseConfigs, commonFlags Flags, cmd string, args []string) error {
var valueDir string
+ var redacted bool
+ var value string
if len(commonFlags.targetReleases) > 1 {
return fmt.Errorf("set command only allows one --release argument. Got: %s", strings.Join(commonFlags.targetReleases, " "))
}
@@ -251,13 +254,20 @@
setFlags := flag.NewFlagSet("set", flag.ExitOnError)
setFlags.StringVar(&valueDir, "dir", "", "Directory in which to place the value")
+ setFlags.BoolVar(&redacted, "redacted", false, "Whether the flag should be redacted")
setFlags.Parse(args)
setArgs := setFlags.Args()
- if len(setArgs) != 2 {
+ if redacted {
+ if len(setArgs) != 1 {
+ return fmt.Errorf("set command expected '--redacted=true flag', got: --redacted=true %s", strings.Join(setArgs, " "))
+ }
+ } else if len(setArgs) != 2 {
return fmt.Errorf("set command expected flag and value, got: %s", strings.Join(setArgs, " "))
}
name := setArgs[0]
- value := setArgs[1]
+ if !redacted {
+ value = setArgs[1]
+ }
release, err := configs.GetReleaseConfig(targetRelease)
targetRelease = release.Name
if err != nil {
@@ -278,9 +288,30 @@
valueDir = mapDir
}
+ var updatedFiles []string
+ rcPath := filepath.Join(valueDir, "release_configs", fmt.Sprintf("%s.textproto", targetRelease))
+ // Create the release config declaration only if necessary.
+ if _, err = os.Stat(rcPath); err != nil {
+ if err = os.MkdirAll(filepath.Dir(rcPath), 0775); err != nil {
+ return err
+ }
+ rcValue := &rc_proto.ReleaseConfig{
+ Name: proto.String(targetRelease),
+ }
+ err = rc_lib.WriteMessage(rcPath, rcValue)
+ if err != nil {
+ return err
+ }
+ updatedFiles = append(updatedFiles, rcPath)
+ }
+
flagValue := &rc_proto.FlagValue{
- Name: proto.String(name),
- Value: rc_lib.UnmarshalValue(value),
+ Name: proto.String(name),
+ }
+ if redacted {
+ flagValue.Redacted = proto.Bool(true)
+ } else {
+ flagValue.Value = rc_lib.UnmarshalValue(value)
}
flagPath := filepath.Join(valueDir, "flag_values", targetRelease, fmt.Sprintf("%s.textproto", name))
err = rc_lib.WriteMessage(flagPath, flagValue)
@@ -293,11 +324,12 @@
if err != nil {
return err
}
- err = GetCommand(configs, commonFlags, cmd, args[0:1])
+ err = GetCommand(configs, commonFlags, cmd, []string{name})
if err != nil {
return err
}
- fmt.Printf("Updated: %s\n", flagPath)
+ updatedFiles = append(updatedFiles, flagPath)
+ fmt.Printf("Added/Updated: %s\n", strings.Join(updatedFiles, " "))
return nil
}
diff --git a/cmd/release_config/release_config/main.go b/cmd/release_config/release_config/main.go
index bd4ab49..d06b2b7 100644
--- a/cmd/release_config/release_config/main.go
+++ b/cmd/release_config/release_config/main.go
@@ -88,7 +88,7 @@
return
}
// Write the makefile where release_config.mk is going to look for it.
- err = configs.WriteMakefile(makefilePath, targetRelease)
+ err = config.WriteMakefile(makefilePath, targetRelease, configs)
if err != nil {
panic(err)
}
@@ -97,7 +97,7 @@
for _, c := range configs.GetSortedReleaseConfigs() {
if c.Name != targetRelease {
makefilePath = filepath.Join(outputDir, fmt.Sprintf("release_config-%s-%s.varmk", product, c.Name))
- err = configs.WriteMakefile(makefilePath, c.Name)
+ err = config.WriteMakefile(makefilePath, c.Name, configs)
if err != nil {
panic(err)
}
diff --git a/cmd/release_config/release_config_lib/flag_artifact.go b/cmd/release_config/release_config_lib/flag_artifact.go
index 6d36595..6cdde7c 100644
--- a/cmd/release_config/release_config_lib/flag_artifact.go
+++ b/cmd/release_config/release_config_lib/flag_artifact.go
@@ -82,6 +82,15 @@
return &ret
}
+func (fas *FlagArtifacts) SortedFlagNames() []string {
+ var names []string
+ for k, _ := range *fas {
+ names = append(names, k)
+ }
+ slices.Sort(names)
+ return names
+}
+
func (fa *FlagArtifact) GenerateFlagDeclarationArtifact() *rc_proto.FlagDeclarationArtifact {
ret := &rc_proto.FlagDeclarationArtifact{
Name: fa.FlagDeclaration.Name,
@@ -135,9 +144,11 @@
value := &rc_proto.Value{}
proto.Merge(value, src.Value)
return &FlagArtifact{
- FlagDeclaration: src.FlagDeclaration,
- Traces: src.Traces,
- Value: value,
+ FlagDeclaration: src.FlagDeclaration,
+ Traces: src.Traces,
+ Value: value,
+ DeclarationIndex: src.DeclarationIndex,
+ Redacted: src.Redacted,
}
}
diff --git a/cmd/release_config/release_config_lib/release_config.go b/cmd/release_config/release_config_lib/release_config.go
index 02b693c..f0ce1bb 100644
--- a/cmd/release_config/release_config_lib/release_config.go
+++ b/cmd/release_config/release_config_lib/release_config.go
@@ -17,6 +17,7 @@
import (
"cmp"
"fmt"
+ "os"
"path/filepath"
"regexp"
"slices"
@@ -169,8 +170,12 @@
if err != nil {
return err
}
- iConfig.GenerateReleaseConfig(configs)
- if err := config.InheritConfig(iConfig); err != nil {
+ err = iConfig.GenerateReleaseConfig(configs)
+ if err != nil {
+ return err
+ }
+ err = config.InheritConfig(iConfig)
+ if err != nil {
return err
}
}
@@ -310,6 +315,74 @@
return nil
}
+// Write the makefile for this targetRelease.
+func (config *ReleaseConfig) WriteMakefile(outFile, targetRelease string, configs *ReleaseConfigs) error {
+ makeVars := make(map[string]string)
+
+ myFlagArtifacts := config.FlagArtifacts.Clone()
+ // Sort the flags by name first.
+ names := myFlagArtifacts.SortedFlagNames()
+ partitions := make(map[string][]string)
+
+ vNames := []string{}
+ addVar := func(name, suffix, value string) {
+ fullName := fmt.Sprintf("_ALL_RELEASE_FLAGS.%s.%s", name, suffix)
+ vNames = append(vNames, fullName)
+ makeVars[fullName] = value
+ }
+
+ for _, name := range names {
+ flag := myFlagArtifacts[name]
+ decl := flag.FlagDeclaration
+
+ for _, container := range decl.Containers {
+ partitions[container] = append(partitions[container], name)
+ }
+ value := MarshalValue(flag.Value)
+ makeVars[name] = value
+ addVar(name, "TYPE", ValueType(flag.Value))
+ addVar(name, "PARTITIONS", strings.Join(decl.Containers, " "))
+ addVar(name, "DEFAULT", MarshalValue(decl.Value))
+ addVar(name, "VALUE", value)
+ addVar(name, "DECLARED_IN", *flag.Traces[0].Source)
+ addVar(name, "SET_IN", *flag.Traces[len(flag.Traces)-1].Source)
+ addVar(name, "NAMESPACE", *decl.Namespace)
+ }
+ pNames := []string{}
+ for k := range partitions {
+ pNames = append(pNames, k)
+ }
+ slices.Sort(pNames)
+
+ // Now sort the make variables, and output them.
+ slices.Sort(vNames)
+
+ // Write the flags as:
+ // _ALL_RELELASE_FLAGS
+ // _ALL_RELEASE_FLAGS.PARTITIONS.*
+ // all _ALL_RELEASE_FLAGS.*, sorted by name
+ // Final flag values, sorted by name.
+ data := fmt.Sprintf("# TARGET_RELEASE=%s\n", config.Name)
+ if targetRelease != config.Name {
+ data += fmt.Sprintf("# User specified TARGET_RELEASE=%s\n", targetRelease)
+ }
+ // As it stands this list is not per-product, but conceptually it is, and will be.
+ data += fmt.Sprintf("ALL_RELEASE_CONFIGS_FOR_PRODUCT :=$= %s\n", strings.Join(configs.GetAllReleaseNames(), " "))
+ data += fmt.Sprintf("_used_files := %s\n", strings.Join(config.GetSortedFileList(), " "))
+ data += fmt.Sprintf("_ALL_RELEASE_FLAGS :=$= %s\n", strings.Join(names, " "))
+ for _, pName := range pNames {
+ data += fmt.Sprintf("_ALL_RELEASE_FLAGS.PARTITIONS.%s :=$= %s\n", pName, strings.Join(partitions[pName], " "))
+ }
+ for _, vName := range vNames {
+ data += fmt.Sprintf("%s :=$= %s\n", vName, makeVars[vName])
+ }
+ data += "\n\n# Values for all build flags\n"
+ for _, name := range names {
+ data += fmt.Sprintf("%s :=$= %s\n", name, makeVars[name])
+ }
+ return os.WriteFile(outFile, []byte(data), 0644)
+}
+
func (config *ReleaseConfig) WritePartitionBuildFlags(outDir string) error {
var err error
for partition, flags := range config.PartitionBuildFlags {
diff --git a/cmd/release_config/release_config_lib/release_configs.go b/cmd/release_config/release_config_lib/release_configs.go
index 052cde8..f2e1388 100644
--- a/cmd/release_config/release_config_lib/release_configs.go
+++ b/cmd/release_config/release_config_lib/release_configs.go
@@ -395,94 +395,10 @@
allReleaseNames = append(allReleaseNames, v.Name)
allReleaseNames = append(allReleaseNames, v.OtherNames...)
}
- slices.SortFunc(allReleaseNames, func(a, b string) int {
- return cmp.Compare(a, b)
- })
+ slices.Sort(allReleaseNames)
return allReleaseNames
}
-// Write the makefile for this targetRelease.
-func (configs *ReleaseConfigs) WriteMakefile(outFile, targetRelease string) error {
- makeVars := make(map[string]string)
- config, err := configs.GetReleaseConfig(targetRelease)
- if err != nil {
- return err
- }
-
- myFlagArtifacts := config.FlagArtifacts.Clone()
- // Sort the flags by name first.
- names := []string{}
- for k, _ := range myFlagArtifacts {
- names = append(names, k)
- }
- slices.SortFunc(names, func(a, b string) int {
- return cmp.Compare(a, b)
- })
- partitions := make(map[string][]string)
-
- vNames := []string{}
- addVar := func(name, suffix, value string) {
- fullName := fmt.Sprintf("_ALL_RELEASE_FLAGS.%s.%s", name, suffix)
- vNames = append(vNames, fullName)
- makeVars[fullName] = value
- }
-
- for _, name := range names {
- flag := myFlagArtifacts[name]
- decl := flag.FlagDeclaration
-
- for _, container := range decl.Containers {
- partitions[container] = append(partitions[container], name)
- }
- value := MarshalValue(flag.Value)
- makeVars[name] = value
- addVar(name, "TYPE", ValueType(flag.Value))
- addVar(name, "PARTITIONS", strings.Join(decl.Containers, " "))
- addVar(name, "DEFAULT", MarshalValue(decl.Value))
- addVar(name, "VALUE", value)
- addVar(name, "DECLARED_IN", *flag.Traces[0].Source)
- addVar(name, "SET_IN", *flag.Traces[len(flag.Traces)-1].Source)
- addVar(name, "NAMESPACE", *decl.Namespace)
- }
- pNames := []string{}
- for k := range partitions {
- pNames = append(pNames, k)
- }
- slices.SortFunc(pNames, func(a, b string) int {
- return cmp.Compare(a, b)
- })
-
- // Now sort the make variables, and output them.
- slices.SortFunc(vNames, func(a, b string) int {
- return cmp.Compare(a, b)
- })
-
- // Write the flags as:
- // _ALL_RELELASE_FLAGS
- // _ALL_RELEASE_FLAGS.PARTITIONS.*
- // all _ALL_RELEASE_FLAGS.*, sorted by name
- // Final flag values, sorted by name.
- data := fmt.Sprintf("# TARGET_RELEASE=%s\n", config.Name)
- if targetRelease != config.Name {
- data += fmt.Sprintf("# User specified TARGET_RELEASE=%s\n", targetRelease)
- }
- // As it stands this list is not per-product, but conceptually it is, and will be.
- data += fmt.Sprintf("ALL_RELEASE_CONFIGS_FOR_PRODUCT :=$= %s\n", strings.Join(configs.GetAllReleaseNames(), " "))
- data += fmt.Sprintf("_used_files := %s\n", strings.Join(config.GetSortedFileList(), " "))
- data += fmt.Sprintf("_ALL_RELEASE_FLAGS :=$= %s\n", strings.Join(names, " "))
- for _, pName := range pNames {
- data += fmt.Sprintf("_ALL_RELEASE_FLAGS.PARTITIONS.%s :=$= %s\n", pName, strings.Join(partitions[pName], " "))
- }
- for _, vName := range vNames {
- data += fmt.Sprintf("%s :=$= %s\n", vName, makeVars[vName])
- }
- data += "\n\n# Values for all build flags\n"
- for _, name := range names {
- data += fmt.Sprintf("%s :=$= %s\n", name, makeVars[name])
- }
- return os.WriteFile(outFile, []byte(data), 0644)
-}
-
func (configs *ReleaseConfigs) GenerateReleaseConfigs(targetRelease string) error {
otherNames := make(map[string][]string)
for aliasName, aliasTarget := range configs.Aliases {
diff --git a/cmd/release_config/release_config_lib/util.go b/cmd/release_config/release_config_lib/util.go
index b8824d1..0a19efe 100644
--- a/cmd/release_config/release_config_lib/util.go
+++ b/cmd/release_config/release_config_lib/util.go
@@ -83,6 +83,11 @@
// error: any error encountered.
func WriteFormattedMessage(path, format string, message proto.Message) (err error) {
var data []byte
+ if _, err := os.Stat(filepath.Dir(path)); err != nil {
+ if err = os.MkdirAll(filepath.Dir(path), 0775); err != nil {
+ return err
+ }
+ }
switch format {
case "json":
data, err = json.MarshalIndent(message, "", " ")
diff --git a/etc/prebuilt_etc.go b/etc/prebuilt_etc.go
index fd3b27f..2075488 100644
--- a/etc/prebuilt_etc.go
+++ b/etc/prebuilt_etc.go
@@ -133,10 +133,6 @@
// Returns the sub install directory relative to BaseDir().
SubDir() string
-
- // Returns an android.OutputPath to the intermediate file, which is the renamed prebuilt source
- // file.
- OutputFiles(tag string) (android.Paths, error)
}
type PrebuiltEtc struct {
@@ -245,7 +241,7 @@
return nil
}
-func (p *PrebuiltEtc) SetImageVariation(ctx android.BaseModuleContext, variation string, module android.Module) {
+func (p *PrebuiltEtc) SetImageVariation(ctx android.BaseModuleContext, variation string) {
}
func (p *PrebuiltEtc) SourceFilePath(ctx android.ModuleContext) android.Path {
@@ -272,17 +268,6 @@
return p.outputFilePaths[0]
}
-var _ android.OutputFileProducer = (*PrebuiltEtc)(nil)
-
-func (p *PrebuiltEtc) OutputFiles(tag string) (android.Paths, error) {
- switch tag {
- case "":
- return p.outputFilePaths.Paths(), nil
- default:
- return nil, fmt.Errorf("unsupported module reference tag %q", tag)
- }
-}
-
func (p *PrebuiltEtc) SubDir() string {
if subDir := proptools.String(p.subdirProperties.Sub_dir); subDir != "" {
return subDir
@@ -424,6 +409,8 @@
for _, ip := range installs {
ip.addInstallRules(ctx)
}
+
+ ctx.SetOutputFiles(p.outputFilePaths.Paths(), "")
}
type installProperties struct {
diff --git a/filesystem/avb_gen_vbmeta_image.go b/filesystem/avb_gen_vbmeta_image.go
index 985f0ea..a7fd782 100644
--- a/filesystem/avb_gen_vbmeta_image.go
+++ b/filesystem/avb_gen_vbmeta_image.go
@@ -81,6 +81,8 @@
a.output = android.PathForModuleOut(ctx, a.installFileName()).OutputPath
cmd.FlagWithOutput("--output_vbmeta_image ", a.output)
builder.Build("avbGenVbmetaImage", fmt.Sprintf("avbGenVbmetaImage %s", ctx.ModuleName()))
+
+ ctx.SetOutputFiles([]android.Path{a.output}, "")
}
var _ android.AndroidMkEntriesProvider = (*avbGenVbmetaImage)(nil)
@@ -99,16 +101,6 @@
}}
}
-var _ android.OutputFileProducer = (*avbGenVbmetaImage)(nil)
-
-// Implements android.OutputFileProducer
-func (a *avbGenVbmetaImage) OutputFiles(tag string) (android.Paths, error) {
- if tag == "" {
- return []android.Path{a.output}, nil
- }
- return nil, fmt.Errorf("unsupported module reference tag %q", tag)
-}
-
type avbGenVbmetaImageDefaults struct {
android.ModuleBase
android.DefaultsModuleBase
diff --git a/filesystem/bootimg.go b/filesystem/bootimg.go
index 352b451..e796ab9 100644
--- a/filesystem/bootimg.go
+++ b/filesystem/bootimg.go
@@ -123,6 +123,8 @@
b.installDir = android.PathForModuleInstall(ctx, "etc")
ctx.InstallFile(b.installDir, b.installFileName(), b.output)
+
+ ctx.SetOutputFiles([]android.Path{b.output}, "")
}
func (b *bootimg) buildBootImage(ctx android.ModuleContext, vendor bool) android.OutputPath {
@@ -292,13 +294,3 @@
}
return nil
}
-
-var _ android.OutputFileProducer = (*bootimg)(nil)
-
-// Implements android.OutputFileProducer
-func (b *bootimg) OutputFiles(tag string) (android.Paths, error) {
- if tag == "" {
- return []android.Path{b.output}, nil
- }
- return nil, fmt.Errorf("unsupported module reference tag %q", tag)
-}
diff --git a/filesystem/filesystem.go b/filesystem/filesystem.go
index d2572c2..c889dd6 100644
--- a/filesystem/filesystem.go
+++ b/filesystem/filesystem.go
@@ -221,6 +221,8 @@
f.installDir = android.PathForModuleInstall(ctx, "etc")
ctx.InstallFile(f.installDir, f.installFileName(), f.output)
+
+ ctx.SetOutputFiles([]android.Path{f.output}, "")
}
func validatePartitionType(ctx android.ModuleContext, p partition) {
@@ -561,16 +563,6 @@
}}
}
-var _ android.OutputFileProducer = (*filesystem)(nil)
-
-// Implements android.OutputFileProducer
-func (f *filesystem) OutputFiles(tag string) (android.Paths, error) {
- if tag == "" {
- return []android.Path{f.output}, nil
- }
- return nil, fmt.Errorf("unsupported module reference tag %q", tag)
-}
-
// Filesystem is the public interface for the filesystem struct. Currently, it's only for the apex
// package to have access to the output file.
type Filesystem interface {
diff --git a/filesystem/logical_partition.go b/filesystem/logical_partition.go
index e2f7d7b..e483fe4 100644
--- a/filesystem/logical_partition.go
+++ b/filesystem/logical_partition.go
@@ -185,6 +185,8 @@
l.installDir = android.PathForModuleInstall(ctx, "etc")
ctx.InstallFile(l.installDir, l.installFileName(), l.output)
+
+ ctx.SetOutputFiles([]android.Path{l.output}, "")
}
// Add a rule that converts the filesystem for the given partition to the given rule builder. The
@@ -231,13 +233,3 @@
func (l *logicalPartition) SignedOutputPath() android.Path {
return nil // logical partition is not signed by itself
}
-
-var _ android.OutputFileProducer = (*logicalPartition)(nil)
-
-// Implements android.OutputFileProducer
-func (l *logicalPartition) OutputFiles(tag string) (android.Paths, error) {
- if tag == "" {
- return []android.Path{l.output}, nil
- }
- return nil, fmt.Errorf("unsupported module reference tag %q", tag)
-}
diff --git a/filesystem/raw_binary.go b/filesystem/raw_binary.go
index 1544ea7..ad36c29 100644
--- a/filesystem/raw_binary.go
+++ b/filesystem/raw_binary.go
@@ -15,8 +15,6 @@
package filesystem
import (
- "fmt"
-
"github.com/google/blueprint"
"github.com/google/blueprint/proptools"
@@ -88,6 +86,8 @@
r.output = outputFile
r.installDir = android.PathForModuleInstall(ctx, "etc")
ctx.InstallFile(r.installDir, r.installFileName(), r.output)
+
+ ctx.SetOutputFiles([]android.Path{r.output}, "")
}
var _ android.AndroidMkEntriesProvider = (*rawBinary)(nil)
@@ -109,13 +109,3 @@
func (r *rawBinary) SignedOutputPath() android.Path {
return nil
}
-
-var _ android.OutputFileProducer = (*rawBinary)(nil)
-
-// Implements android.OutputFileProducer
-func (r *rawBinary) OutputFiles(tag string) (android.Paths, error) {
- if tag == "" {
- return []android.Path{r.output}, nil
- }
- return nil, fmt.Errorf("unsupported module reference tag %q", tag)
-}
diff --git a/filesystem/vbmeta.go b/filesystem/vbmeta.go
index 43a2f37..0c6e7f4 100644
--- a/filesystem/vbmeta.go
+++ b/filesystem/vbmeta.go
@@ -211,6 +211,8 @@
v.installDir = android.PathForModuleInstall(ctx, "etc")
ctx.InstallFile(v.installDir, v.installFileName(), v.output)
+
+ ctx.SetOutputFiles([]android.Path{v.output}, "")
}
// Returns the embedded shell command that prints the rollback index
@@ -288,13 +290,3 @@
func (v *vbmeta) SignedOutputPath() android.Path {
return v.OutputPath() // vbmeta is always signed
}
-
-var _ android.OutputFileProducer = (*vbmeta)(nil)
-
-// Implements android.OutputFileProducer
-func (v *vbmeta) OutputFiles(tag string) (android.Paths, error) {
- if tag == "" {
- return []android.Path{v.output}, nil
- }
- return nil, fmt.Errorf("unsupported module reference tag %q", tag)
-}
diff --git a/genrule/genrule.go b/genrule/genrule.go
index 26dad01..06a7e18 100644
--- a/genrule/genrule.go
+++ b/genrule/genrule.go
@@ -650,7 +650,7 @@
func (x noopImageInterface) DebugRamdiskVariantNeeded(android.BaseModuleContext) bool { return false }
func (x noopImageInterface) RecoveryVariantNeeded(android.BaseModuleContext) bool { return false }
func (x noopImageInterface) ExtraImageVariations(ctx android.BaseModuleContext) []string { return nil }
-func (x noopImageInterface) SetImageVariation(ctx android.BaseModuleContext, variation string, module android.Module) {
+func (x noopImageInterface) SetImageVariation(ctx android.BaseModuleContext, variation string) {
}
func NewGenSrcs() *Module {
diff --git a/java/base.go b/java/base.go
index b4f800b..49214d8 100644
--- a/java/base.go
+++ b/java/base.go
@@ -1852,7 +1852,7 @@
classes := android.PathForModuleOut(ctx, "javac", jarName).OutputPath
TransformJavaToClasses(ctx, classes, idx, srcFiles, srcJars, annoSrcJar, flags, extraJarDeps)
- if ctx.Config().EmitXrefRules() {
+ if ctx.Config().EmitXrefRules() && ctx.Module() == ctx.PrimaryModule() {
extractionFile := android.PathForModuleOut(ctx, kzipName)
emitXrefRule(ctx, extractionFile, idx, srcFiles, srcJars, flags, extraJarDeps)
j.kytheFiles = append(j.kytheFiles, extractionFile)
@@ -2544,7 +2544,7 @@
case Implementation:
return RenameUseInclude, "info"
default:
- //fmt.Printf("LJ: %v -> %v StubsLinkType unknown\n", module, m)
+ //fmt.Printf("collectDirectDepsProviders: %v -> %v StubsLinkType unknown\n", module, m)
// Fall through to the heuristic logic.
}
switch reflect.TypeOf(m).String() {
diff --git a/java/classpath_fragment.go b/java/classpath_fragment.go
index 07bc5c1..18a5dae 100644
--- a/java/classpath_fragment.go
+++ b/java/classpath_fragment.go
@@ -128,19 +128,21 @@
return m.Name() == configuredJars.Jar(i)
}, func(m android.Module) {
if s, ok := m.(*SdkLibrary); ok {
+ minSdkVersion := s.MinSdkVersion(ctx)
+ maxSdkVersion := s.MaxSdkVersion(ctx)
// TODO(208456999): instead of mapping "current" to latest, min_sdk_version should never be set to "current"
- if s.minSdkVersion.Specified() {
- if s.minSdkVersion.IsCurrent() {
+ if minSdkVersion.Specified() {
+ if minSdkVersion.IsCurrent() {
jar.minSdkVersion = ctx.Config().DefaultAppTargetSdk(ctx).String()
} else {
- jar.minSdkVersion = s.minSdkVersion.String()
+ jar.minSdkVersion = minSdkVersion.String()
}
}
- if s.maxSdkVersion.Specified() {
- if s.maxSdkVersion.IsCurrent() {
+ if maxSdkVersion.Specified() {
+ if maxSdkVersion.IsCurrent() {
jar.maxSdkVersion = ctx.Config().DefaultAppTargetSdk(ctx).String()
} else {
- jar.maxSdkVersion = s.maxSdkVersion.String()
+ jar.maxSdkVersion = maxSdkVersion.String()
}
}
}
diff --git a/java/dexpreopt.go b/java/dexpreopt.go
index 832b850..7949244 100644
--- a/java/dexpreopt.go
+++ b/java/dexpreopt.go
@@ -96,6 +96,10 @@
}
}
+func (install dexpreopterInstall) PackageFile(ctx android.ModuleContext) android.PackagingSpec {
+ return ctx.PackageFile(install.installDirOnDevice, install.installFileOnDevice, install.outputPathOnHost)
+}
+
type Dexpreopter struct {
dexpreopter
}
@@ -312,10 +316,6 @@
dexpreopt.RegisterToolDeps(ctx)
}
-func (d *dexpreopter) odexOnSystemOther(ctx android.ModuleContext, libName string, installPath android.InstallPath) bool {
- return dexpreopt.OdexOnSystemOtherByName(libName, android.InstallPathToOnDevicePath(ctx, installPath), dexpreopt.GetGlobalConfig(ctx))
-}
-
// Returns the install path of the dex jar of a module.
//
// Do not rely on `ApexInfo.ApexVariationName` because it can be something like "apex1000", rather
@@ -545,12 +545,29 @@
// Use the path of the dex file to determine the library name
isApexSystemServerJar := global.AllApexSystemServerJars(ctx).ContainsJar(dexJarStem)
+ dexpreoptPartition := d.installPath.Partition()
+ // dexpreoptPartition is set to empty for dexpreopts of system APEX and system_other.
+ // In case of system APEX, however, we can set it to "system" manually.
+ // TODO(b/346662300): Let dexpreopter generate the installPath for dexpreopt files instead of
+ // using the dex location to generate the installPath.
+ if isApexSystemServerJar {
+ dexpreoptPartition = "system"
+ }
for _, install := range dexpreoptRule.Installs() {
// Remove the "/" prefix because the path should be relative to $ANDROID_PRODUCT_OUT.
installDir := strings.TrimPrefix(filepath.Dir(install.To), "/")
+ partition := dexpreoptPartition
+ if strings.HasPrefix(installDir, partition+"/") {
+ installDir = strings.TrimPrefix(installDir, partition+"/")
+ } else {
+ // If the partition for the installDir is different from the install partition, set the
+ // partition empty to install the dexpreopt files to the desired partition.
+ // TODO(b/346439786): Define and use the dexpreopt module type to avoid this mismatch.
+ partition = ""
+ }
installBase := filepath.Base(install.To)
arch := filepath.Base(installDir)
- installPath := android.PathForModuleInPartitionInstall(ctx, "", installDir)
+ installPath := android.PathForModuleInPartitionInstall(ctx, partition, installDir)
isProfile := strings.HasSuffix(installBase, ".prof")
if isProfile {
@@ -584,6 +601,37 @@
}
}
+func getModuleInstallPathInfo(ctx android.ModuleContext, fullInstallPath string) (android.InstallPath, string, string) {
+ installPath := android.PathForModuleInstall(ctx)
+ installDir, installBase := filepath.Split(strings.TrimPrefix(fullInstallPath, "/"))
+
+ if !strings.HasPrefix(installDir, installPath.Partition()+"/") {
+ // Return empty filename if the install partition is not for the target image.
+ return installPath, "", ""
+ }
+ relDir, err := filepath.Rel(installPath.Partition(), installDir)
+ if err != nil {
+ panic(err)
+ }
+ return installPath, relDir, installBase
+}
+
+// RuleBuilder.Install() adds output-to-install copy pairs to a list for Make. To share this
+// information with PackagingSpec in soong, call PackageFile for them.
+// The install path and the target install partition of the module must be the same.
+func packageFile(ctx android.ModuleContext, install android.RuleBuilderInstall) {
+ installPath, relDir, name := getModuleInstallPathInfo(ctx, install.To)
+ // Empty name means the install partition is not for the target image.
+ // For the system image, files for "apex" and "system_other" are skipped here.
+ // The skipped "apex" files are for testing only, for example,
+ // "/apex/art_boot_images/javalib/x86/boot.vdex".
+ // TODO(b/320196894): Files for "system_other" are skipped because soong creates the system
+ // image only for now.
+ if name != "" {
+ ctx.PackageFile(installPath.Join(ctx, relDir), name, install.From)
+ }
+}
+
func (d *dexpreopter) DexpreoptBuiltInstalledForApex() []dexpreopterInstall {
return d.builtInstalledForApex
}
diff --git a/java/dexpreopt_bootjars.go b/java/dexpreopt_bootjars.go
index 7229ca0..defa82c 100644
--- a/java/dexpreopt_bootjars.go
+++ b/java/dexpreopt_bootjars.go
@@ -612,6 +612,9 @@
profileInstalls: profileInstalls,
profileLicenseMetadataFile: android.OptionalPathForPath(ctx.LicenseMetadataFile()),
})
+ for _, install := range profileInstalls {
+ packageFile(ctx, install)
+ }
}
}
@@ -929,6 +932,35 @@
return apexNameToApexExportsInfoMap
}
+func packageFileForTargetImage(ctx android.ModuleContext, image *bootImageVariant) {
+ if image.target.Os != ctx.Os() {
+ // This is not for the target device.
+ return
+ }
+
+ for _, install := range image.installs {
+ packageFile(ctx, install)
+ }
+
+ for _, install := range image.vdexInstalls {
+ if image.target.Arch.ArchType.Name != ctx.DeviceConfig().DeviceArch() {
+ // Note that the vdex files are identical between architectures. If the target image is
+ // not for the primary architecture create symlinks to share the vdex of the primary
+ // architecture with the other architectures.
+ //
+ // Assuming that the install path has the architecture name with it, replace the
+ // architecture name with the primary architecture name to find the source vdex file.
+ installPath, relDir, name := getModuleInstallPathInfo(ctx, install.To)
+ if name != "" {
+ srcRelDir := strings.Replace(relDir, image.target.Arch.ArchType.Name, ctx.DeviceConfig().DeviceArch(), 1)
+ ctx.InstallSymlink(installPath.Join(ctx, relDir), name, installPath.Join(ctx, srcRelDir, name))
+ }
+ } else {
+ packageFile(ctx, install)
+ }
+ }
+}
+
// Generate boot image build rules for a specific target.
func buildBootImageVariant(ctx android.ModuleContext, image *bootImageVariant, profile android.Path) bootImageVariantOutputs {
@@ -1123,6 +1155,7 @@
image.installs = rule.Installs()
image.vdexInstalls = vdexInstalls
image.unstrippedInstalls = unstrippedInstalls
+ packageFileForTargetImage(ctx, image)
// Only set the licenseMetadataFile from the active module.
if isActiveModule(ctx, ctx.Module()) {
diff --git a/java/droidstubs.go b/java/droidstubs.go
index 5ca6c25..b32b754 100644
--- a/java/droidstubs.go
+++ b/java/droidstubs.go
@@ -1054,8 +1054,7 @@
}
if !treatDocumentationIssuesAsErrors {
- // Treat documentation issues as warnings, but error when new.
- cmd.Flag("--error-when-new-category").Flag("Documentation")
+ treatDocumentationIssuesAsWarningErrorWhenNew(cmd)
}
// Add "check released" options. (Detect incompatible API changes from the last public release)
@@ -1083,6 +1082,22 @@
}
}
+// HIDDEN_DOCUMENTATION_ISSUES is the set of documentation related issues that should always be
+// hidden as they are very noisy and provide little value.
+var HIDDEN_DOCUMENTATION_ISSUES = []string{
+ "Deprecated",
+ "IntDef",
+ "Nullable",
+}
+
+func treatDocumentationIssuesAsWarningErrorWhenNew(cmd *android.RuleBuilderCommand) {
+ // Treat documentation issues as warnings, but error when new.
+ cmd.Flag("--error-when-new-category").Flag("Documentation")
+
+ // Hide some documentation issues that generated a lot of noise for little benefit.
+ cmd.FlagForEachArg("--hide ", HIDDEN_DOCUMENTATION_ISSUES)
+}
+
// Sandbox rule for generating exportable stubs and other artifacts
func (d *Droidstubs) exportableStubCmd(ctx android.ModuleContext, params stubsCommandConfigParams) {
optionalCmdParams := stubsCommandParams{
@@ -1154,7 +1169,7 @@
}
// Treat documentation issues as warnings, but error when new.
- cmd.Flag("--error-when-new-category").Flag("Documentation")
+ treatDocumentationIssuesAsWarningErrorWhenNew(cmd)
if params.stubConfig.generateStubs {
rule.Command().
diff --git a/java/java.go b/java/java.go
index ccccbac..08fb678 100644
--- a/java/java.go
+++ b/java/java.go
@@ -2180,7 +2180,7 @@
// Map where key is the api scope name and value is the int value
// representing the order of the api scope, narrowest to the widest
-var scopeOrderMap = allApiScopes.MapToIndex(
+var scopeOrderMap = AllApiScopes.MapToIndex(
func(s *apiScope) string { return s.name })
func (al *ApiLibrary) sortApiFilesByApiScope(ctx android.ModuleContext, srcFilesInfo []JavaApiImportInfo) []JavaApiImportInfo {
diff --git a/java/sdk_library.go b/java/sdk_library.go
index 72eb6e3..e9fa83a 100644
--- a/java/sdk_library.go
+++ b/java/sdk_library.go
@@ -324,6 +324,16 @@
return ret
}
+func (scopes apiScopes) ConvertStubsLibraryExportableToEverything(name string) string {
+ for _, scope := range scopes {
+ if strings.HasSuffix(name, scope.exportableStubsLibraryModuleNameSuffix()) {
+ return strings.TrimSuffix(name, scope.exportableStubsLibraryModuleNameSuffix()) +
+ scope.stubsLibraryModuleNameSuffix()
+ }
+ }
+ return name
+}
+
var (
scopeByName = make(map[string]*apiScope)
allScopeNames []string
@@ -418,7 +428,7 @@
},
kind: android.SdkSystemServer,
})
- allApiScopes = apiScopes{
+ AllApiScopes = apiScopes{
apiScopePublic,
apiScopeSystem,
apiScopeTest,
@@ -1204,7 +1214,7 @@
paths := c.findClosestScopePath(apiScope)
if paths == nil {
var scopes []string
- for _, s := range allApiScopes {
+ for _, s := range AllApiScopes {
if c.findScopePaths(s) != nil {
scopes = append(scopes, s.name)
}
@@ -1421,7 +1431,7 @@
// Check to see if any scopes have been explicitly enabled. If any have then all
// must be.
anyScopesExplicitlyEnabled := false
- for _, scope := range allApiScopes {
+ for _, scope := range AllApiScopes {
scopeProperties := module.scopeToProperties[scope]
if scopeProperties.Enabled != nil {
anyScopesExplicitlyEnabled = true
@@ -1431,7 +1441,7 @@
var generatedScopes apiScopes
enabledScopes := make(map[*apiScope]struct{})
- for _, scope := range allApiScopes {
+ for _, scope := range AllApiScopes {
scopeProperties := module.scopeToProperties[scope]
// If any scopes are explicitly enabled then ignore the legacy enabled status.
// This is to ensure that any new usages of this module type do not rely on legacy
@@ -1451,7 +1461,7 @@
// Now check to make sure that any scope that is extended by an enabled scope is also
// enabled.
- for _, scope := range allApiScopes {
+ for _, scope := range AllApiScopes {
if _, ok := enabledScopes[scope]; ok {
extends := scope.extends
if extends != nil {
@@ -2580,7 +2590,7 @@
// Initialize the map from scope to scope specific properties.
scopeToProperties := make(map[*apiScope]*ApiScopeProperties)
- for _, scope := range allApiScopes {
+ for _, scope := range AllApiScopes {
scopeToProperties[scope] = scope.scopeSpecificProperties(module)
}
module.scopeToProperties = scopeToProperties
@@ -2697,7 +2707,7 @@
// Dynamically create a structure type for each apiscope in allApiScopes.
func createAllScopePropertiesStructType() reflect.Type {
var fields []reflect.StructField
- for _, apiScope := range allApiScopes {
+ for _, apiScope := range AllApiScopes {
field := reflect.StructField{
Name: apiScope.fieldName,
Type: reflect.TypeOf(sdkLibraryScopeProperties{}),
@@ -2715,7 +2725,7 @@
allScopePropertiesStruct := allScopePropertiesPtr.Elem()
scopeProperties := make(map[*apiScope]*sdkLibraryScopeProperties)
- for _, apiScope := range allApiScopes {
+ for _, apiScope := range AllApiScopes {
field := allScopePropertiesStruct.FieldByName(apiScope.fieldName)
scopeProperties[apiScope] = field.Addr().Interface().(*sdkLibraryScopeProperties)
}
@@ -3242,11 +3252,6 @@
return "permissions"
}
-// from android.PrebuiltEtcModule
-func (module *sdkLibraryXml) OutputFiles(tag string) (android.Paths, error) {
- return android.OutputPaths{module.outputFilePath}.Paths(), nil
-}
-
var _ etc.PrebuiltEtcModule = (*sdkLibraryXml)(nil)
// from android.ApexModule
@@ -3390,6 +3395,8 @@
module.installDirPath = android.PathForModuleInstall(ctx, "etc", module.SubDir())
ctx.PackageFile(module.installDirPath, libName+".xml", module.outputFilePath)
+
+ ctx.SetOutputFiles(android.OutputPaths{module.outputFilePath}.Paths(), "")
}
func (module *sdkLibraryXml) AndroidMkEntries() []android.AndroidMkEntries {
@@ -3597,7 +3604,7 @@
s.Stem = sdk.distStem()
s.Scopes = make(map[*apiScope]*scopeProperties)
- for _, apiScope := range allApiScopes {
+ for _, apiScope := range AllApiScopes {
paths := sdk.findScopePaths(apiScope)
if paths == nil {
continue
@@ -3659,7 +3666,7 @@
stem := s.Stem
- for _, apiScope := range allApiScopes {
+ for _, apiScope := range AllApiScopes {
if properties, ok := s.Scopes[apiScope]; ok {
scopeSet := propertySet.AddPropertySet(apiScope.propertyName)
diff --git a/linkerconfig/linkerconfig.go b/linkerconfig/linkerconfig.go
index 98aa408..3a8d3cf 100644
--- a/linkerconfig/linkerconfig.go
+++ b/linkerconfig/linkerconfig.go
@@ -15,7 +15,6 @@
package linkerconfig
import (
- "fmt"
"sort"
"strings"
@@ -73,17 +72,6 @@
return l.outputFilePath
}
-var _ android.OutputFileProducer = (*linkerConfig)(nil)
-
-func (l *linkerConfig) OutputFiles(tag string) (android.Paths, error) {
- switch tag {
- case "":
- return android.Paths{l.outputFilePath}, nil
- default:
- return nil, fmt.Errorf("unsupported module reference tag %q", tag)
- }
-}
-
func (l *linkerConfig) GenerateAndroidBuildActions(ctx android.ModuleContext) {
input := android.PathForModuleSrc(ctx, android.String(l.properties.Src))
output := android.PathForModuleOut(ctx, "linker.config.pb").OutputPath
@@ -98,6 +86,8 @@
l.SkipInstall()
}
ctx.InstallFile(l.installDirPath, l.outputFilePath.Base(), l.outputFilePath)
+
+ ctx.SetOutputFiles(android.Paths{l.outputFilePath}, "")
}
func BuildLinkerConfig(ctx android.ModuleContext, builder *android.RuleBuilder,
diff --git a/rust/bindgen.go b/rust/bindgen.go
index 4277753..83a6e95 100644
--- a/rust/bindgen.go
+++ b/rust/bindgen.go
@@ -236,7 +236,8 @@
esc := proptools.NinjaAndShellEscapeList
// Filter out invalid cflags
- for _, flag := range b.ClangProperties.Cflags {
+ cflagsProp := b.ClangProperties.Cflags.GetOrDefault(ctx, nil)
+ for _, flag := range cflagsProp {
if flag == "-x c++" || flag == "-xc++" {
ctx.PropertyErrorf("cflags",
"-x c++ should not be specified in cflags; setting cpp_std specifies this is a C++ header, or change the file extension to '.hpp' or '.hh'")
@@ -248,7 +249,7 @@
}
// Module defined clang flags and include paths
- cflags = append(cflags, esc(b.ClangProperties.Cflags)...)
+ cflags = append(cflags, esc(cflagsProp)...)
for _, include := range b.ClangProperties.Local_include_dirs {
cflags = append(cflags, "-I"+android.PathForModuleSrc(ctx, include).String())
implicits = append(implicits, android.PathForModuleSrc(ctx, include))
diff --git a/rust/config/global.go b/rust/config/global.go
index e83e23a..6943467 100644
--- a/rust/config/global.go
+++ b/rust/config/global.go
@@ -24,7 +24,7 @@
var (
pctx = android.NewPackageContext("android/soong/rust/config")
- RustDefaultVersion = "1.77.1.p1"
+ RustDefaultVersion = "1.78.0"
RustDefaultBase = "prebuilts/rust/"
DefaultEdition = "2021"
Stdlibs = []string{
diff --git a/rust/image.go b/rust/image.go
index e0d267d..fec6d92 100644
--- a/rust/image.go
+++ b/rust/image.go
@@ -197,21 +197,20 @@
return mod.InVendor() || mod.InProduct()
}
-func (mod *Module) SetImageVariation(ctx android.BaseModuleContext, variant string, module android.Module) {
- m := module.(*Module)
+func (mod *Module) SetImageVariation(ctx android.BaseModuleContext, variant string) {
if variant == android.VendorRamdiskVariation {
- m.MakeAsPlatform()
+ mod.MakeAsPlatform()
} else if variant == android.RecoveryVariation {
- m.MakeAsPlatform()
+ mod.MakeAsPlatform()
} else if strings.HasPrefix(variant, cc.VendorVariation) {
- m.Properties.ImageVariation = cc.VendorVariation
+ mod.Properties.ImageVariation = cc.VendorVariation
if strings.HasPrefix(variant, cc.VendorVariationPrefix) {
- m.Properties.VndkVersion = strings.TrimPrefix(variant, cc.VendorVariationPrefix)
+ mod.Properties.VndkVersion = strings.TrimPrefix(variant, cc.VendorVariationPrefix)
}
} else if strings.HasPrefix(variant, cc.ProductVariation) {
- m.Properties.ImageVariation = cc.ProductVariation
+ mod.Properties.ImageVariation = cc.ProductVariation
if strings.HasPrefix(variant, cc.ProductVariationPrefix) {
- m.Properties.VndkVersion = strings.TrimPrefix(variant, cc.ProductVariationPrefix)
+ mod.Properties.VndkVersion = strings.TrimPrefix(variant, cc.ProductVariationPrefix)
}
}
}
diff --git a/sdk/sdk_test.go b/sdk/sdk_test.go
index f9d49d9..4894210 100644
--- a/sdk/sdk_test.go
+++ b/sdk/sdk_test.go
@@ -519,4 +519,140 @@
)
})
+ t.Run("test replacing exportable module", func(t *testing.T) {
+ result := android.GroupFixturePreparers(
+ prepareForSdkTestWithJava,
+ java.PrepareForTestWithJavaDefaultModules,
+ java.PrepareForTestWithJavaSdkLibraryFiles,
+ java.FixtureWithLastReleaseApis("mysdklibrary", "anothersdklibrary"),
+ android.FixtureWithRootAndroidBp(`
+ sdk {
+ name: "mysdk",
+ bootclasspath_fragments: ["mybootclasspathfragment"],
+ }
+
+ bootclasspath_fragment {
+ name: "mybootclasspathfragment",
+ apex_available: ["myapex"],
+ contents: ["mysdklibrary"],
+ hidden_api: {
+ split_packages: ["*"],
+ },
+ core_platform_api: {
+ stub_libs: [
+ "anothersdklibrary.stubs.exportable",
+ ],
+ },
+ api: {
+ stub_libs: [
+ "anothersdklibrary",
+ ],
+ },
+ }
+
+ java_sdk_library {
+ name: "mysdklibrary",
+ srcs: ["Test.java"],
+ compile_dex: true,
+ min_sdk_version: "S",
+ public: {enabled: true},
+ permitted_packages: ["mysdklibrary"],
+ }
+
+ java_sdk_library {
+ name: "anothersdklibrary",
+ srcs: ["Test.java"],
+ compile_dex: true,
+ min_sdk_version: "S",
+ public: {enabled: true},
+ system: {enabled: true},
+ module_lib: {enabled: true},
+ }
+ `),
+ android.FixtureMergeEnv(map[string]string{
+ "SOONG_SDK_SNAPSHOT_TARGET_BUILD_RELEASE": "S",
+ }),
+ android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) {
+ variables.BuildFlags = map[string]string{
+ "RELEASE_HIDDEN_API_EXPORTABLE_STUBS": "true",
+ }
+ variables.Platform_version_active_codenames = []string{"UpsideDownCake", "Tiramisu", "S-V2"}
+ }),
+ ).RunTest(t)
+
+ CheckSnapshot(t, result, "mysdk", "",
+ checkAndroidBpContents(`
+// This is auto-generated. DO NOT EDIT.
+
+prebuilt_bootclasspath_fragment {
+ name: "mybootclasspathfragment",
+ prefer: false,
+ visibility: ["//visibility:public"],
+ apex_available: ["myapex"],
+ contents: ["mysdklibrary"],
+ api: {
+ stub_libs: ["anothersdklibrary"],
+ },
+ core_platform_api: {
+ stub_libs: ["anothersdklibrary.stubs"],
+ },
+ hidden_api: {
+ annotation_flags: "hiddenapi/annotation-flags.csv",
+ metadata: "hiddenapi/metadata.csv",
+ index: "hiddenapi/index.csv",
+ stub_flags: "hiddenapi/stub-flags.csv",
+ all_flags: "hiddenapi/all-flags.csv",
+ },
+}
+
+java_sdk_library_import {
+ name: "mysdklibrary",
+ prefer: false,
+ visibility: ["//visibility:public"],
+ apex_available: ["//apex_available:platform"],
+ shared_library: true,
+ compile_dex: true,
+ permitted_packages: ["mysdklibrary"],
+ public: {
+ jars: ["sdk_library/public/mysdklibrary-stubs.jar"],
+ stub_srcs: ["sdk_library/public/mysdklibrary_stub_sources"],
+ current_api: "sdk_library/public/mysdklibrary.txt",
+ removed_api: "sdk_library/public/mysdklibrary-removed.txt",
+ sdk_version: "current",
+ },
+}
+
+java_sdk_library_import {
+ name: "anothersdklibrary",
+ prefer: false,
+ visibility: ["//visibility:public"],
+ apex_available: ["//apex_available:platform"],
+ shared_library: true,
+ compile_dex: true,
+ public: {
+ jars: ["sdk_library/public/anothersdklibrary-stubs.jar"],
+ stub_srcs: ["sdk_library/public/anothersdklibrary_stub_sources"],
+ current_api: "sdk_library/public/anothersdklibrary.txt",
+ removed_api: "sdk_library/public/anothersdklibrary-removed.txt",
+ sdk_version: "current",
+ },
+ system: {
+ jars: ["sdk_library/system/anothersdklibrary-stubs.jar"],
+ stub_srcs: ["sdk_library/system/anothersdklibrary_stub_sources"],
+ current_api: "sdk_library/system/anothersdklibrary.txt",
+ removed_api: "sdk_library/system/anothersdklibrary-removed.txt",
+ sdk_version: "system_current",
+ },
+ module_lib: {
+ jars: ["sdk_library/module-lib/anothersdklibrary-stubs.jar"],
+ stub_srcs: ["sdk_library/module-lib/anothersdklibrary_stub_sources"],
+ current_api: "sdk_library/module-lib/anothersdklibrary.txt",
+ removed_api: "sdk_library/module-lib/anothersdklibrary-removed.txt",
+ sdk_version: "module_current",
+ },
+}
+`),
+ )
+ })
+
}
diff --git a/sdk/update.go b/sdk/update.go
index afecf9f..0a97fd9 100644
--- a/sdk/update.go
+++ b/sdk/update.go
@@ -480,6 +480,12 @@
// Transform the module module to make it suitable for use in the snapshot.
module = transformModule(module, snapshotTransformer)
module = transformModule(module, emptyClasspathContentsTransformation{})
+
+ targetApiLevel, err := android.ApiLevelFromUserWithConfig(ctx.Config(), s.targetBuildRelease(ctx).name)
+ if err == nil && targetApiLevel.LessThan(android.ApiLevelVanillaIceCream) {
+ module = transformModule(module, replaceExportablePropertiesTransformer{})
+ }
+
if module != nil {
bpFile.AddModule(module)
}
@@ -804,6 +810,50 @@
}
}
+type replaceExportablePropertiesTransformer struct {
+ identityTransformation
+}
+
+var _ bpTransformer = (*replaceExportablePropertiesTransformer)(nil)
+
+func handleExportableProperties[T any](value T) any {
+ switch v := any(value).(type) {
+ case string:
+ return java.AllApiScopes.ConvertStubsLibraryExportableToEverything(v)
+ case *bpPropertySet:
+ v.properties = handleExportableProperties(v.properties).(map[string]interface{})
+ return v
+ case []string:
+ result := make([]string, len(v))
+ for i, elem := range v {
+ result[i] = handleExportableProperties(elem).(string)
+ }
+ return result
+ case []any:
+ result := make([]any, len(v))
+ for i, elem := range v {
+ result[i] = handleExportableProperties(elem)
+ }
+ return result
+ case map[string]any:
+ result := make(map[string]any)
+ for k, val := range v {
+ result[k] = handleExportableProperties(val)
+ }
+ return result
+ default:
+ return value
+ }
+}
+
+func (t replaceExportablePropertiesTransformer) transformPropertySetAfterContents(name string, propertySet *bpPropertySet, tag android.BpPropertyTag) (*bpPropertySet, android.BpPropertyTag) {
+ if name == "name" {
+ return propertySet, tag
+ }
+ propertySet.properties = handleExportableProperties(propertySet.properties).(map[string]interface{})
+ return propertySet, tag
+}
+
func generateBpContents(bpFile *bpFile) string {
contents := &generatedContents{}
contents.IndentedPrintf("// This is auto-generated. DO NOT EDIT.\n")
diff --git a/sh/sh_binary.go b/sh/sh_binary.go
index 3cbbc45..48a442d 100644
--- a/sh/sh_binary.go
+++ b/sh/sh_binary.go
@@ -15,7 +15,6 @@
package sh
import (
- "fmt"
"path/filepath"
"strings"
@@ -100,6 +99,12 @@
// Make this module available when building for recovery.
Recovery_available *bool
+
+ // The name of the image this module is built for
+ ImageVariation string `blueprint:"mutated"`
+
+ // Suffix for the name of Android.mk entries generated by this module
+ SubName string `blueprint:"mutated"`
}
type TestProperties struct {
@@ -188,15 +193,6 @@
return s.outputFilePath
}
-func (s *ShBinary) OutputFiles(tag string) (android.Paths, error) {
- switch tag {
- case "":
- return android.Paths{s.outputFilePath}, nil
- default:
- return nil, fmt.Errorf("unsupported module reference tag %q", tag)
- }
-}
-
func (s *ShBinary) SubDir() string {
return proptools.String(s.properties.Sub_dir)
}
@@ -217,15 +213,15 @@
func (s *ShBinary) ImageMutatorBegin(ctx android.BaseModuleContext) {}
func (s *ShBinary) CoreVariantNeeded(ctx android.BaseModuleContext) bool {
- return !s.ModuleBase.InstallInRecovery() && !s.ModuleBase.InstallInRamdisk()
+ return !s.InstallInRecovery() && !s.InstallInRamdisk() && !s.InstallInVendorRamdisk() && !s.ModuleBase.InstallInVendor()
}
func (s *ShBinary) RamdiskVariantNeeded(ctx android.BaseModuleContext) bool {
- return proptools.Bool(s.properties.Ramdisk_available) || s.ModuleBase.InstallInRamdisk()
+ return proptools.Bool(s.properties.Ramdisk_available) || s.InstallInRamdisk()
}
func (s *ShBinary) VendorRamdiskVariantNeeded(ctx android.BaseModuleContext) bool {
- return proptools.Bool(s.properties.Vendor_ramdisk_available) || s.ModuleBase.InstallInVendorRamdisk()
+ return proptools.Bool(s.properties.Vendor_ramdisk_available) || s.InstallInVendorRamdisk()
}
func (s *ShBinary) DebugRamdiskVariantNeeded(ctx android.BaseModuleContext) bool {
@@ -233,14 +229,43 @@
}
func (s *ShBinary) RecoveryVariantNeeded(ctx android.BaseModuleContext) bool {
- return proptools.Bool(s.properties.Recovery_available) || s.ModuleBase.InstallInRecovery()
+ return proptools.Bool(s.properties.Recovery_available) || s.InstallInRecovery()
}
func (s *ShBinary) ExtraImageVariations(ctx android.BaseModuleContext) []string {
- return nil
+ extraVariations := []string{}
+ if s.InstallInProduct() {
+ extraVariations = append(extraVariations, cc.ProductVariation)
+ }
+ if s.InstallInVendor() {
+ extraVariations = append(extraVariations, cc.VendorVariation)
+ }
+ return extraVariations
}
-func (s *ShBinary) SetImageVariation(ctx android.BaseModuleContext, variation string, module android.Module) {
+func (s *ShBinary) SetImageVariation(ctx android.BaseModuleContext, variation string) {
+ s.properties.ImageVariation = variation
+}
+
+// Overrides ModuleBase.InstallInRamdisk() so that the install rule respects
+// Ramdisk_available property for ramdisk variant
+func (s *ShBinary) InstallInRamdisk() bool {
+ return s.ModuleBase.InstallInRamdisk() ||
+ (proptools.Bool(s.properties.Ramdisk_available) && s.properties.ImageVariation == android.RamdiskVariation)
+}
+
+// Overrides ModuleBase.InstallInVendorRamdisk() so that the install rule respects
+// Vendor_ramdisk_available property for vendor ramdisk variant
+func (s *ShBinary) InstallInVendorRamdisk() bool {
+ return s.ModuleBase.InstallInVendorRamdisk() ||
+ (proptools.Bool(s.properties.Vendor_ramdisk_available) && s.properties.ImageVariation == android.VendorRamdiskVariation)
+}
+
+// Overrides ModuleBase.InstallInRecovery() so that the install rule respects
+// Recovery_available property for recovery variant
+func (s *ShBinary) InstallInRecovery() bool {
+ return s.ModuleBase.InstallInRecovery() ||
+ (proptools.Bool(s.properties.Recovery_available) && s.properties.ImageVariation == android.RecoveryVariation)
}
func (s *ShBinary) generateAndroidBuildActions(ctx android.ModuleContext) {
@@ -270,7 +295,22 @@
Output: s.outputFilePath,
Input: s.sourceFilePath,
})
+
+ s.properties.SubName = s.GetSubname(ctx)
+
android.SetProvider(ctx, blueprint.SrcsFileProviderKey, blueprint.SrcsFileProviderData{SrcPaths: []string{s.sourceFilePath.String()}})
+
+ ctx.SetOutputFiles(android.Paths{s.outputFilePath}, "")
+}
+
+func (s *ShBinary) GetSubname(ctx android.ModuleContext) string {
+ ret := ""
+ if s.properties.ImageVariation != "" {
+ if s.properties.ImageVariation != cc.VendorVariation {
+ ret = "." + s.properties.ImageVariation
+ }
+ }
+ return ret
}
func (s *ShBinary) GenerateAndroidBuildActions(ctx android.ModuleContext) {
@@ -286,7 +326,7 @@
}
func (s *ShBinary) AndroidMkEntries() []android.AndroidMkEntries {
- return []android.AndroidMkEntries{android.AndroidMkEntries{
+ return []android.AndroidMkEntries{{
Class: "EXECUTABLES",
OutputFile: android.OptionalPathForPath(s.outputFilePath),
Include: "$(BUILD_SYSTEM)/soong_cc_rust_prebuilt.mk",
@@ -297,6 +337,7 @@
entries.SetBoolIfTrue("LOCAL_UNINSTALLABLE_MODULE", !s.Installable())
},
},
+ SubName: s.properties.SubName,
}}
}
diff --git a/sysprop/sysprop_library.go b/sysprop/sysprop_library.go
index b9b68be..84f20c5 100644
--- a/sysprop/sysprop_library.go
+++ b/sysprop/sysprop_library.go
@@ -49,8 +49,6 @@
android.ModuleBase
properties syspropGenProperties
-
- genSrcjars android.Paths
}
type syspropRustGenRule struct {
@@ -59,7 +57,6 @@
properties rustLibraryProperties
}
-var _ android.OutputFileProducer = (*syspropJavaGenRule)(nil)
var _ rust.SourceProvider = (*syspropRustGenRule)(nil)
var (
@@ -100,6 +97,7 @@
}
})
+ var genSrcjars android.Paths
for _, syspropFile := range android.PathsForModuleSrc(ctx, g.properties.Srcs) {
srcJarFile := android.GenPathWithExt(ctx, "sysprop", syspropFile, "srcjar")
@@ -114,8 +112,10 @@
},
})
- g.genSrcjars = append(g.genSrcjars, srcJarFile)
+ genSrcjars = append(genSrcjars, srcJarFile)
}
+
+ ctx.SetOutputFiles(genSrcjars, "")
}
func (g *syspropJavaGenRule) DepsMutator(ctx android.BottomUpMutatorContext) {
@@ -124,15 +124,6 @@
ctx.AddFarVariationDependencies(nil, nil, proptools.String(g.properties.Check_api))
}
-func (g *syspropJavaGenRule) OutputFiles(tag string) (android.Paths, error) {
- switch tag {
- case "":
- return g.genSrcjars, nil
- default:
- return nil, fmt.Errorf("unsupported module reference tag %q", tag)
- }
-}
-
func syspropJavaGenFactory() android.Module {
g := &syspropJavaGenRule{}
g.AddProperties(&g.properties)
diff --git a/ui/build/androidmk_denylist.go b/ui/build/androidmk_denylist.go
index a29f413..bbac2db 100644
--- a/ui/build/androidmk_denylist.go
+++ b/ui/build/androidmk_denylist.go
@@ -19,10 +19,13 @@
)
var androidmk_denylist []string = []string{
+ "bionic/",
"chained_build_config/",
"cts/",
"dalvik/",
"developers/",
+ "development/",
+ "device/sample/",
"frameworks/",
// Do not block other directories in kernel/, see b/319658303.
"kernel/configs/",
@@ -31,6 +34,10 @@
"libcore/",
"libnativehelper/",
"pdk/",
+ "prebuilts/",
+ "sdk/",
+ "test/",
+ "trusty/",
// Add back toolchain/ once defensive Android.mk files are removed
//"toolchain/",
}
diff --git a/ui/build/build.go b/ui/build/build.go
index 9a9eccd..03d8392 100644
--- a/ui/build/build.go
+++ b/ui/build/build.go
@@ -21,7 +21,6 @@
"path/filepath"
"sync"
"text/template"
- "time"
"android/soong/ui/metrics"
)
@@ -66,9 +65,12 @@
// (to allow for source control that uses something other than numbers),
// but must be a single word and a valid file name.
//
- // If no BUILD_NUMBER is set, create a useful "I am an engineering build
- // from this date/time" value. Make it start with a non-digit so that
- // anyone trying to parse it as an integer will probably get "0".
+ // If no BUILD_NUMBER is set, create a useful "I am an engineering build"
+ // value. Make it start with a non-digit so that anyone trying to parse
+ // it as an integer will probably get "0". This value used to contain
+ // a timestamp, but now that more dependencies are tracked in order to
+ // reduce the importance of `m installclean`, changing it every build
+ // causes unnecessary rebuilds for local development.
buildNumber, ok := config.environ.Get("BUILD_NUMBER")
if ok {
writeValueIfChanged(ctx, config, config.OutDir(), "file_name_tag.txt", buildNumber)
@@ -77,7 +79,7 @@
if username, ok = config.environ.Get("BUILD_USERNAME"); !ok {
ctx.Fatalln("Missing BUILD_USERNAME")
}
- buildNumber = fmt.Sprintf("eng.%.6s.%s", username, time.Now().Format("20060102.150405" /* YYYYMMDD.HHMMSS */))
+ buildNumber = fmt.Sprintf("eng.%.6s.00000000.000000", username)
writeValueIfChanged(ctx, config, config.OutDir(), "file_name_tag.txt", username)
}
// Write the build number to a file so it can be read back in