aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Googler <noreply@google.com>2015-07-15 22:01:18 +0000
committerGravatar Kristina Chodorow <kchodorow@google.com>2015-07-16 08:15:20 +0000
commitb8d1e700841d8aa7186ccbdfb0eba53e12a672d0 (patch)
tree75df4237ea8401e76e88c1d0d7522cee327815ae /src
parentb9d84134dc95795fea6ce8477d5030bd8adf726e (diff)
Description redacted.
-- MOS_MIGRATED_REVID=98347349
Diffstat (limited to 'src')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/objc/BundleSupport.java35
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/objc/IosSdkCommands.java2
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/objc/ObjcRuleClasses.java13
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/objc/ReleaseBundlingSupport.java29
-rw-r--r--src/objc_tools/momczip/BUILD11
-rw-r--r--src/objc_tools/momczip/README2
-rw-r--r--src/objc_tools/momczip/java/com/google/devtools/build/xcode/momczip/MomcZip.java56
-rw-r--r--src/tools/xcode-common/BUILD2
-rw-r--r--src/tools/xcode-common/java/com/google/devtools/build/xcode/actoolzip/ActoolZip.java116
-rw-r--r--src/tools/xcode-common/java/com/google/devtools/build/xcode/actoolzip/BUILD17
-rw-r--r--src/tools/xcode-common/java/com/google/devtools/build/xcode/actoolzip/README4
-rw-r--r--src/tools/xcode-common/java/com/google/devtools/build/xcode/swiftstdlibtoolzip/BUILD17
-rw-r--r--src/tools/xcode-common/java/com/google/devtools/build/xcode/swiftstdlibtoolzip/README4
-rw-r--r--src/tools/xcode-common/java/com/google/devtools/build/xcode/swiftstdlibtoolzip/SwiftStdlibToolZip.java59
-rw-r--r--src/tools/xcode/actoolwrapper/BUILD12
-rw-r--r--src/tools/xcode/actoolwrapper/README6
-rwxr-xr-xsrc/tools/xcode/actoolwrapper/actoolwrapper.sh71
-rwxr-xr-xsrc/tools/xcode/ibtoolwrapper/ibtoolwrapper.sh13
-rw-r--r--src/tools/xcode/momcwrapper/BUILD12
-rw-r--r--src/tools/xcode/momcwrapper/README6
-rwxr-xr-xsrc/tools/xcode/momcwrapper/momcwrapper.sh38
-rw-r--r--src/tools/xcode/swiftstdlibtoolwrapper/BUILD12
-rw-r--r--src/tools/xcode/swiftstdlibtoolwrapper/README6
-rwxr-xr-xsrc/tools/xcode/swiftstdlibtoolwrapper/swiftstdlibtoolwrapper.sh38
24 files changed, 251 insertions, 330 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/BundleSupport.java b/src/main/java/com/google/devtools/build/lib/rules/objc/BundleSupport.java
index 9ace1d304e..8382ac8007 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/objc/BundleSupport.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/objc/BundleSupport.java
@@ -200,7 +200,7 @@ final class BundleSupport {
ruleContext.registerAction(
ObjcRuleClasses.spawnOnDarwinActionBuilder()
.setMnemonic("StoryboardCompile")
- .setExecutable(attributes.ibtoolwrapper())
+ .setExecutable(attributes.ibtoolWrapper())
.setCommandLine(ibActionsCommandLine(archiveRoot, zipOutput, storyboardInput))
.addOutput(zipOutput)
.addInput(storyboardInput)
@@ -238,15 +238,17 @@ final class BundleSupport {
for (Xcdatamodel datamodel : xcdatamodels) {
Artifact outputZip = datamodel.getOutputZip();
ruleContext.registerAction(
- ObjcRuleClasses.spawnJavaOnDarwinActionBuilder(attributes.momczipDeployJar())
+ ObjcRuleClasses.spawnOnDarwinActionBuilder()
.setMnemonic("MomCompile")
+ .setExecutable(attributes.momcWrapper())
.addOutput(outputZip)
.addInputs(datamodel.getInputs())
+ // TODO(dmaclach): Adding realpath here should not be required once
+ // https://github.com/google/bazel/issues/285 is fixed.
+ .addInput(attributes.realpath())
.setCommandLine(CustomCommandLine.builder()
.addPath(outputZip.getExecPath())
.add(datamodel.archiveRootForMomczip())
- .add(IosSdkCommands.MOMC_PATH)
-
.add("-XD_MOMC_SDKROOT=" + IosSdkCommands.sdkDir(objcConfiguration))
.add("-XD_MOMC_IOS_TARGET_VERSION=" + bundling.getMinimumOsVersion())
.add("-MOMC_PLATFORMS")
@@ -269,7 +271,7 @@ final class BundleSupport {
ruleContext.registerAction(
ObjcRuleClasses.spawnOnDarwinActionBuilder()
.setMnemonic("XibCompile")
- .setExecutable(attributes.ibtoolwrapper())
+ .setExecutable(attributes.ibtoolWrapper())
.setCommandLine(ibActionsCommandLine(archiveRoot, zipOutput, original))
.addOutput(zipOutput)
.addInput(original)
@@ -348,11 +350,15 @@ final class BundleSupport {
// zip file will be rooted at the bundle root, and we have to prepend the bundle root to each
// entry when merging it with the final .ipa file.
ruleContext.registerAction(
- ObjcRuleClasses.spawnJavaOnDarwinActionBuilder(attributes.actoolzipDeployJar())
+ ObjcRuleClasses.spawnOnDarwinActionBuilder()
.setMnemonic("AssetCatalogCompile")
+ .setExecutable(attributes.actoolWrapper())
.addTransitiveInputs(objcProvider.get(ASSET_CATALOG))
.addOutput(zipOutput)
.addOutput(actoolPartialInfoplist)
+ // TODO(dmaclach): Adding realpath here should not be required once
+ // https://github.com/google/bazel/issues/285 is fixed.
+ .addInput(attributes.realpath())
.setCommandLine(actoolzipCommandLine(
objcProvider,
zipOutput,
@@ -366,9 +372,6 @@ final class BundleSupport {
CustomCommandLine.Builder commandLine = CustomCommandLine.builder()
// The next three arguments are positional, i.e. they don't have flags before them.
.addPath(zipOutput.getExecPath())
- .add("") // archive root
- .add(IosSdkCommands.ACTOOL_PATH)
-
.add("--platform").add(objcConfiguration.getBundlingPlatform().getLowerCaseNameInPlist())
.addExecPath("--output-partial-info-plist", partialInfoPlist)
.add("--minimum-deployment-target").add(bundling.getMinimumOsVersion());
@@ -439,7 +442,7 @@ final class BundleSupport {
/**
* Returns the location of the ibtoolwrapper tool.
*/
- FilesToRunProvider ibtoolwrapper() {
+ FilesToRunProvider ibtoolWrapper() {
return ruleContext.getExecutablePrerequisite("$ibtoolwrapper", Mode.HOST);
}
@@ -453,17 +456,17 @@ final class BundleSupport {
}
/**
- * Returns the location of the momczip deploy jar.
+ * Returns the location of the momcwrapper.
*/
- Artifact momczipDeployJar() {
- return ruleContext.getPrerequisiteArtifact("$momczip_deploy", Mode.HOST);
+ FilesToRunProvider momcWrapper() {
+ return ruleContext.getExecutablePrerequisite("$momcwrapper", Mode.HOST);
}
/**
- * Returns the location of the actoolzip deploy jar.
+ * Returns the location of the actoolwrapper.
*/
- Artifact actoolzipDeployJar() {
- return ruleContext.getPrerequisiteArtifact("$actoolzip_deploy", Mode.HOST);
+ FilesToRunProvider actoolWrapper() {
+ return ruleContext.getExecutablePrerequisite("$actoolwrapper", Mode.HOST);
}
}
}
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/IosSdkCommands.java b/src/main/java/com/google/devtools/build/lib/rules/objc/IosSdkCommands.java
index 7d0c2337a3..799597bee0 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/objc/IosSdkCommands.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/objc/IosSdkCommands.java
@@ -32,8 +32,6 @@ import java.util.List;
*/
public class IosSdkCommands {
public static final String DEVELOPER_DIR = "/Applications/Xcode.app/Contents/Developer";
- public static final String ACTOOL_PATH = DEVELOPER_DIR + "/usr/bin/actool";
- public static final String MOMC_PATH = DEVELOPER_DIR + "/usr/bin/momc";
// There is a handy reference to many clang warning flags at
// http://nshipster.com/clang-diagnostics/
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 02d3566135..a879f9d786 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
@@ -66,7 +66,6 @@ public class ObjcRuleClasses {
static final PathFragment LIBTOOL = new PathFragment(BIN_DIR + "/libtool");
static final PathFragment DSYMUTIL = new PathFragment(BIN_DIR + "/dsymutil");
static final PathFragment LIPO = new PathFragment(BIN_DIR + "/lipo");
- static final PathFragment SWIFT_STDLIB_TOOL = new PathFragment(BIN_DIR + "/swift-stdlib-tool");
static final PathFragment STRIP = new PathFragment(BIN_DIR + "/strip");
private static final PathFragment JAVA = new PathFragment("/usr/bin/java");
@@ -469,16 +468,14 @@ public class ObjcRuleClasses {
return builder
.add(attr("$plmerge", LABEL).cfg(HOST).exec()
.value(env.getLabel("//tools/objc:plmerge")))
- .add(attr("$actoolzip_deploy", LABEL).cfg(HOST)
- .value(env.getLabel("//tools/objc:actoolzip_deploy.jar")))
+ .add(attr("$actoolwrapper", LABEL).cfg(HOST).exec()
+ .value(env.getLabel("//tools/objc:actoolwrapper")))
.add(attr("$ibtoolwrapper", LABEL).cfg(HOST).exec()
.value(env.getLabel("//tools/objc:ibtoolwrapper")))
// TODO(dmaclach): Adding realpath here should not be required once
// https://github.com/google/bazel/issues/285 is fixed.
.add(attr("$realpath", LABEL).cfg(HOST).exec()
.value(env.getLabel("//tools/objc:realpath")))
- .add(attr("$swiftstdlibtoolzip_deploy", LABEL).cfg(HOST)
- .value(env.getLabel("//tools/objc:swiftstdlibtoolzip_deploy.jar")))
.build();
}
@Override
@@ -871,8 +868,10 @@ public class ObjcRuleClasses {
<!-- #END_BLAZE_RULE.ATTRIBUTE -->*/
.add(attr("families", STRING_LIST)
.value(ImmutableList.of(TargetDeviceFamily.IPHONE.getNameInRule())))
- .add(attr("$momczip_deploy", LABEL).cfg(HOST)
- .value(env.getLabel("//tools/objc:momczip_deploy.jar")))
+ .add(attr("$momcwrapper", LABEL).cfg(HOST).exec()
+ .value(env.getLabel("//tools/objc:momcwrapper")))
+ .add(attr("$swiftstdlibtoolwrapper", LABEL).cfg(HOST).exec()
+ .value(env.getLabel("//tools/objc:swiftstdlibtoolwrapper")))
.build();
}
@Override
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/ReleaseBundlingSupport.java b/src/main/java/com/google/devtools/build/lib/rules/objc/ReleaseBundlingSupport.java
index 2d3bda4b2a..dc0fa8eca7 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/objc/ReleaseBundlingSupport.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/objc/ReleaseBundlingSupport.java
@@ -676,9 +676,7 @@ public final class ReleaseBundlingSupport {
.build(ruleContext));
}
- /**
- * Registers an action to copy Swift standard library dylibs into app bundle.
- */
+ /** Registers an action to copy Swift standard library dylibs into app bundle. */
private void registerSwiftStdlibActionsIfNecessary() {
if (!objcProvider.is(USES_SWIFT)) {
return;
@@ -688,17 +686,19 @@ public final class ReleaseBundlingSupport {
CustomCommandLine.Builder commandLine = CustomCommandLine.builder()
.addPath(intermediateArtifacts.swiftFrameworksFileZip().getExecPath())
- .add("Frameworks")
- .addPath(ObjcRuleClasses.SWIFT_STDLIB_TOOL)
.add("--platform").add(IosSdkCommands.swiftPlatform(objcConfiguration))
.addExecPath("--scan-executable", intermediateArtifacts.strippedSingleArchitectureBinary());
ruleContext.registerAction(
- ObjcRuleClasses.spawnJavaOnDarwinActionBuilder(attributes.swiftStdlibToolDeployJar())
+ ObjcRuleClasses.spawnOnDarwinActionBuilder()
.setMnemonic("SwiftStdlibCopy")
+ .setExecutable(attributes.swiftStdlibToolWrapper())
.setCommandLine(commandLine.build())
.addOutput(intermediateArtifacts.swiftFrameworksFileZip())
.addInput(intermediateArtifacts.strippedSingleArchitectureBinary())
+ // TODO(dmaclach): Adding realpath here should not be required once
+ // https://github.com/google/bazel/issues/285 is fixed.
+ .addInput(attributes.realpath())
.build(ruleContext));
}
@@ -790,11 +790,18 @@ public final class ReleaseBundlingSupport {
ruleContext.getPrerequisiteArtifact("$runner_script_template", Mode.HOST));
}
+ /** Returns the location of the swiftstdlibtoolwrapper. */
+ FilesToRunProvider swiftStdlibToolWrapper() {
+ return ruleContext.getExecutablePrerequisite("$swiftstdlibtoolwrapper", Mode.HOST);
+ }
+
/**
- * Returns the location of the swiftstdlibtoolzip deploy jar.
+ * Returns the location of the realpath tool.
+ * TODO(dmaclach): Should not be required once https://github.com/google/bazel/issues/285
+ * is fixed.
*/
- Artifact swiftStdlibToolDeployJar() {
- return ruleContext.getPrerequisiteArtifact("$swiftstdlibtoolzip_deploy", Mode.HOST);
+ Artifact realpath() {
+ return ruleContext.getPrerequisiteArtifact("$realpath", Mode.HOST);
}
String bundleId() {
@@ -889,9 +896,7 @@ public final class ReleaseBundlingSupport {
return true;
}
- /**
- * Returns the configuration distinguisher for this transition instance.
- */
+ /** Returns the configuration distinguisher for this transition instance. */
protected ConfigurationDistinguisher getConfigurationDistinguisher() {
return ConfigurationDistinguisher.APPLICATION;
}
diff --git a/src/objc_tools/momczip/BUILD b/src/objc_tools/momczip/BUILD
deleted file mode 100644
index a2ae946d60..0000000000
--- a/src/objc_tools/momczip/BUILD
+++ /dev/null
@@ -1,11 +0,0 @@
-package(default_visibility = ["//visibility:public"])
-
-java_binary(
- name = "momczip",
- srcs = glob(["java/**/*.java"]),
- main_class = "com.google.devtools.build.xcode.momczip.MomcZip",
- deps = [
- "//src/tools/xcode-common/java/com/google/devtools/build/xcode/zippingoutput",
- "//third_party:guava",
- ],
-)
diff --git a/src/objc_tools/momczip/README b/src/objc_tools/momczip/README
deleted file mode 100644
index 1c87f43a5c..0000000000
--- a/src/objc_tools/momczip/README
+++ /dev/null
@@ -1,2 +0,0 @@
-momczip invokes momc ("Managed object model compiler") and zips up the output,
-as the number of output files is unpredictable.
diff --git a/src/objc_tools/momczip/java/com/google/devtools/build/xcode/momczip/MomcZip.java b/src/objc_tools/momczip/java/com/google/devtools/build/xcode/momczip/MomcZip.java
deleted file mode 100644
index 2134440795..0000000000
--- a/src/objc_tools/momczip/java/com/google/devtools/build/xcode/momczip/MomcZip.java
+++ /dev/null
@@ -1,56 +0,0 @@
-// Copyright 2014 Google Inc. 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.xcode.momczip;
-
-import com.google.common.collect.ImmutableList;
-import com.google.devtools.build.xcode.zippingoutput.Arguments;
-import com.google.devtools.build.xcode.zippingoutput.Wrapper;
-import com.google.devtools.build.xcode.zippingoutput.Wrappers;
-
-import java.io.IOException;
-
-/**
- * A tool which wraps momc, by running momc and zipping its output. See the JavaDoc for
- * {@link Wrapper} for more information.
- */
-public class MomcZip implements Wrapper {
- @Override
- public String name() {
- return "MomcZip";
- }
-
- @Override
- public String subtoolName() {
- return "momc";
- }
-
- @Override
- public Iterable<String> subCommand(Arguments args, String outputDirectory) {
- return new ImmutableList.Builder<String>()
- .add(args.subtoolCmd())
- .addAll(args.subtoolExtraArgs())
- .add(outputDirectory)
- .build();
- }
-
- public static void main(String[] args) throws IOException, InterruptedException {
- Wrappers.executePipingOutput(args, new MomcZip());
- }
-
- @Override
- public boolean outputDirectoryMustExist() {
- return false;
- }
-}
diff --git a/src/tools/xcode-common/BUILD b/src/tools/xcode-common/BUILD
index 639c621679..bfd7849aef 100644
--- a/src/tools/xcode-common/BUILD
+++ b/src/tools/xcode-common/BUILD
@@ -3,9 +3,7 @@ package(default_visibility = ["//src/test:__subpackages__"])
filegroup(
name = "srcs",
srcs = [
- "//src/tools/xcode-common/java/com/google/devtools/build/xcode/actoolzip:srcs",
"//src/tools/xcode-common/java/com/google/devtools/build/xcode/common:srcs",
- "//src/tools/xcode-common/java/com/google/devtools/build/xcode/swiftstdlibtoolzip:srcs",
"//src/tools/xcode-common/java/com/google/devtools/build/xcode/util:srcs",
"//src/tools/xcode-common/java/com/google/devtools/build/xcode/zip:srcs",
"//src/tools/xcode-common/java/com/google/devtools/build/xcode/zippingoutput:srcs",
diff --git a/src/tools/xcode-common/java/com/google/devtools/build/xcode/actoolzip/ActoolZip.java b/src/tools/xcode-common/java/com/google/devtools/build/xcode/actoolzip/ActoolZip.java
deleted file mode 100644
index cd4466748c..0000000000
--- a/src/tools/xcode-common/java/com/google/devtools/build/xcode/actoolzip/ActoolZip.java
+++ /dev/null
@@ -1,116 +0,0 @@
-// Copyright 2014 Google Inc. 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.xcode.actoolzip;
-
-import com.google.common.base.Optional;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Iterables;
-import com.google.devtools.build.xcode.zippingoutput.Arguments;
-import com.google.devtools.build.xcode.zippingoutput.Wrapper;
-import com.google.devtools.build.xcode.zippingoutput.Wrappers;
-import com.google.devtools.build.xcode.zippingoutput.Wrappers.CommandFailedException;
-import com.google.devtools.build.xcode.zippingoutput.Wrappers.OutErr;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.Set;
-
-/**
- * A tool which wraps actool by running actool and zipping its output. See the JavaDoc for
- * {@link Wrapper} for more information.
- */
-public class ActoolZip implements Wrapper {
-
- @Override
- public String name() {
- return "ActoolZip";
- }
-
- @Override
- public String subtoolName() {
- return "actool";
- }
-
- @Override
- public Iterable<String> subCommand(Arguments args, String outputDirectory) {
- return new ImmutableList.Builder<String>()
- .add(args.subtoolCmd())
- .add("--output-format").add("human-readable-text")
- .add("--notices")
- .add("--warnings")
- .add("--errors")
- .add("--compress-pngs")
- .add("--compile")
- .add(outputDirectory)
- // actool munges paths in some way which doesn't work if one of the directories in the path
- // is a symlink.
- .addAll(Iterables.transform(args.subtoolExtraArgs(), Wrappers.CANONICALIZE_IF_PATH))
- .build();
- }
-
- public static void main(String[] args) throws IOException, InterruptedException {
- Optional<File> infoPlistPath = replaceInfoPlistPath(args);
- try {
- OutErr outErr = Wrappers.executeCapturingOutput(args, new ActoolZip());
- if (infoPlistPath.isPresent() && !infoPlistPath.get().exists()) {
- outErr.print();
- System.exit(1);
- }
- } catch (CommandFailedException e) {
- Wrappers.handleException(e);
- }
- }
-
- /**
- * Absolute-ify output partial info plist's path.
- *
- * <p>actool occasionally writes the partial info plist file to the wrong directory if a
- * non-absolute path is passed as --output-partial-info-plist, so we optimistically try to
- * absolute-ify its path. This isn't caught by the "CANONICAL_PATH" transform above, because the
- * file doesn't exist at the time of flag parsing.
- *
- * <p>Modifies args in-place.
- *
- * @return new value of the output-partial-info-plist flag.
- */
- private static Optional<File> replaceInfoPlistPath(String[] args) {
- String flag = "output-partial-info-plist";
- Set<String> flagOptions = ImmutableSet.of(
- "-" + flag,
- "--" + flag);
- Optional<File> newPath = Optional.absent();
- for (int i = 0; i < args.length; ++i) {
- for (String flagOption : flagOptions) {
- String arg = args[i];
- String flagEquals = flagOption + "=";
- if (arg.startsWith(flagEquals)) {
- newPath = Optional.of(new File(arg.substring(flagEquals.length())));
- args[i] = flagEquals + newPath.get().getAbsolutePath();
- }
- if (arg.equals(flagOption) && i + 1 < args.length) {
- newPath = Optional.of(new File(args[i + 1]));
- args[i + 1] = newPath.get().getAbsolutePath();
- }
- }
- }
- return newPath;
- }
-
- @Override
- public boolean outputDirectoryMustExist() {
- return true;
- }
-}
diff --git a/src/tools/xcode-common/java/com/google/devtools/build/xcode/actoolzip/BUILD b/src/tools/xcode-common/java/com/google/devtools/build/xcode/actoolzip/BUILD
deleted file mode 100644
index 8e08b62c82..0000000000
--- a/src/tools/xcode-common/java/com/google/devtools/build/xcode/actoolzip/BUILD
+++ /dev/null
@@ -1,17 +0,0 @@
-package(default_visibility = ["//src:__subpackages__"])
-
-filegroup(
- name = "srcs",
- srcs = glob(["**"]),
-)
-
-java_binary(
- name = "actoolzip",
- srcs = ["ActoolZip.java"],
- main_class = "com.google.devtools.build.xcode.actoolzip.ActoolZip",
- visibility = ["//visibility:public"],
- deps = [
- "//src/tools/xcode-common/java/com/google/devtools/build/xcode/zippingoutput",
- "//third_party:guava",
- ],
-)
diff --git a/src/tools/xcode-common/java/com/google/devtools/build/xcode/actoolzip/README b/src/tools/xcode-common/java/com/google/devtools/build/xcode/actoolzip/README
deleted file mode 100644
index 7aaae168bb..0000000000
--- a/src/tools/xcode-common/java/com/google/devtools/build/xcode/actoolzip/README
+++ /dev/null
@@ -1,4 +0,0 @@
-actoolzip runs actool, which compiles asset catalog files and zips up the
-output, because actool returns an unpredictable number of output files.
-
-actool only runs on Darwin, so actoolzip only runs on Darwin.
diff --git a/src/tools/xcode-common/java/com/google/devtools/build/xcode/swiftstdlibtoolzip/BUILD b/src/tools/xcode-common/java/com/google/devtools/build/xcode/swiftstdlibtoolzip/BUILD
deleted file mode 100644
index b42968804a..0000000000
--- a/src/tools/xcode-common/java/com/google/devtools/build/xcode/swiftstdlibtoolzip/BUILD
+++ /dev/null
@@ -1,17 +0,0 @@
-package(default_visibility = ["//src:__subpackages__"])
-
-filegroup(
- name = "srcs",
- srcs = glob(["**"]),
-)
-
-java_binary(
- name = "swiftstdlibtoolzip",
- srcs = ["SwiftStdlibToolZip.java"],
- main_class = "com.google.devtools.build.xcode.swiftstdlibtoolzip.SwiftStdlibToolZip",
- visibility = ["//visibility:public"],
- deps = [
- "//src/tools/xcode-common/java/com/google/devtools/build/xcode/zippingoutput",
- "//third_party:guava",
- ],
-)
diff --git a/src/tools/xcode-common/java/com/google/devtools/build/xcode/swiftstdlibtoolzip/README b/src/tools/xcode-common/java/com/google/devtools/build/xcode/swiftstdlibtoolzip/README
deleted file mode 100644
index 0c8b3f082d..0000000000
--- a/src/tools/xcode-common/java/com/google/devtools/build/xcode/swiftstdlibtoolzip/README
+++ /dev/null
@@ -1,4 +0,0 @@
-swiftstdlibtoolzip runs swift-stdlib-tool, which scans executables and copies required Swift
-framework dylibs to the specified path, then zips up the output for further bundle merging.
-
-swift-stdlib-tool only runs on Darwin, so swiftstdlibtoolzip only runs on Darwin.
diff --git a/src/tools/xcode-common/java/com/google/devtools/build/xcode/swiftstdlibtoolzip/SwiftStdlibToolZip.java b/src/tools/xcode-common/java/com/google/devtools/build/xcode/swiftstdlibtoolzip/SwiftStdlibToolZip.java
deleted file mode 100644
index 2043a08fd3..0000000000
--- a/src/tools/xcode-common/java/com/google/devtools/build/xcode/swiftstdlibtoolzip/SwiftStdlibToolZip.java
+++ /dev/null
@@ -1,59 +0,0 @@
-// Copyright 2015 Google Inc. 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.xcode.swiftstdlibtoolzip;
-
-import com.google.common.collect.ImmutableList;
-import com.google.devtools.build.xcode.zippingoutput.Arguments;
-import com.google.devtools.build.xcode.zippingoutput.Wrapper;
-import com.google.devtools.build.xcode.zippingoutput.Wrappers;
-
-import java.io.IOException;
-
-/**
- * A tool which wraps swift-stdlib-tool by running and zipping its output. See {@link Wrapper} for
- * more information.
- */
-public class SwiftStdlibToolZip implements Wrapper {
-
- @Override
- public String name() {
- return "SwiftStdlibToolZip";
- }
-
- @Override
- public String subtoolName() {
- return "swift-stdlib-tool";
- }
-
- @Override
- public Iterable<String> subCommand(Arguments arguments, String outputDirectory) {
- return new ImmutableList.Builder<String>()
- .add(arguments.subtoolCmd())
- .addAll(arguments.subtoolExtraArgs())
- .add("--copy")
- .add("--verbose")
- .add("--destination").add(outputDirectory)
- .build();
- }
-
- @Override
- public boolean outputDirectoryMustExist() {
- return true;
- }
-
- public static void main(String[] args) throws IOException, InterruptedException {
- Wrappers.executePipingOutput(args, new SwiftStdlibToolZip());
- }
-}
diff --git a/src/tools/xcode/actoolwrapper/BUILD b/src/tools/xcode/actoolwrapper/BUILD
new file mode 100644
index 0000000000..79bfdd6eda
--- /dev/null
+++ b/src/tools/xcode/actoolwrapper/BUILD
@@ -0,0 +1,12 @@
+package(default_visibility = ["//src/test:__subpackages__"])
+
+filegroup(
+ name = "srcs",
+ srcs = glob(["**"]),
+)
+
+sh_binary(
+ name = "actoolwrapper",
+ srcs = ["actoolwrapper.sh"],
+ data = ["//src/tools/xcode/realpath:realpath_genrule"],
+)
diff --git a/src/tools/xcode/actoolwrapper/README b/src/tools/xcode/actoolwrapper/README
new file mode 100644
index 0000000000..d274e63ec1
--- /dev/null
+++ b/src/tools/xcode/actoolwrapper/README
@@ -0,0 +1,6 @@
+actoolwrapper runs actool, which compiles asset catalog files.
+actoolwrapper then zips up the output, because actool returns an unpredictable
+number of output files.
+
+actool only runs on Darwin, so actoolwrapper only runs on Darwin.
+
diff --git a/src/tools/xcode/actoolwrapper/actoolwrapper.sh b/src/tools/xcode/actoolwrapper/actoolwrapper.sh
new file mode 100755
index 0000000000..7191583b94
--- /dev/null
+++ b/src/tools/xcode/actoolwrapper/actoolwrapper.sh
@@ -0,0 +1,71 @@
+#!/bin/bash
+# Copyright 2015 Google Inc. 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.
+#
+# actoolwrapper runs actool and zips up the output.
+# This script only runs on darwin and you must have Xcode installed.
+#
+# $1 OUTZIP - the path to place the output zip file.
+
+set -eu
+
+OUTZIP=$(tools/objc/realpath "$1")
+shift 1
+TEMPDIR=$(mktemp -d -t ZippingOutput)
+trap "rm -rf \"$TEMPDIR\"" EXIT
+
+# actool needs to have absolute paths sent to it, so we call realpaths on
+# on all arguments seeing if we can expand them.
+# actool and ibtool appear to depend on the same code base.
+# --output-partial-info-plist gives actool real troubles
+# so we create a file where we expect the plist to be so we can get a full
+# path to it.
+# Radar 21045660 ibtool has difficulty dealing with relative paths.
+TOOLARGS=()
+LASTARG=""
+for i in $@; do
+ if [ "$LASTARG" = "--output-partial-info-plist" ]; then
+ PARENTDIR=$(dirname "$i")
+ mkdir -p "$PARENTDIR"
+ touch "$i"
+ fi
+ if [ -e "$i" ]; then
+ TOOLARGS+=($(tools/objc/realpath "$i"))
+ else
+ TOOLARGS+=("$i")
+ fi
+ LASTARG="$i"
+done
+
+# If we are running into problems figuring out actool issues, there are a couple
+# of env variables that may help. Both of the following must be set to work.
+# IBToolDebugLogFile=<OUTPUT FILE PATH>
+# IBToolDebugLogLevel=4
+# you may also see if
+# IBToolNeverDeque=1
+# helps.
+# Yes IBTOOL appears to be correct here due to actool and ibtool being based
+# on the same codebase.
+/usr/bin/xcrun actool --errors --warnings --notices \
+ --compress-pngs --output-format human-readable-text \
+ --compile "$TEMPDIR" "${TOOLARGS[@]}"
+
+# Need to push/pop tempdir so it isn't the current working directory
+# when we remove it via the EXIT trap.
+pushd "$TEMPDIR" > /dev/null
+# Reset all dates to Unix Epoch so that two identical zips created at different
+# times appear the exact same for comparison purposes.
+find . -exec touch -h -t 197001010000 {} \;
+zip --symlinks --recurse-paths --quiet "$OUTZIP" .
+popd > /dev/null
diff --git a/src/tools/xcode/ibtoolwrapper/ibtoolwrapper.sh b/src/tools/xcode/ibtoolwrapper/ibtoolwrapper.sh
index 7cc4be3201..dc0b9e519c 100755
--- a/src/tools/xcode/ibtoolwrapper/ibtoolwrapper.sh
+++ b/src/tools/xcode/ibtoolwrapper/ibtoolwrapper.sh
@@ -37,12 +37,12 @@ FULLPATH=$(tools/objc/realpath "$FULLPATH")
# IBTool needs to have absolute paths sent to it, so we call realpaths on
# on all arguments seeing if we can expand them.
# Radar 21045660 ibtool has difficulty dealing with relative paths.
-IBTOOLARGS=()
+TOOLARGS=()
for i in $@; do
if [ -e "$i" ]; then
- IBTOOLARGS+=($(tools/objc/realpath "$i"))
+ TOOLARGS+=($(tools/objc/realpath "$i"))
else
- IBTOOLARGS+=($i)
+ TOOLARGS+=("$i")
fi
done
@@ -55,10 +55,13 @@ done
# helps.
/usr/bin/xcrun ibtool --errors --warnings --notices \
--auto-activate-custom-fonts --output-format human-readable-text \
- --compile "$FULLPATH" ${IBTOOLARGS[@]}
+ --compile "$FULLPATH" "${TOOLARGS[@]}"
# Need to push/pop tempdir so it isn't the current working directory
# when we remove it via the EXIT trap.
pushd "$TEMPDIR" > /dev/null
-zip -y -r -q "$OUTZIP" .
+# Reset all dates to Unix Epoch so that two identical zips created at different
+# times appear the exact same for comparison purposes.
+find . -exec touch -h -t 197001010000 {} \;
+zip --symlinks --recurse-paths --quiet "$OUTZIP" .
popd > /dev/null
diff --git a/src/tools/xcode/momcwrapper/BUILD b/src/tools/xcode/momcwrapper/BUILD
new file mode 100644
index 0000000000..61acf80960
--- /dev/null
+++ b/src/tools/xcode/momcwrapper/BUILD
@@ -0,0 +1,12 @@
+package(default_visibility = ["//src/test:__subpackages__"])
+
+filegroup(
+ name = "srcs",
+ srcs = glob(["**"]),
+)
+
+sh_binary(
+ name = "momcwrapper",
+ srcs = ["momcwrapper.sh"],
+ data = ["//src/tools/xcode/realpath:realpath_genrule"],
+)
diff --git a/src/tools/xcode/momcwrapper/README b/src/tools/xcode/momcwrapper/README
new file mode 100644
index 0000000000..37654de429
--- /dev/null
+++ b/src/tools/xcode/momcwrapper/README
@@ -0,0 +1,6 @@
+momcwrapper runs momc, which compiles xcdatamodels.
+momcwrapper then zips up the output, because momc returns an unpredictable
+number of output files.
+
+momc only runs on Darwin, so momcwrapper only runs on Darwin.
+
diff --git a/src/tools/xcode/momcwrapper/momcwrapper.sh b/src/tools/xcode/momcwrapper/momcwrapper.sh
new file mode 100755
index 0000000000..a13181b6d7
--- /dev/null
+++ b/src/tools/xcode/momcwrapper/momcwrapper.sh
@@ -0,0 +1,38 @@
+#!/bin/bash
+# Copyright 2015 Google Inc. 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.
+#
+# momcwrapper runs momc and zips up the output.
+# This script only runs on darwin and you must have Xcode installed.
+#
+# $1 OUTZIP - the path to place the output zip file.
+
+
+set -eu
+
+OUTZIP="$1"
+shift 1
+TEMPDIR=$(mktemp -d -t ZippingOutput)
+trap "rm -rf \"$TEMPDIR\"" EXIT
+
+/usr/bin/xcrun momc "$@" "$TEMPDIR"
+
+# Need to push/pop tempdir so it isn't the current working directory
+# when we remove it via the EXIT trap.
+pushd "$TEMPDIR" > /dev/null
+# Reset all dates to Unix Epoch so that two identical zips created at different
+# times appear the exact same for comparison purposes.
+find . -exec touch -h -t 197001010000 {} \;
+zip --symlinks --recurse-paths --quiet "$OUTZIP" .
+popd > /dev/null
diff --git a/src/tools/xcode/swiftstdlibtoolwrapper/BUILD b/src/tools/xcode/swiftstdlibtoolwrapper/BUILD
new file mode 100644
index 0000000000..1a98848a4b
--- /dev/null
+++ b/src/tools/xcode/swiftstdlibtoolwrapper/BUILD
@@ -0,0 +1,12 @@
+package(default_visibility = ["//src/test:__subpackages__"])
+
+filegroup(
+ name = "srcs",
+ srcs = glob(["**"]),
+)
+
+sh_binary(
+ name = "swiftstdlibtoolwrapper",
+ srcs = ["swiftstdlibtoolwrapper.sh"],
+ data = ["//src/tools/xcode/realpath:realpath_genrule"],
+)
diff --git a/src/tools/xcode/swiftstdlibtoolwrapper/README b/src/tools/xcode/swiftstdlibtoolwrapper/README
new file mode 100644
index 0000000000..e99ff4ed02
--- /dev/null
+++ b/src/tools/xcode/swiftstdlibtoolwrapper/README
@@ -0,0 +1,6 @@
+swiftstdlibtoolwrapper runs swift-stdlib-tool, which scans executables and
+copies required Swift framework dylibs to the specified path, then zips up
+the output for further bundle merging.
+
+swift-stdlib-tool only runs on Darwin, so swiftstdlibtoolwrapper only runs on
+Darwin.
diff --git a/src/tools/xcode/swiftstdlibtoolwrapper/swiftstdlibtoolwrapper.sh b/src/tools/xcode/swiftstdlibtoolwrapper/swiftstdlibtoolwrapper.sh
new file mode 100755
index 0000000000..d6e8c41934
--- /dev/null
+++ b/src/tools/xcode/swiftstdlibtoolwrapper/swiftstdlibtoolwrapper.sh
@@ -0,0 +1,38 @@
+#!/bin/bash
+# Copyright 2015 Google Inc. 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.
+#
+# swiftstdlibtoolwrapper runs swift-stdlib-tool and zips up the output.
+# This script only runs on darwin and you must have Xcode installed.
+#
+# $1 OUTZIP - the path to place the output zip file.
+
+set -eu
+
+OUTZIP="$1"
+shift 1
+TEMPDIR=$(mktemp -d -t ZippingOutput)
+trap "rm -rf \"$TEMPDIR\"" EXIT
+FULLPATH="$TEMPDIR/Frameworks"
+
+/usr/bin/xcrun swift-stdlib-tool --copy --verbose --destination "$FULLPATH" "$@"
+
+# Need to push/pop tempdir so it isn't the current working directory
+# when we remove it via the EXIT trap.
+pushd "$TEMPDIR" > /dev/null
+# Reset all dates to Unix Epoch so that two identical zips created at different
+# times appear the exact same for comparison purposes.
+find . -exec touch -h -t 197001010000 {} \;
+zip --symlinks --recurse-paths --quiet "$OUTZIP" .
+popd > /dev/null