Merge "Don't strip oat files on host."
diff --git a/android/config.go b/android/config.go
index 839ff05..fa43962 100644
--- a/android/config.go
+++ b/android/config.go
@@ -701,6 +701,10 @@
if c.productVariables.DeviceArch != nil && *c.productVariables.DeviceArch == "riscv64" {
return false
}
+ // Disable Bazel when Kythe is running
+ if c.EmitXrefRules() {
+ return false
+ }
if c.IsEnvTrue("GLOBAL_THINLTO") {
return false
}
diff --git a/android/depset_generic.go b/android/depset_generic.go
index ae14d32..4f31b86 100644
--- a/android/depset_generic.go
+++ b/android/depset_generic.go
@@ -175,16 +175,6 @@
// its transitive dependencies, in which case the ordering of the duplicated element is not
// guaranteed).
func (d *DepSet[T]) ToList() []T {
- return d.toList(firstUnique[T])
-}
-
-// toList returns the DepSet flattened to a list. The order in the list is based on the order
-// of the DepSet. POSTORDER and PREORDER orders return a postordered or preordered left to right
-// flattened list. TOPOLOGICAL returns a list that guarantees that elements of children are listed
-// after all of their parents (unless there are duplicate direct elements in the DepSet or any of
-// its transitive dependencies, in which case the ordering of the duplicated element is not
-// guaranteed). The firstUniqueFunc is used to remove duplicates from the list.
-func (d *DepSet[T]) toList(firstUniqueFunc func([]T) []T) []T {
if d == nil {
return nil
}
@@ -192,7 +182,7 @@
d.walk(func(paths []T) {
list = append(list, paths...)
})
- list = firstUniqueFunc(list)
+ list = firstUniqueInPlace(list)
if d.reverse {
reverseSliceInPlace(list)
}
diff --git a/android/test_suites.go b/android/test_suites.go
index b48d71a..63a709f 100644
--- a/android/test_suites.go
+++ b/android/test_suites.go
@@ -68,7 +68,8 @@
FlagWithOutput("-o ", outputFile).
FlagWithArg("-P ", "host/testcases").
FlagWithArg("-C ", testCasesDir.String()).
- FlagWithRspFileInputList("-r ", outputFile.ReplaceExtension(ctx, "rsp"), installedPaths.Paths())
+ FlagWithRspFileInputList("-r ", outputFile.ReplaceExtension(ctx, "rsp"), installedPaths.Paths()).
+ Flag("-sha256")
rule.Build("robolectric_tests_zip", "robolectric-tests.zip")
return outputFile
diff --git a/android/util.go b/android/util.go
index 9695454..50bf5aa 100644
--- a/android/util.go
+++ b/android/util.go
@@ -25,12 +25,12 @@
)
// CopyOf returns a new slice that has the same contents as s.
-func CopyOf(s []string) []string {
+func CopyOf[T any](s []T) []T {
// If the input is nil, return nil and not an empty list
if s == nil {
return s
}
- return append([]string{}, s...)
+ return append([]T{}, s...)
}
// Concat returns a new slice concatenated from the two input slices. It does not change the input
@@ -288,22 +288,25 @@
}
// FirstUniqueStrings returns all unique elements of a slice of strings, keeping the first copy of
-// each. It modifies the slice contents in place, and returns a subslice of the original slice.
+// each. It does not modify the input slice.
func FirstUniqueStrings(list []string) []string {
- // Do not moodify the input in-place, operate on a copy instead.
- list = CopyOf(list)
- // 128 was chosen based on BenchmarkFirstUniqueStrings results.
- if len(list) > 128 {
- return firstUnique(list)
- }
return firstUnique(list)
}
// firstUnique returns all unique elements of a slice, keeping the first copy of each. It
-// modifies the slice contents in place, and returns a subslice of the original slice.
+// does not modify the input slice.
func firstUnique[T comparable](slice []T) []T {
- // 4 was chosen based on Benchmark_firstUnique results.
- if len(slice) > 4 {
+ // Do not modify the input in-place, operate on a copy instead.
+ slice = CopyOf(slice)
+ return firstUniqueInPlace(slice)
+}
+
+// firstUniqueInPlace returns all unique elements of a slice, keeping the first copy of
+// each. It modifies the slice contents in place, and returns a subslice of the original
+// slice.
+func firstUniqueInPlace[T comparable](slice []T) []T {
+ // 128 was chosen based on BenchmarkFirstUniqueStrings results.
+ if len(slice) > 128 {
return firstUniqueMap(slice)
}
return firstUniqueList(slice)
diff --git a/android/util_test.go b/android/util_test.go
index bee31a9..0e28b56 100644
--- a/android/util_test.go
+++ b/android/util_test.go
@@ -385,7 +385,7 @@
emptyList := []string{}
copyOfEmptyList := CopyOf(emptyList)
AssertBoolEquals(t, "Copy of an empty list should be an empty list and not nil", true, copyOfEmptyList != nil)
- copyOfNilList := CopyOf(nil)
+ copyOfNilList := CopyOf([]string(nil))
AssertBoolEquals(t, "Copy of a nil list should be a nil list and not an empty list", true, copyOfNilList == nil)
}
diff --git a/cc/lto.go b/cc/lto.go
index 878c21f..547ebff 100644
--- a/cc/lto.go
+++ b/cc/lto.go
@@ -109,7 +109,7 @@
// If the module does not have a profile, be conservative and limit cross TU inline
// limit to 5 LLVM IR instructions, to balance binary size increase and performance.
- if !ctx.isPgoCompile() && !ctx.isAfdoCompile() {
+ if !ctx.Darwin() && !ctx.isPgoCompile() && !ctx.isAfdoCompile() {
flags.Local.LdFlags = append(flags.Local.LdFlags,
"-Wl,-plugin-opt,-import-instr-limit=5")
}
diff --git a/dexpreopt/class_loader_context.go b/dexpreopt/class_loader_context.go
index 6ead589..57c7ae8 100644
--- a/dexpreopt/class_loader_context.go
+++ b/dexpreopt/class_loader_context.go
@@ -310,7 +310,7 @@
// Nested class loader context shouldn't have conditional part (it is allowed only at the top level).
for ver, _ := range nestedClcMap {
if ver != AnySdkVersion {
- clcPaths := ComputeClassLoaderContextDependencies(nestedClcMap)
+ _, clcPaths := ComputeClassLoaderContextDependencies(nestedClcMap)
return fmt.Errorf("nested class loader context shouldn't have conditional part: %+v", clcPaths)
}
}
@@ -553,27 +553,28 @@
return true, nil
}
-// Returns a slice of build paths for all possible dependencies that the class loader context may
-// refer to.
+// Returns a slice of library names and a slice of build paths for all possible dependencies that
+// the class loader context may refer to.
// Perform a depth-first preorder traversal of the class loader context tree for each SDK version.
-func ComputeClassLoaderContextDependencies(clcMap ClassLoaderContextMap) android.Paths {
- var paths android.Paths
+func ComputeClassLoaderContextDependencies(clcMap ClassLoaderContextMap) (names []string, paths android.Paths) {
for _, clcs := range clcMap {
- hostPaths := ComputeClassLoaderContextDependenciesRec(clcs)
- paths = append(paths, hostPaths...)
+ currentNames, currentPaths := ComputeClassLoaderContextDependenciesRec(clcs)
+ names = append(names, currentNames...)
+ paths = append(paths, currentPaths...)
}
- return android.FirstUniquePaths(paths)
+ return android.FirstUniqueStrings(names), android.FirstUniquePaths(paths)
}
// Helper function for ComputeClassLoaderContextDependencies() that handles recursion.
-func ComputeClassLoaderContextDependenciesRec(clcs []*ClassLoaderContext) android.Paths {
- var paths android.Paths
+func ComputeClassLoaderContextDependenciesRec(clcs []*ClassLoaderContext) (names []string, paths android.Paths) {
for _, clc := range clcs {
- subPaths := ComputeClassLoaderContextDependenciesRec(clc.Subcontexts)
+ subNames, subPaths := ComputeClassLoaderContextDependenciesRec(clc.Subcontexts)
+ names = append(names, clc.Name)
paths = append(paths, clc.Host)
+ names = append(names, subNames...)
paths = append(paths, subPaths...)
}
- return paths
+ return names, paths
}
// Class loader contexts that come from Make via JSON dexpreopt.config. JSON CLC representation is
diff --git a/dexpreopt/class_loader_context_test.go b/dexpreopt/class_loader_context_test.go
index 39b4652..7260abb 100644
--- a/dexpreopt/class_loader_context_test.go
+++ b/dexpreopt/class_loader_context_test.go
@@ -97,10 +97,11 @@
fixClassLoaderContext(m)
- var havePaths android.Paths
+ var actualNames []string
+ var actualPaths android.Paths
var haveUsesLibsReq, haveUsesLibsOpt []string
if valid && validationError == nil {
- havePaths = ComputeClassLoaderContextDependencies(m)
+ actualNames, actualPaths = ComputeClassLoaderContextDependencies(m)
haveUsesLibsReq, haveUsesLibsOpt = m.UsesLibs()
}
@@ -112,19 +113,26 @@
})
// Test that all expected build paths are gathered.
- t.Run("paths", func(t *testing.T) {
- wantPaths := []string{
+ t.Run("names and paths", func(t *testing.T) {
+ expectedNames := []string{
+ "a'", "a1", "a2", "a3", "android.hidl.base-V1.0-java", "android.hidl.manager-V1.0-java", "b",
+ "b1", "b2", "b3", "c", "c2", "d", "f",
+ }
+ expectedPaths := []string{
"out/soong/android.hidl.manager-V1.0-java.jar", "out/soong/android.hidl.base-V1.0-java.jar",
"out/soong/a.jar", "out/soong/b.jar", "out/soong/c.jar", "out/soong/d.jar",
"out/soong/a2.jar", "out/soong/b2.jar", "out/soong/c2.jar",
"out/soong/a1.jar", "out/soong/b1.jar",
"out/soong/f.jar", "out/soong/a3.jar", "out/soong/b3.jar",
}
- actual := havePaths.Strings()
+ actualPathsStrs := actualPaths.Strings()
// The order does not matter.
- sort.Strings(wantPaths)
- sort.Strings(actual)
- android.AssertArrayString(t, "", wantPaths, actual)
+ sort.Strings(expectedNames)
+ sort.Strings(actualNames)
+ android.AssertArrayString(t, "", expectedNames, actualNames)
+ sort.Strings(expectedPaths)
+ sort.Strings(actualPathsStrs)
+ android.AssertArrayString(t, "", expectedPaths, actualPathsStrs)
})
// Test the JSON passed to construct_context.py.
diff --git a/dexpreopt/dexpreopt.go b/dexpreopt/dexpreopt.go
index 20737e3..29ae188 100644
--- a/dexpreopt/dexpreopt.go
+++ b/dexpreopt/dexpreopt.go
@@ -353,7 +353,7 @@
}
// Generate command that saves host and target class loader context in shell variables.
- paths := ComputeClassLoaderContextDependencies(module.ClassLoaderContexts)
+ _, paths := ComputeClassLoaderContextDependencies(module.ClassLoaderContexts)
rule.Command().
Text(`eval "$(`).Tool(globalSoong.ConstructContext).
Text(` --target-sdk-version ${target_sdk_version}`).
@@ -630,5 +630,3 @@
}
return false
}
-
-var copyOf = android.CopyOf
diff --git a/fuzz/fuzz_common.go b/fuzz/fuzz_common.go
index b470304..ada4712 100644
--- a/fuzz/fuzz_common.go
+++ b/fuzz/fuzz_common.go
@@ -368,6 +368,9 @@
Triage_assignee string `json:"triage_assignee,omitempty"`
// Specifies libs used to initialize ART (java only, 'use_none' for no initialization)
Use_platform_libs UsePlatformLibs `json:"use_platform_libs,omitempty"`
+ // Specifies whether fuzz target should check presubmitted code changes for crashes.
+ // Defaults to false.
+ Use_for_presubmit *bool `json:"use_for_presubmit,omitempty"`
}
type FuzzFrameworks struct {
diff --git a/java/app_test.go b/java/app_test.go
index cf7d174..0f98416 100644
--- a/java/app_test.go
+++ b/java/app_test.go
@@ -2697,7 +2697,7 @@
cmd := app.Rule("dexpreopt").RuleParams.Command
android.AssertStringDoesContain(t, "dexpreopt app cmd context", cmd, "--context-json=")
android.AssertStringDoesContain(t, "dexpreopt app cmd product_packages", cmd,
- "--product-packages=out/soong/target/product/test_device/product_packages.txt")
+ "--product-packages=out/soong/.intermediates/app/android_common/dexpreopt/product_packages.txt")
}
func TestDexpreoptBcp(t *testing.T) {
diff --git a/java/base.go b/java/base.go
index 75e25e3..f2ad5c2 100644
--- a/java/base.go
+++ b/java/base.go
@@ -2202,7 +2202,7 @@
func (j *Module) ConvertWithBp2build(ctx android.TopDownMutatorContext) {
switch ctx.ModuleType() {
- case "java_library", "java_library_host", "java_library_static":
+ case "java_library", "java_library_host", "java_library_static", "tradefed_java_library_host":
if lib, ok := ctx.Module().(*Library); ok {
javaLibraryBp2Build(ctx, lib)
}
diff --git a/java/dexpreopt.go b/java/dexpreopt.go
index e588c9a..998730e 100644
--- a/java/dexpreopt.go
+++ b/java/dexpreopt.go
@@ -16,6 +16,7 @@
import (
"path/filepath"
+ "sort"
"strings"
"android/soong/android"
@@ -390,11 +391,37 @@
globalSoong := dexpreopt.GetGlobalSoongConfig(ctx)
- // "product_packages.txt" is generated by `build/make/core/Makefile`.
+ // The root "product_packages.txt" is generated by `build/make/core/Makefile`. It contains a list
+ // of all packages that are installed on the device. We use `grep` to filter the list by the app's
+ // dependencies to create a per-app list, and use `rsync --checksum` to prevent the file's mtime
+ // from being changed if the contents don't change. This avoids unnecessary dexpreopt reruns.
productPackages := android.PathForModuleInPartitionInstall(ctx, "", "product_packages.txt")
+ appProductPackages := android.PathForModuleOut(ctx, "dexpreopt", "product_packages.txt")
+ appProductPackagesStaging := appProductPackages.ReplaceExtension(ctx, "txt.tmp")
+ clcNames, _ := dexpreopt.ComputeClassLoaderContextDependencies(dexpreoptConfig.ClassLoaderContexts)
+ sort.Strings(clcNames) // The order needs to be deterministic.
+ productPackagesRule := android.NewRuleBuilder(pctx, ctx)
+ if len(clcNames) > 0 {
+ productPackagesRule.Command().
+ Text("grep -F -x").
+ FlagForEachArg("-e ", clcNames).
+ Input(productPackages).
+ FlagWithOutput("> ", appProductPackagesStaging).
+ Text("|| true")
+ } else {
+ productPackagesRule.Command().
+ Text("rm -f").Output(appProductPackagesStaging).
+ Text("&&").
+ Text("touch").Output(appProductPackagesStaging)
+ }
+ productPackagesRule.Command().
+ Text("rsync --checksum").
+ Input(appProductPackagesStaging).
+ Output(appProductPackages)
+ productPackagesRule.Restat().Build("product_packages", "dexpreopt product_packages")
dexpreoptRule, err := dexpreopt.GenerateDexpreoptRule(
- ctx, globalSoong, global, dexpreoptConfig, productPackages)
+ ctx, globalSoong, global, dexpreoptConfig, appProductPackages)
if err != nil {
ctx.ModuleErrorf("error generating dexpreopt rule: %s", err.Error())
return
diff --git a/java/dexpreopt_config.go b/java/dexpreopt_config.go
index 9100e87..28f50d7 100644
--- a/java/dexpreopt_config.go
+++ b/java/dexpreopt_config.go
@@ -250,8 +250,6 @@
var defaultBootclasspathKey = android.NewOnceKey("defaultBootclasspath")
-var copyOf = android.CopyOf
-
func init() {
android.RegisterMakeVarsProvider(pctx, dexpreoptConfigMakevars)
}
diff --git a/java/java.go b/java/java.go
index caafaa2..50d48ab 100644
--- a/java/java.go
+++ b/java/java.go
@@ -1624,13 +1624,6 @@
})
}
-type JavaApiLibraryDepsInfo struct {
- JavaInfo
- StubsSrcJar android.Path
-}
-
-var JavaApiLibraryDepsProvider = blueprint.NewProvider(JavaApiLibraryDepsInfo{})
-
type ApiLibrary struct {
android.ModuleBase
android.DefaultableModuleBase
@@ -1672,10 +1665,11 @@
// merge zipped after metalava invocation
Static_libs []string
- // Java Api library to provide the full API surface text files and jar file.
- // If this property is set, the provided full API surface text files and
- // jar file are passed to metalava invocation.
- Dep_api_srcs *string
+ // Java Api library to provide the full API surface stub jar file.
+ // If this property is set, the stub jar of this module is created by
+ // extracting the compiled class files provided by the
+ // full_api_surface_stub module.
+ Full_api_surface_stub *string
}
func ApiLibraryFactory() android.Module {
@@ -1762,35 +1756,37 @@
}
}
-// This method extracts the stub java files from the srcjar file provided from dep_api_srcs module
-// and replaces the java stubs generated by invoking metalava in this module.
+// This method extracts the stub class files from the stub jar file provided
+// from full_api_surface_stub module instead of compiling the srcjar generated from invoking metalava.
// This method is used because metalava can generate compilable from-text stubs only when
-// the codebase encompasses all classes listed in the input API text file, but a class can extend
+// the codebase encompasses all classes listed in the input API text file, and a class can extend
// a class that is not within the same API domain.
-func (al *ApiLibrary) extractApiSrcs(ctx android.ModuleContext, rule *android.RuleBuilder, stubsDir android.OptionalPath, depApiSrcsSrcJar android.Path) {
- generatedStubsList := android.PathForModuleOut(ctx, "metalava", "sources.txt")
+func (al *ApiLibrary) extractApiSrcs(ctx android.ModuleContext, rule *android.RuleBuilder, stubsDir android.OptionalPath, fullApiSurfaceStubJar android.Path) {
+ classFilesList := android.PathForModuleOut(ctx, "metalava", "classes.txt")
unzippedSrcJarDir := android.PathForModuleOut(ctx, "metalava", "unzipDir")
rule.Command().
BuiltTool("list_files").
Text(stubsDir.String()).
- FlagWithOutput("--out ", generatedStubsList).
+ FlagWithOutput("--out ", classFilesList).
FlagWithArg("--extensions ", ".java").
- FlagWithArg("--root ", unzippedSrcJarDir.String())
+ FlagWithArg("--root ", unzippedSrcJarDir.String()).
+ Flag("--classes")
rule.Command().
Text("unzip").
Flag("-q").
- Input(depApiSrcsSrcJar).
+ Input(fullApiSurfaceStubJar).
FlagWithArg("-d ", unzippedSrcJarDir.String())
rule.Command().
BuiltTool("soong_zip").
- Flag("-srcjar").
+ Flag("-jar").
Flag("-write_if_changed").
+ Flag("-ignore_missing_files").
FlagWithArg("-C ", unzippedSrcJarDir.String()).
- FlagWithInput("-l ", generatedStubsList).
- FlagWithOutput("-o ", al.stubsSrcJar)
+ FlagWithInput("-l ", classFilesList).
+ FlagWithOutput("-o ", al.stubsJarWithoutStaticLibs)
}
func (al *ApiLibrary) DepsMutator(ctx android.BottomUpMutatorContext) {
@@ -1800,8 +1796,8 @@
}
ctx.AddVariationDependencies(nil, libTag, al.properties.Libs...)
ctx.AddVariationDependencies(nil, staticLibTag, al.properties.Static_libs...)
- if al.properties.Dep_api_srcs != nil {
- ctx.AddVariationDependencies(nil, depApiSrcsTag, String(al.properties.Dep_api_srcs))
+ if al.properties.Full_api_surface_stub != nil {
+ ctx.AddVariationDependencies(nil, depApiSrcsTag, String(al.properties.Full_api_surface_stub))
}
}
@@ -1823,7 +1819,7 @@
var srcFiles android.Paths
var classPaths android.Paths
var staticLibs android.Paths
- var depApiSrcsStubsSrcJar android.Path
+ var depApiSrcsStubsJar android.Path
ctx.VisitDirectDeps(func(dep android.Module) {
tag := ctx.OtherModuleDependencyTag(dep)
switch tag {
@@ -1841,9 +1837,8 @@
provider := ctx.OtherModuleProvider(dep, JavaInfoProvider).(JavaInfo)
staticLibs = append(staticLibs, provider.HeaderJars...)
case depApiSrcsTag:
- provider := ctx.OtherModuleProvider(dep, JavaApiLibraryDepsProvider).(JavaApiLibraryDepsInfo)
- classPaths = append(classPaths, provider.HeaderJars...)
- depApiSrcsStubsSrcJar = provider.StubsSrcJar
+ provider := ctx.OtherModuleProvider(dep, JavaInfoProvider).(JavaInfo)
+ depApiSrcsStubsJar = provider.HeaderJars[0]
}
})
@@ -1861,31 +1856,31 @@
al.stubsFlags(ctx, cmd, stubsDir)
al.stubsSrcJar = android.PathForModuleOut(ctx, "metalava", ctx.ModuleName()+"-"+"stubs.srcjar")
+ al.stubsJarWithoutStaticLibs = android.PathForModuleOut(ctx, "metalava", "stubs.jar")
+ al.stubsJar = android.PathForModuleOut(ctx, ctx.ModuleName(), fmt.Sprintf("%s.jar", ctx.ModuleName()))
- if depApiSrcsStubsSrcJar != nil {
- al.extractApiSrcs(ctx, rule, stubsDir, depApiSrcsStubsSrcJar)
- } else {
- rule.Command().
- BuiltTool("soong_zip").
- Flag("-write_if_changed").
- Flag("-jar").
- FlagWithOutput("-o ", al.stubsSrcJar).
- FlagWithArg("-C ", stubsDir.String()).
- FlagWithArg("-D ", stubsDir.String())
+ if depApiSrcsStubsJar != nil {
+ al.extractApiSrcs(ctx, rule, stubsDir, depApiSrcsStubsJar)
}
+ rule.Command().
+ BuiltTool("soong_zip").
+ Flag("-write_if_changed").
+ Flag("-jar").
+ FlagWithOutput("-o ", al.stubsSrcJar).
+ FlagWithArg("-C ", stubsDir.String()).
+ FlagWithArg("-D ", stubsDir.String())
rule.Build("metalava", "metalava merged")
- al.stubsJarWithoutStaticLibs = android.PathForModuleOut(ctx, ctx.ModuleName(), "stubs.jar")
- al.stubsJar = android.PathForModuleOut(ctx, ctx.ModuleName(), fmt.Sprintf("%s.jar", ctx.ModuleName()))
+ if depApiSrcsStubsJar == nil {
+ var flags javaBuilderFlags
+ flags.javaVersion = getStubsJavaVersion()
+ flags.javacFlags = strings.Join(al.properties.Javacflags, " ")
+ flags.classpath = classpath(classPaths)
- var flags javaBuilderFlags
- flags.javaVersion = getStubsJavaVersion()
- flags.javacFlags = strings.Join(al.properties.Javacflags, " ")
- flags.classpath = classpath(classPaths)
-
- TransformJavaToClasses(ctx, al.stubsJarWithoutStaticLibs, 0, android.Paths{},
- android.Paths{al.stubsSrcJar}, flags, android.Paths{})
+ TransformJavaToClasses(ctx, al.stubsJarWithoutStaticLibs, 0, android.Paths{},
+ android.Paths{al.stubsSrcJar}, flags, android.Paths{})
+ }
builder := android.NewRuleBuilder(pctx, ctx)
builder.Command().
@@ -1917,13 +1912,6 @@
ImplementationJars: android.PathsIfNonNil(al.stubsJar),
AidlIncludeDirs: android.Paths{},
})
-
- ctx.SetProvider(JavaApiLibraryDepsProvider, JavaApiLibraryDepsInfo{
- JavaInfo: JavaInfo{
- HeaderJars: android.PathsIfNonNil(al.stubsJar),
- },
- StubsSrcJar: al.stubsSrcJar,
- })
}
func (al *ApiLibrary) DexJarBuildPath() OptionalDexJarPath {
diff --git a/java/java_test.go b/java/java_test.go
index 561b187..4738304 100644
--- a/java/java_test.go
+++ b/java/java_test.go
@@ -2208,7 +2208,7 @@
}
}
-func TestJavaApiLibraryDepApiSrcs(t *testing.T) {
+func TestJavaApiLibraryFullApiSurfaceStub(t *testing.T) {
provider_bp_a := `
java_api_contribution {
name: "foo1",
@@ -2234,7 +2234,7 @@
name: "bar1",
api_surface: "public",
api_contributions: ["foo1"],
- dep_api_srcs: "lib1",
+ full_api_surface_stub: "lib1",
}
`,
map[string][]byte{
@@ -2247,9 +2247,7 @@
manifest := m.Output("metalava.sbox.textproto")
sboxProto := android.RuleBuilderSboxProtoForTests(t, manifest)
manifestCommand := sboxProto.Commands[0].GetCommand()
-
- android.AssertStringDoesContain(t, "Command expected to contain module srcjar file", manifestCommand, "bar1-stubs.srcjar")
- android.AssertStringDoesContain(t, "Command expected to contain output files list text file flag", manifestCommand, "--out __SBOX_SANDBOX_DIR__/out/sources.txt")
+ android.AssertStringDoesContain(t, "Command expected to contain full_api_surface_stub output jar", manifestCommand, "lib1.jar")
}
func TestJavaApiLibraryFilegroupInput(t *testing.T) {
diff --git a/java/robolectric.go b/java/robolectric.go
index 6bbe872..0041af4 100644
--- a/java/robolectric.go
+++ b/java/robolectric.go
@@ -299,7 +299,7 @@
func (r *robolectricTest) generateRoboSrcJar(ctx android.ModuleContext, outputFile android.WritablePath,
instrumentedApp *AndroidApp) {
- srcJarArgs := copyOf(instrumentedApp.srcJarArgs)
+ srcJarArgs := android.CopyOf(instrumentedApp.srcJarArgs)
srcJarDeps := append(android.Paths(nil), instrumentedApp.srcJarDeps...)
for _, m := range ctx.GetDirectDepsWithTag(roboCoverageLibsTag) {
diff --git a/java/sdk_library.go b/java/sdk_library.go
index a3d81ce..dbb2f02 100644
--- a/java/sdk_library.go
+++ b/java/sdk_library.go
@@ -1780,12 +1780,12 @@
func (module *SdkLibrary) createApiLibrary(mctx android.DefaultableHookContext, apiScope *apiScope) {
props := struct {
- Name *string
- Visibility []string
- Api_contributions []string
- Libs []string
- Static_libs []string
- Dep_api_srcs *string
+ Name *string
+ Visibility []string
+ Api_contributions []string
+ Libs []string
+ Static_libs []string
+ Full_api_surface_stub *string
}{}
props.Name = proptools.StringPtr(module.apiLibraryModuleName(apiScope))
@@ -1807,12 +1807,12 @@
props.Libs = append(props.Libs, module.sdkLibraryProperties.Stub_only_libs...)
props.Libs = append(props.Libs, "stub-annotations")
props.Static_libs = module.sdkLibraryProperties.Stub_only_static_libs
- props.Dep_api_srcs = proptools.StringPtr(apiScope.kind.DefaultJavaLibraryName() + ".from-text")
+ props.Full_api_surface_stub = proptools.StringPtr(apiScope.kind.DefaultJavaLibraryName() + ".from-text")
// android_module_lib_stubs_current.from-text only comprises api contributions from art, conscrypt and i18n.
// Thus, replace with android_module_lib_stubs_current_full.from-text, which comprises every api domains.
if apiScope.kind == android.SdkModule {
- props.Dep_api_srcs = proptools.StringPtr(apiScope.kind.DefaultJavaLibraryName() + "_full.from-text")
+ props.Full_api_surface_stub = proptools.StringPtr(apiScope.kind.DefaultJavaLibraryName() + "_full.from-text")
}
mctx.CreateModule(ApiLibraryFactory, &props)
diff --git a/java/sdk_library_test.go b/java/sdk_library_test.go
index 7ba1f6d..c22b980 100644
--- a/java/sdk_library_test.go
+++ b/java/sdk_library_test.go
@@ -1442,35 +1442,35 @@
`)
testCases := []struct {
- scope *apiScope
- apiContributions []string
- depApiSrcs string
+ scope *apiScope
+ apiContributions []string
+ fullApiSurfaceStub string
}{
{
- scope: apiScopePublic,
- apiContributions: []string{"foo.stubs.source.api.contribution"},
- depApiSrcs: "android_stubs_current.from-text",
+ scope: apiScopePublic,
+ apiContributions: []string{"foo.stubs.source.api.contribution"},
+ fullApiSurfaceStub: "android_stubs_current.from-text",
},
{
- scope: apiScopeSystem,
- apiContributions: []string{"foo.stubs.source.system.api.contribution", "foo.stubs.source.api.contribution"},
- depApiSrcs: "android_system_stubs_current.from-text",
+ scope: apiScopeSystem,
+ apiContributions: []string{"foo.stubs.source.system.api.contribution", "foo.stubs.source.api.contribution"},
+ fullApiSurfaceStub: "android_system_stubs_current.from-text",
},
{
- scope: apiScopeTest,
- apiContributions: []string{"foo.stubs.source.test.api.contribution", "foo.stubs.source.system.api.contribution", "foo.stubs.source.api.contribution"},
- depApiSrcs: "android_test_stubs_current.from-text",
+ scope: apiScopeTest,
+ apiContributions: []string{"foo.stubs.source.test.api.contribution", "foo.stubs.source.system.api.contribution", "foo.stubs.source.api.contribution"},
+ fullApiSurfaceStub: "android_test_stubs_current.from-text",
},
{
- scope: apiScopeModuleLib,
- apiContributions: []string{"foo.stubs.source.module_lib.api.contribution", "foo.stubs.source.system.api.contribution", "foo.stubs.source.api.contribution"},
- depApiSrcs: "android_module_lib_stubs_current_full.from-text",
+ scope: apiScopeModuleLib,
+ apiContributions: []string{"foo.stubs.source.module_lib.api.contribution", "foo.stubs.source.system.api.contribution", "foo.stubs.source.api.contribution"},
+ fullApiSurfaceStub: "android_module_lib_stubs_current_full.from-text",
},
}
for _, c := range testCases {
m := result.ModuleForTests(c.scope.apiLibraryModuleName("foo"), "android_common").Module().(*ApiLibrary)
android.AssertArrayString(t, "Module expected to contain api contributions", c.apiContributions, m.properties.Api_contributions)
- android.AssertStringEquals(t, "Module expected to contain full api surface api library", c.depApiSrcs, *m.properties.Dep_api_srcs)
+ android.AssertStringEquals(t, "Module expected to contain full api surface api library", c.fullApiSurfaceStub, *m.properties.Full_api_surface_stub)
}
}
diff --git a/tests/run_integration_tests.sh b/tests/run_integration_tests.sh
index 43a9f0f..bec43ae 100755
--- a/tests/run_integration_tests.sh
+++ b/tests/run_integration_tests.sh
@@ -16,7 +16,8 @@
# mock client.
"$TOP/build/soong/tests/apex_comparison_tests.sh"
"$TOP/build/soong/tests/apex_comparison_tests.sh" "module_arm64only"
-TEST_BAZEL=true extra_build_params=--bazel-mode-staging "$TOP/build/soong/tests/dcla_apex_comparison_test.sh"
+# TODO(b/289141798): uncomment the first dcla_apex_comparison_test.sh
+#TEST_BAZEL=true extra_build_params=--bazel-mode-staging "$TOP/build/soong/tests/dcla_apex_comparison_test.sh"
#BUILD_BROKEN_DISABLE_BAZEL=true "$TOP/build/soong/tests/dcla_apex_comparison_test.sh"
"$TOP/build/soong/tests/apex_cc_module_arch_variant_tests.sh"
"$TOP/build/soong/tests/apex_cc_module_arch_variant_tests.sh" "aosp_arm" "armv7-a"