aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/analysis/actions/CustomCommandLine.java
diff options
context:
space:
mode:
authorGravatar Googler <noreply@google.com>2015-10-16 21:00:41 +0000
committerGravatar Lukacs Berki <lberki@google.com>2015-10-19 08:20:43 +0000
commitb019e5ea0957ec9e0e90fa40a685078e3608a936 (patch)
tree368d1841a0c1401aecb97810fed5cdb57b8a4276 /src/main/java/com/google/devtools/build/lib/analysis/actions/CustomCommandLine.java
parent7637f9cba731e1c93ad3be637f94612a581efe5e (diff)
Trying again with checking for the presence of the "resources" attribute.
Change the resource dependency handling to separate between the transitive and direct resources from libraries. This slightly increases the complexity of resource propagation. The initial algorithm was to simply merge all transitive ResourceContainers together with any new ResourceContainer and propagate them via the AndroidResourcesProvider. The new algorithm is encapsulated inside a new ResourceDependencies class which works as follows: 1. Collect resources from the deps into transitive and direct NestedSets 2. If a rule provides a ResourceContainer, merge the transitive and direct into a new transitive set 3. Export the provider This results having a rule without resources "forward" the merged sets of transitive and direct resources to the next rule. -- MOS_MIGRATED_REVID=105631635
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/analysis/actions/CustomCommandLine.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/analysis/actions/CustomCommandLine.java24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/actions/CustomCommandLine.java b/src/main/java/com/google/devtools/build/lib/analysis/actions/CustomCommandLine.java
index 8eed18804e..584944f0e9 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/actions/CustomCommandLine.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/actions/CustomCommandLine.java
@@ -129,6 +129,22 @@ public final class CustomCommandLine extends CommandLine {
}
}
+ private static final class JoinStringsArg extends ArgvFragment {
+
+ private final String delimiter;
+ private final Iterable<String> strings;
+
+ private JoinStringsArg(String delimiter, Iterable<String> strings) {
+ this.delimiter = delimiter;
+ this.strings = CollectionUtils.makeImmutable(strings);
+ }
+
+ @Override
+ void eval(ImmutableList.Builder<String> builder) {
+ builder.add(Joiner.on(delimiter).join(strings));
+ }
+ }
+
/**
* Arguments that intersperse strings between the items in a sequence. There are two forms of
* interspersing, and either may be used by this implementation:
@@ -261,6 +277,14 @@ public final class CustomCommandLine extends CommandLine {
return this;
}
+ public Builder addJoinStrings(String arg, String delimiter, Iterable<String> strings) {
+ if (arg != null && strings != null) {
+ arguments.add(new ObjectArg(arg));
+ arguments.add(new JoinStringsArg(delimiter, strings));
+ }
+ return this;
+ }
+
public Builder addJoinExecPaths(String arg, String delimiter, Iterable<Artifact> artifacts) {
if (arg != null && artifacts != null) {
arguments.add(new ObjectArg(arg));