diff options
Diffstat (limited to 'src/main/java')
14 files changed, 144 insertions, 47 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/bazel/rules/java/BazelJavaBinaryRule.java b/src/main/java/com/google/devtools/build/lib/bazel/rules/java/BazelJavaBinaryRule.java index 0c626e7340..4364f9ed45 100644 --- a/src/main/java/com/google/devtools/build/lib/bazel/rules/java/BazelJavaBinaryRule.java +++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/java/BazelJavaBinaryRule.java @@ -26,6 +26,7 @@ import com.google.devtools.build.lib.packages.Attribute; import com.google.devtools.build.lib.packages.AttributeMap; import com.google.devtools.build.lib.packages.RuleClass; import com.google.devtools.build.lib.packages.RuleClass.Builder; +import com.google.devtools.build.lib.rules.cpp.CppConfiguration; import com.google.devtools.build.lib.rules.java.JavaConfiguration; /** @@ -40,7 +41,7 @@ public final class BazelJavaBinaryRule implements RuleDefinition { <code>Main.java</code>, then your name could be <code>Main</code>. <!-- #END_BLAZE_RULE.NAME --> */ return builder - .requiresConfigurationFragments(JavaConfiguration.class) + .requiresConfigurationFragments(JavaConfiguration.class, CppConfiguration.class) /* <!-- #BLAZE_RULE(java_binary).IMPLICIT_OUTPUTS --> <ul> <li><code><var>name</var>.jar</code>: A Java archive, containing the class files and other diff --git a/src/main/java/com/google/devtools/build/lib/bazel/rules/java/BazelJavaTestRule.java b/src/main/java/com/google/devtools/build/lib/bazel/rules/java/BazelJavaTestRule.java index 16546a03e2..19e9ab806b 100644 --- a/src/main/java/com/google/devtools/build/lib/bazel/rules/java/BazelJavaTestRule.java +++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/java/BazelJavaTestRule.java @@ -30,6 +30,7 @@ import com.google.devtools.build.lib.packages.RuleClass; import com.google.devtools.build.lib.packages.RuleClass.Builder; import com.google.devtools.build.lib.packages.RuleClass.Builder.RuleClassType; import com.google.devtools.build.lib.packages.TriState; +import com.google.devtools.build.lib.rules.cpp.CppConfiguration; import com.google.devtools.build.lib.rules.java.JavaConfiguration; import com.google.devtools.build.lib.rules.java.JavaSemantics; @@ -50,7 +51,7 @@ public final class BazelJavaTestRule implements RuleDefinition { </ul> <!-- #END_BLAZE_RULE.IMPLICIT_OUTPUTS --> */ return builder - .requiresConfigurationFragments(JavaConfiguration.class) + .requiresConfigurationFragments(JavaConfiguration.class, CppConfiguration.class) .setImplicitOutputsFunction(BazelJavaRuleClasses.JAVA_BINARY_IMPLICIT_OUTPUTS) // Proguard can be run over java_test targets using the --java_optimization_mode flag. // Primarily this is intended to help test changes to Proguard. diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcBinary.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcBinary.java index 1791dcfe30..5e79a11e18 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcBinary.java +++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcBinary.java @@ -95,6 +95,7 @@ public abstract class CcBinary implements RuleConfiguredTargetFactory { private static Runfiles collectRunfiles( RuleContext context, + FeatureConfiguration featureConfiguration, CcToolchainProvider toolchain, CcLinkingOutputs linkingOutputs, CcLinkingOutputs ccLibraryLinkingOutputs, @@ -117,7 +118,7 @@ public abstract class CcBinary implements RuleConfiguredTargetFactory { builder.add(context, runfilesMapping); // Add the C++ runtime libraries if linking them dynamically. if (linkStaticness == LinkStaticness.DYNAMIC) { - builder.addTransitiveArtifacts(toolchain.getDynamicRuntimeLinkInputs()); + builder.addTransitiveArtifacts(toolchain.getDynamicRuntimeLinkInputs(featureConfiguration)); } if (linkCompileOutputSeparately) { builder.addArtifacts( @@ -299,17 +300,17 @@ public abstract class CcBinary implements RuleConfiguredTargetFactory { if (linkStaticness == LinkStaticness.DYNAMIC) { linkActionBuilder.setRuntimeInputs( ArtifactCategory.DYNAMIC_LIBRARY, - ccToolchain.getDynamicRuntimeLinkMiddleman(), - ccToolchain.getDynamicRuntimeLinkInputs()); + ccToolchain.getDynamicRuntimeLinkMiddleman(featureConfiguration), + ccToolchain.getDynamicRuntimeLinkInputs(featureConfiguration)); } else { linkActionBuilder.setRuntimeInputs( ArtifactCategory.STATIC_LIBRARY, - ccToolchain.getStaticRuntimeLinkMiddleman(), - ccToolchain.getStaticRuntimeLinkInputs()); + ccToolchain.getStaticRuntimeLinkMiddleman(featureConfiguration), + ccToolchain.getStaticRuntimeLinkInputs(featureConfiguration)); // Only force a static link of libgcc if static runtime linking is enabled (which // can't be true if runtimeInputs is empty). // TODO(bazel-team): Move this to CcToolchain. - if (!ccToolchain.getStaticRuntimeLinkInputs().isEmpty()) { + if (!ccToolchain.getStaticRuntimeLinkInputs(featureConfiguration).isEmpty()) { linkActionBuilder.addLinkopt("-static-libgcc"); } } @@ -466,6 +467,7 @@ public abstract class CcBinary implements RuleConfiguredTargetFactory { Runfiles runfiles = collectRunfiles( ruleContext, + featureConfiguration, ccToolchain, linkingOutputs, ccLinkingOutputs, diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcCommon.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcCommon.java index 8db2bd3ba3..ddb240bf5a 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcCommon.java +++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcCommon.java @@ -704,6 +704,7 @@ public final class CcCommon { ImmutableSet<String> requestedFeatures, ImmutableSet<String> unsupportedFeatures, CcToolchainProvider toolchain) { + ImmutableSet.Builder<String> allRequestedFeaturesBuilder = ImmutableSet.builder(); ImmutableSet.Builder<String> unsupportedFeaturesBuilder = ImmutableSet.builder(); unsupportedFeaturesBuilder.addAll(unsupportedFeatures); unsupportedFeaturesBuilder.addAll(ruleContext.getDisabledFeatures()); @@ -716,8 +717,13 @@ public final class CcCommon { if (toolchain.getCcCompilationContextInfo().getCppModuleMap() == null) { unsupportedFeaturesBuilder.add(CppRuleClasses.MODULE_MAPS); } + if (toolchain.supportsEmbeddedRuntimes()) { + allRequestedFeaturesBuilder.add(CppRuleClasses.STATIC_LINK_CPP_RUNTIMES); + } else { + unsupportedFeaturesBuilder.add(CppRuleClasses.STATIC_LINK_CPP_RUNTIMES); + } + ImmutableSet<String> allUnsupportedFeatures = unsupportedFeaturesBuilder.build(); - ImmutableSet.Builder<String> allRequestedFeaturesBuilder = ImmutableSet.builder(); // If STATIC_LINK_MSVCRT feature isn't specified by user, we add DYNAMIC_LINK_MSVCRT_* feature // according to compilation mode. diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcLibrary.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcLibrary.java index 2bc00bbf5e..88e3cb32d1 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcLibrary.java +++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcLibrary.java @@ -66,10 +66,13 @@ public abstract class CcLibrary implements RuleConfiguredTargetFactory { CppFileTypes.ALWAYS_LINK_LIBRARY, CppFileTypes.ALWAYS_LINK_PIC_LIBRARY, CppFileTypes.SHARED_LIBRARY, CppFileTypes.VERSIONED_SHARED_LIBRARY); - private static Runfiles collectRunfiles(RuleContext context, + private static Runfiles collectRunfiles( + RuleContext context, + FeatureConfiguration featureConfiguration, CcLinkingOutputs ccLinkingOutputs, CcToolchainProvider ccToolchain, - boolean neverLink, boolean addDynamicRuntimeInputArtifactsToRunfiles, + boolean neverLink, + boolean addDynamicRuntimeInputArtifactsToRunfiles, boolean linkingStatically) { Runfiles.Builder builder = new Runfiles.Builder( context.getWorkspaceName(), context.getConfiguration().legacyExternalRunfiles()); @@ -83,7 +86,7 @@ public abstract class CcLibrary implements RuleConfiguredTargetFactory { builder.addDataDeps(context); if (addDynamicRuntimeInputArtifactsToRunfiles) { - builder.addTransitiveArtifacts(ccToolchain.getDynamicRuntimeLinkInputs()); + builder.addTransitiveArtifacts(ccToolchain.getDynamicRuntimeLinkInputs(featureConfiguration)); } return builder.build(); } @@ -314,10 +317,24 @@ public abstract class CcLibrary implements RuleConfiguredTargetFactory { } NestedSet<Artifact> filesToBuild = filesBuilder.build(); - Runfiles staticRunfiles = collectRunfiles(ruleContext, linkingOutputs, ccToolchain, - neverLink, addDynamicRuntimeInputArtifactsToRunfiles, true); - Runfiles sharedRunfiles = collectRunfiles(ruleContext, linkingOutputs, ccToolchain, - neverLink, addDynamicRuntimeInputArtifactsToRunfiles, false); + Runfiles staticRunfiles = + collectRunfiles( + ruleContext, + featureConfiguration, + linkingOutputs, + ccToolchain, + neverLink, + addDynamicRuntimeInputArtifactsToRunfiles, + true); + Runfiles sharedRunfiles = + collectRunfiles( + ruleContext, + featureConfiguration, + linkingOutputs, + ccToolchain, + neverLink, + addDynamicRuntimeInputArtifactsToRunfiles, + false); List<Artifact> instrumentedObjectFiles = new ArrayList<>(); instrumentedObjectFiles.addAll(compilationInfo.getCcCompilationOutputs().getObjectFiles(false)); diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcLinkingHelper.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcLinkingHelper.java index 12257baa8d..3b85d35add 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcLinkingHelper.java +++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcLinkingHelper.java @@ -880,8 +880,8 @@ public final class CcLinkingHelper { .addLinkopts(sonameLinkopts) .setRuntimeInputs( ArtifactCategory.DYNAMIC_LIBRARY, - ccToolchain.getDynamicRuntimeLinkMiddleman(), - ccToolchain.getDynamicRuntimeLinkInputs()) + ccToolchain.getDynamicRuntimeLinkMiddleman(featureConfiguration), + ccToolchain.getDynamicRuntimeLinkInputs(featureConfiguration)) .addVariablesExtensions(variablesExtensions); if (featureConfiguration.isEnabled(CppRuleClasses.TARGETS_WINDOWS)) { diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcToolchainProvider.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcToolchainProvider.java index e5b853ba6a..1b08e173e3 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcToolchainProvider.java +++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcToolchainProvider.java @@ -29,6 +29,7 @@ import com.google.devtools.build.lib.collect.nestedset.NestedSetBuilder; import com.google.devtools.build.lib.collect.nestedset.Order; import com.google.devtools.build.lib.concurrent.ThreadSafety.Immutable; import com.google.devtools.build.lib.events.Location; +import com.google.devtools.build.lib.rules.cpp.CcToolchainFeatures.FeatureConfiguration; import com.google.devtools.build.lib.rules.cpp.CcToolchainFeatures.Variables; import com.google.devtools.build.lib.rules.cpp.CppConfiguration.Tool; import com.google.devtools.build.lib.rules.cpp.FdoSupport.FdoMode; @@ -338,31 +339,51 @@ public final class CcToolchainProvider extends ToolchainInfo { } /** - * Returns the static runtime libraries. + * Returns true if the featureConfiguration includes statically linking the cpp runtimes. + * + * @param featureConfiguration the relevant FeatureConfiguration. */ - public NestedSet<Artifact> getStaticRuntimeLinkInputs() { - return staticRuntimeLinkInputs; + public boolean shouldStaticallyLinkCppRuntimes(FeatureConfiguration featureConfiguration) { + return featureConfiguration.isEnabled(CppRuleClasses.STATIC_LINK_CPP_RUNTIMES); } - /** - * Returns an aggregating middleman that represents the static runtime libraries. - */ - @Nullable public Artifact getStaticRuntimeLinkMiddleman() { - return staticRuntimeLinkMiddleman; + /** Returns the static runtime libraries. */ + public NestedSet<Artifact> getStaticRuntimeLinkInputs(FeatureConfiguration featureConfiguration) { + if (shouldStaticallyLinkCppRuntimes(featureConfiguration)) { + return staticRuntimeLinkInputs; + } else { + return NestedSetBuilder.emptySet(Order.STABLE_ORDER); + } } - /** - * Returns the dynamic runtime libraries. - */ - public NestedSet<Artifact> getDynamicRuntimeLinkInputs() { - return dynamicRuntimeLinkInputs; + /** Returns an aggregating middleman that represents the static runtime libraries. */ + @Nullable + public Artifact getStaticRuntimeLinkMiddleman(FeatureConfiguration featureConfiguration) { + if (shouldStaticallyLinkCppRuntimes(featureConfiguration)) { + return staticRuntimeLinkMiddleman; + } else { + return null; + } } - /** - * Returns an aggregating middleman that represents the dynamic runtime libraries. - */ - @Nullable public Artifact getDynamicRuntimeLinkMiddleman() { - return dynamicRuntimeLinkMiddleman; + /** Returns the dynamic runtime libraries. */ + public NestedSet<Artifact> getDynamicRuntimeLinkInputs( + FeatureConfiguration featureConfiguration) { + if (shouldStaticallyLinkCppRuntimes(featureConfiguration)) { + return dynamicRuntimeLinkInputs; + } else { + return NestedSetBuilder.emptySet(Order.STABLE_ORDER); + } + } + + /** Returns an aggregating middleman that represents the dynamic runtime libraries. */ + @Nullable + public Artifact getDynamicRuntimeLinkMiddleman(FeatureConfiguration featureConfiguration) { + if (shouldStaticallyLinkCppRuntimes(featureConfiguration)) { + return dynamicRuntimeLinkMiddleman; + } else { + return null; + } } /** diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppActionConfigs.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppActionConfigs.java index 3b49a4d879..97182b1e8f 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppActionConfigs.java +++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppActionConfigs.java @@ -202,6 +202,11 @@ public class CppActionConfigs { " }", " }", "}"), + ifTrue( + !existingFeatureNames.contains(CppRuleClasses.STATIC_LINK_CPP_RUNTIMES), + "feature {", + " name: 'static_link_cpp_runtimes'", + "}"), // Gcc options: // -MD turns on .d file output as a side-effect (doesn't imply -E) // -MM[D] enables user includes only, not system includes diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppHelper.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppHelper.java index a146b951b1..5b78e144dd 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppHelper.java +++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppHelper.java @@ -351,10 +351,11 @@ public class CppHelper { public static ImmutableList<String> getMostlyStaticLinkOptions( CppConfiguration config, CcToolchainProvider toolchain, - Boolean sharedLib) { + boolean sharedLib, + boolean shouldStaticallyLinkCppRuntimes) { if (sharedLib) { return toolchain.getSharedLibraryLinkOptions( - toolchain.supportsEmbeddedRuntimes() + shouldStaticallyLinkCppRuntimes ? toolchain.getMostlyStaticSharedLinkFlags( config.getCompilationMode(), config.getLipoMode()) : toolchain.getDynamicLinkFlags(config.getCompilationMode(), config.getLipoMode())); @@ -505,6 +506,38 @@ public class CppHelper { } /** + * Convenience function for finding the dynamic runtime inputs for the current toolchain. Useful + * for non C++ rules that link against the C++ runtime. + */ + public static NestedSet<Artifact> getDefaultCcToolchainDynamicRuntimeInputs( + RuleContext ruleContext) { + CcToolchainProvider defaultToolchain = + getToolchain(ruleContext, CcToolchain.CC_TOOLCHAIN_DEFAULT_ATTRIBUTE_NAME); + if (defaultToolchain == null) { + return NestedSetBuilder.emptySet(Order.STABLE_ORDER); + } + FeatureConfiguration featureConfiguration = + CcCommon.configureFeatures(ruleContext, defaultToolchain); + return defaultToolchain.getDynamicRuntimeLinkInputs(featureConfiguration); + } + + /** + * Convenience function for finding the static runtime inputs for the current toolchain. Useful + * for non C++ rules that link against the C++ runtime. + */ + public static NestedSet<Artifact> getDefaultCcToolchainStaticRuntimeInputs( + RuleContext ruleContext) { + CcToolchainProvider defaultToolchain = + getToolchain(ruleContext, CcToolchain.CC_TOOLCHAIN_DEFAULT_ATTRIBUTE_NAME); + if (defaultToolchain == null) { + return NestedSetBuilder.emptySet(Order.STABLE_ORDER); + } + FeatureConfiguration featureConfiguration = + CcCommon.configureFeatures(ruleContext, defaultToolchain); + return defaultToolchain.getStaticRuntimeLinkInputs(featureConfiguration); + } + + /** * Makes sure that the given info collection has a {@link CcToolchainProvider} (gives an error * otherwise), and returns a reference to that {@link CcToolchainProvider}. The method will only * return {@code null}, if the toolchain attribute is undefined for the rule class. diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppLinkActionBuilder.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppLinkActionBuilder.java index 756b6a987b..23429f1b65 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppLinkActionBuilder.java +++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppLinkActionBuilder.java @@ -224,7 +224,7 @@ public class CppLinkActionBuilder { this.cppConfiguration = configuration.getFragment(CppConfiguration.class); this.toolchain = toolchain; this.fdoSupport = fdoSupport; - if (toolchain.supportsEmbeddedRuntimes() && toolchain != null) { + if (featureConfiguration.isEnabled(CppRuleClasses.STATIC_LINK_CPP_RUNTIMES)) { runtimeSolibDir = toolchain.getDynamicRuntimeSolibDir(); } this.featureConfiguration = featureConfiguration; @@ -707,7 +707,9 @@ public class CppLinkActionBuilder { CppHelper.getFullyStaticLinkOptions(cppConfiguration, toolchain, sharedLinkopts)); } else if (mostlyStatic) { result.addAll( - CppHelper.getMostlyStaticLinkOptions(cppConfiguration, toolchain, sharedLinkopts)); + CppHelper.getMostlyStaticLinkOptions( + cppConfiguration, toolchain, sharedLinkopts, + featureConfiguration.isEnabled(CppRuleClasses.STATIC_LINK_CPP_RUNTIMES))); } else { result.addAll(CppHelper.getDynamicLinkOptions(cppConfiguration, toolchain, sharedLinkopts)); } diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppRuleClasses.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppRuleClasses.java index 2525eb588d..40309e822e 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppRuleClasses.java +++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppRuleClasses.java @@ -329,6 +329,9 @@ public class CppRuleClasses { /** A string constant for a feature to dynamically link MSVCRT with debug info on Windows. */ public static final String DYNAMIC_LINK_MSVCRT_DEBUG = "dynamic_link_msvcrt_debug"; + /** A string constant for a feature to statically link the C++ runtimes. */ + public static final String STATIC_LINK_CPP_RUNTIMES = "static_link_cpp_runtimes"; + /** * A string constant for a feature that indicates we are using a toolchain building for Windows. */ diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppToolchainInfo.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppToolchainInfo.java index 0814552932..b8643ad4c5 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppToolchainInfo.java +++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppToolchainInfo.java @@ -401,6 +401,8 @@ public final class CppToolchainInfo { linkerToolPath, arToolPath, stripToolPath, + // This should be toolchain-based, rather than feature based, because + // it controls whether or not to declare the feature at all. toolchain.getSupportsEmbeddedRuntimes(), toolchain.getSupportsInterfaceSharedObjects()), toolchainBuilder); diff --git a/src/main/java/com/google/devtools/build/lib/rules/java/JavaBinary.java b/src/main/java/com/google/devtools/build/lib/rules/java/JavaBinary.java index 870c3b525e..01124b60d4 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/java/JavaBinary.java +++ b/src/main/java/com/google/devtools/build/lib/rules/java/JavaBinary.java @@ -247,8 +247,7 @@ public class JavaBinary implements RuleConfiguredTargetFactory { // Collect the action inputs for the runfiles collector here because we need to access the // analysis environment, and that may no longer be safe when the runfiles collector runs. Iterable<Artifact> dynamicRuntimeActionInputs = - CppHelper.getToolchainUsingDefaultCcToolchainAttribute(ruleContext) - .getDynamicRuntimeLinkInputs(); + CppHelper.getDefaultCcToolchainDynamicRuntimeInputs(ruleContext); Iterables.addAll(jvmFlags, semantics.getJvmFlags(ruleContext, common.getSrcsArtifacts(), userJvmFlags)); 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 d8ddf994d9..5121bd1752 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 @@ -234,11 +234,15 @@ public abstract class NativeDepsHelper { featureConfiguration, cppSemantics); if (useDynamicRuntime) { - builder.setRuntimeInputs(ArtifactCategory.DYNAMIC_LIBRARY, - toolchain.getDynamicRuntimeLinkMiddleman(), toolchain.getDynamicRuntimeLinkInputs()); + builder.setRuntimeInputs( + ArtifactCategory.DYNAMIC_LIBRARY, + toolchain.getDynamicRuntimeLinkMiddleman(featureConfiguration), + toolchain.getDynamicRuntimeLinkInputs(featureConfiguration)); } else { - builder.setRuntimeInputs(ArtifactCategory.STATIC_LIBRARY, - toolchain.getStaticRuntimeLinkMiddleman(), toolchain.getStaticRuntimeLinkInputs()); + builder.setRuntimeInputs( + ArtifactCategory.STATIC_LIBRARY, + toolchain.getStaticRuntimeLinkMiddleman(featureConfiguration), + toolchain.getStaticRuntimeLinkInputs(featureConfiguration)); } ImmutableMap.Builder<Artifact, Artifact> ltoBitcodeFilesMap = new ImmutableMap.Builder<>(); for (LibraryToLink lib : linkerInputs) { @@ -288,7 +292,8 @@ public abstract class NativeDepsHelper { List<Artifact> runtimeSymlinks; if (useDynamicRuntime) { runtimeSymlinks = new LinkedList<>(); - for (final Artifact runtimeInput : toolchain.getDynamicRuntimeLinkInputs()) { + for (final Artifact runtimeInput : + toolchain.getDynamicRuntimeLinkInputs(featureConfiguration)) { final Artifact runtimeSymlink = ruleContext.getPackageRelativeArtifact( getRuntimeLibraryPath(ruleContext, runtimeInput), bindirIfShared); |