Skip to content

Commit cba563c

Browse files
committed
Cleaning up code:
- Add darwin_ prefix to preset variables - Add license header to utils/toolchain-codesign and utils/toolchain-installer - Simplify the logic to remove Info.plist
1 parent 4c0c8df commit cba563c

File tree

4 files changed

+40
-15
lines changed

4 files changed

+40
-15
lines changed

utils/build-presets.ini

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,7 @@ installable-package=%(installable_package)s
597597
symbols-package=%(symbols_package)s
598598

599599
# Info.plist
600-
darwin-toolchain-bundle-identifier=%(toolchain_bundle_identifier)s
601-
darwin-toolchain-display-name=%(toolchain_display_name)s
602-
darwin-toolchain-name=%(toolchain_xctoolchain_name)s
603-
darwin-toolchain-version=%(toolchain_version)s
600+
darwin-toolchain-bundle-identifier=%(darwin_toolchain_bundle_identifier)s
601+
darwin-toolchain-display-name=%(darwin_toolchain_display_name)s
602+
darwin-toolchain-name=%(darwin_toolchain_xctoolchain_name)s
603+
darwin-toolchain-version=%(darwin_toolchain_version)s

utils/build-script-impl

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2123,20 +2123,23 @@ if [[ "${INSTALLABLE_PACKAGE}" ]] ; then
21232123
cp "${SWIFT_SOURCE_DIR}/utils/swift-stdlib-tool-substitute" "${INSTALL_DESTDIR}/${INSTALL_PREFIX}/bin/swift-stdlib-tool"
21242124
fi
21252125

2126-
#Create plist for xctoolchain
2126+
# Create plist for xctoolchain
21272127
echo "-- Create Info.plist --"
21282128
PLISTBUDDY_BIN="/usr/libexec/PlistBuddy"
2129+
21292130
DARWIN_TOOLCHAIN_INSTALL_LOCATION="/Library/Developer/Toolchains/${DARWIN_TOOLCHAIN_NAME}.xctoolchain"
2130-
if [[ -f "${INSTALL_DESTDIR}/${TOOLCHAIN_PREFIX}/Info.plist" ]] ; then
2131-
echo "-- Removing: ${INSTALL_DESTDIR}/${TOOLCHAIN_PREFIX}/Info.plist"
2132-
rm "${INSTALL_DESTDIR}/${TOOLCHAIN_PREFIX}/Info.plist"
2133-
fi
2134-
${PLISTBUDDY_BIN} -c "Add DisplayName string '${DARWIN_TOOLCHAIN_DISPLAY_NAME}'" "${INSTALL_DESTDIR}/${TOOLCHAIN_PREFIX}/Info.plist"
2135-
${PLISTBUDDY_BIN} -c "Add Version string '${DARWIN_TOOLCHAIN_VERSION}'" "${INSTALL_DESTDIR}/${TOOLCHAIN_PREFIX}/Info.plist"
2136-
${PLISTBUDDY_BIN} -c "Add CFBundleIdentifier string '${DARWIN_TOOLCHAIN_BUNDLE_IDENTIFIER}'" "${INSTALL_DESTDIR}/${TOOLCHAIN_PREFIX}/Info.plist"
2137-
${PLISTBUDDY_BIN} -c "Add ReportProblemURL string 'https://bugs.swift.org/'" "${INSTALL_DESTDIR}/${TOOLCHAIN_PREFIX}/Info.plist"
2138-
${PLISTBUDDY_BIN} -c "Add OverrideEnvironment::DYLD_LIBRARY_PATH string '${DARWIN_TOOLCHAIN_INSTALL_LOCATION}/usr/lib'" "${INSTALL_DESTDIR}/${TOOLCHAIN_PREFIX}/Info.plist"
2139-
chmod a+r "${INSTALL_DESTDIR}/${TOOLCHAIN_PREFIX}/Info.plist"
2131+
DARWIN_TOOLCHAIN_INFO_PLIST="${INSTALL_DESTDIR}/${TOOLCHAIN_PREFIX}/Info.plist"
2132+
DARWIN_TOOLCHAIN_REPORT_URL="https://bugs.swift.org/"
2133+
2134+
echo "-- Removing: ${DARWIN_TOOLCHAIN_INFO_PLIST}"
2135+
rm -f ${DARWIN_TOOLCHAIN_INFO_PLIST}
2136+
2137+
${PLISTBUDDY_BIN} -c "Add DisplayName string '${DARWIN_TOOLCHAIN_DISPLAY_NAME}'" "${DARWIN_TOOLCHAIN_INFO_PLIST}"
2138+
${PLISTBUDDY_BIN} -c "Add Version string '${DARWIN_TOOLCHAIN_VERSION}'" "${DARWIN_TOOLCHAIN_INFO_PLIST}"
2139+
${PLISTBUDDY_BIN} -c "Add CFBundleIdentifier string '${DARWIN_TOOLCHAIN_BUNDLE_IDENTIFIER}'" "${DARWIN_TOOLCHAIN_INFO_PLIST}"
2140+
${PLISTBUDDY_BIN} -c "Add ReportProblemURL string '${DARWIN_TOOLCHAIN_REPORT_URL}'" "${DARWIN_TOOLCHAIN_INFO_PLIST}"
2141+
${PLISTBUDDY_BIN} -c "Add OverrideEnvironment::DYLD_LIBRARY_PATH string '${DARWIN_TOOLCHAIN_INSTALL_LOCATION}/usr/lib'" "${DARWIN_TOOLCHAIN_INFO_PLIST}"
2142+
chmod a+r "${DARWIN_TOOLCHAIN_INFO_PLIST}"
21402143

21412144
if [[ "${DARWIN_TOOLCHAIN_APPLICATION_CERT}" ]] ; then
21422145
echo "-- Codesign xctoolchain --"

utils/toolchain-codesign

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,15 @@
11
#!/bin/bash
2+
#===--- build-script-impl - Implementation details of build-script ---------===#
3+
#
4+
## This source file is part of the Swift.org open source project
5+
##
6+
## Copyright (c) 2014 - 2015 Apple Inc. and the Swift project authors
7+
## Licensed under Apache License v2.0 with Runtime Library Exception
8+
##
9+
## See http://swift.org/LICENSE.txt for license information
10+
## See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
11+
#
12+
#===------------------------------------------------------------------------===#
213

314
DARWIN_TOOLCHAIN_APPLICATION_CERT=$1
415
TOOLCHAIN_PREFIX=$2

utils/toolchain-installer

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,15 @@
11
#!/bin/bash
2+
#===--- build-script-impl - Implementation details of build-script ---------===#
3+
#
4+
## This source file is part of the Swift.org open source project
5+
##
6+
## Copyright (c) 2014 - 2015 Apple Inc. and the Swift project authors
7+
## Licensed under Apache License v2.0 with Runtime Library Exception
8+
##
9+
## See http://swift.org/LICENSE.txt for license information
10+
## See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
11+
#
12+
#===------------------------------------------------------------------------===#
213

314
TOOLCHAIN_PREFIX=$1
415
DARWIN_BUNDLE_IDENTIFIER=$2

0 commit comments

Comments
 (0)