Merge "Put shared library R.jar files in the classpath" into main
diff --git a/android/allowlists/allowlists.go b/android/allowlists/allowlists.go
index 5354611..cc428e9 100644
--- a/android/allowlists/allowlists.go
+++ b/android/allowlists/allowlists.go
@@ -203,6 +203,7 @@
"external/pcre": Bp2BuildDefaultTrueRecursively,
"external/perfmark/api": Bp2BuildDefaultTrueRecursively,
"external/protobuf": Bp2BuildDefaultTrueRecursively,
+ "external/python/pyfakefs/pyfakefs": Bp2BuildDefaultTrueRecursively,
"external/python/pyyaml/lib/yaml": Bp2BuildDefaultTrueRecursively,
"external/python/six": Bp2BuildDefaultTrueRecursively,
"external/python/jinja/src": Bp2BuildDefaultTrueRecursively,
@@ -1006,6 +1007,8 @@
"libandroid_net_connectivity_com_android_net_module_util_jni",
"libservice-connectivity",
+
+ "mainline_modules_sdks_test",
}
Bp2buildModuleTypeAlwaysConvertList = []string{
diff --git a/bp2build/java_library_conversion_test.go b/bp2build/java_library_conversion_test.go
index 2e205b1..c88af1b 100644
--- a/bp2build/java_library_conversion_test.go
+++ b/bp2build/java_library_conversion_test.go
@@ -463,6 +463,7 @@
},
Blueprint: `java_library {
name: "java-lib-1",
+ srcs: ["foo.java"],
java_resource_dirs: ["res", "res1"],
sdk_version: "current",
}`,
@@ -472,9 +473,10 @@
"resources": `["res1/b.res"]`,
}),
MakeBazelTarget("java_library", "java-lib-1", AttrNameToString{
- "additional_resources": `["java-lib-1_resource_dir_res1"]`,
+ "deps": `["java-lib-1_resource_dir_res1"]`,
"resources": `["res/a.res"]`,
"resource_strip_prefix": `"res"`,
+ "srcs": `["foo.java"]`,
"sdk_version": `"current"`,
}),
MakeNeverlinkDuplicateTarget("java_library", "java-lib-1"),
@@ -492,6 +494,7 @@
java_resources: ["res1", "res2"],
java_resource_dirs: ["resdir"],
sdk_version: "current",
+ srcs: ["foo.java"],
}`,
ExpectedBazelTargets: []string{
MakeBazelTarget("java_resources", "java-lib-1_resource_dir_resdir", AttrNameToString{
@@ -499,12 +502,13 @@
"resources": `["resdir/a.res"]`,
}),
MakeBazelTarget("java_library", "java-lib-1", AttrNameToString{
- "additional_resources": `["java-lib-1_resource_dir_resdir"]`,
+ "deps": `["java-lib-1_resource_dir_resdir"]`,
"resource_strip_prefix": `"."`,
"resources": `[
"res1",
"res2",
]`,
+ "srcs": `["foo.java"]`,
"sdk_version": `"current"`,
}),
MakeNeverlinkDuplicateTarget("java_library", "java-lib-1"),
@@ -1064,7 +1068,7 @@
"srcs": `["a.java"]`,
"resources": `["a.res"]`,
"resource_strip_prefix": `"."`,
- "additional_resources": `[
+ "deps": `[
"java-lib-1_filegroup_resources_filegroup1",
"java-lib-1_filegroup_resources_filegroup2",
]`,
diff --git a/java/java.go b/java/java.go
index a4e4b50..3b20ea4 100644
--- a/java/java.go
+++ b/java/java.go
@@ -2775,7 +2775,7 @@
type javaResourcesAttributes struct {
Resources bazel.LabelListAttribute
Resource_strip_prefix *string
- Additional_resources bazel.LabelListAttribute
+ Additional_resources bazel.LabelListAttribute `blueprint:"mutated"`
}
func (m *Library) getResourceFilegroupStripPrefix(ctx android.Bp2buildMutatorContext, resourceFilegroup string) (*string, bool) {
@@ -3052,9 +3052,11 @@
javacopts.Append(bazel.MakeStringListAttribute([]string{"-XepDisableAllChecks"}))
}
+ resourcesAttrs := m.convertJavaResourcesAttributes(ctx)
+
commonAttrs := &javaCommonAttributes{
Srcs: javaSrcs,
- javaResourcesAttributes: m.convertJavaResourcesAttributes(ctx),
+ javaResourcesAttributes: resourcesAttrs,
Plugins: plugins,
Javacopts: javacopts,
Java_version: bazel.StringAttribute{Value: m.properties.Java_version},
@@ -3077,6 +3079,7 @@
}
depLabels := &javaDependencyLabels{}
+ deps.Append(resourcesAttrs.Additional_resources)
depLabels.Deps = deps
for axis, configToProps := range archVariantProps {
diff --git a/rust/config/arm_device.go b/rust/config/arm_device.go
index 42c1c02..a5f4afb 100644
--- a/rust/config/arm_device.go
+++ b/rust/config/arm_device.go
@@ -44,6 +44,7 @@
strings.Join(rustFlags, " "))
}
+ ExportedVars.ExportStringListStaticVariable("DEVICE_ARM_RUSTC_FLAGS", ArmRustFlags)
}
type toolchainArm struct {
diff --git a/rust/config/x86_64_device.go b/rust/config/x86_64_device.go
index 45d1fd0..c797eef 100644
--- a/rust/config/x86_64_device.go
+++ b/rust/config/x86_64_device.go
@@ -53,7 +53,7 @@
pctx.StaticVariable("X86_64"+variant+"VariantRustFlags",
strings.Join(rustFlags, " "))
}
-
+ ExportedVars.ExportStringListStaticVariable("DEVICE_X86_64_RUSTC_FLAGS", x86_64RustFlags)
}
type toolchainX86_64 struct {
diff --git a/rust/config/x86_device.go b/rust/config/x86_device.go
index 43f7340..822f281 100644
--- a/rust/config/x86_device.go
+++ b/rust/config/x86_device.go
@@ -55,6 +55,7 @@
strings.Join(rustFlags, " "))
}
+ ExportedVars.ExportStringListStaticVariable("DEVICE_X86_RUSTC_FLAGS", x86RustFlags)
}
type toolchainX86 struct {
diff --git a/ui/build/build.go b/ui/build/build.go
index 15cff5f..9d5c330 100644
--- a/ui/build/build.go
+++ b/ui/build/build.go
@@ -298,8 +298,6 @@
runMakeProductConfig(ctx, config)
}
- checkForCleanPartitions(ctx, config)
-
// Everything below here depends on product config.
if inList("installclean", config.Arguments()) ||
diff --git a/ui/build/cleanbuild.go b/ui/build/cleanbuild.go
index 7114963..41cb5ab 100644
--- a/ui/build/cleanbuild.go
+++ b/ui/build/cleanbuild.go
@@ -218,50 +218,6 @@
writeConfig()
}
-// Writes out/partitions_were_clean_at_start_of_build.txt.
-// This file will contain "true" if there were no partition staging directories at the start of
-// the build (most likely from having just run `m installclean`) and "false" otherwise.
-// It's used to make a test that the staging directories are correct. That test can only be
-// correctly run directly after `m installclean`, and this is how we check for that.
-func checkForCleanPartitions(ctx Context, config Config) {
- productOutPath := config.ProductOut()
- productOut := func(path string) string {
- return filepath.Join(productOutPath, path)
- }
-
- notExists := func(path string) bool {
- _, err := os.Stat(path)
- return os.IsNotExist(err)
- }
-
- clean := notExists(productOut("ramdisk")) &&
- notExists(productOut("ramdisk_16k")) &&
- notExists(productOut("debug_ramdisk")) &&
- notExists(productOut("vendor_ramdisk")) &&
- notExists(productOut("vendor_debug_ramdisk")) &&
- notExists(productOut("vendor_kernel_ramdisk")) &&
- notExists(productOut("test_harness_ramdisk")) &&
- notExists(productOut("data")) &&
- notExists(productOut("recovery")) &&
- notExists(productOut("root")) &&
- notExists(productOut("system")) &&
- notExists(productOut("system_dlkm")) &&
- notExists(productOut("system_other")) &&
- notExists(productOut("vendor")) &&
- notExists(productOut("vendor_dlkm")) &&
- notExists(productOut("product")) &&
- notExists(productOut("system_ext")) &&
- notExists(productOut("oem")) &&
- notExists(productOut("breakpad")) &&
- notExists(productOut("cache")) &&
- notExists(productOut("coverage")) &&
- notExists(productOut("installer")) &&
- notExists(productOut("odm")) &&
- notExists(productOut("odm_dlkm"))
-
- writeValueIfChanged(ctx, config, config.OutDir(), "partitions_were_clean_at_start_of_build.txt", fmt.Sprintf("%t\n", clean))
-}
-
// cleanOldFiles takes an input file (with all paths relative to basePath), and removes files from
// the filesystem if they were removed from the input file since the last execution.
func cleanOldFiles(ctx Context, basePath, newFile string) {
diff --git a/ui/build/kati.go b/ui/build/kati.go
index 7f0ea24..31e7440 100644
--- a/ui/build/kati.go
+++ b/ui/build/kati.go
@@ -102,8 +102,6 @@
"--use_ninja_phony_output",
// Support declaring symlink outputs in AOSP Ninja.
"--use_ninja_symlink_outputs",
- // Support ninja validation actions with .KATI_VALIDATIONS: https://ninja-build.org/manual.html#validations
- "--use_ninja_validations",
// Regenerate the Ninja file if environment inputs have changed. e.g.
// CLI flags, .mk file timestamps, env vars, $(wildcard ..) and some
// $(shell ..) results.
diff --git a/ui/build/test_build.go b/ui/build/test_build.go
index af60e0d..2efc732 100644
--- a/ui/build/test_build.go
+++ b/ui/build/test_build.go
@@ -103,10 +103,8 @@
// treated as an source file.
dexpreoptConfigFilePath := filepath.Join(outDir, "soong", "dexpreopt.config")
- // These files are written by soong_ui at the beginning of every build.
- // Ninja considers them "source files"
+ // out/build_date.txt is considered a "source file"
buildDatetimeFilePath := filepath.Join(outDir, "build_date.txt")
- cleanPartitionsFilePath := filepath.Join(outDir, "partitions_were_clean_at_start_of_build.txt")
// bpglob is built explicitly using Microfactory
bpglob := filepath.Join(config.SoongOutDir(), "bpglob")
@@ -124,7 +122,6 @@
line == variablesFilePath ||
line == dexpreoptConfigFilePath ||
line == buildDatetimeFilePath ||
- line == cleanPartitionsFilePath ||
line == bpglob {
// Leaf node is in one of Soong's bootstrap directories, which do not have
// full build rules in the primary build.ninja file.