Merge "Only write release config files if they've changed" into main
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/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/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/cmake_module_cc.txt b/cc/cmake_module_cc.txt
index 693406d..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
diff --git a/cc/cmake_snapshot.go b/cc/cmake_snapshot.go
index ad7beed..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()
},
diff --git a/cc/compiler.go b/cc/compiler.go
index ede6a5d..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"`
@@ -98,7 +98,7 @@
// list of generated headers to add to the include path. These are the names
// of genrule modules.
- Generated_headers []string `android:"arch_variant,variant_prepend"`
+ Generated_headers proptools.Configurable[[]string] `android:"arch_variant,variant_prepend"`
// pass -frtti instead of -fno-rtti
Rtti *bool `android:"arch_variant"`
@@ -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) {
@@ -302,7 +302,7 @@
func (compiler *baseCompiler) compilerDeps(ctx DepsContext, deps Deps) Deps {
deps.GeneratedSources = append(deps.GeneratedSources, compiler.Properties.Generated_sources...)
deps.GeneratedSources = removeListFromList(deps.GeneratedSources, compiler.Properties.Exclude_generated_sources)
- deps.GeneratedHeaders = append(deps.GeneratedHeaders, compiler.Properties.Generated_headers...)
+ deps.GeneratedHeaders = append(deps.GeneratedHeaders, compiler.Properties.Generated_headers.GetOrDefault(ctx, nil)...)
deps.AidlLibs = append(deps.AidlLibs, compiler.Properties.Aidl.Libs...)
android.ProtoDeps(ctx, &compiler.Proto)
@@ -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)...)
@@ -819,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/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 090908f..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"`
@@ -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() {
@@ -2081,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 746b951..9643ec2 100644
--- a/cc/library_stub.go
+++ b/cc/library_stub.go
@@ -511,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/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/etc/prebuilt_etc.go b/etc/prebuilt_etc.go
index c17594b..2075488 100644
--- a/etc/prebuilt_etc.go
+++ b/etc/prebuilt_etc.go
@@ -241,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 {
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 1a6584b..49214d8 100644
--- a/java/base.go
+++ b/java/base.go
@@ -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/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/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/sh/sh_binary.go b/sh/sh_binary.go
index 3f82560..48a442d 100644
--- a/sh/sh_binary.go
+++ b/sh/sh_binary.go
@@ -243,10 +243,8 @@
return extraVariations
}
-func (s *ShBinary) SetImageVariation(ctx android.BaseModuleContext, variation string, module android.Module) {
- if m, ok := module.(*ShBinary); ok {
- m.properties.ImageVariation = variation
- }
+func (s *ShBinary) SetImageVariation(ctx android.BaseModuleContext, variation string) {
+ s.properties.ImageVariation = variation
}
// Overrides ModuleBase.InstallInRamdisk() so that the install rule respects
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/",
}