Skip to content

Commit 463dc10

Browse files
committed
Windows: add a toolchain image for 10.0.19044.1706 (21H2)
Add rules for building a docker image for the toolchain build at 10.0.19044.1706 (21H2). As the base image for the release is not available, use a slightly older release which should be compatible to avoid any issues due to kernel mismatches (the newer image will not run). This allows building the toolchain in a docker image with the latest stable release of Windows 10.
1 parent 594ab4b commit 463dc10

File tree

4 files changed

+103
-0
lines changed

4 files changed

+103
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# escape=`
2+
3+
# 10.0.19044.1706 is not yet published, use the 20H2 snapshot as that is
4+
# believed to work better than the newer image.
5+
FROM mcr.microsoft.com/windows/servercore:10.0.19042.1706 AS windows
6+
7+
LABEL maintainer="Swift Infrastructure <[email protected]>"
8+
LABEL description="Docker Container for the Swift programming language"
9+
10+
ARG GIT=https://github.com/git-for-windows/git/releases/download/v2.36.1.windows.1/Git-2.36.1-64-bit.exe
11+
ARG PYTHON=https://www.python.org/ftp/python/3.10.4/python-3.10.4-amd64.exe
12+
13+
# restore the default Windows shell for correct batch processing
14+
SHELL ["cmd", "/S", "/C"]
15+
16+
# Enable Developer Mode.
17+
RUN reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock" /t REG_DWORD /f /v "AllowDevelopmentWithoutDevLicense" /d "1"
18+
19+
# Enable Long Paths
20+
RUN reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem" /t REG_DWORD /f /v "LongPathsEnabled" /d "1"
21+
22+
# Install Git.
23+
# See: git-[version]-[bit].exe /SAVEINF=git.inf and /?
24+
COPY git.inf .
25+
RUN `
26+
curl -SLo git.exe %GIT% `
27+
&& (start /w git.exe /SP- /VERYSILENT /SUPPRESSMSGBOXES /NOCANCEL /NORESTART /CLOSEAPPLICATIONS /FORCECLOSEAPPLICATIONS /LOADINF=git.inf ) `
28+
&& del /q git.exe git.inf
29+
30+
# Install Python.
31+
# See: https://docs.python.org/3.10/using/windows.html
32+
# FIXME: it appears that `PYTHONHOME` and `PYTHONPATH` are unset
33+
COPY unattend.xml .
34+
RUN `
35+
curl -SLo python.exe %PYTHON% `
36+
&& (start /w python.exe /quiet ) `
37+
&& del /q python.exe unattend.xml
38+
39+
# Install Visual Studio Build Tools
40+
RUN `
41+
curl -SLo vs_buildtools.exe https://aka.ms/vs/17/release/vs_buildtools.exe `
42+
&& (start /w vs_buildtools.exe --quiet --wait --norestart --nocache `
43+
--add Microsoft.VisualStudio.Component.Windows11SDK.22000 `
44+
--add Microsoft.VisualStudio.Component.VC.ATL `
45+
--add Microsoft.VisualStudio.Component.VC.ATL.ARM `
46+
--add Microsoft.VisualStudio.Component.VC.ATL.ARM64 `
47+
--add Microsoft.VisualStudio.Component.VC.CMake.Project `
48+
--add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 `
49+
--add Microsoft.VisualStudio.Component.VC.Tools.ARM64 `
50+
--add Microsoft.VisualStudio.Component.VC.Tools.ARM `
51+
|| IF "%EXITCODE%"=="3010" EXIT 0) `
52+
&& del /q vs_buildtools.exe
53+
COPY InstallModules.cmd .
54+
RUN InstallModules.cmd && del /q InstallModules.cmd
55+
56+
# FIXME: we should use a non-Administrator user
57+
# USER ContainerUser
58+
59+
ENV PYTHONUTF8=1
60+
# Default to powershell
61+
CMD ["powershell.exe", "-nologo", "-ExecutionPolicy", "Bypass"]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
@echo off
2+
setlocal
3+
set vswhere=%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe
4+
FOR /F "tokens=* usebackq" %%r IN (`"%vswhere%" -nologo -latest -all -prerelease -products * -property installationPath`) DO SET VsDevCmd=%%r\Common7\Tools\VsDevCmd.bat
5+
CALL "%VsDevCmd%" -no_logo -host_arch=amd64 -arch=amd64
6+
mklink "%UniversalCRTSdkDir%\Include\%UCRTVersion%\ucrt\module.modulemap" S:\SourceCache\swift\stdlib\public\Platform\ucrt.modulemap
7+
mklink "%UniversalCRTSdkDir%\Include\%UCRTVersion%\um\module.modulemap" S:\SourceCache\swift\stdlib\public\Platform\winsdk.modulemap
8+
mklink "%VCToolsInstallDir%\include\module.modulemap" S:\SourceCache\swift\stdlib\public\Platform\visualc.modulemap
9+
mklink "%VCToolsInstallDir%\include\visualc.apinotes" S:\SourceCache\swift\stdlib\public\Platform\visualc.apinotes
10+
endlocal
11+
@echo on
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[Setup]
2+
NoIcons=1
3+
Components=gitlfs
4+
EditorOption=VIM
5+
PathOption=Cmd
6+
SSHOption=OpenSSH
7+
TurtoiseOption=false
8+
CURLOption=WinSSL
9+
BashTerminalOption=ConHost
10+
PerformanceTweaksFSCache=Enabled
11+
EnableSymlinks=Enabled
12+
EnablePseudoConsoltSupport=Disabled
13+
EnableFSMonitor=Enabled
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Options>
3+
<Option Name="InstallAllUsers" Value="1" />
4+
<Option Name="AssociateFiles" Value="0" />
5+
<Option Name="PrependPath" Value="1" />
6+
<Option Name="Shortcuts" Value="0" />
7+
<Option Name="Include_doc" Value="0" />
8+
<Option Name="Include_debug" Value="0" />
9+
<Option Name="Include_dev" Value="1" />
10+
<Option Name="Include_exe" Value="1" />
11+
<Option Name="Include_launcher" Value="0" />
12+
<Option Name="InstallLauncherAllUsers" Value="0" />
13+
<Option Name="Include_lib" Value="1" />
14+
<Option Name="Include_symbols" Value="0" />
15+
<Option Name="Include_tcltk" Value="0" />
16+
<Option Name="Include_test" Value="0" />
17+
<Option Name="Include_tools" Value="0" />
18+
</Options>

0 commit comments

Comments
 (0)