aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/tools
diff options
context:
space:
mode:
authorGravatar Googler <noreply@google.com>2015-06-16 21:10:26 +0000
committerGravatar John Field <jfield@google.com>2015-06-17 15:22:50 +0000
commitaa7cb9a253b2a66a54bf8c65af9a8e7748bf23b9 (patch)
tree9d35c67aa48b79ab4f6398dcadf874dc04e074ba /src/tools
parente4682895367ad1cc5033d1ef37093a2d6439043b (diff)
Add ability to compile objc_binary targets with Swift sources.
* Swift sources whitelisted * Swift compilation and module merging actions * Swift stdlib copying into IPA action * Special case for signing embedded swift stdlib dylibs during bundle signing * Works with mixed ObjC/Swift sources * Doesn't support working with dependencies from Swift code. * Requires Xcode 6.3.1 for swift compiler and tooling. -- MOS_MIGRATED_REVID=96141887
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/xcode-common/BUILD1
-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
4 files changed, 81 insertions, 0 deletions
diff --git a/src/tools/xcode-common/BUILD b/src/tools/xcode-common/BUILD
index b34518bb66..187e8c1dfe 100644
--- a/src/tools/xcode-common/BUILD
+++ b/src/tools/xcode-common/BUILD
@@ -6,6 +6,7 @@ filegroup(
"//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/ibtoolzip: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/swiftstdlibtoolzip/BUILD b/src/tools/xcode-common/java/com/google/devtools/build/xcode/swiftstdlibtoolzip/BUILD
new file mode 100644
index 0000000000..b42968804a
--- /dev/null
+++ b/src/tools/xcode-common/java/com/google/devtools/build/xcode/swiftstdlibtoolzip/BUILD
@@ -0,0 +1,17 @@
+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
new file mode 100644
index 0000000000..0c8b3f082d
--- /dev/null
+++ b/src/tools/xcode-common/java/com/google/devtools/build/xcode/swiftstdlibtoolzip/README
@@ -0,0 +1,4 @@
+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
new file mode 100644
index 0000000000..2043a08fd3
--- /dev/null
+++ b/src/tools/xcode-common/java/com/google/devtools/build/xcode/swiftstdlibtoolzip/SwiftStdlibToolZip.java
@@ -0,0 +1,59 @@
+// 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());
+ }
+}