aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/tools/xcode/swiftstdlibtoolwrapper
diff options
context:
space:
mode:
authorGravatar Dave MacLachlan <dmaclach@google.com>2015-09-29 19:21:29 +0000
committerGravatar Florian Weikert <fwe@google.com>2015-09-30 09:35:49 +0000
commit0bb2f0201bda365348f9543d83e53fa90b9134d0 (patch)
treee5d0df1136aa1312296b3abc7946d07f0cfcafe7 /src/tools/xcode/swiftstdlibtoolwrapper
parent1726affaca7be2707f1e462c8e1ba783f4e1770f (diff)
Move actoolzip, momczip and swiftstdlibtoolzip to tools/xcode and convert them to scripts instead of java apps.
RELNOTES: actoolzip, momczip and swiftstdlibtoolzip have all been made into bash scripts and have been renamed to actoolwrapper, momcwrapper and swiftstdlibtoolwrapper respectively. The old versions will be deleted in a later change. -- MOS_MIGRATED_REVID=104225062
Diffstat (limited to 'src/tools/xcode/swiftstdlibtoolwrapper')
-rw-r--r--src/tools/xcode/swiftstdlibtoolwrapper/BUILD12
-rw-r--r--src/tools/xcode/swiftstdlibtoolwrapper/README6
-rwxr-xr-xsrc/tools/xcode/swiftstdlibtoolwrapper/swiftstdlibtoolwrapper.sh40
3 files changed, 58 insertions, 0 deletions
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..208f22e35e
--- /dev/null
+++ b/src/tools/xcode/swiftstdlibtoolwrapper/swiftstdlibtoolwrapper.sh
@@ -0,0 +1,40 @@
+#!/bin/bash
+#
+# Copyright 2015 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.
+#
+# 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=$(tools/objc/realpath "$1")
+shift 1
+TEMPDIR=$(mktemp -d -t swiftstdlibtoolZippingOutput)
+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 Zip Epoch so that two identical zips created at different
+# times appear the exact same for comparison purposes.
+find . -exec touch -h -t 198001010000 {} \;
+zip --symlinks --recurse-paths --quiet "$OUTZIP" .
+popd > /dev/null