Skip to content

Commit 437302f

Browse files
authored
Merge pull request #38839 from compnerd/package
utils: add support to package the Windows toolchain
2 parents f132379 + 6fb0de5 commit 437302f

File tree

1 file changed

+78
-1
lines changed

1 file changed

+78
-1
lines changed

utils/build-windows-toolchain.bat

Lines changed: 78 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ subst T: /d
2424
subst T: %BuildRoot% || (exit /b)
2525
set BuildRoot=T:
2626

27+
:: Identify the PackageRoot
28+
set PackageRoot=%BuildRoot%\package
29+
30+
md %PackageRoot%
31+
2732
:: Identify the InstallRoot
2833
set InstallRoot=%BuildRoot%\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr
2934
set PlatformRoot=%BuildRoot%\Library\Developer\Platforms\Windows.platform
@@ -38,10 +43,15 @@ set TMPDIR=%BuildRoot%\tmp
3843
call :CloneDependencies || (exit /b)
3944
call :CloneRepositories || (exit /b)
4045

46+
md "%BuildRoot%\Library"
47+
4148
:: TODO(compnerd) build ICU from source
4249
curl.exe -sOL "https://github.com/unicode-org/icu/releases/download/release-67-1/icu4c-67_1-Win64-MSVC2017.zip" || (exit /b)
43-
md "%BuildRoot%\Library"
4450
"%SystemDrive%\Program Files\Git\usr\bin\unzip.exe" -o icu4c-67_1-Win64-MSVC2017.zip -d %BuildRoot%\Library\icu-67.1
51+
md %BuildRoot%\Library\icu-67.1\usr\bin
52+
copy %BuildRoot%\Library\icu-67.1\bin64\icudt67.dll %BuildRoot%\Library\icu-67.1\usr\bin || (exit /b)
53+
copy %BuildRoot%\Library\icu-67.1\bin64\icuin67.dll %BuildRoot%\Library\icu-67.1\usr\bin || (exit /b)
54+
copy %BuildRoot%\Library\icu-67.1\bin64\icuuc67.dll %BuildRoot%\Library\icu-67.1\usr\bin || (exit /b)
4555

4656
:: FIXME(compnerd) is there a way to build the sources without downloading the amalgamation?
4757
curl.exe -sOL "https://sqlite.org/2021/sqlite-amalgamation-3360000.zip" || (exit /b)
@@ -585,6 +595,73 @@ python -c "import plistlib; print(str(plistlib.dumps({ 'DefaultProperties': { 'D
585595
:: TODO(compnerd) match the XCTest installation name
586596
python -c "import plistlib; print(str(plistlib.dumps({ 'DefaultProperties': { 'XCTEST_VERSION': 'development' } }), encoding='utf-8'))" > %PlatformRoot%\Info.plist
587597

