Merge changes from topic "drop_circular_dep"
* changes:
Remove srcs_lib and srcs_lib_whitelist_pkgs
Remove the automatic dependency to framework-res.apk for R/Manifest
Prepare to be able to put framework-res in srcs
diff --git a/android/variable.go b/android/variable.go
index 0931db8..3f2b9e9 100644
--- a/android/variable.go
+++ b/android/variable.go
@@ -115,6 +115,10 @@
Static_libs []string
Srcs []string
}
+
+ Flatten_apex struct {
+ Enabled *bool
+ }
} `android:"arch_variant"`
}
diff --git a/apex/apex.go b/apex/apex.go
index 832188d..70e685a 100644
--- a/apex/apex.go
+++ b/apex/apex.go
@@ -435,6 +435,7 @@
bundleModuleFile android.WritablePath
outputFiles map[apexPackaging]android.WritablePath
+ flattenedOutput android.OutputPath
installDir android.OutputPath
prebuiltFileToDelete string
@@ -639,6 +640,13 @@
} else {
return nil, nil
}
+ case ".flattened":
+ if a.flattened {
+ flattenedApexPath := a.flattenedOutput
+ return android.Paths{flattenedApexPath}, nil
+ } else {
+ return nil, nil
+ }
default:
return nil, fmt.Errorf("unsupported module reference tag %q", tag)
}
@@ -784,6 +792,15 @@
return
}
+// Context "decorator", overriding the InstallBypassMake method to always reply `true`.
+type flattenedApexContext struct {
+ android.ModuleContext
+}
+
+func (c *flattenedApexContext) InstallBypassMake() bool {
+ return true
+}
+
func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) {
filesInfo := []apexFile{}
@@ -1051,6 +1068,14 @@
},
})
+ // Temporarily wrap the original `ctx` into a `flattenedApexContext` to have it
+ // reply true to `InstallBypassMake()` (thus making the call
+ // `android.PathForModuleInstall` below use `android.pathForInstallInMakeDir`
+ // instead of `android.PathForOutput`) to return the correct path to the flattened
+ // APEX (as its contents is installed by Make, not Soong).
+ factx := flattenedApexContext{ctx}
+ a.flattenedOutput = android.PathForModuleInstall(&factx, "apex", factx.ModuleName())
+
if a.apexTypes.zip() {
a.buildUnflattenedApex(ctx, zipApex)
}
@@ -1451,6 +1476,8 @@
fmt.Fprintln(w, "LOCAL_REQUIRED_MODULES :=", strings.Join(moduleNames, " "))
}
fmt.Fprintln(w, "include $(BUILD_PHONY_PACKAGE)")
+ fmt.Fprintln(w, "$(LOCAL_INSTALLED_MODULE): .KATI_IMPLICIT_OUTPUTS :=", a.flattenedOutput.String())
+
} else {
// zip-apex is the less common type so have the name refer to the image-apex
// only and use {name}.zip if you want the zip-apex
diff --git a/cc/config/clang.go b/cc/config/clang.go
index 47b60e7..0647584 100644
--- a/cc/config/clang.go
+++ b/cc/config/clang.go
@@ -169,7 +169,6 @@
"-Wno-tautological-constant-compare",
"-Wno-tautological-type-limit-compare",
"-Wno-tautological-unsigned-enum-zero-compare",
- "-Wno-tautological-unsigned-zero-compare",
// http://b/72330874 Disable -Wenum-compare until the instances detected by this new
// warning are fixed.
diff --git a/cc/library.go b/cc/library.go
index 6564fa1..52fd346 100644
--- a/cc/library.go
+++ b/cc/library.go
@@ -464,7 +464,7 @@
}
}
}
- if enabled != nil && Bool(enabled) {
+ if Bool(enabled) || ctx.hasStubsVariants() {
return "PLATFORM"
}
return ""
@@ -894,7 +894,7 @@
}
exportedHeaderFlags := strings.Join(SourceAbiFlags, " ")
library.sAbiOutputFile = TransformDumpToLinkedDump(ctx, objs.sAbiDumpFiles, soFile, fileName, exportedHeaderFlags,
- android.OptionalPathForModuleSrc(ctx, library.Properties.Header_abi_checker.Symbol_file),
+ android.OptionalPathForModuleSrc(ctx, library.symbolFileForAbiCheck(ctx)),
library.Properties.Header_abi_checker.Exclude_symbol_versions,
library.Properties.Header_abi_checker.Exclude_symbol_tags)
@@ -1095,6 +1095,16 @@
return library.MutatedProperties.BuildStubs
}
+func (library *libraryDecorator) symbolFileForAbiCheck(ctx ModuleContext) *string {
+ if library.Properties.Header_abi_checker.Symbol_file != nil {
+ return library.Properties.Header_abi_checker.Symbol_file
+ }
+ if ctx.hasStubsVariants() && library.Properties.Stubs.Symbol_file != nil {
+ return library.Properties.Stubs.Symbol_file
+ }
+ return nil
+}
+
func (library *libraryDecorator) stubsVersion() string {
return library.MutatedProperties.StubsVersion
}
diff --git a/cc/sanitize.go b/cc/sanitize.go
index 192b8d9..72c0ecb 100644
--- a/cc/sanitize.go
+++ b/cc/sanitize.go
@@ -475,6 +475,12 @@
// TODO(b/133876586): Experimental PM breaks sanitizer coverage.
_, flags.CFlags = removeFromList("-fexperimental-new-pass-manager", flags.CFlags)
flags.CFlags = append(flags.CFlags, "-fno-experimental-new-pass-manager")
+
+ // Disable fortify for fuzzing builds. Generally, we'll be building with
+ // UBSan or ASan here and the fortify checks pollute the stack traces.
+ _, flags.CFlags = removeFromList("-D_FORTIFY_SOURCE=1", flags.CFlags)
+ _, flags.CFlags = removeFromList("-D_FORTIFY_SOURCE=2", flags.CFlags)
+ flags.CFlags = append(flags.CFlags, "-U_FORTIFY_SOURCE")
}
if Bool(sanitize.Properties.Sanitize.Cfi) {
diff --git a/cc/test.go b/cc/test.go
index aff8ba5..1a0d44f 100644
--- a/cc/test.go
+++ b/cc/test.go
@@ -68,6 +68,9 @@
// Add RootTargetPreparer to auto generated test config. This guarantees the test to run
// with root permission.
Require_root *bool
+
+ // Add RunCommandTargetPreparer to stop framework before the test and start it after the test.
+ Disable_framework *bool
}
func init() {
@@ -313,7 +316,13 @@
test.data = android.PathsForModuleSrc(ctx, test.Properties.Data)
var configs []tradefed.Config
if Bool(test.Properties.Require_root) {
- configs = append(configs, tradefed.Preparer{"com.android.tradefed.targetprep.RootTargetPreparer"})
+ configs = append(configs, tradefed.Preparer{"com.android.tradefed.targetprep.RootTargetPreparer", nil})
+ }
+ if Bool(test.Properties.Disable_framework) {
+ var options []tradefed.Option
+ options = append(options, tradefed.Option{"run-command", "stop"})
+ options = append(options, tradefed.Option{"teardown-command", "start"})
+ configs = append(configs, tradefed.Preparer{"com.android.tradefed.targetprep.RunCommandTargetPreparer", options})
}
if Bool(test.testDecorator.Properties.Isolated) {
configs = append(configs, tradefed.Option{"not-shardable", "true"})
@@ -448,7 +457,7 @@
benchmark.data = android.PathsForModuleSrc(ctx, benchmark.Properties.Data)
var configs []tradefed.Config
if Bool(benchmark.Properties.Require_root) {
- configs = append(configs, tradefed.Preparer{"com.android.tradefed.targetprep.RootTargetPreparer"})
+ configs = append(configs, tradefed.Preparer{"com.android.tradefed.targetprep.RootTargetPreparer", nil})
}
benchmark.testConfig = tradefed.AutoGenNativeBenchmarkTestConfig(ctx, benchmark.Properties.Test_config,
benchmark.Properties.Test_config_template, benchmark.Properties.Test_suites, configs)
diff --git a/java/java.go b/java/java.go
index 4ae40bf..87ee2f2 100644
--- a/java/java.go
+++ b/java/java.go
@@ -883,7 +883,7 @@
ctx.PropertyErrorf("sdk_version", "%s", err)
}
if javaVersion != "" {
- ret = javaVersion
+ ret = normalizeJavaVersion(ctx, javaVersion)
} else if ctx.Device() && sdk <= 23 {
ret = "1.7"
} else if ctx.Device() && sdk <= 29 || !ctx.Config().TargetOpenJDK9() {
@@ -902,6 +902,25 @@
return ret
}
+func normalizeJavaVersion(ctx android.ModuleContext, javaVersion string) string {
+ switch javaVersion {
+ case "1.6", "6":
+ return "1.6"
+ case "1.7", "7":
+ return "1.7"
+ case "1.8", "8":
+ return "1.8"
+ case "1.9", "9":
+ return "1.9"
+ case "10", "11":
+ ctx.PropertyErrorf("java_version", "Java language levels above 9 are not supported")
+ return "unsupported"
+ default:
+ ctx.PropertyErrorf("java_version", "Unrecognized Java language level")
+ return "unrecognized"
+ }
+}
+
func (j *Module) collectBuilderFlags(ctx android.ModuleContext, deps deps) javaBuilderFlags {
var flags javaBuilderFlags
diff --git a/java/platform_compat_config.go b/java/platform_compat_config.go
index f1da203..3d46077 100644
--- a/java/platform_compat_config.go
+++ b/java/platform_compat_config.go
@@ -23,8 +23,7 @@
}
type platformCompatConfigProperties struct {
- Src *string `android:"path"`
- Prefix *string
+ Src *string `android:"path"`
}
type platformCompatConfig struct {
@@ -38,13 +37,13 @@
func (p *platformCompatConfig) GenerateAndroidBuildActions(ctx android.ModuleContext) {
rule := android.NewRuleBuilder()
- configFileName := String(p.properties.Prefix) + "_platform_compat_config.xml"
+ configFileName := p.Name() + ".xml"
p.configFile = android.PathForModuleOut(ctx, configFileName).OutputPath
path := android.PathForModuleSrc(ctx, String(p.properties.Src))
// Use the empty config if the compat config file idoesn't exist (can happen if @ChangeId
// annotation is not used).
- emptyConfig := `<?xml version="1.0" encoding="UTF-8" standalone="no"?><config/>`
+ emptyConfig := `'<?xml version="1.0" encoding="UTF-8" standalone="no"?><config/>'`
configPath := `compat/compat_config.xml`
rule.Command().
@@ -61,13 +60,13 @@
Text(configPath).
Text(`>`).
Output(p.configFile).
- Text(`; else echo '`).
+ Text(`; else echo `).
Text(emptyConfig).
- Text(`' >`).
+ Text(`>`).
Output(p.configFile).
Text(`; fi`)
- p.installDirPath = android.PathForModuleInstall(ctx, "etc", "sysconfig")
+ p.installDirPath = android.PathForModuleInstall(ctx, "etc", "compatconfig")
rule.Build(pctx, ctx, configFileName, "Extract compat/compat_config.xml and install it")
}
diff --git a/tradefed/autogen.go b/tradefed/autogen.go
index 952b022..7cd7c5a 100644
--- a/tradefed/autogen.go
+++ b/tradefed/autogen.go
@@ -24,6 +24,8 @@
"android/soong/android"
)
+const test_xml_indent = " "
+
func getTestConfigTemplate(ctx android.ModuleContext, prop *string) android.OptionalPath {
return ctx.ExpandOptionalSource(prop, "test_config_template")
}
@@ -72,13 +74,25 @@
}
type Preparer struct {
- Class string
+ Class string
+ Options []Option
}
var _ Config = Preparer{}
func (p Preparer) Config() string {
- return fmt.Sprintf(`<target_preparer class="%s" />`, p.Class)
+ var optionStrings []string
+ for _, option := range p.Options {
+ optionStrings = append(optionStrings, option.Config())
+ }
+ var options string
+ if len(p.Options) == 0 {
+ options = ""
+ } else {
+ optionDelimiter := fmt.Sprintf("\\n%s%s", test_xml_indent, test_xml_indent)
+ options = optionDelimiter + strings.Join(optionStrings, optionDelimiter)
+ }
+ return fmt.Sprintf(`<target_preparer class="%s">%s\n%s</target_preparer>`, p.Class, options, test_xml_indent)
}
func autogenTemplate(ctx android.ModuleContext, output android.WritablePath, template string, configs []Config) {
@@ -86,7 +100,7 @@
for _, config := range configs {
configStrings = append(configStrings, config.Config())
}
- extraConfigs := strings.Join(configStrings, "\n ")
+ extraConfigs := strings.Join(configStrings, fmt.Sprintf("\\n%s", test_xml_indent))
extraConfigs = proptools.NinjaAndShellEscape(extraConfigs)
ctx.Build(pctx, android.BuildParams{