|
1 |
| -:: build-windows-toolchain.bat |
2 |
| -:: |
3 |
| -:: This source file is part of the Swift.org open source project |
4 |
| -:: |
5 |
| -:: Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors |
6 |
| -:: Licensed under Apache License v2.0 with Runtime Library Exception |
7 |
| -:: |
8 |
| -:: See https://swift.org/LICENSE.txt for license information |
9 |
| -:: See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors |
10 |
| - |
11 |
| -setlocal enableextensions enabledelayedexpansion |
12 |
| - |
13 |
| -:: Work around CI invocation in vsdevcmd |
14 |
| -:: The build relies on build.ps1, which should not be called in a vs dev cmd |
15 |
| -if "%VSCMD_ARG_HOST_ARCH%"=="" goto Start |
16 |
| -echo This script should not be called in a vs developer command prompt |
17 |
| -echo Reeinvoking script in the default environment |
18 |
| -set TEMP=%~dp0..\..\tmp |
19 |
| -mkdir %TEMP% 2>&1 1>nul |
20 |
| -echo set PYTHON_HOME=%PYTHON_HOME%> %TEMP%\call-build.cmd |
21 |
| -echo set CMAKE_BUILD_TYPE=%CMAKE_BUILD_TYPE%>> %TEMP%\call-build.cmd |
22 |
| -echo set SKIP_TESTS=%SKIP_TESTS%>> %TEMP%\call-build.cmd |
23 |
| -echo set SKIP_PACKAGING=%SKIP_PACKAGING%>> %TEMP%\call-build.cmd |
24 |
| -echo set SKIP_UPDATE_CHECKOUT=%SKIP_UPDATE_CHECKOUT%>> %TEMP%\call-build.cmd |
25 |
| -echo set REPO_SCHEME=%REPO_SCHEME%>> %TEMP%\call-build.cmd |
26 |
| -echo "%~f0">> %TEMP%\call-build.cmd |
27 |
| -start /i /b /wait cmd.exe /env=default /c "%TEMP%\call-build.cmd" |
28 |
| -set ec=%errorlevel% |
29 |
| -del %TEMP%\call-build.cmd |
30 |
| -exit /b %ec% |
31 |
| - |
32 |
| -:Start |
33 |
| - |
34 |
| -:: Work around CI invocation with PYTHON_HOME containing double quotes |
35 |
| -if defined PYTHON_HOME path !Path!;!PYTHON_HOME:"=! |
36 |
| - |
37 |
| -:: Identify the SourceRoot |
38 |
| -:: Normalize the SourceRoot to make it easier to read the output. |
39 |
| -cd %~dp0\..\.. |
40 |
| -set SourceRoot=%CD% |
41 |
| - |
42 |
| -:: Identify the BuildRoot |
43 |
| -set BuildRoot=%SourceRoot%\build |
44 |
| - |
45 |
| -md %BuildRoot% |
46 |
| -subst T: /d |
47 |
| -subst T: %BuildRoot% || (exit /b 1) |
48 |
| -set BuildRoot=T: |
49 |
| - |
50 |
| -:: Identify the PackageRoot |
51 |
| -set PackageRoot=%BuildRoot%\artifacts |
52 |
| - |
53 |
| -md %PackageRoot% |
54 |
| - |
55 |
| -:: Setup temporary directories |
56 |
| -md %BuildRoot%\tmp |
57 |
| -set TEMP=%BuildRoot%\tmp |
58 |
| -set TMP=%BuildRoot%\tmp |
59 |
| -set TMPDIR=%BuildRoot%\tmp |
60 |
| - |
61 |
| -set NINJA_STATUS=[%%f/%%t][%%p][%%es] |
62 |
| - |
63 |
| -if "%CMAKE_BUILD_TYPE%"=="" (set CMAKE_BUILD_TYPE=Release) |
64 |
| - |
65 |
| -:: Build the -Test argument, if any, by subtracting skipped tests |
66 |
| -set TestArg=-Test swift,dispatch,foundation,xctest, |
67 |
| -for %%I in (%SKIP_TESTS%) do (call set TestArg=%%TestArg:%%I,=%%) |
68 |
| -if "%TestArg:~-1%"=="," (set TestArg=%TestArg:~0,-1%) else (set TestArg= ) |
69 |
| - |
70 |
| -:: Build the -SkipPackaging argument, if any |
71 |
| -set SkipPackagingArg=-SkipPackaging |
72 |
| -if not "%SKIP_PACKAGING%"=="1" set "SkipPackagingArg= " |
73 |
| - |
74 |
| -call :CloneRepositories || (exit /b 1) |
75 |
| - |
76 |
| -:: We only have write access to BuildRoot, so use that as the image root. |
77 |
| -powershell.exe -ExecutionPolicy RemoteSigned -File %~dp0build.ps1 ^ |
78 |
| - -SourceCache %SourceRoot% ^ |
79 |
| - -BinaryCache %BuildRoot% ^ |
80 |
| - -ImageRoot %BuildRoot% ^ |
81 |
| - -BuildType %CMAKE_BUILD_TYPE% ^ |
82 |
| - %SkipPackagingArg% ^ |
83 |
| - %TestArg% ^ |
84 |
| - -Stage %PackageRoot% || (exit /b 1) |
85 |
| - |
86 |
| -:: Clean up the module cache |
87 |
| -rd /s /q %LocalAppData%\clang\ModuleCache |
88 |
| - |
89 |
| -goto :end |
90 |
| -endlocal |
91 |
| - |
92 |
| -:CloneRepositories |
93 |
| -setlocal enableextensions enabledelayedexpansion |
94 |
| - |
95 |
| -if defined SKIP_UPDATE_CHECKOUT goto :eof |
96 |
| - |
97 |
| -if defined REPO_SCHEME set "args=--scheme %REPO_SCHEME%" |
98 |
| - |
99 |
| -:: Always enable symbolic links |
100 |
| -git config --global core.symlink true |
101 |
| - |
102 |
| -:: Ensure that we have the files in the original line endings, the swift tests |
103 |
| -:: depend on this being the case. |
104 |
| -rem git -C "%SourceRoot%\swift" config --local core.autocrlf input |
105 |
| -rem git -C "%SourceRoot%\swift" checkout-index --force --all |
106 |
| - |
107 |
| -set "args=%args% --skip-repository swift" |
108 |
| -set "args=%args% --skip-repository ninja" |
109 |
| -set "args=%args% --skip-repository swift-integration-tests" |
110 |
| -set "args=%args% --skip-repository swift-stress-tester" |
111 |
| -set "args=%args% --skip-repository swift-xcode-playground-support" |
112 |
| - |
113 |
| -call "%SourceRoot%\swift\utils\update-checkout.cmd" %args% --clone --skip-history --reset-to-remote --github-comment "%ghprbCommentBody%" |
114 |
| - |
115 |
| -goto :eof |
116 |
| -endlocal |
117 |
| - |
118 |
| -:end |
| 1 | +:: build-windows-toolchain.bat |
| 2 | +:: |
| 3 | +:: This source file is part of the Swift.org open source project |
| 4 | +:: |
| 5 | +:: Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors |
| 6 | +:: Licensed under Apache License v2.0 with Runtime Library Exception |
| 7 | +:: |
| 8 | +:: See https://swift.org/LICENSE.txt for license information |
| 9 | +:: See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors |
| 10 | + |
| 11 | +setlocal enableextensions enabledelayedexpansion |
| 12 | + |
| 13 | +:: Work around CI invocation in vsdevcmd |
| 14 | +:: The build relies on build.ps1, which should not be called in a vs dev cmd |
| 15 | +if "%VSCMD_ARG_HOST_ARCH%"=="" goto Start |
| 16 | +echo This script should not be called in a vs developer command prompt |
| 17 | +echo Reeinvoking script in the default environment |
| 18 | +set TEMP=%~dp0..\..\tmp |
| 19 | +mkdir %TEMP% 2>&1 1>nul |
| 20 | +echo set PYTHON_HOME=%PYTHON_HOME%> %TEMP%\call-build.cmd |
| 21 | +echo set CMAKE_BUILD_TYPE=%CMAKE_BUILD_TYPE%>> %TEMP%\call-build.cmd |
| 22 | +echo set SKIP_TESTS=%SKIP_TESTS%>> %TEMP%\call-build.cmd |
| 23 | +echo set SKIP_PACKAGING=%SKIP_PACKAGING%>> %TEMP%\call-build.cmd |
| 24 | +echo set SKIP_UPDATE_CHECKOUT=%SKIP_UPDATE_CHECKOUT%>> %TEMP%\call-build.cmd |
| 25 | +echo set REPO_SCHEME=%REPO_SCHEME%>> %TEMP%\call-build.cmd |
| 26 | +echo "%~f0">> %TEMP%\call-build.cmd |
| 27 | +start /i /b /wait cmd.exe /env=default /c "%TEMP%\call-build.cmd" |
| 28 | +set ec=%errorlevel% |
| 29 | +del %TEMP%\call-build.cmd |
| 30 | +exit /b %ec% |
| 31 | + |
| 32 | +:Start |
| 33 | + |
| 34 | +:: Work around CI invocation with PYTHON_HOME containing double quotes |
| 35 | +if defined PYTHON_HOME path !Path!;!PYTHON_HOME:"=! |
| 36 | + |
| 37 | +:: Identify the SourceRoot |
| 38 | +:: Normalize the SourceRoot to make it easier to read the output. |
| 39 | +cd %~dp0\..\.. |
| 40 | +set SourceRoot=%CD% |
| 41 | + |
| 42 | +:: Identify the BuildRoot |
| 43 | +set BuildRoot=%SourceRoot%\build |
| 44 | + |
| 45 | +md %BuildRoot% |
| 46 | +subst T: /d |
| 47 | +subst T: %BuildRoot% || (exit /b 1) |
| 48 | +set BuildRoot=T: |
| 49 | + |
| 50 | +:: Identify the PackageRoot |
| 51 | +set PackageRoot=%BuildRoot%\artifacts |
| 52 | + |
| 53 | +md %PackageRoot% |
| 54 | + |
| 55 | +:: Setup temporary directories |
| 56 | +md %BuildRoot%\tmp |
| 57 | +set TEMP=%BuildRoot%\tmp |
| 58 | +set TMP=%BuildRoot%\tmp |
| 59 | +set TMPDIR=%BuildRoot%\tmp |
| 60 | + |
| 61 | +set NINJA_STATUS=[%%f/%%t][%%p][%%es] |
| 62 | + |
| 63 | +:: Build the -Test argument, if any, by subtracting skipped tests |
| 64 | +set TestArg=-Test swift,dispatch,foundation,xctest, |
| 65 | +for %%I in (%SKIP_TESTS%) do (call set TestArg=%%TestArg:%%I,=%%) |
| 66 | +if "%TestArg:~-1%"=="," (set TestArg=%TestArg:~0,-1%) else (set TestArg= ) |
| 67 | + |
| 68 | +:: Build the -SkipPackaging argument, if any |
| 69 | +set SkipPackagingArg=-SkipPackaging |
| 70 | +if not "%SKIP_PACKAGING%"=="1" set "SkipPackagingArg= " |
| 71 | + |
| 72 | +call :CloneRepositories || (exit /b 1) |
| 73 | + |
| 74 | +:: We only have write access to BuildRoot, so use that as the image root. |
| 75 | +powershell.exe -ExecutionPolicy RemoteSigned -File %~dp0build.ps1 ^ |
| 76 | + -SourceCache %SourceRoot% ^ |
| 77 | + -BinaryCache %BuildRoot% ^ |
| 78 | + -ImageRoot %BuildRoot% ^ |
| 79 | + %SkipPackagingArg% ^ |
| 80 | + %TestArg% ^ |
| 81 | + -Stage %PackageRoot% || (exit /b 1) |
| 82 | + |
| 83 | +:: Clean up the module cache |
| 84 | +rd /s /q %LocalAppData%\clang\ModuleCache |
| 85 | + |
| 86 | +goto :end |
| 87 | +endlocal |
| 88 | + |
| 89 | +:CloneRepositories |
| 90 | +setlocal enableextensions enabledelayedexpansion |
| 91 | + |
| 92 | +if defined SKIP_UPDATE_CHECKOUT goto :eof |
| 93 | + |
| 94 | +if defined REPO_SCHEME set "args=--scheme %REPO_SCHEME%" |
| 95 | + |
| 96 | +:: Always enable symbolic links |
| 97 | +git config --global core.symlink true |
| 98 | + |
| 99 | +:: Ensure that we have the files in the original line endings, the swift tests |
| 100 | +:: depend on this being the case. |
| 101 | +rem git -C "%SourceRoot%\swift" config --local core.autocrlf input |
| 102 | +rem git -C "%SourceRoot%\swift" checkout-index --force --all |
| 103 | + |
| 104 | +set "args=%args% --skip-repository swift" |
| 105 | +set "args=%args% --skip-repository ninja" |
| 106 | +set "args=%args% --skip-repository swift-integration-tests" |
| 107 | +set "args=%args% --skip-repository swift-stress-tester" |
| 108 | +set "args=%args% --skip-repository swift-xcode-playground-support" |
| 109 | + |
| 110 | +call "%SourceRoot%\swift\utils\update-checkout.cmd" %args% --clone --skip-history --reset-to-remote --github-comment "%ghprbCommentBody%" |
| 111 | + |
| 112 | +goto :eof |
| 113 | +endlocal |
| 114 | + |
| 115 | +:end |
0 commit comments