diff options
author | Carmi Grushko <carmi@google.com> | 2016-09-21 03:43:40 +0000 |
---|---|---|
committer | Laszlo Csomor <laszlocsomor@google.com> | 2016-09-21 07:14:30 +0000 |
commit | 2e5ec0fd99ac4bfd930da99f6089dc5faf778464 (patch) | |
tree | 2b9d52eedb48fc041bbe798ba71b37ded69440dc /src/test/java/com/google/devtools/build/lib/rules | |
parent | 7d391c5dd8fd05a7e9a21a6bedc898c2a53432d4 (diff) |
Make java_proto_library's strict_deps default to true.
Remove package-level attribute to set the default of strict_deps.
Change the semantics to --strict_deps_java_protos to mean force strict deps of all Java protos to be true regardless of their strict_deps attribute.
--
MOS_MIGRATED_REVID=133789725
Diffstat (limited to 'src/test/java/com/google/devtools/build/lib/rules')
-rw-r--r-- | src/test/java/com/google/devtools/build/lib/rules/java/proto/StrictDepsUtilsTest.java | 68 |
1 files changed, 2 insertions, 66 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/rules/java/proto/StrictDepsUtilsTest.java b/src/test/java/com/google/devtools/build/lib/rules/java/proto/StrictDepsUtilsTest.java index 7a6c3b8989..df6c1d9f36 100644 --- a/src/test/java/com/google/devtools/build/lib/rules/java/proto/StrictDepsUtilsTest.java +++ b/src/test/java/com/google/devtools/build/lib/rules/java/proto/StrictDepsUtilsTest.java @@ -35,44 +35,12 @@ public class StrictDepsUtilsTest extends BuildViewTestCase { "java_proto_library(name = 'b', strict_deps = 0)", "java_proto_library(name = 'c', strict_deps = 1)"); - assertThat(StrictDepsUtils.isStrictDepsJavaProtoLibrary(getRuleContext("//x:a"))).isFalse(); + assertThat(StrictDepsUtils.isStrictDepsJavaProtoLibrary(getRuleContext("//x:a"))).isTrue(); assertThat(StrictDepsUtils.isStrictDepsJavaProtoLibrary(getRuleContext("//x:b"))).isFalse(); assertThat(StrictDepsUtils.isStrictDepsJavaProtoLibrary(getRuleContext("//x:c"))).isTrue(); } @Test - public void isStrictDepsJavaProtoLibrary_flagIsFalse_packageLevelIs0() throws Exception { - useConfiguration("--strict_deps_java_protos=false"); - - scratch.file( - "y/BUILD", - "package(default_strict_deps_java_protos = 0)", - "java_proto_library(name = 'a')", - "java_proto_library(name = 'b', strict_deps = 0)", - "java_proto_library(name = 'c', strict_deps = 1)"); - - assertThat(StrictDepsUtils.isStrictDepsJavaProtoLibrary(getRuleContext("//y:a"))).isFalse(); - assertThat(StrictDepsUtils.isStrictDepsJavaProtoLibrary(getRuleContext("//y:b"))).isFalse(); - assertThat(StrictDepsUtils.isStrictDepsJavaProtoLibrary(getRuleContext("//y:c"))).isTrue(); - } - - @Test - public void isStrictDepsJavaProtoLibrary_flagIsFalse_packageLevelIs1() throws Exception { - useConfiguration("--strict_deps_java_protos=false"); - - scratch.file( - "z/BUILD", - "package(default_strict_deps_java_protos = 1)", - "java_proto_library(name = 'a')", - "java_proto_library(name = 'b', strict_deps = 0)", - "java_proto_library(name = 'c', strict_deps = 1)"); - - assertThat(StrictDepsUtils.isStrictDepsJavaProtoLibrary(getRuleContext("//z:a"))).isTrue(); - assertThat(StrictDepsUtils.isStrictDepsJavaProtoLibrary(getRuleContext("//z:b"))).isFalse(); - assertThat(StrictDepsUtils.isStrictDepsJavaProtoLibrary(getRuleContext("//z:c"))).isTrue(); - } - - @Test public void isStrictDepsJavaProtoLibrary_flagIsTrue_noPackageLevelAttribute() throws Exception { useConfiguration("--strict_deps_java_protos=true"); @@ -83,42 +51,10 @@ public class StrictDepsUtilsTest extends BuildViewTestCase { "java_proto_library(name = 'c', strict_deps = 1)"); assertThat(StrictDepsUtils.isStrictDepsJavaProtoLibrary(getRuleContext("//x:a"))).isTrue(); - assertThat(StrictDepsUtils.isStrictDepsJavaProtoLibrary(getRuleContext("//x:b"))).isFalse(); + assertThat(StrictDepsUtils.isStrictDepsJavaProtoLibrary(getRuleContext("//x:b"))).isTrue(); assertThat(StrictDepsUtils.isStrictDepsJavaProtoLibrary(getRuleContext("//x:c"))).isTrue(); } - @Test - public void isStrictDepsJavaProtoLibrary_flagIsTrue_packageLevelIs0() throws Exception { - useConfiguration("--strict_deps_java_protos=true"); - - scratch.file( - "y/BUILD", - "package(default_strict_deps_java_protos = 0)", - "java_proto_library(name = 'a')", - "java_proto_library(name = 'b', strict_deps = 0)", - "java_proto_library(name = 'c', strict_deps = 1)"); - - assertThat(StrictDepsUtils.isStrictDepsJavaProtoLibrary(getRuleContext("//y:a"))).isFalse(); - assertThat(StrictDepsUtils.isStrictDepsJavaProtoLibrary(getRuleContext("//y:b"))).isFalse(); - assertThat(StrictDepsUtils.isStrictDepsJavaProtoLibrary(getRuleContext("//y:c"))).isTrue(); - } - - @Test - public void isStrictDepsJavaProtoLibrary_flagIsTrue_packageLevelIs1() throws Exception { - useConfiguration("--strict_deps_java_protos=true"); - - scratch.file( - "z/BUILD", - "package(default_strict_deps_java_protos = 1)", - "java_proto_library(name = 'a')", - "java_proto_library(name = 'b', strict_deps = 0)", - "java_proto_library(name = 'c', strict_deps = 1)"); - - assertThat(StrictDepsUtils.isStrictDepsJavaProtoLibrary(getRuleContext("//z:a"))).isTrue(); - assertThat(StrictDepsUtils.isStrictDepsJavaProtoLibrary(getRuleContext("//z:b"))).isFalse(); - assertThat(StrictDepsUtils.isStrictDepsJavaProtoLibrary(getRuleContext("//z:c"))).isTrue(); - } - private RuleContext getRuleContext(String label) throws Exception { return getRuleContext(getConfiguredTarget(label)); } |