aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/rules/proto/ProtoCompileActionBuilder.java
diff options
context:
space:
mode:
authorGravatar Mike Lewis <lewis@squareup.com>2018-03-01 08:19:14 -0800
committerGravatar Copybara-Service <copybara-piper@google.com>2018-03-01 08:20:42 -0800
commitf43df1e29765f75e02838e4139417e914b3ee812 (patch)
tree5f366006c984984aab58d70b1d091dc94b60a627 /src/main/java/com/google/devtools/build/lib/rules/proto/ProtoCompileActionBuilder.java
parent940dbc531bf79907806bcf4f09543b3a2468d9b1 (diff)
Fixing issue with external j2objc protos
The output files are created without a repository, but the expected filenames have them This resolves issues when having a proto_library from an external build file. This seems to be a regression, so maybe should go into the 0.8.0 branch? Note: Work at Square and we have a signed CLA with google Note, without this fix we get errors like ``` ERROR: /private/var/tmp/_bazel_lewis/4a25cfc2b9b758043413ac58525ef6b4/external/AllProtos/BUILD.bazel:27:1: output 'external/AllProtos/squareup/objc/objc.j2objc.pb.m' was not created ERROR: /private/var/tmp/_bazel_lewis/4a25cfc2b9b758043413ac58525ef6b4/external/AllProtos/BUILD.bazel:27:1: output 'external/AllProtos/squareup/objc/objc.j2objc.pb.h' was not created ``` Closes #4058. PiperOrigin-RevId: 187480864
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.java23
1 files changed, 6 insertions, 17 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 6fdcc040f0..c0767acdf0 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
@@ -611,26 +611,15 @@ public class ProtoCompileActionBuilder {
}
private static void expandTransitiveImportArg(Artifact artifact, Consumer<String> args) {
- args.accept("-I" + getPathIgnoringRepository(artifact) + "=" + artifact.getExecPathString());
+ args.accept(
+ "-I"
+ + ProtoCommon.getPathIgnoringRepository(artifact).toString()
+ + "="
+ + artifact.getExecPathString());
}
private static void expandToPathIgnoringRepository(Artifact artifact, Consumer<String> args) {
- args.accept(getPathIgnoringRepository(artifact));
- }
-
- /**
- * Gets the artifact's path relative to the root, ignoring the external repository the artifact is
- * at. For example, <code>
- * //a:b.proto --> a/b.proto
- * {@literal @}foo//a:b.proto --> a/b.proto
- * </code>
- */
- private static String getPathIgnoringRepository(Artifact artifact) {
- return artifact
- .getRootRelativePath()
- .relativeTo(
- artifact.getOwnerLabel().getPackageIdentifier().getRepository().getPathUnderExecRoot())
- .toString();
+ args.accept(ProtoCommon.getPathIgnoringRepository(artifact).toString());
}
/**