Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 02d475c3 authored by Ted Bauer's avatar Ted Bauer
Browse files

Add storage API as dependency to Rust codegen

Test: m
Bug: 328444881
Change-Id: Id1ef9276adb9f9b990a05b910937e96ab0a5ac50
parent 949157d5
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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
}
+15 −0
Original line number Diff line number Diff line
@@ -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",
+18 −0
Original line number Diff line number Diff line
@@ -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"],
+15 −6
Original line number Diff line number Diff line
@@ -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",