Merge "Allow cc_prebuilt version suffix to include `svn`"
diff --git a/README.md b/README.md
index 9f427c4..16d3cce 100644
--- a/README.md
+++ b/README.md
@@ -30,7 +30,7 @@
all Android.bp files.
For a list of valid module types and their properties see
-[$OUT_DIR/soong/.bootstrap/docs/soong_build.html](https://go/Android.bp).
+[$OUT_DIR/soong/.bootstrap/docs/soong_build.html](http://go/Android.bp).
### Globs
diff --git a/android/neverallow.go b/android/neverallow.go
index ec440d5..a7f4f82 100644
--- a/android/neverallow.go
+++ b/android/neverallow.go
@@ -56,7 +56,7 @@
without("vendor", "true").
without("owner", "").
because("a VNDK module can never have an owner."),
- neverallow().notIn("libcore", "development").with("no_standard_libs", "true"),
+ neverallow().notIn("libcore", "development", "external/conscrypt").with("no_standard_libs", "true"),
// TODO(b/67974785): always enforce the manifest
neverallow().
diff --git a/cc/compiler.go b/cc/compiler.go
index f3cf040..5ef9e4e 100644
--- a/cc/compiler.go
+++ b/cc/compiler.go
@@ -444,16 +444,6 @@
cppStd = strings.Replace(String(compiler.Properties.Cpp_std), "17", "1z", 1)
}
- if !flags.Clang {
- // GCC uses an invalid C++14 ABI (emits calls to
- // __cxa_throw_bad_array_length, which is not a valid C++ RT ABI).
- // http://b/25022512
- // The host GCC doesn't support C++14 (and is deprecated, so likely
- // never will).
- // Build these modules with C++11.
- cppStd = config.GccCppStdVersion
- }
-
if compiler.Properties.Gnu_extensions != nil && *compiler.Properties.Gnu_extensions == false {
cStd = gnuToCReplacer.Replace(cStd)
cppStd = gnuToCReplacer.Replace(cppStd)
diff --git a/cc/config/global.go b/cc/config/global.go
index 8b02f02..000aab6 100644
--- a/cc/config/global.go
+++ b/cc/config/global.go
@@ -119,7 +119,6 @@
CStdVersion = "gnu99"
CppStdVersion = "gnu++14"
- GccCppStdVersion = "gnu++11"
ExperimentalCStdVersion = "gnu11"
ExperimentalCppStdVersion = "gnu++1z"
diff --git a/cc/object.go b/cc/object.go
index b5fd835..7c134ac 100644
--- a/cc/object.go
+++ b/cc/object.go
@@ -39,6 +39,7 @@
baseLinker: NewBaseLinker(nil),
}
module.compiler = NewBaseCompiler()
+ module.stl = &stl{}
return module.Init()
}
diff --git a/cc/test.go b/cc/test.go
index b67341e..3fffffc 100644
--- a/cc/test.go
+++ b/cc/test.go
@@ -49,6 +49,10 @@
// the name of the test configuration (for example "AndroidTest.xml") that should be
// installed with the module.
Test_config *string `android:"arch_variant"`
+
+ // the name of the test configuration template (for example "AndroidTestTemplate.xml") that
+ // should be installed with the module.
+ Test_config_template *string `android:"arch_variant"`
}
func init() {
@@ -220,6 +224,7 @@
func (test *testBinary) linkerDeps(ctx DepsContext, deps Deps) Deps {
android.ExtractSourcesDeps(ctx, test.Properties.Data)
android.ExtractSourceDeps(ctx, test.Properties.Test_config)
+ android.ExtractSourceDeps(ctx, test.Properties.Test_config_template)
deps = test.testDecorator.linkerDeps(ctx, deps)
deps = test.binaryDecorator.linkerDeps(ctx, deps)
@@ -234,7 +239,8 @@
func (test *testBinary) install(ctx ModuleContext, file android.Path) {
test.data = ctx.ExpandSources(test.Properties.Data, nil)
- test.testConfig = tradefed.AutoGenNativeTestConfig(ctx, test.Properties.Test_config)
+ test.testConfig = tradefed.AutoGenNativeTestConfig(ctx, test.Properties.Test_config,
+ test.Properties.Test_config_template)
test.binaryDecorator.baseInstaller.dir = "nativetest"
test.binaryDecorator.baseInstaller.dir64 = "nativetest64"
@@ -317,6 +323,10 @@
// the name of the test configuration (for example "AndroidTest.xml") that should be
// installed with the module.
Test_config *string `android:"arch_variant"`
+
+ // the name of the test configuration template (for example "AndroidTestTemplate.xml") that
+ // should be installed with the module.
+ Test_config_template *string `android:"arch_variant"`
}
type benchmarkDecorator struct {
@@ -344,6 +354,7 @@
func (benchmark *benchmarkDecorator) linkerDeps(ctx DepsContext, deps Deps) Deps {
android.ExtractSourcesDeps(ctx, benchmark.Properties.Data)
android.ExtractSourceDeps(ctx, benchmark.Properties.Test_config)
+ android.ExtractSourceDeps(ctx, benchmark.Properties.Test_config_template)
deps = benchmark.binaryDecorator.linkerDeps(ctx, deps)
deps.StaticLibs = append(deps.StaticLibs, "libgoogle-benchmark")
@@ -352,7 +363,8 @@
func (benchmark *benchmarkDecorator) install(ctx ModuleContext, file android.Path) {
benchmark.data = ctx.ExpandSources(benchmark.Properties.Data, nil)
- benchmark.testConfig = tradefed.AutoGenNativeBenchmarkTestConfig(ctx, benchmark.Properties.Test_config)
+ benchmark.testConfig = tradefed.AutoGenNativeBenchmarkTestConfig(ctx, benchmark.Properties.Test_config,
+ benchmark.Properties.Test_config_template)
benchmark.binaryDecorator.baseInstaller.dir = filepath.Join("benchmarktest", ctx.ModuleName())
benchmark.binaryDecorator.baseInstaller.dir64 = filepath.Join("benchmarktest64", ctx.ModuleName())
diff --git a/java/app.go b/java/app.go
index e90c388..f8bef1c 100644
--- a/java/app.go
+++ b/java/app.go
@@ -236,12 +236,13 @@
a.generateAndroidBuildActions(ctx)
- a.testConfig = tradefed.AutoGenInstrumentationTestConfig(ctx, a.testProperties.Test_config, a.manifestPath)
+ a.testConfig = tradefed.AutoGenInstrumentationTestConfig(ctx, a.testProperties.Test_config, a.testProperties.Test_config_template, a.manifestPath)
a.data = ctx.ExpandSources(a.testProperties.Data, nil)
}
func (a *AndroidTest) DepsMutator(ctx android.BottomUpMutatorContext) {
android.ExtractSourceDeps(ctx, a.testProperties.Test_config)
+ android.ExtractSourceDeps(ctx, a.testProperties.Test_config_template)
android.ExtractSourcesDeps(ctx, a.testProperties.Data)
a.AndroidApp.DepsMutator(ctx)
}
diff --git a/java/dex.go b/java/dex.go
index 6445940..c612a0c 100644
--- a/java/dex.go
+++ b/java/dex.go
@@ -25,7 +25,7 @@
var d8 = pctx.AndroidStaticRule("d8",
blueprint.RuleParams{
Command: `rm -rf "$outDir" && mkdir -p "$outDir" && ` +
- `${config.D8Cmd} --output $outDir $dxFlags $in && ` +
+ `${config.D8Cmd} --output $outDir $d8Flags $in && ` +
`${config.SoongZipCmd} -o $outDir/classes.dex.jar -C $outDir -D $outDir && ` +
`${config.MergeZipsCmd} -D -stripFile "**/*.class" $out $outDir/classes.dex.jar $in`,
CommandDeps: []string{
@@ -34,7 +34,7 @@
"${config.MergeZipsCmd}",
},
},
- "outDir", "dxFlags")
+ "outDir", "d8Flags")
var r8 = pctx.AndroidStaticRule("r8",
blueprint.RuleParams{
@@ -44,7 +44,7 @@
`--force-proguard-compatibility ` +
`--no-data-resources ` +
`-printmapping $outDict ` +
- `$dxFlags $r8Flags && ` +
+ `$r8Flags && ` +
`touch "$outDict" && ` +
`${config.SoongZipCmd} -o $outDir/classes.dex.jar -C $outDir -D $outDir && ` +
`${config.MergeZipsCmd} -D -stripFile "**/*.class" $out $outDir/classes.dex.jar $in`,
@@ -54,9 +54,9 @@
"${config.MergeZipsCmd}",
},
},
- "outDir", "outDict", "dxFlags", "r8Flags")
+ "outDir", "outDict", "r8Flags")
-func (j *Module) dxFlags(ctx android.ModuleContext) []string {
+func (j *Module) dexCommonFlags(ctx android.ModuleContext) []string {
flags := j.deviceProperties.Dxflags
// Translate all the DX flags to D8 ones until all the build files have been migrated
// to D8 flags. See: b/69377755
@@ -82,6 +82,15 @@
return flags
}
+func (j *Module) d8Flags(ctx android.ModuleContext, flags javaBuilderFlags) []string {
+ d8Flags := j.dexCommonFlags(ctx)
+
+ d8Flags = append(d8Flags, flags.bootClasspath.FormTurbineClasspath("--lib")...)
+ d8Flags = append(d8Flags, flags.classpath.FormTurbineClasspath("--lib")...)
+
+ return d8Flags
+}
+
func (j *Module) r8Flags(ctx android.ModuleContext, flags javaBuilderFlags) (r8Flags []string, r8Deps android.Paths) {
opt := j.deviceProperties.Optimize
@@ -97,6 +106,8 @@
proguardRaiseDeps = append(proguardRaiseDeps, dep.(Dependency).HeaderJars()...)
})
+ r8Flags = append(r8Flags, j.dexCommonFlags(ctx)...)
+
r8Flags = append(r8Flags, proguardRaiseDeps.FormJavaClassPath("-libraryjars"))
r8Flags = append(r8Flags, flags.bootClasspath.FormJavaClassPath("-libraryjars"))
r8Flags = append(r8Flags, flags.classpath.FormJavaClassPath("-libraryjars"))
@@ -147,8 +158,6 @@
useR8 := Bool(j.deviceProperties.Optimize.Enabled)
- dxFlags := j.dxFlags(ctx)
-
// Compile classes.jar into classes.dex and then javalib.jar
javalibJar := android.PathForModuleOut(ctx, "dex", jarName)
outDir := android.PathForModuleOut(ctx, "dex")
@@ -167,20 +176,20 @@
Input: classesJar,
Implicits: r8Deps,
Args: map[string]string{
- "dxFlags": strings.Join(dxFlags, " "),
"r8Flags": strings.Join(r8Flags, " "),
"outDict": j.proguardDictionary.String(),
"outDir": outDir.String(),
},
})
} else {
+ d8Flags := j.d8Flags(ctx, flags)
ctx.Build(pctx, android.BuildParams{
Rule: d8,
Description: "d8",
Output: javalibJar,
Input: classesJar,
Args: map[string]string{
- "dxFlags": strings.Join(dxFlags, " "),
+ "d8Flags": strings.Join(d8Flags, " "),
"outDir": outDir.String(),
},
})
diff --git a/java/java.go b/java/java.go
index 3332482..0bd7857 100644
--- a/java/java.go
+++ b/java/java.go
@@ -1446,6 +1446,10 @@
// installed with the module.
Test_config *string `android:"arch_variant"`
+ // the name of the test configuration template (for example "AndroidTestTemplate.xml") that
+ // should be installed with the module.
+ Test_config_template *string `android:"arch_variant"`
+
// list of files or filegroup modules that provide data that should be installed alongside
// the test
Data []string
@@ -1461,7 +1465,7 @@
}
func (j *Test) GenerateAndroidBuildActions(ctx android.ModuleContext) {
- j.testConfig = tradefed.AutoGenJavaTestConfig(ctx, j.testProperties.Test_config)
+ j.testConfig = tradefed.AutoGenJavaTestConfig(ctx, j.testProperties.Test_config, j.testProperties.Test_config_template)
j.data = ctx.ExpandSources(j.testProperties.Data, nil)
j.Library.GenerateAndroidBuildActions(ctx)
@@ -1470,6 +1474,7 @@
func (j *Test) DepsMutator(ctx android.BottomUpMutatorContext) {
j.deps(ctx)
android.ExtractSourceDeps(ctx, j.testProperties.Test_config)
+ android.ExtractSourceDeps(ctx, j.testProperties.Test_config_template)
android.ExtractSourcesDeps(ctx, j.testProperties.Data)
}
diff --git a/python/binary.go b/python/binary.go
index 4135dfe..bf9acb4 100644
--- a/python/binary.go
+++ b/python/binary.go
@@ -84,15 +84,15 @@
main := binary.getPyMainFile(ctx, srcsPathMappings)
- var launcherPath android.Path
+ var launcherPath android.OptionalPath
if embeddedLauncher {
ctx.VisitDirectDepsWithTag(launcherTag, func(m android.Module) {
if provider, ok := m.(IntermPathProvider); ok {
- if launcherPath != nil {
+ if launcherPath.Valid() {
panic(fmt.Errorf("launcher path was found before: %q",
launcherPath))
}
- launcherPath = provider.IntermPathForModuleOut().Path()
+ launcherPath = provider.IntermPathForModuleOut()
}
})
}
diff --git a/python/builder.go b/python/builder.go
index ec4cb4e..11a792a 100644
--- a/python/builder.go
+++ b/python/builder.go
@@ -70,7 +70,7 @@
}
func registerBuildActionForParFile(ctx android.ModuleContext, embeddedLauncher bool,
- launcherPath android.Path, interpreter, main, binName string,
+ launcherPath android.OptionalPath, interpreter, main, binName string,
srcsZips android.Paths) android.Path {
// .intermediate output path for merged zip file.
@@ -104,9 +104,9 @@
"srcsZips": strings.Join(srcsZips.Strings(), " "),
},
})
- } else {
+ } else if launcherPath.Valid() {
// added launcherPath to the implicits Ninja dependencies.
- implicits = append(implicits, launcherPath)
+ implicits = append(implicits, launcherPath.Path())
// .intermediate output path for entry_point.txt
entryPoint := android.PathForModuleOut(ctx, entryPointFile).String()
diff --git a/tradefed/autogen.go b/tradefed/autogen.go
index 264e422..131fdc4 100644
--- a/tradefed/autogen.go
+++ b/tradefed/autogen.go
@@ -22,6 +22,10 @@
"android/soong/android"
)
+func getTestConfigTemplate(ctx android.ModuleContext, prop *string) android.OptionalPath {
+ return ctx.ExpandOptionalSource(prop, "test_config_template")
+}
+
func getTestConfig(ctx android.ModuleContext, prop *string) android.Path {
if p := ctx.ExpandOptionalSource(prop, "test_config"); p.Valid() {
return p.Path()
@@ -41,8 +45,7 @@
return p, nil
} else if !strings.HasPrefix(ctx.ModuleDir(), "cts/") {
outputFile := android.PathForModuleOut(ctx, ctx.ModuleName()+".config")
-
- return outputFile, outputFile
+ return nil, outputFile
} else {
// CTS modules can be used for test data, so test config files must be
// explicitly created using AndroidTest.xml
@@ -63,59 +66,86 @@
})
}
-func AutoGenNativeTestConfig(ctx android.ModuleContext, prop *string) android.Path {
- path, autogenPath := testConfigPath(ctx, prop)
+func AutoGenNativeTestConfig(ctx android.ModuleContext, testConfigProp *string,
+ testConfigTemplateProp *string) android.Path {
+ path, autogenPath := testConfigPath(ctx, testConfigProp)
if autogenPath != nil {
- if ctx.Device() {
- autogenTemplate(ctx, autogenPath, "${NativeTestConfigTemplate}")
+ templatePath := getTestConfigTemplate(ctx, testConfigTemplateProp)
+ if templatePath.Valid() {
+ autogenTemplate(ctx, autogenPath, templatePath.String())
} else {
- autogenTemplate(ctx, autogenPath, "${NativeHostTestConfigTemplate}")
+ if ctx.Device() {
+ autogenTemplate(ctx, autogenPath, "${NativeTestConfigTemplate}")
+ } else {
+ autogenTemplate(ctx, autogenPath, "${NativeHostTestConfigTemplate}")
+ }
}
+ return autogenPath
}
return path
}
-func AutoGenNativeBenchmarkTestConfig(ctx android.ModuleContext, prop *string) android.Path {
- path, autogenPath := testConfigPath(ctx, prop)
+func AutoGenNativeBenchmarkTestConfig(ctx android.ModuleContext, testConfigProp *string,
+ testConfigTemplateProp *string) android.Path {
+ path, autogenPath := testConfigPath(ctx, testConfigProp)
if autogenPath != nil {
- autogenTemplate(ctx, autogenPath, "${NativeBenchmarkTestConfigTemplate}")
+ templatePath := getTestConfigTemplate(ctx, testConfigTemplateProp)
+ if templatePath.Valid() {
+ autogenTemplate(ctx, autogenPath, templatePath.String())
+ } else {
+ autogenTemplate(ctx, autogenPath, "${NativeBenchmarkTestConfigTemplate}")
+ }
+ return autogenPath
}
return path
}
-func AutoGenJavaTestConfig(ctx android.ModuleContext, prop *string) android.Path {
- path, autogenPath := testConfigPath(ctx, prop)
+func AutoGenJavaTestConfig(ctx android.ModuleContext, testConfigProp *string, testConfigTemplateProp *string) android.Path {
+ path, autogenPath := testConfigPath(ctx, testConfigProp)
if autogenPath != nil {
- if ctx.Device() {
- autogenTemplate(ctx, autogenPath, "${JavaTestConfigTemplate}")
+ templatePath := getTestConfigTemplate(ctx, testConfigTemplateProp)
+ if templatePath.Valid() {
+ autogenTemplate(ctx, autogenPath, templatePath.String())
} else {
- autogenTemplate(ctx, autogenPath, "${JavaHostTestConfigTemplate}")
+ if ctx.Device() {
+ autogenTemplate(ctx, autogenPath, "${JavaTestConfigTemplate}")
+ } else {
+ autogenTemplate(ctx, autogenPath, "${JavaHostTestConfigTemplate}")
+ }
}
+ return autogenPath
}
return path
}
var autogenInstrumentationTest = pctx.StaticRule("autogenInstrumentationTest", blueprint.RuleParams{
- Command: "${AutoGenTestConfigScript} $out $in ${EmptyTestConfig} ${InstrumentationTestConfigTemplate}",
+ Command: "${AutoGenTestConfigScript} $out $in ${EmptyTestConfig} $template",
CommandDeps: []string{
"${AutoGenTestConfigScript}",
"${EmptyTestConfig}",
- "${InstrumentationTestConfigTemplate}",
+ "$template",
},
-}, "name")
+}, "name", "template")
-func AutoGenInstrumentationTestConfig(ctx android.ModuleContext, prop *string, manifest android.Path) android.Path {
- path, autogenPath := testConfigPath(ctx, prop)
+func AutoGenInstrumentationTestConfig(ctx android.ModuleContext, testConfigProp *string, testConfigTemplateProp *string, manifest android.Path) android.Path {
+ path, autogenPath := testConfigPath(ctx, testConfigProp)
if autogenPath != nil {
+ template := "${InstrumentationTestConfigTemplate}"
+ moduleTemplate := getTestConfigTemplate(ctx, testConfigTemplateProp)
+ if moduleTemplate.Valid() {
+ template = moduleTemplate.String()
+ }
ctx.Build(pctx, android.BuildParams{
Rule: autogenInstrumentationTest,
Description: "test config",
Input: manifest,
Output: autogenPath,
Args: map[string]string{
- "name": ctx.ModuleName(),
+ "name": ctx.ModuleName(),
+ "template": template,
},
})
+ return autogenPath
}
return path
}
diff --git a/ui/build/finder.go b/ui/build/finder.go
index 6dc35a0..3130f74 100644
--- a/ui/build/finder.go
+++ b/ui/build/finder.go
@@ -62,6 +62,7 @@
"Android.bp",
"Blueprints",
"CleanSpec.mk",
+ "OWNERS",
"TEST_MAPPING",
},
}
@@ -102,10 +103,16 @@
ctx.Fatalf("Could not export module list: %v", err)
}
+ owners := f.FindNamedAt(".", "OWNERS")
+ err = dumpListToFile(owners, filepath.Join(dumpDir, "OWNERS.list"))
+ if err != nil {
+ ctx.Fatalf("Could not find OWNERS: %v", err)
+ }
+
testMappings := f.FindNamedAt(".", "TEST_MAPPING")
err = dumpListToFile(testMappings, filepath.Join(dumpDir, "TEST_MAPPING.list"))
if err != nil {
- ctx.Fatalf("Could not find modules: %v", err)
+ ctx.Fatalf("Could not find TEST_MAPPING: %v", err)
}
androidBps := f.FindNamedAt(".", "Android.bp")