summaryrefslogtreecommitdiff
path: root/java/java_test.go
diff options
context:
space:
mode:
authorJeongik Cha <jeongik@google.com>2019-06-25 16:26:18 +0900
committerJeongik Cha <jeongik@google.com>2019-06-28 14:56:59 +0900
commit6bd33c13bb552d3eee52bcc553b35d55dd91fe98 (patch)
treedc2e0fbb2e22815893b95a06d37ab27ca156ae12 /java/java_test.go
parent7dc6951c3d7a7495a03d97cf13084be78f1896e7 (diff)
Enforce hidden api usage in vendor (soong)
From aosp/588578, if vendor app doesn't fill sdk_version, build scirpt overwrites system_current to sdk_version. But there is no similar enforcement in soong. So, as make does, sdkVersion() returns "system_current" if it is device-specific or soc-specific module. and sdk_version is not filled. Test: pass soong test Bug: 132780927 Change-Id: I69bb3d7bfcf7c27c2db4d0efbe046f9c7879b4bc
Diffstat (limited to 'java/java_test.go')
-rw-r--r--java/java_test.go26
1 files changed, 26 insertions, 0 deletions
diff --git a/java/java_test.go b/java/java_test.go
index 22dec073f..628fec3f8 100644
--- a/java/java_test.go
+++ b/java/java_test.go
@@ -282,6 +282,32 @@ func TestSimple(t *testing.T) {
}
}
+func TestSdkVersion(t *testing.T) {
+ ctx := testJava(t, `
+ java_library {
+ name: "foo",
+ srcs: ["a.java"],
+ vendor: true,
+ }
+
+ java_library {
+ name: "bar",
+ srcs: ["b.java"],
+ }
+ `)
+
+ foo := ctx.ModuleForTests("foo", "android_common").Module().(*Library)
+ bar := ctx.ModuleForTests("bar", "android_common").Module().(*Library)
+
+ if foo.sdkVersion() != "system_current" {
+ t.Errorf("If sdk version of vendor module is empty, it must change to system_current.")
+ }
+
+ if bar.sdkVersion() != "" {
+ t.Errorf("If sdk version of non-vendor module is empty, it keeps empty.")
+ }
+}
+
func TestArchSpecific(t *testing.T) {
ctx := testJava(t, `
java_library {