@@ -35,6 +35,118 @@ 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+ Windows docker images must match the kernel version in the container and the
47+ host. You can identify the correct version by runing the ` winver ` command. The
48+ "OS Build" identifies the version suffix to apply to "10.0".
49+
50+ ``` powershell
51+ cd master\windows\10.0.19044.1706
52+ docker image build --compress -t swift:swiftci .
53+ ```
54+
55+ ### Running the image
56+
57+ ``` powershell
58+ docker run --rm -it -v %UserProfile%\data:S: swift:swiftci
59+ ```
60+
61+ ### Building the Toolchain
62+
63+ While we can build the toolchain in the containerized environment, the sources
64+ are expected to reside on the host and is passed into the docker container as a
65+ volume. The rest of automation expects that the Sources reside under a
66+ directory with the name ` SourceCache ` .
67+
68+ #### Clone the Sources
69+
70+ ``` cmd
71+ md %UserProfile%\data\SourceCache
72+ cd %UserProfile%\data\SourceCache
73+
74+ git clone -b stable/20211026 -c core.autocrlf=input -c core.symlink=true -c core.useBuiltinFSMonitor=false https://github.com/apple/llvm-project
75+ git clone -c core.autocrlf=input -c core.symlink=true -c core.useBuiltinFSMonitor=false https://github.com/apple/swift
76+ git clone -c core.autocrlf=input -c core.symlink=true -c core.useBuiltinFSMonitor=false https://github.com/apple/swift-cmark cmark
77+ git clone -c core.autocrlf=input -c core.symlink=true -c core.useBuiltinFSMonitor=false https://github.com/apple/swift-experimental-string-processing
78+ git clone -c core.autocrlf=input -c core.symlink=true -c core.useBuiltinFSMonitor=false https://github.com/apple/swift-corelibs-libdispatch
79+ git clone -c core.autocrlf=input -c core.symlink=true -c core.useBuiltinFSMonitor=false https://github.com/apple/swift-corelibs-foundation
80+ git clone -c core.autocrlf=input -c core.symlink=true -c core.useBuiltinFSMonitor=false https://github.com/apple/swift-corelibs-xctest
81+ git clone -c core.autocrlf=input -c core.symlink=true -c core.useBuiltinFSMonitor=false https://github.com/apple/swift-argument-parser
82+ git clone -c core.autocrlf=input -c core.symlink=true -c core.useBuiltinFSMonitor=false https://github.com/apple/swift-crypto
83+ git clone -c core.autocrlf=input -c core.symlink=true -c core.useBuiltinFSMonitor=false https://github.com/apple/swift-driver
84+ git clone -c core.autocrlf=input -c core.symlink=true -c core.useBuiltinFSMonitor=false https://github.com/apple/swift-llbuild llbuild
85+ git clone -c core.autocrlf=input -c core.symlink=true -c core.useBuiltinFSMonitor=false https://github.com/apple/swift-package-manager
86+ git clone -c core.autocrlf=input -c core.symlink=true -c core.useBuiltinFSMonitor=false https://github.com/apple/swift-system
87+ git clone -c core.autocrlf=input -c core.symlink=true -c core.useBuiltinFSMonitor=false https://github.com/apple/swift-tools-support-core
88+ git clone -c core.autocrlf=input -c core.symlink=true -c core.useBuiltinFSMonitor=false https://github.com/apple/swift-installer-scripts
89+ git clone -c core.autocrlf=input -c core.symlink=true -c core.useBuiltinFSMonitor=false https://github.com/apple/indexstore-db
90+ git clone -c core.autocrlf=input -c core.symlink=true -c core.useBuiltinFSMonitor=false https://github.com/apple/sourcekit-lsp
91+ git clone -c core.autocrlf=input -c core.symlink=true -c core.useBuiltinFSMonitor=false https://github.com/jpsim/Yams
92+ git clone -c core.autocrlf=input -c core.symlink=true -c core.useBuiltinFSMonitor=false https://github.com/compnerd/swift-build
93+ git clone -b curl-7_77_0 -c core.autocrlf=input -c core.symlink=true -c core.useBuiltinFSMonitor=false https://github.com/curl/curl
94+ git clone -b v2.9.12 -c core.autocrlf=input -c core.symlink=true -c core.useBuiltinFSMonitor=false https://github.com/gnome/libxml2
95+ git clone -b v1.2.11 -c core.autocrlf=input -c core.symlink=true -c core.useBuiltinFSMonitor=false https://github.com/madler/zlib
96+ git clone -b maint/maint-69 -c core.autocrlf=input -c core.symlink=true -c core.useBuiltinFSMonitor=false https://github.com/unicode-org/icu
97+ ```
98+
99+ #### Run Docker
100+
101+ ``` cmd
102+ docker run --rm -it -v %UserProfile%\data:S: swift:swiftci
103+ ```
104+
105+ #### Build the Toolchain
106+
107+ This will build a full Swift toolchain distribution (llvm, clang, lld, lldb,
108+ swift, swift-package-manger, SourceKit-LSP) and the Windows SDK (x86, x64,
109+ ARM64).
110+
111+ ``` cmd
112+ S:
113+ S:\SourceCache\swift\utils\build.cmd
114+ ```
115+
116+ #### Running Swift Tests
117+
118+ The toolchain tests require some modifications to the path to find some of the
119+ dependencies. The following will run the Swift test suite within the docker
120+ container:
121+
122+ ``` cmd
123+ path S:\b\1\bin;S:\b\1\tools\swift\libdispatch-windows-x86_64-prefix\bin;%Path%;%ProgramFiles%\Git\usr\bin
124+ ninja -C S:\b\1 check-swift
125+ ```
126+
127+ #### Using the Toolchain
128+
129+ > ** NOTE** : Running the test suite and using the toolchain near the production mode are mututally incompatible (due to the path changes).
130+
131+ The build will generate a toolchain image that is roughly similar to the
132+ installed version. The following can be run inside the docker container to use
133+ the toolchain:
134+
135+ ``` cmd
136+ set SDKROOT=S:\Library\Developer\Platforms\Windows.platform\Developer\SDKs\Windows.sdk
137+ 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%
138+ ```
139+
140+ Because the toolchain is built in the volume which is backed by the host, the
141+ toolchain can be used on the host (assuming the dependencies such as Visual
142+ Studio is installed and the module modules deployed). The adjusted paths below
143+ should enable that:
144+
145+ ``` cmd
146+ set SDKROOT=%UserProfile%\data\Library\Developer\Platforms\Windows.platform\Developer\SDKs\Windows.sdk
147+ 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%
148+ ```
149+
38150## Contributions
39151
40152Contributions via pull requests are welcome and encouraged :)
0 commit comments