diff options
author | 2017-10-21 04:06:39 +0200 | |
---|---|---|
committer | 2017-10-23 17:16:18 +0200 | |
commit | 9cc97513839442ac13fe10ab84e103e127e36987 (patch) | |
tree | c3bc0aa44c7df12e85cc857d9d614b9a7ec12d8f /src/main/java/com/google/devtools/build/lib/rules/nativedeps | |
parent | 89d13b8810bfe9216ed1746a28b83d636183c1c7 (diff) |
Add support for linker scripts in auto-linked Android native deps
Android's mechanism for automatically linking native deps does not currently support linker scripts. A dependency cc_library can specify the linker script in the linkopts and include it in its deps, but since the artifact is not provided as an input to the generated link action, this results in an error. This change provides the missing inputs and makes this work.
RELNOTES: Support for linker scripts in NativeDepsHelper (e.g., android_binary)
PiperOrigin-RevId: 172963605
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/nativedeps')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/rules/nativedeps/NativeDepsHelper.java | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/nativedeps/NativeDepsHelper.java b/src/main/java/com/google/devtools/build/lib/rules/nativedeps/NativeDepsHelper.java index 2c8cf58886..83f1be8491 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/nativedeps/NativeDepsHelper.java +++ b/src/main/java/com/google/devtools/build/lib/rules/nativedeps/NativeDepsHelper.java @@ -232,6 +232,12 @@ public abstract class NativeDepsHelper { ltoBitcodeFilesMap.putAll(lib.getLtoBitcodeFiles()); } } + + Iterable<Artifact> nonCodeInputs = linkParams.getNonCodeInputs(); + if (nonCodeInputs == null) { + nonCodeInputs = ImmutableList.of(); + } + builder .setLinkArtifactFactory(SHAREABLE_LINK_ARTIFACT_FACTORY) .setCrosstoolInputs(toolchain.getLink()) @@ -242,7 +248,8 @@ public abstract class NativeDepsHelper { .addLinkopts(linkopts) .setNativeDeps(true) .addLinkstamps(linkstamps) - .addLtoBitcodeFiles(ltoBitcodeFilesMap.build()); + .addLtoBitcodeFiles(ltoBitcodeFilesMap.build()) + .addNonCodeInputs(nonCodeInputs); if (!builder.getLtoBitcodeFiles().isEmpty() && featureConfiguration.isEnabled(CppRuleClasses.THIN_LTO)) { |