aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google
diff options
context:
space:
mode:
authorGravatar Cal Peyser <cpeyser@google.com>2016-01-06 14:52:37 +0000
committerGravatar Philipp Wollermann <philwo@google.com>2016-01-07 13:45:37 +0000
commit34c24820681350e0cbcec8c35b5f761ca975ab10 (patch)
tree2b3697de04db5be4386ff890e0f1c12f6a0bdbdd /src/main/java/com/google
parent6e24a37d6dcd78f808415567f16db585ca7f92af (diff)
Removes experimental_ios_test. Will wait on [].
-- MOS_MIGRATED_REVID=111505409
Diffstat (limited to 'src/main/java/com/google')
-rw-r--r--src/main/java/com/google/devtools/build/lib/bazel/rules/BazelRuleClassProvider.java4
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/objc/AbstractIosTestRule.java132
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/objc/ExperimentalIosTestRule.java53
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/objc/IosTestRule.java166
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/objc/ObjcRuleClasses.java76
5 files changed, 164 insertions, 267 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/bazel/rules/BazelRuleClassProvider.java b/src/main/java/com/google/devtools/build/lib/bazel/rules/BazelRuleClassProvider.java
index 03ff07be0d..f062244ed1 100644
--- a/src/main/java/com/google/devtools/build/lib/bazel/rules/BazelRuleClassProvider.java
+++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/BazelRuleClassProvider.java
@@ -95,7 +95,6 @@ import com.google.devtools.build.lib.rules.java.JavaOptions;
import com.google.devtools.build.lib.rules.java.JavaToolchainRule;
import com.google.devtools.build.lib.rules.java.JvmConfigurationLoader;
import com.google.devtools.build.lib.rules.java.ProguardLibraryRule;
-import com.google.devtools.build.lib.rules.objc.ExperimentalIosTestRule;
import com.google.devtools.build.lib.rules.objc.IosApplicationRule;
import com.google.devtools.build.lib.rules.objc.IosDeviceRule;
import com.google.devtools.build.lib.rules.objc.IosExtensionBinaryRule;
@@ -318,8 +317,6 @@ public class BazelRuleClassProvider {
builder.addRuleDefinition(new BazelAndroidBinaryRule());
builder.addRuleDefinition(new IosTestRule());
- // TODO(bazel-team): Remove this line after experimental_ios_test is completely removed.
- builder.addRuleDefinition(new ExperimentalIosTestRule());
builder.addRuleDefinition(new IosDeviceRule());
builder.addRuleDefinition(new ObjcBinaryRule());
builder.addRuleDefinition(new ObjcBundleRule());
@@ -331,7 +328,6 @@ public class BazelRuleClassProvider {
builder.addRuleDefinition(new ObjcProtoLibraryRule());
builder.addRuleDefinition(new ObjcXcodeprojRule());
builder.addRuleDefinition(new ObjcRuleClasses.CoptsRule());
- builder.addRuleDefinition(new ObjcRuleClasses.IosTestBaseRule());
builder.addRuleDefinition(new ObjcRuleClasses.BundlingRule());
builder.addRuleDefinition(new ObjcRuleClasses.ReleaseBundlingRule());
builder.addRuleDefinition(new ObjcRuleClasses.SimulatorRule());
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/AbstractIosTestRule.java b/src/main/java/com/google/devtools/build/lib/rules/objc/AbstractIosTestRule.java
deleted file mode 100644
index 75f3e9ca29..0000000000
--- a/src/main/java/com/google/devtools/build/lib/rules/objc/AbstractIosTestRule.java
+++ /dev/null
@@ -1,132 +0,0 @@
-// Copyright 2014 The Bazel Authors. All rights reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-
-package com.google.devtools.build.lib.rules.objc;
-
-import static com.google.devtools.build.lib.packages.Attribute.ConfigurationTransition.HOST;
-import static com.google.devtools.build.lib.packages.Attribute.attr;
-import static com.google.devtools.build.lib.packages.BuildType.LABEL;
-import static com.google.devtools.build.lib.packages.BuildType.LABEL_LIST;
-import static com.google.devtools.build.lib.syntax.Type.STRING_LIST;
-
-import com.google.common.collect.ImmutableList;
-import com.google.devtools.build.lib.Constants;
-import com.google.devtools.build.lib.analysis.RuleDefinition;
-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.LateBoundLabelList;
-import com.google.devtools.build.lib.packages.ImplicitOutputsFunction;
-import com.google.devtools.build.lib.packages.Rule;
-import com.google.devtools.build.lib.packages.RuleClass;
-import com.google.devtools.build.lib.rules.apple.AppleConfiguration;
-import com.google.devtools.build.lib.rules.java.J2ObjcConfiguration;
-import com.google.devtools.build.lib.util.FileType;
-
-import java.util.List;
-
-/**
- * Rule definition for {@code ios_test} rule. Abstract so that extensions can support
- * the equivalent ios_test and experimental_ios_test rules until experimental_ios_test is
- * fully deprecated.
- */
-public abstract class AbstractIosTestRule implements RuleDefinition {
- @Override
- public RuleClass build(RuleClass.Builder builder, final RuleDefinitionEnvironment env) {
- return builder
- .requiresConfigurationFragments(ObjcConfiguration.class, J2ObjcConfiguration.class,
- AppleConfiguration.class)
- /*<!-- #BLAZE_RULE(ios_test).IMPLICIT_OUTPUTS -->
- <ul>
- <li><code><var>name</var>.ipa</code>: the test bundle as an
- <code>.ipa</code> file
- <li><code><var>name</var>.xcodeproj/project.pbxproj: An Xcode project file which can be
- used to develop or build on a Mac.</li>
- </ul>
- <!-- #END_BLAZE_RULE.IMPLICIT_OUTPUTS -->*/
- .setImplicitOutputsFunction(
- ImplicitOutputsFunction.fromFunctions(ReleaseBundlingSupport.IPA, XcodeSupport.PBXPROJ))
- .override(
- attr(IosTest.TARGET_DEVICE, LABEL)
- .allowedFileTypes()
- .allowedRuleClasses("ios_device")
- .value(
- env.getLabel(Constants.TOOLS_REPOSITORY + "//tools/objc/sim_devices:default")))
- /* <!-- #BLAZE_RULE(ios_test).ATTRIBUTE(ios_test_target_device) -->
- The device against how to run the test. If this attribute is defined, the test will run on
- the lab device. Otherwise, the test will run on simulator.
- ${SYNOPSIS}
- <!-- #END_BLAZE_RULE.ATTRIBUTE -->*/
- .add(
- attr("ios_test_target_device", LABEL)
- .allowedFileTypes()
- .allowedRuleClasses("ios_lab_device"))
- /* <!-- #BLAZE_RULE(ios_test).ATTRIBUTE(ios_device_arg) -->
- Extra arguments to pass to the <code>ios_test_target_device</code>'s binary. They should be
- in the form KEY=VALUE or simply KEY (check your device's documentation for allowed
- parameters).
- ${SYNOPSIS}
- <!-- #END_BLAZE_RULE.ATTRIBUTE -->*/
- .add(attr("ios_device_arg", STRING_LIST))
- /* <!-- #BLAZE_RULE(ios_test).ATTRIBUTE(plugins) -->
- Plugins to pass to the test runner.
- ${SYNOPSIS}
- <!-- #END_BLAZE_RULE.ATTRIBUTE -->*/
- .add(attr("plugins", LABEL_LIST).allowedFileTypes(FileType.of("_deploy.jar")))
- .add(
- attr("$test_template", LABEL)
- .value(
- env.getLabel(
- Constants.TOOLS_REPOSITORY + "//tools/objc:ios_test.sh.bazel_template")))
- .add(
- attr("$test_runner", LABEL)
- .value(env.getLabel(Constants.TOOLS_REPOSITORY + "//tools/objc:testrunner")))
- .add(
- attr(IosTest.MEMLEAKS_DEP, LABEL)
- .value(env.getLabel(Constants.TOOLS_REPOSITORY + "//tools/objc/memleaks:memleaks")))
- .add(
- attr(IosTest.MEMLEAKS_PLUGIN, LABEL)
- .value(env.getLabel(Constants.TOOLS_REPOSITORY + "//tools/objc:memleaks_plugin")))
- .override(
- attr(":gcov", LABEL_LIST)
- .cfg(HOST)
- .value(
- new LateBoundLabelList<BuildConfiguration>() {
- @Override
- public List<Label> getDefault(Rule rule, BuildConfiguration configuration) {
- if (!configuration.isCodeCoverageEnabled()) {
- return ImmutableList.of();
- }
- return ImmutableList.of(
- configuration
- .getFragment(ObjcConfiguration.class)
- .getExperimentalGcovLabel());
- }
- }))
- .build();
- }
-}
-
-/*<!-- #BLAZE_RULE (NAME = ios_test, TYPE = TEST, FAMILY = Objective-C) -->
-
-${ATTRIBUTE_SIGNATURE}
-
-<p>This rule provides a way to build iOS unit tests written in KIF, GTM and XCTest test frameworks
-on both iOS simulator and real devices.
-</p>
-
-${ATTRIBUTE_DEFINITION}
-
-<!-- #END_BLAZE_RULE -->*/
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
deleted file mode 100644
index 1629a0ac8c..0000000000
--- a/src/main/java/com/google/devtools/build/lib/rules/objc/ExperimentalIosTestRule.java
+++ /dev/null
@@ -1,53 +0,0 @@
-// Copyright 2014 The Bazel Authors. All rights reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package com.google.devtools.build.lib.rules.objc;
-
-import com.google.devtools.build.lib.analysis.BaseRuleClasses;
-import com.google.devtools.build.lib.analysis.RuleDefinition;
-import com.google.devtools.build.lib.packages.RuleClass.Builder.RuleClassType;
-
-/**
- * Rule definition for {@code experimental_ios_test} rule in Bazel.
- *
- * <p>experimental_ios_test is equivalent to ios_test.
- */
-public final class ExperimentalIosTestRule extends AbstractIosTestRule {
- @Override
- public Metadata getMetadata() {
- return RuleDefinition.Metadata.builder()
- .name("experimental_ios_test")
- .type(RuleClassType.TEST)
- .ancestors(
- BaseRuleClasses.BaseRule.class,
- BaseRuleClasses.TestBaseRule.class,
- ObjcRuleClasses.IosTestBaseRule.class,
- ObjcRuleClasses.SimulatorRule.class)
- .factoryClass(IosTest.class)
- .build();
- }
-}
-
-/*<!-- #BLAZE_RULE (NAME = experimental_ios_test, TYPE = TEST, FAMILY = Objective-C) -->
-${ATTRIBUTE_SIGNATURE}
-
-<p>Deprecated. Use ios_test instead.</p>
-
-<p>This rule provides a way to build iOS unit tests written in GTM and XCTest test frameworks
-on both iOS simulator and real devices.
-</p>
-
-${ATTRIBUTE_DEFINITION}
-
-<!-- #END_BLAZE_RULE -->*/
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/IosTestRule.java b/src/main/java/com/google/devtools/build/lib/rules/objc/IosTestRule.java
index d2c2e7457e..c7284d85b3 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/objc/IosTestRule.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/objc/IosTestRule.java
@@ -14,14 +14,161 @@
package com.google.devtools.build.lib.rules.objc;
+import static com.google.devtools.build.lib.packages.Attribute.ConfigurationTransition.HOST;
+import static com.google.devtools.build.lib.packages.Attribute.attr;
+import static com.google.devtools.build.lib.packages.BuildType.LABEL;
+import static com.google.devtools.build.lib.packages.BuildType.LABEL_LIST;
+import static com.google.devtools.build.lib.syntax.Type.BOOLEAN;
+import static com.google.devtools.build.lib.syntax.Type.STRING_LIST;
+
+import com.google.common.collect.ImmutableList;
+import com.google.devtools.build.lib.Constants;
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.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.LateBoundLabelList;
+import com.google.devtools.build.lib.packages.AttributeMap;
+import com.google.devtools.build.lib.packages.ImplicitOutputsFunction;
+import com.google.devtools.build.lib.packages.Rule;
+import com.google.devtools.build.lib.packages.RuleClass;
import com.google.devtools.build.lib.packages.RuleClass.Builder.RuleClassType;
+import com.google.devtools.build.lib.rules.apple.AppleConfiguration;
+import com.google.devtools.build.lib.rules.java.J2ObjcConfiguration;
+import com.google.devtools.build.lib.syntax.Type;
+import com.google.devtools.build.lib.util.FileType;
+
+import java.util.List;
/**
* Rule definition for {@code ios_test} rule in Bazel.
*/
-public class IosTestRule extends AbstractIosTestRule {
+public class IosTestRule implements RuleDefinition {
+
+ @Override
+ public RuleClass build(RuleClass.Builder builder, final RuleDefinitionEnvironment env) {
+ return builder
+ .requiresConfigurationFragments(
+ ObjcConfiguration.class, J2ObjcConfiguration.class, AppleConfiguration.class)
+ /*<!-- #BLAZE_RULE(ios_test).IMPLICIT_OUTPUTS -->
+ <ul>
+ <li><code><var>name</var>.ipa</code>: the test bundle as an
+ <code>.ipa</code> file
+ <li><code><var>name</var>.xcodeproj/project.pbxproj: An Xcode project file which can be
+ used to develop or build on a Mac.</li>
+ </ul>
+ <!-- #END_BLAZE_RULE.IMPLICIT_OUTPUTS -->*/
+ .setImplicitOutputsFunction(
+ ImplicitOutputsFunction.fromFunctions(ReleaseBundlingSupport.IPA, XcodeSupport.PBXPROJ))
+ /* <!-- #BLAZE_RULE($ios_test_base_rule).ATTRIBUTE(target_device) -->
+ The device against which to run the test.
+ ${SYNOPSIS}
+ <!-- #END_BLAZE_RULE.ATTRIBUTE -->*/
+ .add(
+ attr(IosTest.TARGET_DEVICE, LABEL)
+ .allowedFileTypes()
+ .allowedRuleClasses("ios_device")
+ .value(
+ env.getLabel(Constants.TOOLS_REPOSITORY + "//tools/objc/sim_devices:default")))
+ /* <!-- #BLAZE_RULE($ios_test_base_rule).ATTRIBUTE(xctest) -->
+ Whether this target contains tests using the XCTest testing framework.
+ ${SYNOPSIS}
+ <!-- #END_BLAZE_RULE.ATTRIBUTE -->*/
+ .add(attr(IosTest.IS_XCTEST, BOOLEAN).value(true))
+ /* <!-- #BLAZE_RULE($ios_test_base_rule).ATTRIBUTE(xctest_app) -->
+ A <code>objc_binary</code> or <code>ios_application</code> target that contains the
+ app bundle to test against in XCTest.
+ This attribute is only valid if <code>xctest</code> is true.
+ ${SYNOPSIS}
+ <!-- #END_BLAZE_RULE.ATTRIBUTE -->*/
+ .add(
+ attr(IosTest.XCTEST_APP, LABEL)
+ .value(
+ new Attribute.ComputedDefault(IosTest.IS_XCTEST) {
+ @Override
+ public Object getDefault(AttributeMap rule) {
+ return rule.get(IosTest.IS_XCTEST, Type.BOOLEAN)
+ // No TOOLS_REPOSITORY prefix for the xctest_app tool; xcode projects
+ // referencing a dependency under a repository do not work. Thus,
+ // this target must be available in the target depot.
+ ? env.getLabel("//tools/objc:xctest_app")
+ : null;
+ }
+ })
+ .allowedFileTypes()
+ // TODO(bazel-team): Remove objc_binary once it stops exporting XcTestAppProvider.
+ .allowedRuleClasses("objc_binary", "ios_application"))
+ .override(
+ attr("infoplist", LABEL)
+ .value(
+ new Attribute.ComputedDefault(IosTest.IS_XCTEST) {
+ @Override
+ public Object getDefault(AttributeMap rule) {
+ return rule.get(IosTest.IS_XCTEST, Type.BOOLEAN)
+ // No TOOLS_REPOSITORY prefix for the xctest_app tool; xcode projects
+ // referencing a dependency under a repository do not work. Thus,
+ // this target must be available in the target depot.
+ ? env.getLabel("//tools/objc:xctest_infoplist")
+ : null;
+ }
+ })
+ .allowedFileTypes(ObjcRuleClasses.PLIST_TYPE))
+ /* <!-- #BLAZE_RULE(ios_test).ATTRIBUTE(ios_test_target_device) -->
+ The device against how to run the test. If this attribute is defined, the test will run on
+ the lab device. Otherwise, the test will run on simulator.
+ ${SYNOPSIS}
+ <!-- #END_BLAZE_RULE.ATTRIBUTE -->*/
+ .add(
+ attr("ios_test_target_device", LABEL)
+ .allowedFileTypes()
+ .allowedRuleClasses("ios_lab_device"))
+ /* <!-- #BLAZE_RULE(ios_test).ATTRIBUTE(ios_device_arg) -->
+ Extra arguments to pass to the <code>ios_test_target_device</code>'s binary. They should be
+ in the form KEY=VALUE or simply KEY (check your device's documentation for allowed
+ parameters).
+ ${SYNOPSIS}
+ <!-- #END_BLAZE_RULE.ATTRIBUTE -->*/
+ .add(attr("ios_device_arg", STRING_LIST))
+ /* <!-- #BLAZE_RULE(ios_test).ATTRIBUTE(plugins) -->
+ Plugins to pass to the test runner.
+ ${SYNOPSIS}
+ <!-- #END_BLAZE_RULE.ATTRIBUTE -->*/
+ .add(attr("plugins", LABEL_LIST).allowedFileTypes(FileType.of("_deploy.jar")))
+ .add(
+ attr("$test_template", LABEL)
+ .value(
+ env.getLabel(
+ Constants.TOOLS_REPOSITORY + "//tools/objc:ios_test.sh.bazel_template")))
+ .add(
+ attr("$test_runner", LABEL)
+ .value(env.getLabel(Constants.TOOLS_REPOSITORY + "//tools/objc:testrunner")))
+ .add(
+ attr(IosTest.MEMLEAKS_DEP, LABEL)
+ .value(env.getLabel(Constants.TOOLS_REPOSITORY + "//tools/objc/memleaks:memleaks")))
+ .add(
+ attr(IosTest.MEMLEAKS_PLUGIN, LABEL)
+ .value(env.getLabel(Constants.TOOLS_REPOSITORY + "//tools/objc:memleaks_plugin")))
+ .override(
+ attr(":gcov", LABEL_LIST)
+ .cfg(HOST)
+ .value(
+ new LateBoundLabelList<BuildConfiguration>() {
+ @Override
+ public List<Label> getDefault(Rule rule, BuildConfiguration configuration) {
+ if (!configuration.isCodeCoverageEnabled()) {
+ return ImmutableList.of();
+ }
+ return ImmutableList.of(
+ configuration
+ .getFragment(ObjcConfiguration.class)
+ .getExperimentalGcovLabel());
+ }
+ }))
+ .build();
+ }
+
@Override
public Metadata getMetadata() {
return RuleDefinition.Metadata.builder()
@@ -30,9 +177,24 @@ public class IosTestRule extends AbstractIosTestRule {
.ancestors(
BaseRuleClasses.BaseRule.class,
BaseRuleClasses.TestBaseRule.class,
- ObjcRuleClasses.IosTestBaseRule.class,
+ ObjcRuleClasses.CompilingRule.class,
+ ObjcRuleClasses.ReleaseBundlingRule.class,
+ ObjcRuleClasses.LinkingRule.class,
+ ObjcRuleClasses.XcodegenRule.class,
ObjcRuleClasses.SimulatorRule.class)
.factoryClass(IosTest.class)
.build();
}
}
+
+/*<!-- #BLAZE_RULE (NAME = ios_test, TYPE = TEST, FAMILY = Objective-C) -->
+
+${ATTRIBUTE_SIGNATURE}
+
+<p>This rule provides a way to build iOS unit tests written in KIF, GTM and XCTest test frameworks
+on both iOS simulator and real devices.
+</p>
+
+${ATTRIBUTE_DEFINITION}
+
+<!-- #END_BLAZE_RULE -->*/
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcRuleClasses.java b/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcRuleClasses.java
index d4f006e6c4..2faaf1f2ac 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcRuleClasses.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcRuleClasses.java
@@ -804,82 +804,6 @@ public class ObjcRuleClasses {
}
}
-
- /**
- * Base rule definition for iOS test rules.
- */
- public static class IosTestBaseRule implements RuleDefinition {
- @Override
- public RuleClass build(Builder builder, final RuleDefinitionEnvironment env) {
- return builder
- /* <!-- #BLAZE_RULE($ios_test_base_rule).ATTRIBUTE(target_device) -->
- The device against which to run the test.
- ${SYNOPSIS}
- <!-- #END_BLAZE_RULE.ATTRIBUTE -->*/
- .add(
- attr(IosTest.TARGET_DEVICE, LABEL)
- .allowedFileTypes()
- .allowedRuleClasses("ios_device"))
- /* <!-- #BLAZE_RULE($ios_test_base_rule).ATTRIBUTE(xctest) -->
- Whether this target contains tests using the XCTest testing framework.
- ${SYNOPSIS}
- <!-- #END_BLAZE_RULE.ATTRIBUTE -->*/
- .add(attr(IosTest.IS_XCTEST, BOOLEAN).value(true))
- /* <!-- #BLAZE_RULE($ios_test_base_rule).ATTRIBUTE(xctest_app) -->
- A <code>objc_binary</code> or <code>ios_application</code> target that contains the
- app bundle to test against in XCTest.
- This attribute is only valid if <code>xctest</code> is true.
- ${SYNOPSIS}
- <!-- #END_BLAZE_RULE.ATTRIBUTE -->*/
- .add(
- attr(IosTest.XCTEST_APP, LABEL)
- .value(
- new Attribute.ComputedDefault(IosTest.IS_XCTEST) {
- @Override
- public Object getDefault(AttributeMap rule) {
- return rule.get(IosTest.IS_XCTEST, Type.BOOLEAN)
- // No TOOLS_REPOSITORY prefix for the xctest_app tool; xcode projects
- // referencing a dependency under a repository do not work. Thus,
- // this target must be available in the target depot.
- ? env.getLabel("//tools/objc:xctest_app")
- : null;
- }
- })
- .allowedFileTypes()
- // TODO(bazel-team): Remove objc_binary once it stops exporting XcTestAppProvider.
- .allowedRuleClasses("objc_binary", "ios_application"))
- .override(
- attr("infoplist", LABEL)
- .value(
- new Attribute.ComputedDefault(IosTest.IS_XCTEST) {
- @Override
- public Object getDefault(AttributeMap rule) {
- return rule.get(IosTest.IS_XCTEST, Type.BOOLEAN)
- // No TOOLS_REPOSITORY prefix for the xctest_app tool; xcode projects
- // referencing a dependency under a repository do not work. Thus,
- // this target must be available in the target depot.
- ? env.getLabel("//tools/objc:xctest_infoplist")
- : null;
- }
- })
- .allowedFileTypes(PLIST_TYPE))
- .build();
- }
- @Override
- public Metadata getMetadata() {
- return RuleDefinition.Metadata.builder()
- .name("$ios_test_base_rule")
- .type(RuleClassType.ABSTRACT)
- .ancestors(
- CompilingRule.class,
- ReleaseBundlingRule.class,
- LinkingRule.class,
- XcodegenRule.class,
- SimulatorRule.class)
- .build();
- }
- }
-
/**
* Common attributes for {@code objc_*} rules that create a bundle.
*/