From 86f6dc25a6ce8e50ce237c19a434d4e871fd0f73 Mon Sep 17 00:00:00 2001 From: tomlu Date: Mon, 14 Aug 2017 18:13:46 +0200 Subject: 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 --- .../devtools/build/lib/rules/objc/ProtocolBuffers2Support.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'src/main/java/com/google/devtools/build/lib/rules/objc/ProtocolBuffers2Support.java') 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()) { -- cgit v1.2.3