diff options
author | asteinb <asteinb@google.com> | 2018-05-22 10:29:28 -0700 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2018-05-22 10:31:00 -0700 |
commit | 88b58112a0379732f052467b51bd868270e46bc7 (patch) | |
tree | 9ac1a392228f9779e58714441409b92e3729ff0b /src/main/java/com/google/devtools/build/lib/rules/android/AndroidDataConverter.java | |
parent | c944b717608fd93c2e8c1f018b6a42cce2813a0e (diff) |
Add additional methods to BusyBoxActionBuilder
Many of the Busybox action building classes rely heavily on RuleContext. While
we're migrating them to AndroidDataContext, we may as well also move them to
use the BusyBoxAxtionBuilder, which removes a lot of boilerplate and makes bad
practices (like collapsing NestedSets) harder to do by accident. The
BusyBoxActionBuilder needs some more methods to cover all the behavior seen in
various action builders, so update it in one change now rather than scattering
these changes across many different reviews.
RELNOTES: none
PiperOrigin-RevId: 197584157
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/android/AndroidDataConverter.java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/rules/android/AndroidDataConverter.java | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidDataConverter.java b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidDataConverter.java index bafc0a85b2..5aaf6cad99 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidDataConverter.java +++ b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidDataConverter.java @@ -21,6 +21,7 @@ import com.google.devtools.build.lib.analysis.actions.CustomCommandLine.VectorAr import com.google.devtools.build.lib.cmdline.Label; import com.google.devtools.build.lib.collect.nestedset.NestedSet; import com.google.devtools.build.lib.vfs.PathFragment; +import com.google.errorprone.annotations.CompileTimeConstant; import java.util.Objects; import java.util.function.Consumer; import java.util.function.Function; @@ -130,6 +131,11 @@ public class AndroidDataConverter<T> extends ParametrizedMapFn<T> { return VectorArg.join(joinerType.listSeparator).each(values).mapped(this); } + public VectorArg<String> getVectorArgForEach( + @CompileTimeConstant String arg, NestedSet<? extends T> values) { + return VectorArg.addBefore(arg).each(values).mapped(this); + } + static class Builder<T> { private final ImmutableList.Builder<Function<T, String>> inner = ImmutableList.builder(); private final JoinerType joinerType; |