Merge changes from topic "aconfig_framework_circle" into main
* changes:
Allow generated java libs to specify libraries.
Allow access to the generated srcjars for GeneratedJavaLibrary
diff --git a/aconfig/aconfig_declarations.go b/aconfig/aconfig_declarations.go
index 4e199dd..5cdf5b6 100644
--- a/aconfig/aconfig_declarations.go
+++ b/aconfig/aconfig_declarations.go
@@ -116,32 +116,38 @@
func (module *DeclarationsModule) GenerateAndroidBuildActions(ctx android.ModuleContext) {
// Get the values that came from the global RELEASE_ACONFIG_VALUE_SETS flag
+ valuesFiles := make([]android.Path, 0)
ctx.VisitDirectDeps(func(dep android.Module) {
if !ctx.OtherModuleHasProvider(dep, valueSetProviderKey) {
// Other modules get injected as dependencies too, for example the license modules
return
}
depData := ctx.OtherModuleProvider(dep, valueSetProviderKey).(valueSetProviderData)
- valuesFiles, ok := depData.AvailablePackages[module.properties.Package]
+ paths, ok := depData.AvailablePackages[module.properties.Package]
if ok {
- for _, path := range valuesFiles {
+ valuesFiles = append(valuesFiles, paths...)
+ for _, path := range paths {
module.properties.Values = append(module.properties.Values, path.String())
}
}
})
// Intermediate format
- inputFiles := android.PathsForModuleSrc(ctx, module.properties.Srcs)
+ declarationFiles := android.PathsForModuleSrc(ctx, module.properties.Srcs)
intermediatePath := android.PathForModuleOut(ctx, "intermediate.pb")
defaultPermission := ctx.Config().ReleaseAconfigFlagDefaultPermission()
+ inputFiles := make([]android.Path, len(declarationFiles))
+ copy(inputFiles, declarationFiles)
+ inputFiles = append(inputFiles, valuesFiles...)
ctx.Build(pctx, android.BuildParams{
Rule: aconfigRule,
Output: intermediatePath,
+ Inputs: inputFiles,
Description: "aconfig_declarations",
Args: map[string]string{
"release_version": ctx.Config().ReleaseVersion(),
"package": module.properties.Package,
- "declarations": android.JoinPathsWithPrefix(inputFiles, "--declarations "),
+ "declarations": android.JoinPathsWithPrefix(declarationFiles, "--declarations "),
"values": joinAndPrefix(" --values ", module.properties.Values),
"default-permission": optionalVariable(" --default-permission ", defaultPermission),
},
diff --git a/cc/config/global.go b/cc/config/global.go
index ff5ab05..498b3ce 100644
--- a/cc/config/global.go
+++ b/cc/config/global.go
@@ -75,11 +75,6 @@
// Help catch common 32/64-bit errors.
"-Werror=int-conversion",
- // Disable overly aggressive warning for macros defined with a leading underscore
- // This happens in AndroidConfig.h, which is included nearly everywhere.
- // TODO: can we remove this now?
- "-Wno-reserved-id-macro",
-
// Force clang to always output color diagnostics. Ninja will strip the ANSI
// color codes if it is not running in a terminal.
"-fcolor-diagnostics",
@@ -101,6 +96,9 @@
// Warnings from clang-12
"-Wno-gnu-folding-constant",
+ // http://b/145210666
+ "-Wno-error=reorder-init-list",
+
// Calls to the APIs that are newer than the min sdk version of the caller should be
// guarded with __builtin_available.
"-Wunguarded-availability",
@@ -218,8 +216,6 @@
// new warnings are fixed.
"-Wno-tautological-constant-compare",
"-Wno-tautological-type-limit-compare",
- // http://b/145210666
- "-Wno-reorder-init-list",
// http://b/145211066
"-Wno-implicit-int-float-conversion",
// New warnings to be fixed after clang-r377782.
diff --git a/rust/library_test.go b/rust/library_test.go
index add7173..30ef333 100644
--- a/rust/library_test.go
+++ b/rust/library_test.go
@@ -196,6 +196,65 @@
}
}
+func TestNativeDependencyOfRlib(t *testing.T) {
+ ctx := testRust(t, `
+ rust_ffi_static {
+ name: "libffi_static",
+ crate_name: "ffi_static",
+ rlibs: ["librust_rlib"],
+ srcs: ["foo.rs"],
+ }
+ rust_library_rlib {
+ name: "librust_rlib",
+ crate_name: "rust_rlib",
+ srcs: ["foo.rs"],
+ shared_libs: ["shared_cc_dep"],
+ static_libs: ["static_cc_dep"],
+ }
+ cc_library_shared {
+ name: "shared_cc_dep",
+ srcs: ["foo.cpp"],
+ }
+ cc_library_static {
+ name: "static_cc_dep",
+ srcs: ["foo.cpp"],
+ }
+ `)
+
+ rustRlibRlibStd := ctx.ModuleForTests("librust_rlib", "android_arm64_armv8-a_rlib_rlib-std")
+ rustRlibDylibStd := ctx.ModuleForTests("librust_rlib", "android_arm64_armv8-a_rlib_dylib-std")
+ ffiStatic := ctx.ModuleForTests("libffi_static", "android_arm64_armv8-a_static")
+
+ modules := []android.TestingModule{
+ rustRlibRlibStd,
+ rustRlibDylibStd,
+ ffiStatic,
+ }
+
+ // librust_rlib specifies -L flag to cc deps output directory on rustc command
+ // and re-export the cc deps to rdep libffi_static
+ // When building rlib crate, rustc doesn't link the native libraries
+ // The build system assumes the cc deps will be at the final linkage (either a shared library or binary)
+ // Hence, these flags are no-op
+ // TODO: We could consider removing these flags
+ for _, module := range modules {
+ if !strings.Contains(module.Rule("rustc").Args["libFlags"],
+ "-L out/soong/.intermediates/shared_cc_dep/android_arm64_armv8-a_shared/") {
+ t.Errorf(
+ "missing -L flag for shared_cc_dep, rustcFlags: %#v",
+ rustRlibRlibStd.Rule("rustc").Args["libFlags"],
+ )
+ }
+ if !strings.Contains(module.Rule("rustc").Args["libFlags"],
+ "-L out/soong/.intermediates/static_cc_dep/android_arm64_armv8-a_static/") {
+ t.Errorf(
+ "missing -L flag for static_cc_dep, rustcFlags: %#v",
+ rustRlibRlibStd.Rule("rustc").Args["libFlags"],
+ )
+ }
+ }
+}
+
// Test that variants pull in the right type of rustlib autodep
func TestAutoDeps(t *testing.T) {