Skip to content

Commit b664cce

Browse files
committed
[windows] Use update-checkout in build-windows.bat
- Skip the creation of symlinks for the LLVM subprojects. Not needed anymore. - Use `update-checkout.cmd` instead of manually checking out git repositories. - Instead of the focused subset of repositories, `update-checkout` will check all of them, which is not ideal, but the machine network connection is good, so it should not add a lot of delay. - The repositories, however, are cloned without history, which should improve download a little. - Accept new environment variable `REPO_SCHEME` which is passed to update-checkout to be able to use this script for different branches by only changing an enironment variable in the CI server job configuration. By default uses `master` (which will need to be changed soon). - Pass the environment variable `ghprbCommentBody` as a `--github-comment` argument of `update-checkout`, which should checkout the provided PR from GitHub. - Fix the creation of the Clang module cache temporal directory. - Add `PYTHON_HOME` to the path, just in case it is not already there.
1 parent 1c5be70 commit b664cce

File tree

1 file changed

+29
-13
lines changed

1 file changed

+29
-13
lines changed

utils/build-windows.bat

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
:: Additionally, it needs the following variables:
1515
:: - CMAKE_BUILD_TYPE: Kind of build: Release, RelWithDebInfo, Debug.
1616
:: - PYTHON_HOME: The Python installation directory.
17+
:: - REPO_SCHEME: Optional. The scheme name to checkout.
1718

1819
:: REQUIRED PERMISSIONS
1920
:: Practically, it is easier to be in the Adminstrators group to run the
@@ -25,6 +26,8 @@
2526

2627
setlocal enableextensions enabledelayedexpansion
2728

29+
PATH=%PATH%;%PYTHON_HOME%
30+
2831
set icu_version_major=64
2932
set icu_version_minor=2
3033
set icu_version=%icu_version_major%_%icu_version_minor%
@@ -53,7 +56,7 @@ set install_directory=%build_root%\Library\Developer\Toolchains\unknown-Asserts-
5356
md %build_root%\tmp
5457
set TMPDIR=%build_root%\tmp
5558

56-
md %build_root%\tmp\org.llvm.clang
59+
md %build_root%\tmp\org.llvm.clang.9999
5760
set CUSTOM_CLANG_MODULE_CACHE=%build_root%\tmp\org.llvm.clang.9999
5861

5962
md %build_root%\tmp\org.swift.package-manager
@@ -89,20 +92,33 @@ endlocal
8992
:: It supposes the %CD% is the source root.
9093
setlocal enableextensions enabledelayedexpansion
9194

95+
if defined REPO_SCHEME SET "scheme_arg=--scheme %REPO_SCHEME%"
96+
9297
git -C "%source_root%\swift" config --local core.autocrlf input
9398
git -C "%source_root%\swift" config --local core.symlink true
9499
git -C "%source_root%\swift" checkout-index --force --all
95100

96-
git clone --depth 1 --single-branch https://github.com/apple/swift-cmark cmark %exitOnError%
97-
git clone --depth 1 --single-branch --branch swift/master https://github.com/apple/llvm-project llvm-project %exitOnError%
98-
mklink /D "%source_root%\clang" "%source_root%\llvm-project\clang"
99-
mklink /D "%source_root%\llvm" "%source_root%\llvm-project\llvm"
100-
mklink /D "%source_root%\lld" "%source_root%\llvm-project\lld"
101-
mklink /D "%source_root%\lldb" "%source_root%\llvm-project\lldb"
102-
mklink /D "%source_root%\compiler-rt" "%source_root%\llvm-project\compiler-rt"
103-
mklink /D "%source_root%\libcxx" "%source_root%\llvm-project\libcxx"
104-
mklink /D "%source_root%\clang-tools-extra" "%source_root%\llvm-project\clang-tools-extra"
105-
git clone --depth 1 --single-branch https://github.com/apple/swift-corelibs-libdispatch %exitOnError%
101+
:: Always skip Swift, since it is checked out by Jenkins
102+
@set "skip_repositories_arg=--skip-repository swift"
103+
@set "skip_repositories_arg=%skip_repositories_arg% --skip-repository llbuild"
104+
@set "skip_repositories_arg=%skip_repositories_arg% --skip-repository indexstore-db"
105+
@set "skip_repositories_arg=%skip_repositories_arg% --skip-repository ninja"
106+
@set "skip_repositories_arg=%skip_repositories_arg% --skip-repository sourcekit-lsp"
107+
@set "skip_repositories_arg=%skip_repositories_arg% --skip-repository swift-argument-parser"
108+
@set "skip_repositories_arg=%skip_repositories_arg% --skip-repository swift-corelibs-foundation"
109+
@set "skip_repositories_arg=%skip_repositories_arg% --skip-repository swift-corelibs-xctest"
110+
@set "skip_repositories_arg=%skip_repositories_arg% --skip-repository swift-driver"
111+
@set "skip_repositories_arg=%skip_repositories_arg% --skip-repository swift-format"
112+
@set "skip_repositories_arg=%skip_repositories_arg% --skip-repository swift-integration-tests"
113+
@set "skip_repositories_arg=%skip_repositories_arg% --skip-repository swiftpm"
114+
@set "skip_repositories_arg=%skip_repositories_arg% --skip-repository swift-stress-tester"
115+
@set "skip_repositories_arg=%skip_repositories_arg% --skip-repository swift-syntax"
116+
@set "skip_repositories_arg=%skip_repositories_arg% --skip-repository swift-tools-support-core"
117+
@set "skip_repositories_arg=%skip_repositories_arg% --skip-repository swift-xcode-playground-support"
118+
@set "skip_repositories_arg=%skip_repositories_arg% --skip-repository tensorflow-swift-apis"
119+
@set "skip_repositories_arg=%skip_repositories_arg% --skip-repository yams"
120+
121+
call "%source_root%\swift\utils\update-checkout.cmd" %scheme_arg% %skip_repositories_arg% --clone --skip-history --github-comment "%ghprbCommentBody%" >NUL 2>NUL
106122

107123
goto :eof
108124
endlocal
@@ -185,7 +201,7 @@ cmake^
185201
-DCMAKE_CXX_FLAGS:STRING="/GS- /Oy"^
186202
-DCMAKE_EXE_LINKER_FLAGS:STRING=/INCREMENTAL:NO^
187203
-DCMAKE_SHARED_LINKER_FLAGS:STRING=/INCREMENTAL:NO^
188-
-S "%source_root%\llvm" %exitOnError%
204+
-S "%source_root%\llvm-project\llvm" %exitOnError%
189205

190206
cmake --build "%build_root%\llvm" %exitOnError%
191207
cmake --build "%build_root%\llvm" --target install %exitOnError%
@@ -294,7 +310,7 @@ cmake^
294310
-DLLDB_DISABLE_PYTHON=YES^
295311
-DLLDB_INCLUDE_TESTS:BOOL=NO^
296312
-DLLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN=ON^
297-
-S "%source_root%\lldb" %exitOnError%
313+
-S "%source_root%\llvm-project\lldb" %exitOnError%
298314

299315
cmake --build "%build_root%\lldb" %exitOnError%
300316
cmake --build "%build_root%\lldb" --target install %exitOnError%

0 commit comments

Comments
 (0)