diff options
author | 2017-08-14 18:13:46 +0200 | |
---|---|---|
committer | 2017-08-16 11:03:51 +0200 | |
commit | 86f6dc25a6ce8e50ce237c19a434d4e871fd0f73 (patch) | |
tree | 612c31b3b574ccb8c0948908a8011571c53dca5c /src/main/java/com/google/devtools/build/lib/rules/objc/ProtocolBuffers2Support.java | |
parent | 55245e478fcfe8b898e39c7462bc975ba7548325 (diff) |
Add @CompileTimeConstant annotations to CustomCommandLine.
This enforces certain memory-efficient patterns. For deliberate use of dynamic strings, explicitly named overloads are introduced, with javadoc that guides the programmer into making the right choice.
This CL is a memory no-op on benchmarks, but it tries to prevent backslide by making sure programmers make conscious choices when they construct their command lines.
RELNOTES: None
PiperOrigin-RevId: 165185997
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/objc/ProtocolBuffers2Support.java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/rules/objc/ProtocolBuffers2Support.java | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/ProtocolBuffers2Support.java b/src/main/java/com/google/devtools/build/lib/rules/objc/ProtocolBuffers2Support.java index 343aa82741..c7c6f8ddee 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/objc/ProtocolBuffers2Support.java +++ b/src/main/java/com/google/devtools/build/lib/rules/objc/ProtocolBuffers2Support.java @@ -156,18 +156,16 @@ final class ProtocolBuffers2Support { private CustomCommandLine getGenerationCommandLine() { CustomCommandLine.Builder commandLineBuilder = new CustomCommandLine.Builder() - .add(attributes.getProtoCompiler().getExecPathString()) + .add(attributes.getProtoCompiler()) .add("--input-file-list") - .add(getProtoInputsFile().getExecPathString()) + .add(getProtoInputsFile()) .add("--output-dir") - .add(getWorkspaceRelativeOutputDir().getSafePathString()) + .addDynamicString(getWorkspaceRelativeOutputDir().getSafePathString()) .add("--working-dir") .add("."); if (attributes.getOptionsFile().isPresent()) { - commandLineBuilder - .add("--compiler-options-path") - .add(attributes.getOptionsFile().get().getExecPathString()); + commandLineBuilder.add("--compiler-options-path").add(attributes.getOptionsFile().get()); } if (attributes.usesObjcHeaderNames()) { |