aboutsummaryrefslogtreecommitdiff
path: root/java/droidstubs_test.go
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2024-02-29 00:01:16 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2024-02-29 00:01:16 +0000
commita0897e87d044c542ea61bdba495ca2ae10d6957a (patch)
tree44a9535d45b586391456d438788039a7a7c82949 /java/droidstubs_test.go
parentce530f7576229227268b17820c6499ec1151eb46 (diff)
parentc4538a09ef9758488ea3f0e1bf9200b436ccc74e (diff)
Snap for 11510485 from c4538a09ef9758488ea3f0e1bf9200b436ccc74e to 24Q2-release
Change-Id: I4edc66a670cebfee7468d30a500d24dc5fea2605
Diffstat (limited to 'java/droidstubs_test.go')
-rw-r--r--java/droidstubs_test.go36
1 files changed, 30 insertions, 6 deletions
diff --git a/java/droidstubs_test.go b/java/droidstubs_test.go
index e5ffd2847..ca34e0ef1 100644
--- a/java/droidstubs_test.go
+++ b/java/droidstubs_test.go
@@ -396,23 +396,47 @@ func TestAconfigDeclarations(t *testing.T) {
"bar",
],
}
+ droidstubs {
+ name: "baz",
+ srcs: ["a/A.java"],
+ api_surface: "public",
+ check_api: {
+ current: {
+ api_file: "a/current.txt",
+ removed_api_file: "a/removed.txt",
+ }
+ },
+ }
`)
// Check that droidstubs depend on aconfig_declarations
android.AssertBoolEquals(t, "foo expected to depend on bar",
CheckModuleHasDependency(t, result.TestContext, "foo", "android_common", "bar"), true)
- m := result.ModuleForTests("foo", "android_common")
+ fooModule := result.ModuleForTests("foo", "android_common")
android.AssertStringDoesContain(t, "foo generates revert annotations file",
- strings.Join(m.AllOutputs(), ""), "revert-annotations-exportable.txt")
+ strings.Join(fooModule.AllOutputs(), ""), "revert-annotations-exportable.txt")
// revert-annotations.txt passed to exportable stubs generation metalava command
- manifest := m.Output("metalava_exportable.sbox.textproto")
- cmdline := String(android.RuleBuilderSboxProtoForTests(t, result.TestContext, manifest).Commands[0].Command)
- android.AssertStringDoesContain(t, "flagged api hide command not included", cmdline, "revert-annotations-exportable.txt")
+ exportableManifest := fooModule.Output("metalava_exportable.sbox.textproto")
+ exportableCmdline := String(android.RuleBuilderSboxProtoForTests(t, result.TestContext, exportableManifest).Commands[0].Command)
+ android.AssertStringDoesContain(t, "flagged api hide command not included", exportableCmdline, "revert-annotations-exportable.txt")
android.AssertStringDoesContain(t, "foo generates exportable stubs jar",
- strings.Join(m.AllOutputs(), ""), "exportable/foo-stubs.srcjar")
+ strings.Join(fooModule.AllOutputs(), ""), "exportable/foo-stubs.srcjar")
+
+ // revert-annotations.txt passed to runtime stubs generation metalava command
+ runtimeManifest := fooModule.Output("metalava_runtime.sbox.textproto")
+ runtimeCmdline := String(android.RuleBuilderSboxProtoForTests(t, result.TestContext, runtimeManifest).Commands[0].Command)
+ android.AssertStringDoesContain(t, "flagged api hide command not included", runtimeCmdline, "revert-annotations-runtime.txt")
+
+ android.AssertStringDoesContain(t, "foo generates runtime stubs jar",
+ strings.Join(fooModule.AllOutputs(), ""), "runtime/foo-stubs.srcjar")
+
+ // If aconfig_declarations property is not defined, the runtime stubs is a copy of the exportable stubs
+ bazModule := result.ModuleForTests("baz", "android_common")
+ bazRuntimeCmdline := bazModule.Rule("metalava_runtime").RuleParams.Command
+ android.AssertStringDoesContain(t, "copy command should include the input stub", bazRuntimeCmdline, "exportable/baz-stubs.srcjar")
}
func TestReleaseExportRuntimeApis(t *testing.T) {