diff options
author | 2017-01-27 19:30:34 +0000 | |
---|---|---|
committer | 2017-01-30 09:01:24 +0000 | |
commit | 4a877386b0d647885dbba48714d1be36a36362f4 (patch) | |
tree | f629b9892f5afb7efb2ac37e2817fa87dade3e65 /src/main/java/com/google/devtools/build/lib/rules/android/ApkActionsBuilder.java | |
parent | d7e965a3676026d09bb5450425792571aa257a00 (diff) |
Switch to RunfilesSuppliers for communicating runfiles
ActionSpawn/SpawnAction now deal exclusively in RunfilesSuppliers, manifests
maps are no more.
There is some lingering awkwardness, in particular:
- Manifests still need to be tracked in some places, we can work out if this is
still necessary on a case by case basis.
- Skylark makes actions' runfiles available via 'resolve_command' where they are
consumed by 'action'. I've updated the documentation, though the name isn't
entirely accurate anymore. That being said these interfaces _are_ marked as
experimental, so we _should_ be able to be flexible here.
Overall, I think the benefits consolidating runfiles into suppliers, from both
code cleanliness and performance perspectives (no longer needing to parse
manifests), outweights the awkwardnesses.
RELNOTES: resolve_command/action's input_manifest return/parameter is now list
--
PiperOrigin-RevId: 145817429
MOS_MIGRATED_REVID=145817429
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/android/ApkActionsBuilder.java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/rules/android/ApkActionsBuilder.java | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/ApkActionsBuilder.java b/src/main/java/com/google/devtools/build/lib/rules/android/ApkActionsBuilder.java index c483878551..7b03534760 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/android/ApkActionsBuilder.java +++ b/src/main/java/com/google/devtools/build/lib/rules/android/ApkActionsBuilder.java @@ -16,12 +16,15 @@ package com.google.devtools.build.lib.rules.android; import com.google.common.collect.ImmutableMap; import com.google.devtools.build.lib.actions.Artifact; import com.google.devtools.build.lib.analysis.RuleContext; +import com.google.devtools.build.lib.analysis.Runfiles; +import com.google.devtools.build.lib.analysis.RunfilesSupplierImpl; import com.google.devtools.build.lib.analysis.actions.SpawnAction; import com.google.devtools.build.lib.collect.nestedset.NestedSet; import com.google.devtools.build.lib.rules.android.AndroidConfiguration.ApkSigningMethod; import com.google.devtools.build.lib.rules.java.JavaHelper; import com.google.devtools.build.lib.rules.java.JavaToolchainProvider; import com.google.devtools.build.lib.rules.java.Jvm; +import com.google.devtools.build.lib.util.Pair; import com.google.devtools.build.lib.vfs.PathFragment; import java.util.Map; @@ -189,12 +192,19 @@ public class ApkActionsBuilder { .addInputArgument(javaResourceZip); } - Artifact nativeSymlinks = nativeLibs.createApkBuilderSymlinks(ruleContext); - if (nativeSymlinks != null) { - PathFragment nativeSymlinksDir = nativeSymlinks.getExecPath().getParentDirectory(); + Pair<Artifact, Runfiles> nativeSymlinksManifestAndRunfiles = + nativeLibs.createApkBuilderSymlinks(ruleContext); + if (nativeSymlinksManifestAndRunfiles != null) { + Artifact nativeSymlinksManifest = nativeSymlinksManifestAndRunfiles.first; + Runfiles nativeSymlinksRunfiles = nativeSymlinksManifestAndRunfiles.second; + PathFragment nativeSymlinksDir = nativeSymlinksManifest.getExecPath().getParentDirectory(); actionBuilder - .addInputManifest(nativeSymlinks, nativeSymlinksDir) - .addInput(nativeSymlinks) + .addRunfilesSupplier( + new RunfilesSupplierImpl( + nativeSymlinksDir, + nativeSymlinksRunfiles, + nativeSymlinksManifest)) + .addInput(nativeSymlinksManifest) .addInputs(nativeLibs.getAllNativeLibs()) .addArgument("-nf") // If the native libs are "foo/bar/x86/foo.so", we need to pass "foo/bar" here |