diff options
author | 2017-04-26 10:40:33 +0200 | |
---|---|---|
committer | 2017-04-26 12:44:27 +0200 | |
commit | bcd23553f38f54fd4846aa507c827a4ee40cfab4 (patch) | |
tree | 24341ed64e6040003b0c3c1ac296d601121ed119 /src/test/java/com/google/devtools | |
parent | 3bd88a6de2e677eaa7280003a5c62aec6f437336 (diff) |
proto_library: Pass exec path to protoc. Fixes #2265
When passing the paths of the proto files to protoc we need to use the exec
path in order to also have correct paths for generated files.
Change-Id: Id85b959829a0b159d30814314af631a90a4bd296
PiperOrigin-RevId: 154272610
Diffstat (limited to 'src/test/java/com/google/devtools')
-rw-r--r-- | src/test/java/com/google/devtools/build/lib/rules/proto/ProtoCompileActionBuilderTest.java | 24 |
1 files changed, 24 insertions, 0 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 72dc9c3489..0f6d3f5dab 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 @@ -106,6 +106,30 @@ public class ProtoCompileActionBuilderTest { } @Test + public void commandline_derivedArtifact() { + // Verify that the command line contains the correct path to a generated protocol buffers. + SupportData supportData = + SupportData.create( + Predicates.<TransitiveInfoCollection>alwaysFalse(), + ImmutableList.of(derivedArtifact("//:dont-care", "source_file.proto")), + NestedSetBuilder.<Artifact>emptySet(STABLE_ORDER) /* protosInDirectDeps */, + NestedSetBuilder.<Artifact>emptySet(STABLE_ORDER) /* transitiveImports */, + true /* hasProtoSources */); + + CustomCommandLine cmdLine = + createCommandLineFromToolchains( + ImmutableList.<ToolchainInvocation>of() /* toolchainInvocations */, + supportData.getDirectProtoSources(), + supportData.getTransitiveImports(), + null /* protosInDirectDeps */, + "//foo:bar", + true /* allowServices */, + ImmutableList.<String>of() /* protocOpts */); + + assertThat(cmdLine.arguments()).containsExactly("out/source_file.proto"); + } + + @Test public void commandLine_strictDeps() throws Exception { ProtoLangToolchainProvider toolchain = ProtoLangToolchainProvider.create( |