598+
:: Package toolchain.msi
599+
msbuild %SourceRoot%\swift-installer-scripts\platforms\Windows\toolchain.wixproj ^
600+
-p:RunWixToolsOutOfProc=true ^
601+
-p:OutputPath=%PackageRoot%\toolchain\ ^
602+
-p:IntermediateOutputPath=%PackageRoot%\toolchain\ ^
603+
-p:TOOLCHAIN_ROOT=%BuildRoot%\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain
604+
:: TODO(compnerd) actually perform the code-signing
605+
:: signtool sign /f Apple_CodeSign.pfx /p Apple_CodeSign_Password /tr http://timestamp.digicert.com /fd sha256 %PackageRoot%\toolchain\toolchain.msi
606+
607+
:: Package sdk.msi
608+
msbuild %SourceRoot%\swift-installer-scripts\platforms\Windows\CustomActions\SwiftInstaller\SwiftInstaller.vcxproj -t:restore
609+
msbuild %SourceRoot%\swift-installer-scripts\platforms\Windows\sdk.wixproj ^
610+
-p:RunWixToolsOutOfProc=true ^
611+
-p:OutputPath=%PackageRoot%\sdk\ ^
612+
-p:IntermediateOutputPath=%PackageRoot%\sdk\ ^
613+
-p:PLATFORM_ROOT=%PlatformRoot%\ ^
614+
-p:SDK_ROOT=%SDKInstallRoot%\ ^
615+
-p:SWIFT_SOURCE_DIR=%SourceRoot%\swift\ ^
616+
-p:PlatformToolset=v142
617+
:: TODO(compnerd) actually perform the code-signing
618+
:: signtool sign /f Apple_CodeSign.pfx /p Apple_CodeSign_Password /tr http://timestamp.digicert.com /fd sha256 %PackageRoot%\sdk\sdk.msi
619+
620+
:: Package runtime.msi
621+
msbuild %SourceRoot%\swift-installer-scripts\platforms\Windows\runtime.wixproj ^
622+
-p:RunWixToolsOutOfProc=true ^
623+
-p:OutputPath=%PackageRoot%\runtime\ ^
624+
-p:IntermediateOutputPath=%PackageRoot%\runtime\ ^
625+
-p:SDK_ROOT=%SDKInstallRoot%\
626+
:: TODO(compnerd) actually perform the code-signing
627+
:: signtool sign /f Apple_CodeSign.pfx /p Apple_CodeSign_Password /tr http://timestamp.digicert.com /fd sha256 %PackageRoot%\runtime\runtime.msi
628+
629+
:: Package icu.msi
630+
msbuild %SourceRoot%\swift-installer-scripts\platforms\Windows\icu.wixproj ^
631+
-p:RunWixToolsOutOfProc=true ^
632+
-p:OutputPath=%PackageRoot%\icu\ ^
633+
-p:IntermediateOutputPath=%PackageRoot%\icu\ ^
634+
-p:ProductVersion=67.1 ^
635+
-p:ProductVersionMajor=67 ^
636+
-p:ICU_ROOT=%BuildRoot%
637+
:: TODO(compnerd) actually perform the code-signing
638+
:: signtool sign /f Apple_CodeSign.pfx /p Apple_CodeSign_Password /tr http://timestamp.digicert.com /fd sha256 %PackageRoot%\icu\icu.msi
639+
640+
:: Package devtools.msi
641+
msbuild %SourceRoot%\swift-installer-scripts\platforms\Windows\devtools.wixproj ^
642+
-p:RunWixToolsOutOfProc=true ^
643+
-p:OutputPath=%PackageRoot%\devtools\ ^
644+
-p:IntermediateOutputPath=%PackageRoot%\devtools\ ^
645+
-p:DEVTOOLS_ROOT=%BuildRoot%\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain
646+
:: TODO(compnerd) actually perform the code-signing
647+
:: signtool sign /f Apple_CodeSign.pfx /p Apple_CodeSign_Password /tr http://timestamp.digicert.com /fd sha256 %PackageRoot%\devtools\devtools.msi
648+
649+
:: Collate MSIs
650+
move %PackageRoot%\toolchain\toolchain.msi %PackageRoot% || (exit /b)
651+
move %PackageRoot%\sdk\sdk.msi %PackageRoot% || (exit /b)
652+
move %PackageRoot%\runtime\runtime.msi %PackageRoot% || (exit /b)
653+
move %PackageRoot%\icu\icu.msi %PackageRoot% || (exit /b)
654+
move %PackageRoot%\devtools\devtools.msi %PackageRoot% || (exit /b)
655+
656+
:: Build Installer
657+
msbuild %SourceRoot%\swift-installer-scripts\platforms\Windows\installer.wixproj ^
658+
-p:RunWixToolsOutOfProc=true ^
659+
-p:OutputPath=%PackageRoot%\installer\ ^
660+
-p:IntermediateOutputPath=%PackageRoot%\installer\ ^
661+
-p:MSI_LOCATION=%PackageRoot%\
662+
:: TODO(compnerd) actually perform the code-signing
663+
:: signtool sign /f Apple_CodeSign.pfx /p Apple_CodeSign_Password /tr http://timestamp.digicert.com /fd sha256 %PackageRoot%\installer\installer.exe
664+
588665
:: Clean up the module cache
589666
rd /s /q %LocalAppData%\clang\ModuleCache
590667

0 commit comments

Comments
 (0)