aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/tools/xcode
diff options
context:
space:
mode:
authorGravatar cparsons <cparsons@google.com>2017-04-13 16:59:11 +0200
committerGravatar Jakob Buchgraber <buchgr@google.com>2017-04-14 12:39:23 +0200
commit7babdf24800047ed46a86647ceeda96217403e02 (patch)
tree9b4a0730bc254f9cde98066d5c735c8cdb55b4e4 /src/tools/xcode
parenteecd7128f420b2d404ed2f42d549dea3bd198d9d (diff)
Move xcrunwrapper and libtool to third_party/bazel/tools/objc from their xcode src directories
There's no value in having these copied over from src/tools to tools/objc separately. RELNOTES: None. PiperOrigin-RevId: 153060955
Diffstat (limited to 'src/tools/xcode')
-rw-r--r--src/tools/xcode/actoolwrapper/BUILD2
-rw-r--r--src/tools/xcode/ibtoolwrapper/BUILD2
-rw-r--r--src/tools/xcode/libtool/BUILD23
-rw-r--r--src/tools/xcode/libtool/README9
-rwxr-xr-xsrc/tools/xcode/libtool/libtool.sh106
-rw-r--r--src/tools/xcode/libtool/make_hashed_objlist.py50
-rw-r--r--src/tools/xcode/momcwrapper/BUILD2
-rw-r--r--src/tools/xcode/swiftstdlibtoolwrapper/BUILD2
-rw-r--r--src/tools/xcode/xcrunwrapper/BUILD11
-rw-r--r--src/tools/xcode/xcrunwrapper/README7
-rwxr-xr-xsrc/tools/xcode/xcrunwrapper/xcrunwrapper.sh78
11 files changed, 4 insertions, 288 deletions
diff --git a/src/tools/xcode/actoolwrapper/BUILD b/src/tools/xcode/actoolwrapper/BUILD
index 8f717ab9a2..1becfc0f08 100644
--- a/src/tools/xcode/actoolwrapper/BUILD
+++ b/src/tools/xcode/actoolwrapper/BUILD
@@ -10,6 +10,6 @@ sh_binary(
srcs = ["actoolwrapper.sh"],
data = [
"//src/tools/xcode/realpath",
- "//src/tools/xcode/xcrunwrapper",
+ "//tools/objc:xcrunwrapper",
],
)
diff --git a/src/tools/xcode/ibtoolwrapper/BUILD b/src/tools/xcode/ibtoolwrapper/BUILD
index 266b067371..57080e7a78 100644
--- a/src/tools/xcode/ibtoolwrapper/BUILD
+++ b/src/tools/xcode/ibtoolwrapper/BUILD
@@ -10,6 +10,6 @@ sh_binary(
srcs = ["ibtoolwrapper.sh"],
data = [
"//src/tools/xcode/realpath",
- "//src/tools/xcode/xcrunwrapper",
+ "//tools/objc:xcrunwrapper",
],
)
diff --git a/src/tools/xcode/libtool/BUILD b/src/tools/xcode/libtool/BUILD
deleted file mode 100644
index 3aad92a24a..0000000000
--- a/src/tools/xcode/libtool/BUILD
+++ /dev/null
@@ -1,23 +0,0 @@
-package(default_visibility = ["//src:__subpackages__"])
-
-filegroup(
- name = "srcs",
- srcs = glob(["**"]),
-)
-
-filegroup(
- name = "libtool_srcs",
- srcs = [
- "libtool.sh",
- "make_hashed_objlist.py",
- ],
-)
-
-sh_binary(
- name = "libtool",
- srcs = ["libtool.sh"],
- data = [
- ":make_hashed_objlist.py",
- "//src/tools/xcode/xcrunwrapper",
- ],
-)
diff --git a/src/tools/xcode/libtool/README b/src/tools/xcode/libtool/README
deleted file mode 100644
index 7b817537fb..0000000000
--- a/src/tools/xcode/libtool/README
+++ /dev/null
@@ -1,9 +0,0 @@
-libtool.sh runs the command passed to it using "xcrun libtool".
-
-It creates symbolic links for all input files with a content-hash appended
-to their original name (foo.o becomes foo_{md5sum}.o). This is to circumvent
-a bug in the original tool that arises when two input files have the same
-base name (even if they are in different directories).
-
-xcrun only runs on Darwin, so libtool.sh only runs on Darwin.
-
diff --git a/src/tools/xcode/libtool/libtool.sh b/src/tools/xcode/libtool/libtool.sh
deleted file mode 100755
index 5ad89a019d..0000000000
--- a/src/tools/xcode/libtool/libtool.sh
+++ /dev/null
@@ -1,106 +0,0 @@
-#!/bin/bash
-#
-# Copyright 2016 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.
-#
-# libtool.sh runs the command passed to it using "xcrunwrapper libtool".
-#
-# It creates symbolic links for all input files with a path-hash appended
-# to their original name (foo.o becomes foo_{md5sum}.o). This is to circumvent
-# a bug in the original libtool that arises when two input files have the same
-# base name (even if they are in different directories).
-
-set -eu
-
-MY_LOCATION=${MY_LOCATION:-"$0.runfiles/bazel_tools/tools/objc"}
-WRAPPER="${MY_LOCATION}/xcrunwrapper.sh"
-
-# Creates a symbolic link to the input argument file and returns the symlink
-# file path.
-function hash_objfile() {
- ORIGINAL_NAME="$1"
- ORIGINAL_HASH="$(/sbin/md5 -qs "${ORIGINAL_NAME}")"
- SYMLINK_NAME="${ORIGINAL_NAME%.o}_${ORIGINAL_HASH}.o"
- if [[ ! -e "$SYMLINK_NAME" ]]; then
- ln -sf "$(basename "$ORIGINAL_NAME")" "$SYMLINK_NAME"
- fi
- echo "$SYMLINK_NAME"
-}
-
-ARGS=()
-
-while [[ $# -gt 0 ]]; do
- ARG="$1"
- shift
-
- # Libtool artifact symlinking. Apple's libtool has a bug when there are two
- # input files with the same basename. We thus create symlinks that are named
- # with a hash suffix for each input, and pass them to libtool.
- # See b/28186497.
- case "${ARG}" in
- # Filelist flag, need to symlink each input in the contents of file and
- # pass a new filelist which contains the symlinks.
- -filelist)
- ARGS+=("${ARG}")
- ARG="$1"
- shift
- HASHED_FILELIST="${ARG%.objlist}_hashes.objlist"
- rm -f "${HASHED_FILELIST}"
- # Use python helper script for fast md5 calculation of many strings.
- python "${MY_LOCATION}/make_hashed_objlist.py" "${ARG}" "${HASHED_FILELIST}"
- ARGS+=("${HASHED_FILELIST}")
- ;;
- # Output flag
- -o)
- ARGS+=("${ARG}")
- ARG="$1"
- shift
- ARGS+=("${ARG}")
- OUTPUTFILE="${ARG}"
- ;;
- # Flags with no args
- -static|-s|-a|-c|-L|-T|-no_warning_for_no_symbols)
- ARGS+=("${ARG}")
- ;;
- # Single-arg flags
- -arch_only|-syslibroot)
- ARGS+=("${ARG}")
- ARG="$1"
- shift
- ARGS+=("${ARG}")
- ;;
- # Any remaining flags are unexpected and may ruin flag parsing.
- -*)
- echo "Unrecognized libtool flag ${ARG}"
- exit 1
- ;;
- # Archive inputs can remain untouched, as they come from other targets.
- *.a)
- ARGS+=("${ARG}")
- ;;
- # Remaining args are input objects
- *)
- ARGS+=("$(echo "$(hash_objfile "${ARG}")")")
- ;;
- esac
-done
-
-# Ensure 0 timestamping for hermetic results.
-export ZERO_AR_DATE=1
-
-"${WRAPPER}" libtool "${ARGS[@]}"
-
-# Prevents a pre-Xcode-8 bug in which passing zero-date archive files to ld
-# would cause ld to error.
-touch "$OUTPUTFILE"
diff --git a/src/tools/xcode/libtool/make_hashed_objlist.py b/src/tools/xcode/libtool/make_hashed_objlist.py
deleted file mode 100644
index 077d2d12a6..0000000000
--- a/src/tools/xcode/libtool/make_hashed_objlist.py
+++ /dev/null
@@ -1,50 +0,0 @@
-# pylint: disable=g-bad-file-header
-# Copyright 2016 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.
-
-"""Creates symbolic links for .o files with hashcode.
-
-This script reads the file list containing the input files, creates symbolic
-links with a path-hash appended to their original name (foo.o becomes
-foo_{md5sum}.o), then saves the list of symbolic links to another file.
-
-This is to circumvent a bug in the original libtool that arises when two input
-files have the same base name (even if they are in different directories).
-"""
-
-import hashlib
-import os
-import sys
-
-
-def main():
- obj_file_list = open(sys.argv[1])
- hashed_obj_file_list = open(sys.argv[2], 'w')
-
- for line in obj_file_list:
- obj_file_path = line.rstrip('\n')
- hashed_obj_file_path = '%s_%s.o' % (
- os.path.splitext(obj_file_path)[0],
- hashlib.md5(obj_file_path).hexdigest())
-
- hashed_obj_file_list.write(hashed_obj_file_path + '\n')
-
- # Create symlink only if the symlink doesn't exist.
- if not os.path.exists(hashed_obj_file_path):
- os.symlink(os.path.basename(obj_file_path), hashed_obj_file_path)
-
- hashed_obj_file_list.close()
-
-if __name__ == '__main__':
- main()
diff --git a/src/tools/xcode/momcwrapper/BUILD b/src/tools/xcode/momcwrapper/BUILD
index d75c45d34e..6da07affee 100644
--- a/src/tools/xcode/momcwrapper/BUILD
+++ b/src/tools/xcode/momcwrapper/BUILD
@@ -10,6 +10,6 @@ sh_binary(
srcs = ["momcwrapper.sh"],
data = [
"//src/tools/xcode/realpath",
- "//src/tools/xcode/xcrunwrapper",
+ "//tools/objc:xcrunwrapper",
],
)
diff --git a/src/tools/xcode/swiftstdlibtoolwrapper/BUILD b/src/tools/xcode/swiftstdlibtoolwrapper/BUILD
index a4af5932c8..9407697b9e 100644
--- a/src/tools/xcode/swiftstdlibtoolwrapper/BUILD
+++ b/src/tools/xcode/swiftstdlibtoolwrapper/BUILD
@@ -10,6 +10,6 @@ sh_binary(
srcs = ["swiftstdlibtoolwrapper.sh"],
data = [
"//src/tools/xcode/realpath",
- "//src/tools/xcode/xcrunwrapper",
+ "//tools/objc:xcrunwrapper",
],
)
diff --git a/src/tools/xcode/xcrunwrapper/BUILD b/src/tools/xcode/xcrunwrapper/BUILD
deleted file mode 100644
index e3dbf20a28..0000000000
--- a/src/tools/xcode/xcrunwrapper/BUILD
+++ /dev/null
@@ -1,11 +0,0 @@
-package(default_visibility = ["//src:__subpackages__"])
-
-filegroup(
- name = "srcs",
- srcs = glob(["**"]),
-)
-
-sh_binary(
- name = "xcrunwrapper",
- srcs = ["xcrunwrapper.sh"],
-)
diff --git a/src/tools/xcode/xcrunwrapper/README b/src/tools/xcode/xcrunwrapper/README
deleted file mode 100644
index d76642186e..0000000000
--- a/src/tools/xcode/xcrunwrapper/README
+++ /dev/null
@@ -1,7 +0,0 @@
-xcrunwrapper runs the command passed to it using xcrun.
-
-It replaces __DEVELOPER_DIR__ with $DEVELOPER_DIR (or reasonable default)
-and __SDKROOT__ with a valid path based on SDKROOT (or reasonable default).
-
-xcrun only runs on Darwin, so xcrunwrapper only runs on Darwin.
-
diff --git a/src/tools/xcode/xcrunwrapper/xcrunwrapper.sh b/src/tools/xcode/xcrunwrapper/xcrunwrapper.sh
deleted file mode 100755
index 7b27bf5482..0000000000
--- a/src/tools/xcode/xcrunwrapper/xcrunwrapper.sh
+++ /dev/null
@@ -1,78 +0,0 @@
-#!/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.
-#
-# xcrunwrapper runs the command passed to it using xcrun. The first arg
-# passed is the name of the tool to be invoked via xcrun. (For example, libtool
-# or clang).
-# xcrunwrapper replaces __BAZEL_XCODE_DEVELOPER_DIR__ with $DEVELOPER_DIR (or
-# reasonable default) and __BAZEL_XCODE_SDKROOT__ with a valid path based on
-# SDKROOT (or reasonable default).
-# These values (__BAZEL_XCODE_*) are a shared secret withIosSdkCommands.java.
-
-set -eu
-
-TOOLNAME=$1
-shift
-
-# Pick values for DEVELOPER_DIR and SDKROOT as appropriate (if they weren't set)
-WRAPPER_DEVDIR="${DEVELOPER_DIR:-}"
-if [[ -z "${WRAPPER_DEVDIR}" ]] ; then
- WRAPPER_DEVDIR="$(xcode-select -p)"
-fi
-
-# TODO(blaze-team): Remove this once all build environments are setting SDKROOT
-# for us.
-WRAPPER_SDKROOT="${SDKROOT:-}"
-if [[ -z "${WRAPPER_SDKROOT:-}" ]] ; then
- WRAPPER_SDK=iphonesimulator
- for ARG in "$@" ; do
- case "${ARG}" in
- armv6|armv7|armv7s|arm64)
- WRAPPER_SDK=iphoneos
- ;;
- i386|x86_64)
- WRAPPER_SDK=iphonesimulator
- ;;
- esac
- done
- WRAPPER_SDKROOT="$(/usr/bin/xcrun --show-sdk-path --sdk ${WRAPPER_SDK})"
-fi
-
-# Subsitute toolkit path placeholders.
-UPDATEDARGS=()
-for ARG in "$@" ; do
- ARG="${ARG//__BAZEL_XCODE_DEVELOPER_DIR__/${WRAPPER_DEVDIR}}"
- ARG="${ARG//__BAZEL_XCODE_SDKROOT__/${WRAPPER_SDKROOT}}"
- UPDATEDARGS+=("${ARG}")
-done
-
-set +e
-/usr/bin/xcrun "${TOOLNAME}" "${UPDATEDARGS[@]}"
-XCRUN_EXITCODE=$?
-set -e
-REGEX="^(.*)sdk\" cannot be located(.*)$"
-if [[ ${XCRUN_EXITCODE} -ne 0 ]] ; then
- # If xcrun failed it is assumed it will fail again in the same fashion.
- # The second invocation is because combining and collecting stderr while
- # preserving and emitting stdout is difficult without additional file IO.
- XCRUN_OUTPUT="$(/usr/bin/xcrun "${TOOLNAME}" "${UPDATEDARGS[@]}" 2>&1)"
- if [[ "${XCRUN_OUTPUT}" =~ ${REGEX} ]] ; then
- echo "xcrunwrapper: SDK not located. This may indicate that the xcode and \
-SDK version pair is not available."
- fi
-fi
-
-exit ${XCRUN_EXITCODE}