@@ -35,6 +35,114 @@ 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 -c core.autocrlf=input -c core.symlink=true -c core.useBuiltinFSMonitor=false https://github.com/compnerd/swift-build
89+ git clone -t curl-7_77_0 -c core.autocrlf=input -c core.symlink=true -c core.useBuiltinFSMonitor=false https://github.com/curl/curl
90+ git clone -t v2.9.12 -c core.autocrlf=input -c core.symlink=true -c core.useBuiltinFSMonitor=false https://github.com/gnome/libxml2
91+ git clone -t v1.2.11 -c core.autocrlf=input -c core.symlink=true -c core.useBuiltinFSMonitor=false https://github.com/madler/zlib
92+ git clone -b maint/maint-69 -c core.autocrlf=input -c core.symlink=true -c core.useBuiltinFSMonitor=false https://github.com/unicode-org/icu
93+ ```
94+
95+ #### Run Docker
96+
97+ ``` cmd
98+ docker run --rm -it -v %UserProfile%\data:S: swift:swiftci
99+ ```
100+
101+ #### Build the Toolchain
102+
103+ This will build a full Swift toolchain distribution (llvm, clang, lld, lldb,
104+ swift, swift-package-manger, SourceKit-LSP) and the Windows SDK (x86, x64,
105+ ARM64).
106+
107+ ``` cmd
108+ S:
109+ S:\SourceCache\swift\utils\build.cmd
110+ ```
111+
112+ #### Running Swift Tests
113+
114+ The toolchain tests require some modifications to the path to find some of the
115+ dependencies. The following will run the Swift test suite within the docker
116+ container:
117+
118+ ``` cmd
119+ path S:\b\1\bin;S:\b\1\tools\swift\libdispatch-windows-x86_64-prefix\bin;%Path%;%ProgramFiles%\Git\usr\bin
120+ ninja -C S:\b\1 check-swift
121+ ```
122+
123+ #### Using the Toolchain
124+
125+ > ** NOTE** : Running the test suite and using the toolchain near the production mode are mututally incompatible (due to the path changes).
126+
127+ The build will generate a toolchain image that is roughly similar to the
128+ installed version. The following can be run inside the docker container to use
129+ the toolchain:
130+
131+ ``` cmd
132+ set SDKROOT=S:\Library\Developer\Platforms\Windows.platform\Developer\SDKs\Windows.sdk
133+ 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%
134+ ```
135+
136+ Because the toolchain is built in the volume which is backed by the host, the
137+ toolchain can be used on the host (assuming the dependencies such as Visual
138+ Studio is installed and the module modules deployed). The adjusted paths below
139+ should enable that:
140+
141+ ``` cmd
142+ set SDKROOT=%UserProfile%\data\Library\Developer\Platforms\Windows.platform\Developer\SDKs\Windows.sdk
143+ 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%
144+ ```
145+
38146## Contributions
39147
40148Contributions via pull requests are welcome and encouraged :)
0 commit comments