aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/rules/proto/ProtoCompileActionBuilder.java
diff options
context:
space:
mode:
authorGravatar ahumesky <ahumesky@google.com>2018-02-21 15:48:03 -0800
committerGravatar Copybara-Service <copybara-piper@google.com>2018-02-21 15:50:10 -0800
commitcfb8a74908459d839c755abcc1c68bfa2ed25f2a (patch)
treeeb086f1c09d4a5d41d8d851e034a8c2229a7a0ec /src/main/java/com/google/devtools/build/lib/rules/proto/ProtoCompileActionBuilder.java
parentae24bfef708540b0e34744f98528d8e485052714 (diff)
PiperOrigin-RevId: 186532302
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/proto/ProtoCompileActionBuilder.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/proto/ProtoCompileActionBuilder.java37
1 files changed, 3 insertions, 34 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/proto/ProtoCompileActionBuilder.java b/src/main/java/com/google/devtools/build/lib/rules/proto/ProtoCompileActionBuilder.java
index 015c02c3f0..374bf9b9fe 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/proto/ProtoCompileActionBuilder.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/proto/ProtoCompileActionBuilder.java
@@ -322,7 +322,6 @@ public class ProtoCompileActionBuilder {
addIncludeMapArguments(
result,
areDepsStrict ? supportData.getProtosInDirectDeps() : null,
- supportData.getDirectProtoSourceRoots(),
supportData.getTransitiveImports());
if (areDepsStrict) {
@@ -361,8 +360,7 @@ public class ProtoCompileActionBuilder {
Artifact output,
boolean allowServices,
NestedSet<Artifact> transitiveDescriptorSets,
- NestedSet<String> protoSourceRoots,
- NestedSet<String> directProtoSourceRoots) {
+ NestedSet<String> protoSourceRoots) {
if (protosToCompile.isEmpty()) {
ruleContext.registerAction(
FileWriteAction.createEmptyWithInputs(
@@ -378,7 +376,6 @@ public class ProtoCompileActionBuilder {
transitiveSources,
protosInDirectDeps,
protoSourceRoots,
- directProtoSourceRoots,
ruleContext.getLabel(),
ImmutableList.of(output),
"Descriptor Set",
@@ -426,7 +423,6 @@ public class ProtoCompileActionBuilder {
NestedSet<Artifact> transitiveSources,
NestedSet<Artifact> protosInDirectDeps,
NestedSet<String> protoSourceRoots,
- NestedSet<String> directProtoSourceRoots,
Label ruleLabel,
Iterable<Artifact> outputs,
String flavorName,
@@ -439,7 +435,6 @@ public class ProtoCompileActionBuilder {
transitiveSources,
protosInDirectDeps,
protoSourceRoots,
- directProtoSourceRoots,
ruleLabel,
outputs,
flavorName,
@@ -457,7 +452,6 @@ public class ProtoCompileActionBuilder {
NestedSet<Artifact> transitiveSources,
@Nullable NestedSet<Artifact> protosInDirectDeps,
NestedSet<String> protoSourceRoots,
- NestedSet<String> directProtoSourceRoots,
Label ruleLabel,
Iterable<Artifact> outputs,
String flavorName,
@@ -493,7 +487,6 @@ public class ProtoCompileActionBuilder {
protosToCompile,
transitiveSources,
protoSourceRoots,
- directProtoSourceRoots,
areDepsStrict(ruleContext) ? protosInDirectDeps : null,
ruleLabel,
allowServices,
@@ -531,13 +524,11 @@ public class ProtoCompileActionBuilder {
Iterable<Artifact> protosToCompile,
NestedSet<Artifact> transitiveSources,
NestedSet<String> transitiveProtoPathFlags,
- NestedSet<String> directProtoSourceRoots,
@Nullable NestedSet<Artifact> protosInDirectDeps,
Label ruleLabel,
boolean allowServices,
ImmutableList<String> protocOpts) {
CustomCommandLine.Builder cmdLine = CustomCommandLine.builder();
- cmdLine.addAll(transitiveProtoPathFlags);
cmdLine.addAll(transitiveProtoPathFlags);
@@ -574,7 +565,7 @@ public class ProtoCompileActionBuilder {
cmdLine.addAll(protocOpts);
// Add include maps
- addIncludeMapArguments(cmdLine, protosInDirectDeps, directProtoSourceRoots, transitiveSources);
+ addIncludeMapArguments(cmdLine, protosInDirectDeps, transitiveSources);
if (protosInDirectDeps != null) {
cmdLine.addFormatted(STRICT_DEPS_FLAG_TEMPLATE, ruleLabel);
@@ -595,7 +586,6 @@ public class ProtoCompileActionBuilder {
static void addIncludeMapArguments(
CustomCommandLine.Builder commandLine,
@Nullable NestedSet<Artifact> protosInDirectDependencies,
- NestedSet<String> directProtoSourceRoots,
NestedSet<Artifact> transitiveImports) {
commandLine.addAll(
VectorArg.of(transitiveImports)
@@ -606,14 +596,7 @@ public class ProtoCompileActionBuilder {
"--direct_dependencies",
VectorArg.join(":")
.each(protosInDirectDependencies)
- .mapped((Artifact proto, Consumer<String> args) -> {
- for (String directProtoSourceRoot : directProtoSourceRoots) {
- expandToPathIgnoringSourceRoot(proto, directProtoSourceRoot, args);
- }
- expandToPathIgnoringRepository(proto, args);
- })
- );
-
+ .mapped(ProtoCompileActionBuilder::expandToPathIgnoringRepository));
} else {
// The proto compiler requires an empty list to turn on strict deps checking
commandLine.add("--direct_dependencies=");
@@ -644,20 +627,6 @@ public class ProtoCompileActionBuilder {
.toString();
}
- private static void expandToPathIgnoringSourceRoot(
- Artifact artifact, String directProtoSourceRoot, Consumer<String> args) {
- try {
- String relativePath = artifact.getRootRelativePath()
- .relativeTo(
- artifact.getOwnerLabel().getPackageIdentifier().getRepository().getPathUnderExecRoot())
- .relativeTo(directProtoSourceRoot)
- .toString();
- args.accept(relativePath);
- } catch (IllegalArgumentException exception) {
- // do nothing
- }
- }
-
/**
* Describes a toolchain and the value to replace for a $(OUT) that might appear in its
* commandLine() (e.g., "bazel-out/foo.srcjar").