Permit a null feature_configuration in cc_common.create_library_to_link
Swaps the order of tests involving feature_configuration and the
dynamic_library and interfact_library parameters. The feature
configuration is only needed when one of these is non-null and doing
this allows the function to be used without a provided cc_toolchain or
configuration.
@@ -605,8 +605,10 @@ public abstract class CcModule
Artifact resolvedSymlinkDynamicLibrary = null;
Artifact resolvedSymlinkInterfaceLibrary = null;
- if (!featureConfiguration.getFeatureConfiguration().isEnabled(CppRuleClasses.TARGETS_WINDOWS)) {
- if (dynamicLibrary != null) {
+ if (dynamicLibrary != null
+ && !featureConfiguration
+ .getFeatureConfiguration()
+ .isEnabled(CppRuleClasses.TARGETS_WINDOWS)) {
resolvedSymlinkDynamicLibrary = dynamicLibrary;
if (dynamicLibraryPathFragment != null) {
if (dynamicLibrary.getRootRelativePath().getPathString().startsWith("_solib_")) {
@@ -632,7 +634,10 @@ public abstract class CcModule
/* prefixConsumer= */ true);
}
}
- if (interfaceLibrary != null) {
+ if (interfaceLibrary != null
+ && !featureConfiguration
+ .getFeatureConfiguration()
+ .isEnabled(CppRuleClasses.TARGETS_WINDOWS)) {
resolvedSymlinkInterfaceLibrary = interfaceLibrary;
if (interfaceLibraryPathFragment != null) {
if (interfaceLibrary.getRootRelativePath().getPathString().startsWith("_solib_")) {
@@ -642,8 +647,7 @@ public abstract class CcModule
}
interfaceLibrary =
SolibSymlinkAction.getDynamicLibrarySymlink(
- /* actionRegistry= */ starlarkActionFactory.asActionRegistry(
- starlarkActionFactory),
+ /* actionRegistry= */ starlarkActionFactory.asActionRegistry(starlarkActionFactory),
/* actionConstructionContext= */ starlarkActionFactory
.getActionConstructionContext(),
ccToolchainProvider.getSolibDirectory(),
@@ -652,8 +656,7 @@ public abstract class CcModule
} else {
interfaceLibrary =
SolibSymlinkAction.getDynamicLibrarySymlink(
- /* actionRegistry= */ starlarkActionFactory.asActionRegistry(
- starlarkActionFactory),
+ /* actionRegistry= */ starlarkActionFactory.asActionRegistry(starlarkActionFactory),
/* actionConstructionContext= */ starlarkActionFactory
.getActionConstructionContext(),
ccToolchainProvider.getSolibDirectory(),
@@ -662,7 +665,6 @@ public abstract class CcModule
/* prefixConsumer= */ true);
}
}
- }
if (staticLibrary == null
&& picStaticLibrary == null
&& dynamicLibrary == null
