Skip to content

Commit

Permalink
Always declare dependency on xcode gcov.
Browse files Browse the repository at this point in the history
RELNOTES[INC]: Removes --objc_gcov_binary flag.

--
MOS_MIGRATED_REVID=113190035
  • Loading branch information
aragos authored and kchodorow committed Jan 28, 2016
1 parent 25b38ac commit 03e89a9
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -836,12 +836,6 @@ public String getCpu() {
)
public List<Label> targetEnvironments;

@Option(name = "objc_gcov_binary",
converter = ToolsLabelConverter.class,
defaultValue = "//third_party/gcov:gcov_for_xcode_osx",
category = "undocumented")
public Label objcGcovBinary;

/** Converter for labels in the @bazel_tools repository. The @Options' defaultValues can't
* prepend TOOLS_REPOSITORY, unfortunately, because then the compiler thinks they're not
* constant. */
Expand Down Expand Up @@ -913,9 +907,6 @@ public void addAllLabels(Multimap<String, Label> labelMap) {
if ((runUnder != null) && (runUnder.getLabel() != null)) {
labelMap.put("RunUnder", runUnder.getLabel());
}
if (collectCodeCoverage) {
labelMap.put("objc_gcov", objcGcovBinary);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import com.google.devtools.build.lib.analysis.RuleDefinitionEnvironment;
import com.google.devtools.build.lib.analysis.config.BuildConfiguration;
import com.google.devtools.build.lib.cmdline.Label;
import com.google.devtools.build.lib.packages.Attribute;
import com.google.devtools.build.lib.packages.Attribute.ComputedDefault;
import com.google.devtools.build.lib.packages.Attribute.LateBoundLabelList;
import com.google.devtools.build.lib.packages.AttributeMap;
import com.google.devtools.build.lib.packages.ImplicitOutputsFunction;
Expand All @@ -47,6 +47,10 @@
*/
public class IosTestRule implements RuleDefinition {

private static final ImmutableList<Label> GCOV =
ImmutableList.of(
Label.parseAbsoluteUnchecked(Constants.TOOLS_REPOSITORY + "//tools/objc:gcov"));

@Override
public RuleClass build(RuleClass.Builder builder, final RuleDefinitionEnvironment env) {
return builder
Expand Down Expand Up @@ -86,7 +90,7 @@ public RuleClass build(RuleClass.Builder builder, final RuleDefinitionEnvironmen
.add(
attr(IosTest.XCTEST_APP, LABEL)
.value(
new Attribute.ComputedDefault(IosTest.IS_XCTEST) {
new ComputedDefault(IosTest.IS_XCTEST) {
@Override
public Object getDefault(AttributeMap rule) {
return rule.get(IosTest.IS_XCTEST, Type.BOOLEAN)
Expand All @@ -103,7 +107,7 @@ public Object getDefault(AttributeMap rule) {
.override(
attr("infoplist", LABEL)
.value(
new Attribute.ComputedDefault(IosTest.IS_XCTEST) {
new ComputedDefault(IosTest.IS_XCTEST) {
@Override
public Object getDefault(AttributeMap rule) {
return rule.get(IosTest.IS_XCTEST, Type.BOOLEAN)
Expand Down Expand Up @@ -154,16 +158,13 @@ public Object getDefault(AttributeMap rule) {
attr(":gcov", LABEL_LIST)
.cfg(HOST)
.value(
new LateBoundLabelList<BuildConfiguration>() {
new LateBoundLabelList<BuildConfiguration>(GCOV) {
@Override
public List<Label> getDefault(Rule rule, BuildConfiguration configuration) {
if (!configuration.isCodeCoverageEnabled()) {
return ImmutableList.of();
}
return ImmutableList.of(
configuration
.getFragment(ObjcConfiguration.class)
.getGcovLabel());
return GCOV;
}
}))
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import com.google.devtools.build.lib.analysis.BlazeDirectories;
import com.google.devtools.build.lib.analysis.config.BuildConfiguration;
import com.google.devtools.build.lib.analysis.config.CompilationMode;
import com.google.devtools.build.lib.cmdline.Label;
import com.google.devtools.build.lib.rules.apple.DottedVersion;
import com.google.devtools.build.lib.rules.objc.ReleaseBundlingSupport.SplitArchTransition.ConfigurationDistinguisher;
import com.google.devtools.build.lib.util.Preconditions;
Expand Down Expand Up @@ -63,13 +62,6 @@ public class ObjcConfiguration extends BuildConfiguration.Fragment {
private final String xcodeOverrideWorkspaceRoot;
private final boolean useAbsolutePathsForActions;

// We only load these labels if the mode which uses them is enabled. That is known as part of the
// BuildConfiguration. This label needs to be part of a configuration because only configurations
// can conditionally cause loading.
// They are referenced from late bound attributes, and if loading wasn't forced in a
// configuration, the late bound attribute will fail to be initialized because it hasn't been
// loaded.
@Nullable private final Label gcovLabel;

ObjcConfiguration(ObjcCommandLineOptions objcOptions, BuildConfiguration.Options options,
@Nullable BlazeDirectories directories) {
Expand All @@ -82,7 +74,6 @@ public class ObjcConfiguration extends BuildConfiguration.Fragment {
this.runMemleaks = objcOptions.runMemleaks;
this.copts = ImmutableList.copyOf(objcOptions.copts);
this.compilationMode = Preconditions.checkNotNull(options.compilationMode, "compilationMode");
this.gcovLabel = options.objcGcovBinary;
this.iosSplitCpu = Preconditions.checkNotNull(objcOptions.iosSplitCpu, "iosSplitCpu");
this.fastbuildOptions = ImmutableList.copyOf(objcOptions.fastbuildOptions);
this.enableBinaryStripping = objcOptions.enableBinaryStripping;
Expand Down Expand Up @@ -153,14 +144,6 @@ public List<String> getCopts() {
return copts;
}

/**
* Returns the label of the gcov binary, used to get test coverage data. Null iff not in coverage
* mode.
*/
@Nullable public Label getGcovLabel() {
return gcovLabel;
}

/**
* Whether module map generation and interpretation is enabled.
*/
Expand Down
5 changes: 5 additions & 0 deletions tools/objc/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,11 @@ sh_binary(
srcs = [":xcrunwrapper.sh"],
)

filegroup(
name = "gcov",
srcs = [":gcov_stub"],
)

xcode_config(
name = "host_xcodes",
)
Expand Down
7 changes: 7 additions & 0 deletions tools/objc/gcov_stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

(
printf 'Bazel does not yet support coverage.\n'
) >&2

exit 1

0 comments on commit 03e89a9

Please sign in to comment.