diff options
Diffstat (limited to 'src')
5 files changed, 22 insertions, 112 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/apple/AppleCommandLineOptions.java b/src/main/java/com/google/devtools/build/lib/rules/apple/AppleCommandLineOptions.java index 3d71ca5ad8..5d2830a049 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/apple/AppleCommandLineOptions.java +++ b/src/main/java/com/google/devtools/build/lib/rules/apple/AppleCommandLineOptions.java @@ -227,17 +227,6 @@ public class AppleCommandLineOptions extends FragmentOptions { } } - @Option( - name = "xcode_toolchain", - defaultValue = "null", - category = "flags", - help = "The identifier of an Xcode toolchain to use for builds. Currently only the toolchains " - + "that ship with Xcode are supported. For example, in addition to the default toolchain" - + " Xcode 8 has 'com.apple.dt.toolchain.Swift_2_3' which can be used for building legacy" - + " Swift code." - ) - public String xcodeToolchain; - @Option(name = "apple_bitcode", converter = AppleBitcodeMode.Converter.class, // TODO(blaze-team): Default to embedded_markers when fully implemented. diff --git a/src/main/java/com/google/devtools/build/lib/rules/apple/AppleConfiguration.java b/src/main/java/com/google/devtools/build/lib/rules/apple/AppleConfiguration.java index e0d242703f..59a6fc1403 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/apple/AppleConfiguration.java +++ b/src/main/java/com/google/devtools/build/lib/rules/apple/AppleConfiguration.java @@ -84,7 +84,6 @@ public class AppleConfiguration extends BuildConfiguration.Fragment { private final ImmutableList<String> tvosCpus; private final AppleBitcodeMode bitcodeMode; private final Label xcodeConfigLabel; - @Nullable private final String xcodeToolchain; @Nullable private final Label defaultProvisioningProfileLabel; private final boolean disableNativeSwiftRules; @@ -128,7 +127,6 @@ public class AppleConfiguration extends BuildConfiguration.Fragment { this.xcodeConfigLabel = Preconditions.checkNotNull(appleOptions.xcodeVersionConfig, "xcodeConfigLabel"); this.defaultProvisioningProfileLabel = appleOptions.defaultProvisioningProfile; - this.xcodeToolchain = appleOptions.xcodeToolchain; this.disableNativeSwiftRules = appleOptions.disableNativeSwiftRules; } @@ -521,17 +519,6 @@ public class AppleConfiguration extends BuildConfiguration.Fragment { return Joiner.on('-').join(components); } - /** Returns the identifier for an Xcode toolchain to use with tools. */ - @SkylarkCallable( - name = "xcode_toolchain", - doc = "Identifier for the custom Xcode toolchain to use in build or None if not specified", - allowReturnNones = true, - structField = true - ) - public String getXcodeToolchain() { - return xcodeToolchain; - } - /** * Whether the native Swift support should be disabled. Used to deprecate said functionality. */ diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/CompilationSupport.java b/src/main/java/com/google/devtools/build/lib/rules/objc/CompilationSupport.java index 8136e837ca..fa16aaf3f9 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/objc/CompilationSupport.java +++ b/src/main/java/com/google/devtools/build/lib/rules/objc/CompilationSupport.java @@ -1445,22 +1445,9 @@ public final class CompilationSupport { } if (objcProvider.is(USES_SWIFT)) { - // Check if there's a swift library path already. If that's not the case - fall back to - // the default one. This is for backwards compatibility with Swift native rules. - // TODO(b/30281236): Remove when native Swift is deprecated. - boolean swiftLibDirSet = false; - for (String arg : objcProvider.get(ObjcProvider.LINKOPT)) { - if (arg.startsWith("-L") && arg.contains("usr/lib/swift")) { - swiftLibDirSet = true; - break; - } - } - - if (!swiftLibDirSet) { - commandLine - .add("-L") - .add(AppleToolchain.swiftLibDir(appleConfiguration.getSingleArchPlatform())); - } + commandLine + .add("-L") + .add(AppleToolchain.swiftLibDir(appleConfiguration.getSingleArchPlatform())); } for (String linkopt : attributes.linkopts()) { 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 4cf8e6264f..009b3fddfe 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 @@ -1058,21 +1058,13 @@ public final class ReleaseBundlingSupport { return; } - AppleConfiguration appleConfiguration = ruleContext.getFragment(AppleConfiguration.class); - - CustomCommandLine.Builder commandLine = CustomCommandLine.builder(); - if (appleConfiguration.getXcodeToolchain() != null) { - commandLine.add("--toolchain").add(appleConfiguration.getXcodeToolchain()); - } - - commandLine - .add("--output_zip_path") - .addPath(intermediateArtifacts.swiftFrameworksFileZip().getExecPath()) - .add("--bundle_path") - .add("Frameworks") - .add("--platform") - .add(platform.getLowerCaseNameInPlist()) - .addExecPath("--scan-executable", combinedArchBinary); + CustomCommandLine.Builder commandLine = + CustomCommandLine.builder() + .addPath(intermediateArtifacts.swiftFrameworksFileZip().getExecPath()) + .add("Frameworks") + .add("--platform") + .add(platform.getLowerCaseNameInPlist()) + .addExecPath("--scan-executable", combinedArchBinary); ruleContext.registerAction( ObjcRuleClasses.spawnAppleEnvActionBuilder(ruleContext, platform) @@ -1090,21 +1082,13 @@ public final class ReleaseBundlingSupport { return; } - AppleConfiguration configuration = ruleContext.getFragment(AppleConfiguration.class); - - CustomCommandLine.Builder commandLine = CustomCommandLine.builder(); - if (configuration.getXcodeToolchain() != null) { - commandLine.add("--toolchain").add(configuration.getXcodeToolchain()); - } - - commandLine - .add("--output_zip_path") - .addPath(intermediateArtifacts.swiftSupportZip().getExecPath()) - .add("--bundle_path") - .add("SwiftSupport/" + platform.getLowerCaseNameInPlist()) - .add("--platform") - .add(platform.getLowerCaseNameInPlist()) - .addExecPath("--scan-executable", combinedArchBinary); + CustomCommandLine.Builder commandLine = + CustomCommandLine.builder() + .addPath(intermediateArtifacts.swiftSupportZip().getExecPath()) + .add("SwiftSupport/" + platform.getLowerCaseNameInPlist()) + .add("--platform") + .add(platform.getLowerCaseNameInPlist()) + .addExecPath("--scan-executable", combinedArchBinary); ruleContext.registerAction( ObjcRuleClasses.spawnAppleEnvActionBuilder(ruleContext, platform) diff --git a/src/tools/xcode/swiftstdlibtoolwrapper/swiftstdlibtoolwrapper.sh b/src/tools/xcode/swiftstdlibtoolwrapper/swiftstdlibtoolwrapper.sh index d4f2f4fc60..7197cdc32e 100755 --- a/src/tools/xcode/swiftstdlibtoolwrapper/swiftstdlibtoolwrapper.sh +++ b/src/tools/xcode/swiftstdlibtoolwrapper/swiftstdlibtoolwrapper.sh @@ -17,9 +17,7 @@ # swiftstdlibtoolwrapper runs swift-stdlib-tool and zips up the output. # This script only runs on darwin and you must have Xcode installed. # -# --output_zip_path - the path to place the output zip file. -# --bundle_path - the path inside of the archive to where libs will be copied. -# --toolchain - toolchain identifier to use with xcrun. +# $1 OUTZIP - the path to place the output zip file. set -eu @@ -27,50 +25,15 @@ MY_LOCATION=${MY_LOCATION:-"$0.runfiles/bazel_tools/tools/objc"} REALPATH="${MY_LOCATION}/realpath" WRAPPER="${MY_LOCATION}/xcrunwrapper.sh" -TOOL_ARGS=() -while [[ $# -gt 0 ]]; do - ARG="$1" - shift - case "${ARG}" in - --output_zip_path) - ARG="$1" - shift - OUTZIP=$("${REALPATH}" "${ARG}") - ;; - --bundle_path) - ARG="$1" - shift - PATH_INSIDE_ZIP="$ARG" - ;; - --toolchain) - ARG="$1" - shift - TOOLCHAIN=${ARG} - ;; - # Remaining args are swift-stdlib-tool args - *) - TOOL_ARGS+=("$ARG") - ;; - esac -done - - +OUTZIP=$("${REALPATH}" "$1") +PATH_INSIDE_ZIP="$2" +shift 2 TEMPDIR=$(mktemp -d "${TMPDIR:-/tmp}/swiftstdlibtoolZippingOutput.XXXXXX") trap "rm -rf \"$TEMPDIR\"" EXIT FULLPATH="$TEMPDIR/$PATH_INSIDE_ZIP" -XCRUN_ARGS=() - -if [ -n "${TOOLCHAIN:-}" ]; then - XCRUN_ARGS+=(--toolchain "$TOOLCHAIN") -fi - -XCRUN_ARGS+=(swift-stdlib-tool --copy --verbose ) -XCRUN_ARGS+=(--destination "$FULLPATH") -XCRUN_ARGS+=( "${TOOL_ARGS[@]}" ) - -$WRAPPER "${XCRUN_ARGS[@]}" +$WRAPPER 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. |