Deprecate py_extension "outs" attribute.
RELNOTES:
@@ -76,6 +76,7 @@ public abstract class CcLibrary implements RuleConfiguredTargetFactory {
context,
builder,
/* additionalCopts= */ ImmutableList.of(),
+ /* soFilename= */ null,
context.attributes().get("alwayslink", Type.BOOLEAN),
/* neverLink= */ false,
linkStatic,
@@ -88,6 +89,7 @@ public abstract class CcLibrary implements RuleConfiguredTargetFactory {
RuleContext ruleContext,
RuleConfiguredTargetBuilder targetBuilder,
ImmutableList<String> additionalCopts,
+ PathFragment soFilename,
boolean alwaysLink,
boolean neverLink,
boolean linkStatic,
@@ -157,20 +159,12 @@ public abstract class CcLibrary implements RuleConfiguredTargetFactory {
&& supportsDynamicLinker
&& (appearsToHaveObjectFiles(ruleContext.attributes())
|| featureConfiguration.isEnabled(CppRuleClasses.HEADER_MODULE_CODEGEN));
- if (ruleContext.getRule().isAttrDefined("outs", Type.STRING_LIST)) {
- List<String> outs = ruleContext.attributes().get("outs", Type.STRING_LIST);
- if (outs.size() > 1) {
- ruleContext.attributeError("outs", "must be a singleton list");
- } else if (outs.size() == 1) {
- PathFragment soImplFilename = PathFragment.create(ruleContext.getLabel().getName());
- soImplFilename = soImplFilename.replaceName(outs.get(0));
- if (!soImplFilename.getPathString().endsWith(".so")) { // Sanity check.
+ if (soFilename != null) {
+ if (!soFilename.getPathString().endsWith(".so")) { // Sanity check.
ruleContext.attributeError("outs", "file name must end in '.so'");
}
-
if (createDynamicLibrary) {
- soImplArtifact = ruleContext.getBinArtifact(soImplFilename);
- }
+ soImplArtifact = ruleContext.getBinArtifact(soFilename);
}
}
