Last active
February 22, 2023 05:59
-
-
Save russbishop/a9d36bf4fad59893f6df53f993378d36 to your computer and use it in GitHub Desktop.
Swift Toolchain & Build Files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Use at your own risk! Swift moves quickly so it is possible | |
info in these scripts is out of date. | |
To use build-redist-package.sh you'll need a Mac Developer ID certificate. | |
The build will take a long time but the custom my-presets.ini | |
file skips tests to speed things up a fair amount. | |
rebuild-toolchain.sh builds your own Personal local toolchain | |
over top of the previous one, so if you symlink it into the | |
actual Toolchains directory you can always have the most | |
recent toolchain available in Xcode. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
[ ! -x swift/utils/build-script ] && exit 1 | |
# Creates a redistributable toolchain package | |
SRC_DIR=$PWD | |
YEAR=$(date +"%Y") | |
MONTH=$(date +"%m") | |
DAY=$(date +"%d") | |
TOOLCHAIN_VERSION="swift-LOCAL-${YEAR}-${MONTH}-${DAY}-a" | |
ARCHIVE="${TOOLCHAIN_VERSION}-osx.tar.gz" | |
SYM_ARCHIVE="${TOOLCHAIN_VERSION}-osx-symbols.tar.gz" | |
BUNDLE_PREFIX=${1:?Please specify bundle prefix e.g. $0 local.swift} | |
BUNDLE_IDENTIFIER="${BUNDLE_PREFIX}.${YEAR}${MONTH}${DAY}" | |
DISPLAY_NAME_SHORT="Local Swift Development Snapshot" | |
DISPLAY_NAME="${DISPLAY_NAME_SHORT} ${YEAR}-${MONTH}-${DAY}" | |
TOOLCHAIN_NAME="${TOOLCHAIN_VERSION}" | |
SWIFT_INSTALLABLE_PACKAGE="${SRC_DIR}/${ARCHIVE}" | |
SWIFT_INSTALL_DIR="${SRC_DIR}/swift-nightly-install" | |
SWIFT_INSTALL_SYMROOT="${SRC_DIR}/swift-nightly-symroot" | |
SWIFT_TOOLCHAIN_DIR="/Library/Developer/Toolchains/${TOOLCHAIN_NAME}.xctoolchain" | |
SYMBOLS_PACKAGE="${SRC_DIR}/${SYM_ARCHIVE}" | |
SNAPSHOT_DATE=`date "+%Y-%m-%d"` | |
HASH_LLVM=`(cd llvm;git rev-parse --short HEAD)` | |
HASH_CLANG=`(cd clang;git rev-parse --short HEAD)` | |
HASH_SWIFT=`(cd swift;git rev-parse --short HEAD)` | |
HASH_INFO="LLVM ${HASH_LLVM}, Clang ${HASH_CLANG}, Swift ${HASH_SWIFT}" | |
BUNDLE_IDENTIFIER="com.obsolete-software.swift.${SNAPSHOT_DATE}" # "CFBundleIdentifier for xctoolchain info plist" | |
DISPLAY_NAME="Swift 3.0 snapshot (${HASH_INFO})" # "Display Name for xctoolcain info plist" | |
XCTOOLCHAIN_NAME="swift-3.0-SNAPSHOT-${SNAPSHOT_DATE}" # "Directory name for xctoolchain" | |
VERSION="${XCTOOLCHAIN_NAME}" # "Version for xctoolchain info plist and installer pkg" | |
CERT_NAME="YOUR NAME" | |
APPLICATION_CERT="Developer ID Application: ${CERT_NAME}" # "Application Cert name to codesign xctoolchain" | |
INSTALLER_CERT="Developer ID Installer: ${CERT_NAME}" # "Installer Cert name to create installer pkg" | |
INSTALLER_PACKAGE="`pwd`/build/${XCTOOLCHAIN_NAME}.pkg" # "The path to installer pkg" | |
swift/utils/build-script --preset-file=swift/utils/build-presets.ini --preset-file=./my-presets.ini \ | |
--preset=buildbot_osx_package_create_installer \ | |
install_destdir=/tmp/install \ | |
install_symroot=/tmp/symroot \ | |
install_toolchain_dir=/Library/Developer/Toolchains/${XCTOOLCHAIN_NAME}.xctoolchain \ | |
installable_package="`pwd`/build/${XCTOOLCHAIN_NAME}.tar.gz" \ | |
symbols_package="`pwd`/build/symbols-${XCTOOLCHAIN_NAME}.tar.gz" \ | |
darwin_toolchain_bundle_identifier="${BUNDLE_IDENTIFIER}" \ | |
darwin_toolchain_display_name="${DISPLAY_NAME}" \ | |
darwin_toolchain_xctoolchain_name="${XCTOOLCHAIN_NAME}" \ | |
darwin_toolchain_version="${VERSION}" \ | |
darwin_toolchain_application_cert="${APPLICATION_CERT}" \ | |
darwin_toolchain_installer_cert="${INSTALLER_CERT}" \ | |
darwin_toolchain_installer_package="${INSTALLER_PACKAGE}" \ | |
darwin_toolchain_alias="Local" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[preset: buildbot_osx_package_custom] | |
mixin-preset= | |
mixin_osx_package_base | |
mixin_osx_package_test | |
mixin_lightweight_assertions | |
skip-build-benchmarks | |
skip-test-ios | |
skip-test-ios-host | |
skip-test-tvos | |
skip-test-tvos-host | |
skip-test-watchos | |
skip-test-watchos-host | |
skip-test-lldb | |
skip-test-osx | |
skip-test-swift | |
skip-test-cmark | |
skip-test-foundation | |
dash-dash | |
swift-install-components=compiler;clang-builtin-headers;stdlib;sdk-overlay;license;sourcekit-xpc-service;swift-remote-mirror-headers | |
llvm-install-components=libclang;libclang-headers | |
# Path to the .tar.gz package we would create. | |
installable-package=%(installable_package)s | |
# Path to the .tar.gz symbols package | |
symbols-package=%(symbols_package)s | |
# Info.plist | |
darwin-toolchain-bundle-identifier=%(darwin_toolchain_bundle_identifier)s | |
darwin-toolchain-display-name=%(darwin_toolchain_display_name)s | |
darwin-toolchain-display-name-short=%(darwin_toolchain_display_name_short)s | |
darwin-toolchain-name=%(darwin_toolchain_xctoolchain_name)s | |
darwin-toolchain-version=%(darwin_toolchain_version)s | |
darwin-toolchain-alias=%(darwin_toolchain_alias)s | |
[preset: buildbot_osx_package_create_installer] | |
mixin-preset= | |
mixin_osx_package_base | |
mixin_lightweight_assertions | |
# mixin_osx_package_test | |
# test | |
build-subdir=buildbot_osx | |
skip-build-benchmarks | |
skip-test-ios | |
skip-test-ios-host | |
skip-test-tvos | |
skip-test-tvos-host | |
skip-test-watchos | |
skip-test-watchos-host | |
dash-dash | |
swift-install-components=compiler;clang-builtin-headers;stdlib;sdk-overlay;sourcekit-xpc-service | |
llvm-install-components=libclang;clang-headers | |
# Path to the .tar.gz package we would create. | |
installable-package=%(installable_package)s | |
# Path to the .tar.gz symbols package | |
symbols-package=%(symbols_package)s | |
# Info.plist | |
darwin-toolchain-bundle-identifier=%(darwin_toolchain_bundle_identifier)s | |
darwin-toolchain-display-name=%(darwin_toolchain_display_name)s | |
darwin-toolchain-name=%(darwin_toolchain_xctoolchain_name)s | |
darwin-toolchain-version=%(darwin_toolchain_version)s | |
# Build .pkg | |
darwin-toolchain-application-cert=%(darwin_toolchain_application_cert)s | |
darwin-toolchain-installer-cert=%(darwin_toolchain_installer_cert)s | |
darwin-toolchain-installer-package=%(darwin_toolchain_installer_package)s | |
[preset: buildbot_osx_package_test_only] | |
mixin-preset= | |
mixin_lightweight_assertions | |
build-subdir=buildbot_osx | |
ios | |
tvos | |
watchos | |
lldb | |
llbuild | |
swiftpm | |
release-debuginfo | |
skip-build-benchmarks | |
skip-test-ios | |
skip-test-ios-host | |
skip-test-tvos | |
skip-test-tvos-host | |
skip-test-watchos | |
skip-test-watchos-host | |
test | |
dash-dash | |
lldb-no-debugserver | |
lldb-use-system-debugserver | |
lldb-build-type=Release | |
verbose-build | |
build-ninja | |
build-swift-static-stdlib | |
build-swift-stdlib-unittest-extra | |
compiler-vendor=apple | |
swift-sdks=OSX;IOS;IOS_SIMULATOR;TVOS;TVOS_SIMULATOR;WATCHOS;WATCHOS_SIMULATOR | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
[ ! -x swift/utils/build-script ] && exit 1 | |
# Personal script that rebuilds toolchain in-place. | |
# Make sure Xcode is not open and using the toolchain | |
# or you're gonna have a bad time. | |
# The resulting toolchain can be symlinked to /Library/Developer/Toolchains as "swift-PERSONAL" | |
# then each rebuild will update the toolchain without having to reinstall it | |
# and switch toolchains in Xcode. | |
SRC_DIR=$PWD | |
YEAR=$(date +"%Y") | |
MONTH=$(date +"%m") | |
DAY=$(date +"%d") | |
TOOLCHAIN_VERSION="swift-PERSONAL" | |
ARCHIVE="${TOOLCHAIN_VERSION}-osx.tar.gz" | |
SYM_ARCHIVE="${TOOLCHAIN_VERSION}-osx-symbols.tar.gz" | |
#BUNDLE_PREFIX=${1:?Please specify bundle prefix e.g. $0 local.swift} | |
BUNDLE_PREFIX="personal.swift" | |
BUNDLE_IDENTIFIER="${BUNDLE_PREFIX}.${YEAR}${MONTH}${DAY}" | |
DISPLAY_NAME_SHORT="Personal Swift Development Snapshot" | |
DISPLAY_NAME="${DISPLAY_NAME_SHORT} ${YEAR}-${MONTH}-${DAY}" | |
TOOLCHAIN_NAME="${TOOLCHAIN_VERSION}" | |
SWIFT_INSTALLABLE_PACKAGE="${SRC_DIR}/${ARCHIVE}" | |
SWIFT_INSTALL_DIR="${SRC_DIR}/swift-nightly-install" | |
SWIFT_INSTALL_SYMROOT="${SRC_DIR}/swift-nightly-symroot" | |
SWIFT_TOOLCHAIN_DIR="/Library/Developer/Toolchains/${TOOLCHAIN_NAME}.xctoolchain" | |
SYMBOLS_PACKAGE="${SRC_DIR}/${SYM_ARCHIVE}" | |
swift/utils/build-script --preset-file=swift/utils/build-presets.ini --preset-file=./my-presets.ini \ | |
--preset=buildbot_osx_package_custom \ | |
install_destdir="${SWIFT_INSTALL_DIR}" \ | |
installable_package="${SWIFT_INSTALLABLE_PACKAGE}" \ | |
install_toolchain_dir="${SWIFT_TOOLCHAIN_DIR}" \ | |
install_symroot="${SWIFT_INSTALL_SYMROOT}" \ | |
symbols_package="${SYMBOLS_PACKAGE}" \ | |
darwin_toolchain_bundle_identifier="${BUNDLE_IDENTIFIER}" \ | |
darwin_toolchain_display_name="${DISPLAY_NAME}" \ | |
darwin_toolchain_display_name_short="${DISPLAY_NAME_SHORT}" \ | |
darwin_toolchain_xctoolchain_name="${TOOLCHAIN_NAME}" \ | |
darwin_toolchain_version="${TOOLCHAIN_VERSION}" \ | |
darwin_toolchain_alias="Personal" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment