aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test/java/com/google
diff options
context:
space:
mode:
authorGravatar Googler <noreply@google.com>2018-07-09 12:16:24 -0700
committerGravatar Copybara-Service <copybara-piper@google.com>2018-07-09 12:18:00 -0700
commite8956648d1c94a3a51e1aba5d229d1f27bdf8e35 (patch)
treef0549f7f73ceeefc1635e4f2f746da14b096e3ef /src/test/java/com/google
parent68e92b45a37f2142c768a56eb7ecfa484b8b22df (diff)
[Reland] Accept proto paths relative to proto_source_root as direct dependencies.
This is a reland of https://github.com/bazelbuild/bazel/commit/5deca4cf88f5568771f2c836a9b8c693b88bd749. This will make protoc see as direct dependencies the .proto files that were included using the proto_source_root flag. Until now, Bazel passed to protoc the direct dependencies of a target as the path relative to the WORKSPACE, which made it fail when a shorter path, relative to the package was used. Progress on #4544. RELNOTES: None. PiperOrigin-RevId: 203808292
Diffstat (limited to 'src/test/java/com/google')
-rw-r--r--src/test/java/com/google/devtools/build/lib/rules/proto/ProtoCompileActionBuilderTest.java17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/rules/proto/ProtoCompileActionBuilderTest.java b/src/test/java/com/google/devtools/build/lib/rules/proto/ProtoCompileActionBuilderTest.java
index e33ed9a47e..1e2311fa84 100644
--- a/src/test/java/com/google/devtools/build/lib/rules/proto/ProtoCompileActionBuilderTest.java
+++ b/src/test/java/com/google/devtools/build/lib/rules/proto/ProtoCompileActionBuilderTest.java
@@ -83,6 +83,7 @@ public class ProtoCompileActionBuilderTest {
artifact("//:dont-care", "import1.proto"),
artifact("//:dont-care", "import2.proto")),
/*transitiveProtoPathFlags=*/ NestedSetBuilder.<String>emptySet(STABLE_ORDER),
+ /*directProtoSourceRoots=*/ NestedSetBuilder.<String>stableOrder().build(),
/* hasProtoSources= */ true);
CustomCommandLine cmdLine =
@@ -94,6 +95,7 @@ public class ProtoCompileActionBuilderTest {
supportData.getDirectProtoSources(),
supportData.getTransitiveImports(),
/*transitiveProtoPathFlags=*/ NestedSetBuilder.<String>stableOrder().build(),
+ /*directProtoSourceRoots=*/ NestedSetBuilder.<String>stableOrder().build(),
null /* protosInDirectDeps */,
Label.parseAbsoluteUnchecked("//foo:bar"),
true /* allowServices */,
@@ -120,6 +122,7 @@ public class ProtoCompileActionBuilderTest {
/* protosInDirectDeps= */ NestedSetBuilder.<Artifact>emptySet(STABLE_ORDER),
/* transitiveImports= */ NestedSetBuilder.<Artifact>emptySet(STABLE_ORDER),
/*transitiveProtoPathFlags=*/ NestedSetBuilder.<String>emptySet(STABLE_ORDER),
+ /*directProtoSourceRoots=*/ NestedSetBuilder.<String>stableOrder().build(),
/* hasProtoSources= */ true);
CustomCommandLine cmdLine =
@@ -128,6 +131,7 @@ public class ProtoCompileActionBuilderTest {
supportData.getDirectProtoSources(),
supportData.getTransitiveImports(),
/*transitiveProtoPathFlags=*/ NestedSetBuilder.<String>emptySet(STABLE_ORDER),
+ /*directProtoSourceRoots=*/ NestedSetBuilder.<String>emptySet(STABLE_ORDER),
null /* protosInDirectDeps */,
Label.parseAbsoluteUnchecked("//foo:bar"),
true /* allowServices */,
@@ -155,6 +159,7 @@ public class ProtoCompileActionBuilderTest {
artifact("//:dont-care", "import1.proto"),
artifact("//:dont-care", "import2.proto")),
/*transitiveProtoPathFlags=*/ NestedSetBuilder.<String>emptySet(STABLE_ORDER),
+ /*directProtoSourceRoots=*/ NestedSetBuilder.<String>stableOrder().build(),
/* hasProtoSources= */ true);
CustomCommandLine cmdLine =
@@ -163,6 +168,7 @@ public class ProtoCompileActionBuilderTest {
supportData.getDirectProtoSources(),
supportData.getTransitiveImports(),
/*transitiveProtoPathFlags=*/ NestedSetBuilder.<String>emptySet(STABLE_ORDER),
+ /*directProtoSourceRoots=*/ NestedSetBuilder.<String>emptySet(STABLE_ORDER),
supportData.getProtosInDirectDeps(),
Label.parseAbsoluteUnchecked("//foo:bar"),
true /* allowServices */,
@@ -189,6 +195,7 @@ public class ProtoCompileActionBuilderTest {
/* protosInDirectDeps= */ NestedSetBuilder.<Artifact>emptySet(STABLE_ORDER),
NestedSetBuilder.<Artifact>emptySet(STABLE_ORDER),
/*transitiveProtoPathFlags=*/ NestedSetBuilder.<String>emptySet(STABLE_ORDER),
+ /*directProtoSourceRoots=*/ NestedSetBuilder.<String>stableOrder().build(),
/* hasProtoSources= */ true);
CustomCommandLine cmdLine =
@@ -197,6 +204,7 @@ public class ProtoCompileActionBuilderTest {
supportData.getDirectProtoSources(),
supportData.getTransitiveImports(),
/*transitiveProtoPathFlags=*/ NestedSetBuilder.<String>emptySet(STABLE_ORDER),
+ /*directProtoSourceRoots=*/ NestedSetBuilder.<String>emptySet(STABLE_ORDER),
supportData.getProtosInDirectDeps(),
Label.parseAbsoluteUnchecked("//foo:bar"),
false /* allowServices */,
@@ -233,6 +241,7 @@ public class ProtoCompileActionBuilderTest {
/* protosInDirectDeps= */ NestedSetBuilder.<Artifact>emptySet(STABLE_ORDER),
NestedSetBuilder.<Artifact>emptySet(STABLE_ORDER),
/*transitiveProtoPathFlags=*/ NestedSetBuilder.<String>emptySet(STABLE_ORDER),
+ /*directProtoSourceRoots=*/ NestedSetBuilder.<String>stableOrder().build(),
/* hasProtoSources= */ true);
CustomCommandLine cmdLine =
@@ -241,6 +250,7 @@ public class ProtoCompileActionBuilderTest {
supportData.getDirectProtoSources(),
supportData.getTransitiveImports(),
/*transitiveProtoPathFlags=*/ NestedSetBuilder.<String>emptySet(STABLE_ORDER),
+ /*directProtoSourceRoots=*/ NestedSetBuilder.<String>emptySet(STABLE_ORDER),
supportData.getProtosInDirectDeps(),
Label.parseAbsoluteUnchecked("//foo:bar"),
true /* allowServices */,
@@ -264,6 +274,7 @@ public class ProtoCompileActionBuilderTest {
/* protosInDirectDeps= */ NestedSetBuilder.<Artifact>emptySet(STABLE_ORDER),
NestedSetBuilder.<Artifact>emptySet(STABLE_ORDER),
/*transitiveProtoPathFlags=*/ NestedSetBuilder.<String>emptySet(STABLE_ORDER),
+ /*directProtoSourceRoots=*/ NestedSetBuilder.<String>stableOrder().build(),
/* hasProtoSources= */ true);
ProtoLangToolchainProvider toolchain1 =
@@ -288,6 +299,7 @@ public class ProtoCompileActionBuilderTest {
supportData.getDirectProtoSources(),
supportData.getTransitiveImports(),
/*transitiveProtoPathFlags=*/ NestedSetBuilder.<String>emptySet(STABLE_ORDER),
+ /*directProtoSourceRoots=*/ NestedSetBuilder.<String>emptySet(STABLE_ORDER),
supportData.getProtosInDirectDeps(),
Label.parseAbsoluteUnchecked("//foo:bar"),
true /* allowServices */,
@@ -383,7 +395,10 @@ public class ProtoCompileActionBuilderTest {
NestedSet<Artifact> transitiveImportsNestedSet =
NestedSetBuilder.wrap(STABLE_ORDER, transitiveImports);
ProtoCompileActionBuilder.addIncludeMapArguments(
- commandLine, protosInDirectDependenciesBuilder, transitiveImportsNestedSet);
+ commandLine,
+ protosInDirectDependenciesBuilder,
+ NestedSetBuilder.emptySet(STABLE_ORDER),
+ transitiveImportsNestedSet);
return commandLine.build().arguments();
}
}