Add logging dependencies to Rust aconfig APIs
Test: go test
Change-Id: I17c098f6b83c442554e49b6b802f11c97f94ec76
diff --git a/aconfig/codegen/rust_aconfig_library.go b/aconfig/codegen/rust_aconfig_library.go
index a0a2a54..ad8d632 100644
--- a/aconfig/codegen/rust_aconfig_library.go
+++ b/aconfig/codegen/rust_aconfig_library.go
@@ -99,9 +99,11 @@
func (a *aconfigDecorator) SourceProviderDeps(ctx rust.DepsContext, deps rust.Deps) rust.Deps {
deps = a.BaseSourceProvider.SourceProviderDeps(ctx, deps)
+ deps.Rustlibs = append(deps.Rustlibs, "libaconfig_storage_read_api")
deps.Rustlibs = append(deps.Rustlibs, "libflags_rust")
deps.Rustlibs = append(deps.Rustlibs, "liblazy_static")
- deps.Rustlibs = append(deps.Rustlibs, "libaconfig_storage_read_api")
+ deps.Rustlibs = append(deps.Rustlibs, "liblogger")
+ deps.Rustlibs = append(deps.Rustlibs, "liblog_rust")
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 330cecd..1bd5397 100644
--- a/aconfig/codegen/rust_aconfig_library_test.go
+++ b/aconfig/codegen/rust_aconfig_library_test.go
@@ -33,6 +33,16 @@
crate_name: "aconfig_storage_read_api",
srcs: ["lib.rs"],
}
+ rust_library {
+ name: "liblogger", // test mock
+ crate_name: "logger",
+ srcs: ["lib.rs"],
+ }
+ rust_library {
+ name: "liblog_rust", // test mock
+ crate_name: "log_rust",
+ srcs: ["lib.rs"],
+ }
aconfig_declarations {
name: "my_aconfig_declarations",
package: "com.example.package",
@@ -108,6 +118,16 @@
crate_name: "aconfig_storage_read_api",
srcs: ["lib.rs"],
}
+ rust_library {
+ name: "liblogger", // test mock
+ crate_name: "logger",
+ srcs: ["lib.rs"],
+ }
+ rust_library {
+ name: "liblog_rust", // test mock
+ crate_name: "log_rust",
+ srcs: ["lib.rs"],
+ }
aconfig_declarations {
name: "my_aconfig_declarations",
package: "com.example.package",
@@ -160,6 +180,16 @@
crate_name: "aconfig_storage_read_api",
srcs: ["lib.rs"],
}
+ rust_library {
+ name: "liblogger", // test mock
+ crate_name: "logger",
+ srcs: ["lib.rs"],
+ }
+ rust_library {
+ name: "liblog_rust", // test mock
+ crate_name: "log_rust",
+ 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 515b2fd..3e44f0b 100644
--- a/apex/aconfig_test.go
+++ b/apex/aconfig_test.go
@@ -223,6 +223,18 @@
srcs: ["src/lib.rs"],
apex_available: ["myapex"],
}
+ rust_library {
+ name: "liblogger", // test mock
+ crate_name: "logger",
+ srcs: ["src/lib.rs"],
+ apex_available: ["myapex"],
+ }
+ rust_library {
+ name: "liblog_rust", // test mock
+ crate_name: "log_rust",
+ srcs: ["src/lib.rs"],
+ apex_available: ["myapex"],
+ }
rust_ffi_shared {
name: "libmy_rust_library",
srcs: ["src/lib.rs"],
@@ -492,6 +504,18 @@
srcs: ["src/lib.rs"],
apex_available: ["myapex"],
}
+ rust_library {
+ name: "liblogger", // test mock
+ crate_name: "logger",
+ srcs: ["src/lib.rs"],
+ apex_available: ["myapex"],
+ }
+ rust_library {
+ name: "liblog_rust", // test mock
+ crate_name: "log_rust",
+ srcs: ["src/lib.rs"],
+ apex_available: ["myapex"],
+ }
rust_ffi_shared {
name: "libmy_rust_library",
srcs: ["src/lib.rs"],
@@ -542,6 +566,18 @@
srcs: ["src/lib.rs"],
apex_available: ["myapex"],
}
+ rust_library {
+ name: "liblogger", // test mock
+ crate_name: "logger",
+ srcs: ["src/lib.rs"],
+ apex_available: ["myapex"],
+ }
+ rust_library {
+ name: "liblog_rust", // test mock
+ crate_name: "log_rust",
+ 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 3e9f246..67bb55e 100644
--- a/apex/apex_test.go
+++ b/apex/apex_test.go
@@ -10910,6 +10910,24 @@
],
}
+ rust_library {
+ name: "liblogger", // test mock
+ crate_name: "logger",
+ srcs: ["src/lib.rs"],
+ apex_available: [
+ "myapex",
+ ],
+ }
+
+ rust_library {
+ name: "liblog_rust", // test mock
+ crate_name: "log_rust",
+ srcs: ["src/lib.rs"],
+ apex_available: [
+ "myapex",
+ ],
+ }
+
rust_ffi_shared {
name: "libmy_rust_library",
srcs: ["src/lib.rs"],
@@ -10994,14 +11012,14 @@
mod := ctx.ModuleForTests("myapex", "android_common_myapex")
s := mod.Rule("apexRule").Args["copy_commands"]
copyCmds := regexp.MustCompile(" *&& *").Split(s, -1)
- if len(copyCmds) != 28 {
+ if len(copyCmds) != 32 {
t.Fatalf("Expected 28 commands, got %d in:\n%s", len(copyCmds), s)
}
- 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$")
+ ensureMatches(t, copyCmds[28], "^cp -f .*/aconfig_flags.pb .*/image.apex/etc$")
+ ensureMatches(t, copyCmds[29], "^cp -f .*/package.map .*/image.apex/etc$")
+ ensureMatches(t, copyCmds[30], "^cp -f .*/flag.map .*/image.apex/etc$")
+ ensureMatches(t, copyCmds[31], "^cp -f .*/flag.val .*/image.apex/etc$")
inputs := []string{
"my_aconfig_declarations_foo/intermediate.pb",