@@ -35,6 +35,113 @@ docker run \
3535 /bin/bash -lc " cp -r /source/* /home/build-user/; ./swift/utils/build-script --preset buildbot_linux install_destdir=/home/build-user/swift-install installable_package=/home/build-user/swift-DEVELOPMENT-SNAPSHOT-$( date +' %F' ) -a.tar.gz"
3636```
3737
38+ ## Quick Start for Windows Development
39+
40+ The Windows Docker image will setup an enviornment with Python, Visual Studio
41+ Build Tools, and Git. It is setup to assume that the sources will be available
42+ in ` S:\SourceCache ` .
43+
44+ ### Building and Tagging the image
45+
46+ ``` powershell
47+ cd master\windows\10.0.19044.1706
48+ docker image build --compress -t swift:swiftci .
49+ ```
50+
51+ ### Running the image
52+
53+ ``` powershell
54+ docker run --rm -it -v %UserProfile%\data:S: swift:swiftci
55+ ```
56+
57+ ### Building the Toolchain
58+
59+ While we can build the toolchain in the containerized environment, the sources
60+ are expected to reside on the host and is passed into the docker container as a
61+ volume. The rest of automation expects that the Sources reside under a
62+ directory with the name ` SourceCache ` .
63+
64+ #### Clone the Sources
65+
66+ ``` cmd
67+ md %UserProfile%\data\SourceCache
68+ cd %UserProfile%\data\SourceCache
69+
70+ git clone -b stable/20220426 -c core.autocrlf=input -c core.symlink=true -c core.useBuiltinFSMonitor=false https://github.com/apple/llvm-project
71+ git clone -c core.autocrlf=input -c core.symlink=true -c core.useBuiltinFSMonitor=false https://github.com/apple/swift
72+ git clone -c core.autocrlf=input -c core.symlink=true -c core.useBuiltinFSMonitor=false https://github.com/apple/swift-cmark cmark
73+ git clone -c core.autocrlf=input -c core.symlink=true -c core.useBuiltinFSMonitor=false https://github.com/apple/swift-experimental-string-processing
74+ git clone -c core.autocrlf=input -c core.symlink=true -c core.useBuiltinFSMonitor=false https://github.com/apple/swift-corelibs-libdispatch
75+ git clone -c core.autocrlf=input -c core.symlink=true -c core.useBuiltinFSMonitor=false https://github.com/apple/swift-corelibs-foundation
76+ git clone -c core.autocrlf=input -c core.symlink=true -c core.useBuiltinFSMonitor=false https://github.com/apple/swift-corelibs-xctest
77+ git clone -c core.autocrlf=input -c core.symlink=true -c core.useBuiltinFSMonitor=false https://github.com/apple/swift-argument-parser
78+ git clone -c core.autocrlf=input -c core.symlink=true -c core.useBuiltinFSMonitor=false https://github.com/apple/swift-crypto
79+ git clone -c core.autocrlf=input -c core.symlink=true -c core.useBuiltinFSMonitor=false https://github.com/apple/swift-driver
80+ git clone -c core.autocrlf=input -c core.symlink=true -c core.useBuiltinFSMonitor=false https://github.com/apple/swift-llbuild llbuild
81+ git clone -c core.autocrlf=input -c core.symlink=true -c core.useBuiltinFSMonitor=false https://github.com/apple/swift-package-manager
82+ git clone -c core.autocrlf=input -c core.symlink=true -c core.useBuiltinFSMonitor=false https://github.com/apple/swift-system
83+ git clone -c core.autocrlf=input -c core.symlink=true -c core.useBuiltinFSMonitor=false https://github.com/apple/swift-tools-support-core
84+ git clone -c core.autocrlf=input -c core.symlink=true -c core.useBuiltinFSMonitor=false https://github.com/apple/swift-installer-scripts
85+ git clone -c core.autocrlf=input -c core.symlink=true -c core.useBuiltinFSMonitor=false https://github.com/apple/indexstore-db
86+ git clone -c core.autocrlf=input -c core.symlink=true -c core.useBuiltinFSMonitor=false https://github.com/apple/sourcekit-lsp
87+ git clone -c core.autocrlf=input -c core.symlink=true -c core.useBuiltinFSMonitor=false https://github.com/jpsim/Yams
88+ git clone -t curl-7_77_0 -c core.autocrlf=input -c core.symlink=true -c core.useBuiltinFSMonitor=false https://github.com/curl/curl
89+ git clone -t v2.9.12 -c core.autocrlf=input -c core.symlink=true -c core.useBuiltinFSMonitor=false https://github.com/gnome/libxml2
90+ git clone -t v1.2.11 -c core.autocrlf=input -c core.symlink=true -c core.useBuiltinFSMonitor=false https://github.com/madler/zlib
91+ git clone -b maint/maint-69 -c core.autocrlf=input -c core.symlink=true -c core.useBuiltinFSMonitor=false https://github.com/unicode-org/icu
92+ ```
93+
94+ #### Run Docker
95+
96+ ``` cmd
97+ docker run --rm -it -v %UserProfile%\data:S: swift:swiftci
98+ ```
99+
100+ #### Build the Toolchain
101+
102+ This will build a full Swift toolchain distribution (llvm, clang, lld, lldb,
103+ swift, swift-package-manger, SourceKit-LSP) and the Windows SDK (x86, x64,
104+ ARM64).
105+
106+ ``` cmd
107+ S:
108+ S:\SourceCache\swift\utils\build.cmd
109+ ```
110+
111+ #### Running Swift Tests
112+
113+ The toolchain tests require some modifications to the path to find some of the
114+ dependencies. The following will run the Swift test suite within the docker
115+ container:
116+
117+ ``` cmd
118+ path S:\b\1\bin;S:\b\1\tools\swift\libdispatch-windows-x86_64-prefix\bin;%Path%;%ProgramFiles%\Git\usr\bin
119+ ninja -C S:\b\1 check-swift
120+ ```
121+
122+ #### Using the Toolchain
123+
124+ > ** NOTE** : Running the test suite and using the toolchain near the production mode are mututally incompatible (due to the path changes).
125+
126+ The build will generate a toolchain image that is roughly similar to the
127+ installed version. The following can be run inside the docker container to use
128+ the toolchain:
129+
130+ ``` cmd
131+ set SDKROOT=S:\Library\Developer\Platforms\Windows.platform\Developer\SDKs\Windows.sdk
132+ path S:\Library\Developer\Platforms\Windows.platform\Developer\SDKs\Windows.sdk\usr\bin\x64;S:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin;%Path%
133+ ```
134+
135+ Because the toolchain is built in the volume which is backed by the host, the
136+ toolchain can be used on the host (assuming the dependencies such as Visual
137+ Studio is installed and the module modules deployed). The adjusted paths below
138+ should enable that:
139+
140+ ``` cmd
141+ set SDKROOT=%UserProfile%\data\Library\Developer\Platforms\Windows.platform\Developer\SDKs\Windows.sdk
142+ path %UserProfile%\data\Library\Developer\Platforms\Windows.platform\Developer\SDKs\Windows.sdk\usr\bin\x64;%UserProfile%\data\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin;%Path%
143+ ```
144+
38145## Contributions
39146
40147Contributions via pull requests are welcome and encouraged :)
0 commit comments