diff options
author | tomlu <tomlu@google.com> | 2017-08-14 18:13:46 +0200 |
---|---|---|
committer | Irina Iancu <elenairina@google.com> | 2017-08-16 11:03:51 +0200 |
commit | 86f6dc25a6ce8e50ce237c19a434d4e871fd0f73 (patch) | |
tree | 612c31b3b574ccb8c0948908a8011571c53dca5c /src/test/java/com/google/devtools/build/lib/rules/objc | |
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/test/java/com/google/devtools/build/lib/rules/objc')
-rw-r--r-- | src/test/java/com/google/devtools/build/lib/rules/objc/ObjcRuleTestCase.java | 30 |
1 files changed, 12 insertions, 18 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/rules/objc/ObjcRuleTestCase.java b/src/test/java/com/google/devtools/build/lib/rules/objc/ObjcRuleTestCase.java index 41927eb6bf..0b2fe6d22e 100644 --- a/src/test/java/com/google/devtools/build/lib/rules/objc/ObjcRuleTestCase.java +++ b/src/test/java/com/google/devtools/build/lib/rules/objc/ObjcRuleTestCase.java @@ -2160,10 +2160,9 @@ public abstract class ObjcRuleTestCase extends BuildViewTestCase { .containsExactlyElementsIn( new Builder() .add(MOCK_IBTOOLWRAPPER_PATH) - .add(storyboardZip.getExecPathString()) - .add(archiveRoot) // archive root - .add("--minimum-deployment-target") - .add(minimumOsVersion.toString()) + .add(storyboardZip) + .addDynamicString(archiveRoot) // archive root + .add("--minimum-deployment-target", minimumOsVersion.toString()) .add("--module") .add("x") .add(VectorArg.of(targetDevices).beforeEach("--target-device")) @@ -2184,10 +2183,9 @@ public abstract class ObjcRuleTestCase extends BuildViewTestCase { .containsExactlyElementsIn( new Builder() .add(MOCK_IBTOOLWRAPPER_PATH) - .add(storyboardZip.getExecPathString()) - .add(archiveRoot) // archive root - .add("--minimum-deployment-target") - .add(minimumOsVersion.toString()) + .add(storyboardZip) + .addDynamicString(archiveRoot) // archive root + .add("--minimum-deployment-target", minimumOsVersion.toString()) .add("--module") .add("x") .add(VectorArg.of(targetDevices).beforeEach("--target-device")) @@ -2218,18 +2216,14 @@ public abstract class ObjcRuleTestCase extends BuildViewTestCase { CustomCommandLine.builder().add(MOCK_SWIFTSTDLIBTOOLWRAPPER_PATH); if (toolchain != null) { - expectedCommandLine.add("--toolchain").add(toolchain); + expectedCommandLine.add("--toolchain", toolchain); } expectedCommandLine - .add("--output_zip_path") - .add(swiftLibsZip.getExecPathString()) - .add("--bundle_path") - .add(bundlePath) - .add("--platform") - .add(platformName) - .add("--scan-executable") - .add(binary.getExecPathString()); + .add("--output_zip_path", swiftLibsZip) + .add("--bundle_path", bundlePath) + .add("--platform", platformName) + .add("--scan-executable", binary); assertThat(toolAction.getArguments()).isEqualTo(expectedCommandLine.build().arguments()); } @@ -3879,7 +3873,7 @@ public abstract class ObjcRuleTestCase extends BuildViewTestCase { .isEqualTo( new CustomCommandLine.Builder() .add(MOCK_IBTOOLWRAPPER_PATH) - .add(storyboardZip.getExecPathString()) + .add(storyboardZip) .add("launch.storyboardc") .add("--minimum-deployment-target") .add("8.1") |