-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmk-oss-toolchain
More file actions
executable file
·51 lines (40 loc) · 1.64 KB
/
Copy pathmk-oss-toolchain
File metadata and controls
executable file
·51 lines (40 loc) · 1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
if [ -z "$1" ]; then
echo "usage: $0 <tc-name>"
exit 1
fi
src=~/Library/Developer/Toolchains/$1.xctoolchain
name=$(basename *.xcworkspace .xcworkspace)
id=${name}-oss
dest=~/Library/Developer/Toolchains/${id}.xctoolchain
derivedData=~/Library/Developer/Xcode/DerivedData/${name}-*/Build/Products/Debug
#derivedData=~/Library/Developer/Xcode/DerivedData/${name}-*/Build/Intermediates.noindex/InstallIntermediates/macosx/Products/Debug
if [ -z "$derivedData" ]; then
echo run from the worktree directory
exit 1
fi
if [ ! -d $src ]; then
echo Source toolchain not found: $src
exit 1
fi
if [ ! -d $derivedData ]; then
echo Derived data not found: $derivedData
exit 1
fi
echo Creating $id.xctoolchain
rm -fr $dest
ditto $src $dest
rm -f $dest/ToolchainInfo.plist
rm -fr $dest/_CodeSignature
cp ~/Library/Developer/Toolchains/Info.plist $dest/Info.plist
plutil -replace CFBundleIdentifier -string $id $dest/Info.plist
ln -sf $derivedData/swift-package-manager $dest/usr/bin/swift-package
ln -sf $derivedData/sourcekit-lsp $dest/usr/bin/sourcekit-lsp
rm -fr $dest/usr/lib/swift/pm/ManifestAPI/*
ln -sf $derivedData/CompilerPluginSupport.swiftmodule $dest/usr/lib/swift/pm/ManifestAPI
ln -sf $derivedData/PackageDescription.swiftmodule $dest/usr/lib/swift/pm/ManifestAPI
ln -sf $derivedData/PackageFrameworks/PackageDescription.framework $dest/usr/lib/swift/pm/ManifestAPI
rm -fr $dest/usr/lib/swift/pm/PluginAPI/*
ln -sf $derivedData/PackagePlugin.swiftmodule $dest/usr/lib/swift/pm/PluginAPI
ln -sf $derivedData/PackageFrameworks/PackagePlugin.framework $dest/usr/lib/swift/pm/PluginAPI
TOOLCHAINS=$id swift --version
TOOLCHAINS=$id swift build --version