aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test/java/com/google/devtools/build
diff options
context:
space:
mode:
authorGravatar Carmi Grushko <carmi@google.com>2017-02-17 06:49:40 +0000
committerGravatar Dmitry Lomov <dslomov@google.com>2017-02-17 14:55:06 +0000
commit0fd73d6e3602003ae0e7e9ce6a25b27d73e30076 (patch)
tree0547ba510e475322ee512255a8d471ca5ad07fd0 /src/test/java/com/google/devtools/build
parent8153cb80f4a4424640e694cb6ed4792dcc193171 (diff)
--proto_compiler points at @com_google_protobuf//:protoc
This allows proto_library to be used out of the box by adding a repository entry that points to the protobuf distro in one's WORKSPACE file. -- PiperOrigin-RevId: 147808147 MOS_MIGRATED_REVID=147808147
Diffstat (limited to 'src/test/java/com/google/devtools/build')
-rw-r--r--src/test/java/com/google/devtools/build/lib/rules/cpp/proto/CcProtoLibraryTest.java3
-rw-r--r--src/test/java/com/google/devtools/build/lib/rules/proto/BazelProtoLibraryTest.java11
2 files changed, 8 insertions, 6 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/rules/cpp/proto/CcProtoLibraryTest.java b/src/test/java/com/google/devtools/build/lib/rules/cpp/proto/CcProtoLibraryTest.java
index 5951987a1d..6f5ee31a88 100644
--- a/src/test/java/com/google/devtools/build/lib/rules/cpp/proto/CcProtoLibraryTest.java
+++ b/src/test/java/com/google/devtools/build/lib/rules/cpp/proto/CcProtoLibraryTest.java
@@ -34,10 +34,10 @@ import org.junit.runners.JUnit4;
public class CcProtoLibraryTest extends BuildViewTestCase {
@Before
public void setUp() throws Exception {
- scratch.file("third_party/protobuf/BUILD", "licenses(['notice'])", "exports_files(['protoc'])");
scratch.file(
"protobuf/BUILD",
"package(default_visibility=['//visibility:public'])",
+ "exports_files(['protoc'])",
"proto_lang_toolchain(",
" name = 'cc_toolchain',",
" command_line = '--cpp_out=$(OUT)',",
@@ -48,6 +48,7 @@ public class CcProtoLibraryTest extends BuildViewTestCase {
new String(FileSystemUtils.readContentAsLatin1(rootDirectory.getRelative("WORKSPACE")));
mockToolsConfig.overwrite(
"WORKSPACE",
+ "local_repository(name = 'com_google_protobuf', path = 'protobuf/')",
"local_repository(name = 'com_google_protobuf_cc', path = 'protobuf/')",
existingWorkspace);
invalidatePackages(); // A dash of magic to re-evaluate the WORKSPACE file.
diff --git a/src/test/java/com/google/devtools/build/lib/rules/proto/BazelProtoLibraryTest.java b/src/test/java/com/google/devtools/build/lib/rules/proto/BazelProtoLibraryTest.java
index 1133f24b8e..893e4f82ff 100644
--- a/src/test/java/com/google/devtools/build/lib/rules/proto/BazelProtoLibraryTest.java
+++ b/src/test/java/com/google/devtools/build/lib/rules/proto/BazelProtoLibraryTest.java
@@ -34,7 +34,8 @@ public class BazelProtoLibraryTest extends BuildViewTestCase {
@Before
public void setUp() throws Exception {
- scratch.file("third_party/protobuf/BUILD", "licenses(['notice'])", "exports_files(['protoc'])");
+ useConfiguration("--proto_compiler=//proto:compiler");
+ scratch.file("proto/BUILD", "licenses(['notice'])", "exports_files(['compiler'])");
}
@Test
@@ -180,7 +181,7 @@ public class BazelProtoLibraryTest extends BuildViewTestCase {
@Test
public void testDescriptorSetOutput_strictDeps() throws Exception {
- useConfiguration("--strict_proto_deps=error");
+ useConfiguration("--proto_compiler=//proto:compiler", "--strict_proto_deps=error");
scratch.file(
"x/BUILD",
"proto_library(name='nodeps', srcs=['nodeps.proto'])",
@@ -210,7 +211,7 @@ public class BazelProtoLibraryTest extends BuildViewTestCase {
*/
@Test
public void testDescriptorSetOutput_strict_deps_multipleSrcs() throws Exception {
- useConfiguration("--strict_proto_deps=error");
+ useConfiguration("--proto_compiler=//proto:compiler", "--strict_proto_deps=error");
ConfiguredTarget target =
scratchConfiguredTarget(
"x", "foo", "proto_library(name='foo', srcs=['foo.proto', 'bar.proto'])");
@@ -223,7 +224,7 @@ public class BazelProtoLibraryTest extends BuildViewTestCase {
@Test
public void testDescriptorSetOutput_strictDeps_disabled() throws Exception {
- useConfiguration("--strict_proto_deps=off");
+ useConfiguration("--proto_compiler=//proto:compiler", "--strict_proto_deps=off");
scratch.file("x/BUILD", "proto_library(name='foo', srcs=['foo.proto'])");
for (String arg :
@@ -238,7 +239,7 @@ public class BazelProtoLibraryTest extends BuildViewTestCase {
*/
@Test
public void strictCanDependOnNonStrict() throws Exception {
- useConfiguration("--strict_proto_deps=strict");
+ useConfiguration("--proto_compiler=//proto:compiler", "--strict_proto_deps=strict");
scratch.file(
"x/BUILD",
"proto_library(name = 'foo', deps = [':bar'], strict_proto_deps=1)",