diff options
author | 2018-02-20 06:26:33 -0800 | |
---|---|---|
committer | 2018-02-20 06:27:57 -0800 | |
commit | 5deca4cf88f5568771f2c836a9b8c693b88bd749 (patch) | |
tree | 1ab038e4bf10301e0e8878c21e9693091b78e304 /src/test/java/com/google/devtools/build/lib | |
parent | 9ac10696da052d1327b3f1cd276b2ab50fe1fee1 (diff) |
Accept proto paths relative to proto_source_root as direct dependencies.
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: 186294997
Diffstat (limited to 'src/test/java/com/google/devtools/build/lib')
-rw-r--r-- | src/test/java/com/google/devtools/build/lib/rules/proto/ProtoCompileActionBuilderTest.java | 15 |
1 files changed, 14 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 9881b194b3..7cb4912a27 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>emptySet(STABLE_ORDER), true /* hasProtoSources */); 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 { NestedSetBuilder.<Artifact>emptySet(STABLE_ORDER) /* protosInDirectDeps */, NestedSetBuilder.<Artifact>emptySet(STABLE_ORDER) /* transitiveImports */, /*transitiveProtoPathFlags=*/ NestedSetBuilder.<String>emptySet(STABLE_ORDER), + /*directProtoSourceRoots=*/ NestedSetBuilder.<String>emptySet(STABLE_ORDER), true /* hasProtoSources */); 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>emptySet(STABLE_ORDER), true /* hasProtoSources */); 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 { NestedSetBuilder.<Artifact>emptySet(STABLE_ORDER) /* protosInDirectDeps */, NestedSetBuilder.<Artifact>emptySet(STABLE_ORDER), /*transitiveProtoPathFlags=*/ NestedSetBuilder.<String>emptySet(STABLE_ORDER), + /*directProtoSourceRoots=*/ NestedSetBuilder.<String>emptySet(STABLE_ORDER), true /* hasProtoSources */); 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 { NestedSetBuilder.<Artifact>emptySet(STABLE_ORDER) /* protosInDirectDeps */, NestedSetBuilder.<Artifact>emptySet(STABLE_ORDER), /*transitiveProtoPathFlags=*/ NestedSetBuilder.<String>emptySet(STABLE_ORDER), + /*directProtoSourceRoots=*/ NestedSetBuilder.<String>emptySet(STABLE_ORDER), true /* hasProtoSources */); 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 { NestedSetBuilder.<Artifact>emptySet(STABLE_ORDER) /* protosInDirectDeps */, NestedSetBuilder.<Artifact>emptySet(STABLE_ORDER), /*transitiveProtoPathFlags=*/ NestedSetBuilder.<String>emptySet(STABLE_ORDER), + /*directProtoSourceRoots=*/ NestedSetBuilder.<String>emptySet(STABLE_ORDER), true /* hasProtoSources */); 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,8 @@ 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(); } } |