diff options
author | 2016-08-09 15:48:40 +0000 | |
---|---|---|
committer | 2016-08-10 08:36:18 +0000 | |
commit | 5f2ef8d9382f4634f3f10d77f669af3f135bb6e5 (patch) | |
tree | f55465cc481b555c691b98b97b7b81414fda1646 /src/main/java/com/google/devtools/build/lib/rules/cpp/CppModel.java | |
parent | 462edfc6b650b3003bd1dfa8dcd10e953141eb83 (diff) |
Allow extra action inputs and variables extensions to boe propagated to the
CppLinkAction.
--
MOS_MIGRATED_REVID=129753508
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/cpp/CppModel.java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/rules/cpp/CppModel.java | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppModel.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppModel.java index 1c08ea1582..e7e52185a6 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppModel.java +++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppModel.java @@ -80,6 +80,7 @@ public final class CppModel { private final List<String> linkopts = new ArrayList<>(); private LinkTargetType linkType = LinkTargetType.STATIC_LIBRARY; private boolean neverLink; + private final List<Artifact> linkActionInputs = new ArrayList<>(); private boolean allowInterfaceSharedObjects; private boolean createDynamicLibrary = true; private Artifact soImplArtifact; @@ -218,6 +219,14 @@ public final class CppModel { this.neverLink = neverLink; return this; } + + /** + * Adds an artifact to the inputs of any link actions created by this CppModel. + */ + public CppModel addLinkActionInputs(Collection<Artifact> inputs) { + this.linkActionInputs.addAll(inputs); + return this; + } /** * Whether to allow interface dynamic libraries. Note that setting this to true only has an effect @@ -854,7 +863,9 @@ public final class CppModel { .addLTOBitcodeFiles(ccOutputs.getLtoBitcodeFiles()) .setLinkType(linkType) .setLinkStaticness(LinkStaticness.FULLY_STATIC) + .addActionInputs(linkActionInputs) .setLibraryIdentifier(libraryIdentifier) + .addVariablesExtension(variablesExtensions) .setFeatureConfiguration(featureConfiguration) .build(); env.registerAction(maybePicAction); @@ -879,7 +890,9 @@ public final class CppModel { .addLTOBitcodeFiles(ccOutputs.getLtoBitcodeFiles()) .setLinkType(picLinkType) .setLinkStaticness(LinkStaticness.FULLY_STATIC) + .addActionInputs(linkActionInputs) .setLibraryIdentifier(libraryIdentifier) + .addVariablesExtension(variablesExtensions) .setFeatureConfiguration(featureConfiguration) .build(); env.registerAction(picAction); @@ -928,13 +941,15 @@ public final class CppModel { .addLTOBitcodeFiles(ccOutputs.getLtoBitcodeFiles()) .setLinkType(LinkTargetType.DYNAMIC_LIBRARY) .setLinkStaticness(LinkStaticness.DYNAMIC) + .addActionInputs(linkActionInputs) .setLibraryIdentifier(mainLibraryIdentifier) .addLinkopts(linkopts) .addLinkopts(sonameLinkopts) .setRuntimeInputs( CppHelper.getToolchain(ruleContext).getDynamicRuntimeLinkMiddleman(), CppHelper.getToolchain(ruleContext).getDynamicRuntimeLinkInputs()) - .setFeatureConfiguration(featureConfiguration); + .setFeatureConfiguration(featureConfiguration) + .addVariablesExtension(variablesExtensions); if (!ccOutputs.getLtoBitcodeFiles().isEmpty() && featureConfiguration.isEnabled(CppRuleClasses.THIN_LTO)) { |