diff options
author | 2016-08-19 15:36:26 +0000 | |
---|---|---|
committer | 2016-08-22 08:11:09 +0000 | |
commit | f8bb0b434ecfa87ef79b553eeed498a2614a6b0d (patch) | |
tree | 8e49f8cb4b65fd634a4b86b4aeedfd00e0f40a12 /src/main/java/com/google/devtools/build | |
parent | 3d97e2245dbbd34d3428218e745a3770c6d1c0ee (diff) |
Enables support for compiling generated proto files (as in genrules).
--
MOS_MIGRATED_REVID=130755375
Diffstat (limited to 'src/main/java/com/google/devtools/build')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/rules/objc/ProtobufSupport.java | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/ProtobufSupport.java b/src/main/java/com/google/devtools/build/lib/rules/objc/ProtobufSupport.java index 40c98124fd..d8efbfbf8a 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/objc/ProtobufSupport.java +++ b/src/main/java/com/google/devtools/build/lib/rules/objc/ProtobufSupport.java @@ -479,7 +479,7 @@ final class ProtobufSupport { // Sort the file names to make the remote action key independent of the precise deps structure. // compile_protos.py will sort the input list anyway. Iterable<Artifact> sorted = Ordering.natural().immutableSortedCopy(outputProtos); - return Artifact.joinExecPaths("\n", sorted); + return Artifact.joinRootRelativePaths("\n", sorted); } private CustomCommandLine getGenerationCommandLine(Artifact protoInputsFile) { @@ -491,11 +491,20 @@ final class ProtobufSupport { .add(getWorkspaceRelativeOutputDir().getSafePathString()) .add("--force") .add("--proto-root-dir") + .add(getGenfilesPathString()) + .add("--proto-root-dir") .add(".") .addBeforeEachExecPath("--config", getPortableProtoFilters()) .build(); } + private String getGenfilesPathString() { + if (buildConfiguration != null) { + return buildConfiguration.getGenfilesDirectory().getExecPathString(); + } + return ruleContext.getConfiguration().getGenfilesDirectory().getExecPathString(); + } + private PathFragment getWorkspaceRelativeOutputDir() { // Generate sources in a package-and-rule-scoped directory; adds both the // package-and-rule-scoped directory and the header-containing-directory to the include path |