aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/rules/objc
diff options
context:
space:
mode:
authorGravatar Lukacs Berki <lberki@google.com>2015-10-05 12:30:56 +0000
committerGravatar Damien Martin-Guillerez <dmarting@google.com>2015-10-05 15:16:43 +0000
commit3fbcc611533ba19f283afa3e01240456de9e788e (patch)
tree436809460e138df65e0840d61a8554e2650f307d /src/main/java/com/google/devtools/build/lib/rules/objc
parentab141f8d1035eb30bbb9dc09d89ea6a3ba83cc0f (diff)
Add a Constants.TOOLS_PREFIX constant that will serve to redirect the Bazel tools repository.
This is a no-op refactoring CL. The actual switch will be made once everything passes with the new setup. As a side cleanup, change the awkward realAndroidSdk() / realAndroidCrosstoolTop() mechanism to a converter. -- MOS_MIGRATED_REVID=104649067
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/objc')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/objc/BazelJ2ObjcProtoAspect.java5
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/objc/ExperimentalIosTestRule.java10
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/objc/IosApplicationRule.java4
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/objc/J2ObjcAspect.java5
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/objc/ObjcBinaryRule.java4
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/objc/ObjcCommandLineOptions.java26
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/objc/ObjcProtoLibraryRule.java7
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/objc/ObjcRuleClasses.java33
8 files changed, 63 insertions, 31 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/BazelJ2ObjcProtoAspect.java b/src/main/java/com/google/devtools/build/lib/rules/objc/BazelJ2ObjcProtoAspect.java
index 8d692e562c..2da029c7ad 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/objc/BazelJ2ObjcProtoAspect.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/objc/BazelJ2ObjcProtoAspect.java
@@ -19,6 +19,7 @@ import static com.google.devtools.build.lib.packages.Attribute.attr;
import static com.google.devtools.build.lib.packages.BuildType.LABEL;
import com.google.common.collect.ImmutableMap;
+import com.google.devtools.build.lib.Constants;
import com.google.devtools.build.lib.actions.Artifact;
import com.google.devtools.build.lib.analysis.ConfiguredTarget;
import com.google.devtools.build.lib.analysis.RuleConfiguredTarget.Mode;
@@ -42,11 +43,11 @@ public class BazelJ2ObjcProtoAspect extends AbstractJ2ObjcProtoAspect {
.add(attr("$protoc_darwin", LABEL)
.cfg(HOST)
.exec()
- .value(parseLabel("//tools/objc:compile_protos")))
+ .value(parseLabel(Constants.TOOLS_REPOSITORY + "//tools/objc:compile_protos")))
.add(attr("$protoc_support_darwin", LABEL)
.cfg(HOST)
.exec()
- .value(parseLabel("//tools/objc:proto_support")))
+ .value(parseLabel(Constants.TOOLS_REPOSITORY + "//tools/objc:proto_support")))
.add(attr("$j2objc_plugin", LABEL)
.cfg(HOST)
.exec()
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 a7b81dcc07..1769a9c05b 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
@@ -21,6 +21,7 @@ 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.BaseRuleClasses;
import com.google.devtools.build.lib.analysis.RuleDefinition;
import com.google.devtools.build.lib.analysis.RuleDefinitionEnvironment;
@@ -62,7 +63,8 @@ public final class ExperimentalIosTestRule implements RuleDefinition {
attr(IosTest.TARGET_DEVICE, LABEL)
.allowedFileTypes()
.allowedRuleClasses("ios_device")
- .value(env.getLabel("//tools/objc/sim_devices:default")))
+ .value(env.getLabel(
+ Constants.TOOLS_REPOSITORY + "//tools/objc/sim_devices:default")))
/* <!-- #BLAZE_RULE(experimental_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.
@@ -85,8 +87,10 @@ public final class ExperimentalIosTestRule implements RuleDefinition {
<!-- #END_BLAZE_RULE.ATTRIBUTE -->*/
.add(attr("plugins", LABEL_LIST).allowedFileTypes(FileType.of("_deploy.jar")))
.add(attr("$test_template", LABEL)
- .value(env.getLabel("//tools/objc:ios_test.sh.bazel_template")))
- .add(attr("$test_runner", LABEL).value(env.getLabel("//tools/objc:testrunner")))
+ .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")))
.override(attr(":gcov", LABEL_LIST).cfg(HOST)
.value(new LateBoundLabelList<BuildConfiguration>() {
@Override
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/IosApplicationRule.java b/src/main/java/com/google/devtools/build/lib/rules/objc/IosApplicationRule.java
index 363219f0f8..f25d457176 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/objc/IosApplicationRule.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/objc/IosApplicationRule.java
@@ -20,6 +20,7 @@ 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 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;
@@ -65,7 +66,8 @@ public class IosApplicationRule implements RuleDefinition {
.allowedFileTypes()
.direct_compile_time_input())
.add(attr("$runner_script_template", LABEL).cfg(HOST)
- .value(env.getLabel("//tools/objc:ios_runner.sh.mac_template")))
+ .value(env.getLabel(
+ Constants.TOOLS_REPOSITORY + "//tools/objc:ios_runner.sh.mac_template")))
.add(attr("$is_executable", BOOLEAN).value(true)
.nonconfigurable("Called from RunCommand.isExecutable, which takes a Target"))
.build();
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/J2ObjcAspect.java b/src/main/java/com/google/devtools/build/lib/rules/objc/J2ObjcAspect.java
index 4a6a7f182f..f6a527bde6 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/objc/J2ObjcAspect.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/objc/J2ObjcAspect.java
@@ -21,6 +21,7 @@ import static java.nio.charset.StandardCharsets.ISO_8859_1;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
+import com.google.devtools.build.lib.Constants;
import com.google.devtools.build.lib.actions.Artifact;
import com.google.devtools.build.lib.actions.ParameterFile;
import com.google.devtools.build.lib.analysis.Aspect;
@@ -70,13 +71,13 @@ public class J2ObjcAspect implements ConfiguredAspectFactory {
.requireProvider(JavaSourceInfoProvider.class)
.requireProvider(JavaCompilationArgsProvider.class)
.add(attr("$j2objc", LABEL).cfg(HOST).exec()
- .value(parseLabel("//tools/j2objc:j2objc_deploy.jar")))
+ .value(parseLabel(Constants.TOOLS_REPOSITORY + "//tools/j2objc:j2objc_deploy.jar")))
.add(attr("$j2objc_wrapper", LABEL)
.allowedFileTypes(FileType.of(".py"))
.cfg(HOST)
.exec()
.singleArtifact()
- .value(parseLabel("//tools/j2objc:j2objc_wrapper")))
+ .value(parseLabel(Constants.TOOLS_REPOSITORY + "//tools/j2objc:j2objc_wrapper")))
.build();
}
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcBinaryRule.java b/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcBinaryRule.java
index bb34419929..deeb5aca5f 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcBinaryRule.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcBinaryRule.java
@@ -19,6 +19,7 @@ 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.syntax.Type.BOOLEAN;
+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;
@@ -49,7 +50,8 @@ public class ObjcBinaryRule implements RuleDefinition {
ImplicitOutputsFunction.fromFunctions(ReleaseBundlingSupport.IPA, XcodeSupport.PBXPROJ))
// TODO(bazel-team): Remove these when this rule no longer produces a bundle.
.add(attr("$runner_script_template", LABEL).cfg(HOST)
- .value(env.getLabel("//tools/objc:ios_runner.sh.mac_template")))
+ .value(env.getLabel(
+ Constants.TOOLS_REPOSITORY + "//tools/objc:ios_runner.sh.mac_template")))
.add(attr("$is_executable", BOOLEAN).value(true)
.nonconfigurable("Called from RunCommand.isExecutable, which takes a Target"))
.build();
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcCommandLineOptions.java b/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcCommandLineOptions.java
index f88ce4fbdb..d30cc92cdb 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcCommandLineOptions.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcCommandLineOptions.java
@@ -17,7 +17,8 @@ package com.google.devtools.build.lib.rules.objc;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Multimap;
-import com.google.devtools.build.lib.analysis.config.BuildConfiguration.LabelConverter;
+import com.google.devtools.build.lib.Constants;
+import com.google.devtools.build.lib.analysis.config.BuildConfiguration.DefaultLabelConverter;
import com.google.devtools.build.lib.analysis.config.BuildOptions;
import com.google.devtools.build.lib.analysis.config.FragmentOptions;
import com.google.devtools.build.lib.cmdline.Label;
@@ -33,6 +34,20 @@ import java.util.List;
* Command-line options for building Objective-C targets.
*/
public class ObjcCommandLineOptions extends FragmentOptions {
+ /** Converter for --objc_dump_syms_binary. */
+ public static class DumpSymsConverter extends DefaultLabelConverter {
+ public DumpSymsConverter() {
+ super(Constants.TOOLS_REPOSITORY + "//tools/objc:dump_syms");
+ }
+ }
+
+ /** Converter for --default_ios_provisioning_profile. */
+ public static class DefaultProvisioningProfileConverter extends DefaultLabelConverter {
+ public DefaultProvisioningProfileConverter() {
+ super(Constants.TOOLS_REPOSITORY + "//tools/objc:default_provisioning_profile");
+ }
+ }
+
// TODO(cparsons): Validate version flag value.
@Option(name = "xcode_version",
defaultValue = "",
@@ -114,15 +129,15 @@ public class ObjcCommandLineOptions extends FragmentOptions {
public String iosSplitCpu;
@Option(name = "objc_dump_syms_binary",
- defaultValue = "//tools/objc:dump_syms",
+ defaultValue = "",
category = "undocumented",
- converter = LabelConverter.class)
+ converter = DumpSymsConverter.class)
public Label dumpSyms;
@Option(name = "default_ios_provisiong_profile",
- defaultValue = "//tools/objc:default_provisioning_profile",
+ defaultValue = "",
category = "undocumented",
- converter = LabelConverter.class)
+ converter = DefaultProvisioningProfileConverter.class)
public Label defaultProvisioningProfile;
@Option(name = "objc_per_proto_includes",
@@ -206,6 +221,7 @@ public class ObjcCommandLineOptions extends FragmentOptions {
IosApplication.SPLIT_ARCH_TRANSITION, IosExtension.MINIMUM_OS_AND_SPLIT_ARCH_TRANSITION);
}
+ /** Converter for the iOS configuration distinguisher. */
public static final class ConfigurationDistinguisherConverter
extends EnumConverter<ConfigurationDistinguisher> {
public ConfigurationDistinguisherConverter() {
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcProtoLibraryRule.java b/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcProtoLibraryRule.java
index 1374c35d79..03ea73d953 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcProtoLibraryRule.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcProtoLibraryRule.java
@@ -21,6 +21,7 @@ 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 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;
@@ -81,11 +82,11 @@ public class ObjcProtoLibraryRule implements RuleDefinition {
.allowedFileTypes(FileType.of(".py"))
.cfg(HOST)
.singleArtifact()
- .value(env.getLabel("//tools/objc:compile_protos")))
+ .value(env.getLabel(Constants.TOOLS_REPOSITORY + "//tools/objc:compile_protos")))
.add(attr(PROTO_SUPPORT_ATTR, LABEL)
.legacyAllowAnyFileType()
.cfg(HOST)
- .value(env.getLabel("//tools/objc:proto_support")))
+ .value(env.getLabel(Constants.TOOLS_REPOSITORY + "//tools/objc:proto_support")))
.add(attr(USE_OBJC_HEADER_NAMES_ATTR, BOOLEAN).value(false))
.add(attr(LIBPROTOBUF_ATTR, LABEL).allowedRuleClasses("objc_library")
.value(new ComputedDefault(OUTPUT_CPP_ATTR) {
@@ -97,7 +98,7 @@ public class ObjcProtoLibraryRule implements RuleDefinition {
}
}))
.add(attr("$xcodegen", LABEL).cfg(HOST).exec()
- .value(env.getLabel("//tools/objc:xcodegen")))
+ .value(env.getLabel(Constants.TOOLS_REPOSITORY + "//tools/objc:xcodegen")))
.build();
}
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 e21a9755d5..082603d5a9 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
@@ -26,6 +26,7 @@ import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
+import com.google.devtools.build.lib.Constants;
import com.google.devtools.build.lib.actions.Artifact;
import com.google.devtools.build.lib.analysis.BaseRuleClasses;
import com.google.devtools.build.lib.analysis.RuleConfiguredTarget.Mode;
@@ -497,15 +498,15 @@ public class ObjcRuleClasses {
public RuleClass build(Builder builder, RuleDefinitionEnvironment env) {
return builder
.add(attr("$plmerge", LABEL).cfg(HOST).exec()
- .value(env.getLabel("//tools/objc:plmerge")))
+ .value(env.getLabel(Constants.TOOLS_REPOSITORY + "//tools/objc:plmerge")))
.add(attr("$actoolwrapper", LABEL).cfg(HOST).exec()
- .value(env.getLabel("//tools/objc:actoolwrapper")))
+ .value(env.getLabel(Constants.TOOLS_REPOSITORY + "//tools/objc:actoolwrapper")))
.add(attr("$ibtoolwrapper", LABEL).cfg(HOST).exec()
- .value(env.getLabel("//tools/objc:ibtoolwrapper")))
+ .value(env.getLabel(Constants.TOOLS_REPOSITORY + "//tools/objc:ibtoolwrapper")))
// TODO(dmaclach): Adding realpath here should not be required once
// https://github.com/bazelbuild/bazel/issues/285 is fixed.
.add(attr("$realpath", LABEL).cfg(HOST).exec()
- .value(env.getLabel("//tools/objc:realpath")))
+ .value(env.getLabel(Constants.TOOLS_REPOSITORY + "//tools/objc:realpath")))
.build();
}
@Override
@@ -525,9 +526,9 @@ public class ObjcRuleClasses {
public RuleClass build(Builder builder, RuleDefinitionEnvironment env) {
return builder
.add(attr("$xcodegen", LABEL).cfg(HOST).exec()
- .value(env.getLabel("//tools/objc:xcodegen")))
+ .value(env.getLabel(Constants.TOOLS_REPOSITORY + "//tools/objc:xcodegen")))
.add(attr("$dummy_source", LABEL)
- .value(env.getLabel("//tools/objc:dummy.c")))
+ .value(env.getLabel(Constants.TOOLS_REPOSITORY + "//tools/objc:dummy.c")))
.build();
}
@Override
@@ -771,7 +772,8 @@ public class ObjcRuleClasses {
.cfg(HOST)
.exec()
.singleArtifact()
- .value(env.getLabel("//tools/objc:j2objc_dead_code_pruner")))
+ .value(env.getLabel(
+ Constants.TOOLS_REPOSITORY + "//tools/objc:j2objc_dead_code_pruner")))
.build();
}
@Override
@@ -818,7 +820,7 @@ public class ObjcRuleClasses {
@Override
public Object getDefault(AttributeMap rule) {
return rule.get(IosTest.IS_XCTEST, Type.BOOLEAN)
- ? env.getLabel("//tools/objc:xctest_app")
+ ? env.getLabel(Constants.TOOLS_REPOSITORY + "//tools/objc:xctest_app")
: null;
}
})
@@ -832,7 +834,8 @@ public class ObjcRuleClasses {
@Override
public Object getDefault(AttributeMap rule) {
return rule.get(IosTest.IS_XCTEST, Type.BOOLEAN)
- ? env.getLabel("//tools/objc:xctest_infoplist")
+ ? env.getLabel(
+ Constants.TOOLS_REPOSITORY + "//tools/objc:xctest_infoplist")
: null;
}
})
@@ -890,9 +893,10 @@ public class ObjcRuleClasses {
.add(attr("families", STRING_LIST)
.value(ImmutableList.of(TargetDeviceFamily.IPHONE.getNameInRule())))
.add(attr("$momcwrapper", LABEL).cfg(HOST).exec()
- .value(env.getLabel("//tools/objc:momcwrapper")))
+ .value(env.getLabel(Constants.TOOLS_REPOSITORY + "//tools/objc:momcwrapper")))
.add(attr("$swiftstdlibtoolwrapper", LABEL).cfg(HOST).exec()
- .value(env.getLabel("//tools/objc:swiftstdlibtoolwrapper")))
+ .value(env.getLabel(
+ Constants.TOOLS_REPOSITORY + "//tools/objc:swiftstdlibtoolwrapper")))
.build();
}
@Override
@@ -997,9 +1001,10 @@ public class ObjcRuleClasses {
}
}))
.add(attr("$bundlemerge", LABEL).cfg(HOST).exec()
- .value(env.getLabel("//tools/objc:bundlemerge")))
+ .value(env.getLabel(Constants.TOOLS_REPOSITORY + "//tools/objc:bundlemerge")))
.add(attr("$environment_plist_sh", LABEL).cfg(HOST)
- .value(env.getLabel("//tools/objc:environment_plist.sh")))
+ .value(env.getLabel(
+ Constants.TOOLS_REPOSITORY + "//tools/objc:environment_plist.sh")))
.build();
}
@Override
@@ -1023,7 +1028,7 @@ public class ObjcRuleClasses {
.add(attr("$iossim", LABEL).cfg(HOST).exec()
.value(env.getLabel("//third_party/iossim:iossim")))
.add(attr("$std_redirect_dylib", LABEL).cfg(HOST).exec()
- .value(env.getLabel("//tools/objc:StdRedirect.dylib")))
+ .value(env.getLabel(Constants.TOOLS_REPOSITORY + "//tools/objc:StdRedirect.dylib")))
.build();
}
@Override