Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows: add a toolchain image for 10.0.19044.1706 (21H2) #302

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions swift-ci/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ in `S:\SourceCache`.

### Building and Tagging the image

Windows docker images must match the kernel version in the container and the
host. You can identify the correct version by runing the `winver` command. The
"OS Build" identifies the version suffix to apply to "10.0".

```powershell
cd master\windows\10.0.19044.1706
docker image build --compress -t swift:swiftci .
Expand Down
67 changes: 67 additions & 0 deletions swift-ci/master/windows/10.0.19044.1706/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# escape=`

# 10.0.19044.1706 is not yet published, use the 20H2 snapshot as that is
# believed to work better than the newer image.
FROM mcr.microsoft.com/windows/servercore:10.0.19042.1706 AS windows

LABEL maintainer="Swift Infrastructure <[email protected]>"
LABEL description="Docker Container for the Swift programming language"

ARG GIT=https://github.com/git-for-windows/git/releases/download/v2.36.1.windows.1/Git-2.36.1-64-bit.exe
ARG PYTHON=https://www.python.org/ftp/python/3.10.4/python-3.10.4-amd64.exe
ARG WIX=https://wixtoolset.org/downloads/v3.14.0.6526/wix314.exe

# restore the default Windows shell for correct batch processing
SHELL ["cmd", "/S", "/C"]

# Enable Developer Mode.
RUN reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock" /t REG_DWORD /f /v "AllowDevelopmentWithoutDevLicense" /d "1"

# Enable Long Paths
RUN reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem" /t REG_DWORD /f /v "LongPathsEnabled" /d "1"

# Install Git.
# See: git-[version]-[bit].exe /SAVEINF=git.inf and /?
COPY git.inf .
RUN `
curl -SLo git.exe %GIT% `
&& (start /w git.exe /SP- /VERYSILENT /SUPPRESSMSGBOXES /NOCANCEL /NORESTART /CLOSEAPPLICATIONS /FORCECLOSEAPPLICATIONS /LOADINF=git.inf ) `
&& del /q git.exe git.inf

# Install Python.
# See: https://docs.python.org/3.10/using/windows.html
# FIXME: it appears that `PYTHONHOME` and `PYTHONPATH` are unset
COPY unattend.xml .
RUN `
curl -SLo python.exe %PYTHON% `
&& (start /w python.exe /quiet ) `
&& del /q python.exe unattend.xml

# Install Visual Studio Build Tools
RUN `
curl -SLo vs_buildtools.exe https://aka.ms/vs/17/release/vs_buildtools.exe `
&& (start /w vs_buildtools.exe --quiet --wait --norestart --nocache `
--add Microsoft.VisualStudio.Component.Windows11SDK.22000 `
--add Microsoft.VisualStudio.Component.VC.ATL `
--add Microsoft.VisualStudio.Component.VC.ATL.ARM `
--add Microsoft.VisualStudio.Component.VC.ATL.ARM64 `
--add Microsoft.VisualStudio.Component.VC.CMake.Project `
--add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 `
--add Microsoft.VisualStudio.Component.VC.Tools.ARM64 `
--add Microsoft.VisualStudio.Component.VC.Tools.ARM `
|| IF "%EXITCODE%"=="3010" EXIT 0) `
&& del /q vs_buildtools.exe
COPY InstallModules.cmd .
RUN InstallModules.cmd && del /q InstallModules.cmd

RUN `
curl -SLo wix.exe %WIX% `
&& (start /w wix.exe /install /quiet /norestart ) `
&& del /q wix.exe

# FIXME: we should use a non-Administrator user
# USER ContainerUser

ENV PYTHONUTF8=1
# Default to powershell
CMD ["powershell.exe", "-nologo", "-ExecutionPolicy", "Bypass"]
11 changes: 11 additions & 0 deletions swift-ci/master/windows/10.0.19044.1706/InstallModules.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
@echo off
setlocal
set vswhere=%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe
FOR /F "tokens=* usebackq" %%r IN (`"%vswhere%" -nologo -latest -all -prerelease -products * -property installationPath`) DO SET VsDevCmd=%%r\Common7\Tools\VsDevCmd.bat
CALL "%VsDevCmd%" -no_logo -host_arch=amd64 -arch=amd64
mklink "%UniversalCRTSdkDir%\Include\%UCRTVersion%\ucrt\module.modulemap" S:\SourceCache\swift\stdlib\public\Platform\ucrt.modulemap
mklink "%UniversalCRTSdkDir%\Include\%UCRTVersion%\um\module.modulemap" S:\SourceCache\swift\stdlib\public\Platform\winsdk.modulemap
mklink "%VCToolsInstallDir%\include\module.modulemap" S:\SourceCache\swift\stdlib\public\Platform\visualc.modulemap
mklink "%VCToolsInstallDir%\include\visualc.apinotes" S:\SourceCache\swift\stdlib\public\Platform\visualc.apinotes
endlocal
@echo on
13 changes: 13 additions & 0 deletions swift-ci/master/windows/10.0.19044.1706/git.inf
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[Setup]
NoIcons=1
Components=gitlfs
EditorOption=VIM
PathOption=Cmd
SSHOption=OpenSSH
TurtoiseOption=false
CURLOption=WinSSL
BashTerminalOption=ConHost
PerformanceTweaksFSCache=Enabled
EnableSymlinks=Enabled
EnablePseudoConsoltSupport=Disabled
EnableFSMonitor=Enabled
18 changes: 18 additions & 0 deletions swift-ci/master/windows/10.0.19044.1706/unattend.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<Options>
<Option Name="InstallAllUsers" Value="1" />
<Option Name="AssociateFiles" Value="0" />
<Option Name="PrependPath" Value="1" />
<Option Name="Shortcuts" Value="0" />
<Option Name="Include_doc" Value="0" />
<Option Name="Include_debug" Value="0" />
<Option Name="Include_dev" Value="1" />
<Option Name="Include_exe" Value="1" />
<Option Name="Include_launcher" Value="0" />
<Option Name="InstallLauncherAllUsers" Value="0" />
<Option Name="Include_lib" Value="1" />
<Option Name="Include_symbols" Value="0" />
<Option Name="Include_tcltk" Value="0" />
<Option Name="Include_test" Value="0" />
<Option Name="Include_tools" Value="0" />
</Options>