diff --git a/aconfig/codegen/rust_aconfig_library.go b/aconfig/codegen/rust_aconfig_library.go index 3f7495be1..a0a2a546b 100644 --- a/aconfig/codegen/rust_aconfig_library.go +++ b/aconfig/codegen/rust_aconfig_library.go @@ -101,6 +101,7 @@ func (a *aconfigDecorator) SourceProviderDeps(ctx rust.DepsContext, deps rust.De deps = a.BaseSourceProvider.SourceProviderDeps(ctx, deps) deps.Rustlibs = append(deps.Rustlibs, "libflags_rust") deps.Rustlibs = append(deps.Rustlibs, "liblazy_static") + deps.Rustlibs = append(deps.Rustlibs, "libaconfig_storage_read_api") ctx.AddDependency(ctx.Module(), rustDeclarationsTag, a.Properties.Aconfig_declarations) return deps } diff --git a/aconfig/codegen/rust_aconfig_library_test.go b/aconfig/codegen/rust_aconfig_library_test.go index 60bc9f747..330cecd73 100644 --- a/aconfig/codegen/rust_aconfig_library_test.go +++ b/aconfig/codegen/rust_aconfig_library_test.go @@ -28,6 +28,11 @@ func TestRustAconfigLibrary(t *testing.T) { crate_name: "lazy_static", srcs: ["src/lib.rs"], } + rust_library { + name: "libaconfig_storage_read_api", // test mock + crate_name: "aconfig_storage_read_api", + srcs: ["lib.rs"], + } aconfig_declarations { name: "my_aconfig_declarations", package: "com.example.package", @@ -98,6 +103,11 @@ func testRustCodegenModeHelper(t *testing.T, bpMode string, ruleMode string) { crate_name: "lazy_static", srcs: ["src/lib.rs"], } + rust_library { + name: "libaconfig_storage_read_api", // test mock + crate_name: "aconfig_storage_read_api", + srcs: ["lib.rs"], + } aconfig_declarations { name: "my_aconfig_declarations", package: "com.example.package", @@ -145,6 +155,11 @@ func testIncorrectRustCodegenModeHelper(t *testing.T, bpMode string, err string) crate_name: "lazy_static", srcs: ["src/lib.rs"], } + rust_library { + name: "libaconfig_storage_read_api", // test mock + crate_name: "aconfig_storage_read_api", + srcs: ["lib.rs"], + } aconfig_declarations { name: "my_aconfig_declarations", package: "com.example.package", diff --git a/apex/aconfig_test.go b/apex/aconfig_test.go index a179dbffd..515b2fdd0 100644 --- a/apex/aconfig_test.go +++ b/apex/aconfig_test.go @@ -217,6 +217,12 @@ func TestValidationAcrossContainersExportedPass(t *testing.T) { srcs: ["src/lib.rs"], apex_available: ["myapex"], } + rust_library { + name: "libaconfig_storage_read_api", // test mock + crate_name: "aconfig_storage_read_api", + srcs: ["src/lib.rs"], + apex_available: ["myapex"], + } rust_ffi_shared { name: "libmy_rust_library", srcs: ["src/lib.rs"], @@ -480,6 +486,12 @@ func TestValidationAcrossContainersNotExportedFail(t *testing.T) { srcs: ["src/lib.rs"], apex_available: ["myapex"], } + rust_library { + name: "libaconfig_storage_read_api", // test mock + crate_name: "aconfig_storage_read_api", + srcs: ["src/lib.rs"], + apex_available: ["myapex"], + } rust_ffi_shared { name: "libmy_rust_library", srcs: ["src/lib.rs"], @@ -524,6 +536,12 @@ func TestValidationAcrossContainersNotExportedFail(t *testing.T) { srcs: ["src/lib.rs"], apex_available: ["myapex"], } + rust_library { + name: "libaconfig_storage_read_api", // test mock + crate_name: "aconfig_storage_read_api", + srcs: ["src/lib.rs"], + apex_available: ["myapex"], + } rust_binary { name: "my_rust_binary", srcs: ["foo/bar/MyClass.rs"], diff --git a/apex/apex_test.go b/apex/apex_test.go index b7362b202..535805b4e 100644 --- a/apex/apex_test.go +++ b/apex/apex_test.go @@ -11296,6 +11296,15 @@ func TestAconfigFilesRustDeps(t *testing.T) { ], } + rust_library { + name: "libaconfig_storage_read_api", // test mock + crate_name: "aconfig_storage_read_api", + srcs: ["src/lib.rs"], + apex_available: [ + "myapex", + ], + } + rust_ffi_shared { name: "libmy_rust_library", srcs: ["src/lib.rs"], @@ -11380,14 +11389,14 @@ func TestAconfigFilesRustDeps(t *testing.T) { mod := ctx.ModuleForTests("myapex", "android_common_myapex") s := mod.Rule("apexRule").Args["copy_commands"] copyCmds := regexp.MustCompile(" *&& *").Split(s, -1) - if len(copyCmds) != 26 { - t.Fatalf("Expected 26 commands, got %d in:\n%s", len(copyCmds), s) + if len(copyCmds) != 28 { + t.Fatalf("Expected 28 commands, got %d in:\n%s", len(copyCmds), s) } - ensureMatches(t, copyCmds[22], "^cp -f .*/aconfig_flags.pb .*/image.apex/etc$") - ensureMatches(t, copyCmds[23], "^cp -f .*/package.map .*/image.apex/etc$") - ensureMatches(t, copyCmds[24], "^cp -f .*/flag.map .*/image.apex/etc$") - ensureMatches(t, copyCmds[25], "^cp -f .*/flag.val .*/image.apex/etc$") + ensureMatches(t, copyCmds[24], "^cp -f .*/aconfig_flags.pb .*/image.apex/etc$") + ensureMatches(t, copyCmds[25], "^cp -f .*/package.map .*/image.apex/etc$") + ensureMatches(t, copyCmds[26], "^cp -f .*/flag.map .*/image.apex/etc$") + ensureMatches(t, copyCmds[27], "^cp -f .*/flag.val .*/image.apex/etc$") inputs := []string{ "my_aconfig_declarations_foo/intermediate.pb",