Skip to content

Commit

Permalink
Supply the header thinning tool to apple_binary targets so that aspec…
Browse files Browse the repository at this point in the history
…ts that

create ProtoSupport can use it. This is rolling a previous attempt at doing
this forward after an underlying problem has been fixed.

RELNOTES: None.
PiperOrigin-RevId: 257211958
  • Loading branch information
djasper-gh authored and irengrig committed Jul 15, 2019
1 parent 5fef454 commit dc4df1d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import com.google.devtools.build.lib.analysis.BaseRuleClasses;
import com.google.devtools.build.lib.analysis.RuleDefinition;
import com.google.devtools.build.lib.analysis.RuleDefinitionEnvironment;
import com.google.devtools.build.lib.analysis.config.HostTransition;
import com.google.devtools.build.lib.analysis.config.transitions.ComposingTransitionFactory;
import com.google.devtools.build.lib.packages.Attribute.AllowedValueSet;
import com.google.devtools.build.lib.packages.ImplicitOutputsFunction;
Expand Down Expand Up @@ -140,6 +141,13 @@ the main() function.
.allowedFileTypes()
.nonconfigurable("defines an aspect of configuration")
.mandatoryProviders(ImmutableList.of(ConfigFeatureFlagProvider.id())))
.add(
attr(ObjcRuleClasses.HEADER_SCANNER_ATTRIBUTE, LABEL)
.cfg(HostTransition.createFactory())
.value(ObjcRuleClasses.headerScannerAttribute(env)))
.add(
attr(ObjcRuleClasses.APPLE_SDK_ATTRIBUTE, LABEL)
.value(ObjcRuleClasses.CompilingRule.SDK_LATE_BOUND_DEFAULT))
/*<!-- #BLAZE_RULE(apple_binary).IMPLICIT_OUTPUTS -->
<ul>
<li><code><var>name</var>_lipobin</code>: the 'lipo'ed potentially multi-architecture
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -547,14 +547,7 @@ Enables clang module support (via -fmodules).
.add(
attr(HEADER_SCANNER_ATTRIBUTE, LABEL)
.cfg(HostTransition.createFactory())
.value(
LabelLateBoundDefault.fromTargetConfiguration(
ObjcConfiguration.class,
env.getToolsLabel("//tools/objc:header_scanner"),
(Attribute.LateBoundDefault.Resolver<ObjcConfiguration, Label>
& Serializable)
(rule, attributes, objcConfig) ->
objcConfig.getObjcHeaderScannerTool())))
.value(headerScannerAttribute(env)))
.add(attr(APPLE_SDK_ATTRIBUTE, LABEL).value(SDK_LATE_BOUND_DEFAULT))
.build();
}
Expand All @@ -574,6 +567,15 @@ public Metadata getMetadata() {
}
}

static LabelLateBoundDefault<ObjcConfiguration> headerScannerAttribute(
RuleDefinitionEnvironment env) {
return LabelLateBoundDefault.fromTargetConfiguration(
ObjcConfiguration.class,
env.getToolsLabel("//tools/objc:header_scanner"),
(Attribute.LateBoundDefault.Resolver<ObjcConfiguration, Label> & Serializable)
(rule, attributes, objcConfig) -> objcConfig.getObjcHeaderScannerTool());
}

/**
* Common attributes for {@code objc_*} rules that need to call libtool.
*/
Expand Down

0 comments on commit dc4df1d

Please sign in to comment.