Use OS X compatible gcov with experimental_ios_test. -- MOS_MIGRATED_REVID=103549584
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/config/BuildConfiguration.java b/src/main/java/com/google/devtools/build/lib/analysis/config/BuildConfiguration.java index 43cf12f..fd09e4f 100644 --- a/src/main/java/com/google/devtools/build/lib/analysis/config/BuildConfiguration.java +++ b/src/main/java/com/google/devtools/build/lib/analysis/config/BuildConfiguration.java
@@ -812,6 +812,15 @@ category = "undocumented") public Label objcGcovBinary; + // This performs the same function as objc_gcov_binary but applies to experminental_ios_test + // rather than ios_test. + // TODO(bazel-team): Remove this once experimental_ios_test replaces to ios_test. + @Option(name = "experimental_objc_gcov_binary", + converter = LabelConverter.class, + defaultValue = "//third_party/gcov:gcov_for_xcode_osx", + category = "undocumented") + public Label experimentalObjcGcovBinary; + @Option(name = "experimental_dynamic_configs", defaultValue = "false", category = "undocumented", @@ -875,6 +884,7 @@ } if (collectCodeCoverage) { labelMap.put("objc_gcov", objcGcovBinary); + labelMap.put("experimental_objc_gcov", experimentalObjcGcovBinary); } } }
diff --git a/src/main/java/com/google/devtools/build/lib/bazel/rules/objc/BazelIosTestRule.java b/src/main/java/com/google/devtools/build/lib/bazel/rules/objc/BazelIosTestRule.java index 82471dd..8443a45 100644 --- a/src/main/java/com/google/devtools/build/lib/bazel/rules/objc/BazelIosTestRule.java +++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/objc/BazelIosTestRule.java
@@ -96,7 +96,7 @@ return ImmutableList.of(); } return ImmutableList.of( - configuration.getFragment(ObjcConfiguration.class).getGcovLabel()); + configuration.getFragment(ObjcConfiguration.class).getExperimentalGcovLabel()); } })) .build();
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/ExperimentalIosTestRule.java b/src/main/java/com/google/devtools/build/lib/rules/objc/ExperimentalIosTestRule.java index b3e2ff8..129870e 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/objc/ExperimentalIosTestRule.java +++ b/src/main/java/com/google/devtools/build/lib/rules/objc/ExperimentalIosTestRule.java
@@ -95,7 +95,7 @@ return ImmutableList.of(); } return ImmutableList.of( - configuration.getFragment(ObjcConfiguration.class).getGcovLabel()); + configuration.getFragment(ObjcConfiguration.class).getExperimentalGcovLabel()); } })) .build();
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcConfiguration.java b/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcConfiguration.java index e6846e3..24bd94a4 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcConfiguration.java +++ b/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcConfiguration.java
@@ -69,13 +69,14 @@ private final ConfigurationDistinguisher configurationDistinguisher; @Nullable private final Path clientWorkspaceRoot; - // We only load these labels if the mode which uses them is enabled. That is know as part of the + // 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; + @Nullable private final Label experimentalGcovLabel; @Nullable private final Label dumpSymsLabel; @Nullable private final Label defaultProvisioningProfileLabel; @@ -96,6 +97,7 @@ this.copts = ImmutableList.copyOf(objcOptions.copts); this.compilationMode = Preconditions.checkNotNull(options.compilationMode, "compilationMode"); this.gcovLabel = options.objcGcovBinary; + this.experimentalGcovLabel = options.experimentalObjcGcovBinary; this.dumpSymsLabel = objcOptions.dumpSyms; this.defaultProvisioningProfileLabel = objcOptions.defaultProvisioningProfile; this.iosMultiCpus = Preconditions.checkNotNull(objcOptions.iosMultiCpus, "iosMultiCpus"); @@ -217,6 +219,14 @@ } /** + * Returns the label of the experimental gcov binary, used to get test coverage data for {@code + * experimental_ios_test}. Null iff not in coverage mode. + */ + @Nullable public Label getExperimentalGcovLabel() { + return experimentalGcovLabel; + } + + /** * Returns the label of the dump_syms binary, used to get debug symbols from a binary. Null iff * !{@link #generateDebugSymbols}. */