authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-01-04 14:59:18-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-01-04 14:59:18-07:00
log2fe8a482159762724df93225bd70abbd0c2c5930
treeab2ab1f649f3b42efc5b664b22ac507a94f7fe8c
parent462c1d8c7424547051e643648797b9097245b046

ci: omit stage2 backend from stage1 on Windows

to avoid out-of-memory on the CI runs.

5 files changed, 19 insertions(+), 3 deletions(-)

CMakeLists.txt+7
......@@ -89,6 +89,7 @@ set(ZIG_TARGET_MCPU "baseline" CACHE STRING "-mcpu parameter to output binaries
8989set(ZIG_EXECUTABLE "" CACHE STRING "(when cross compiling) path to already-built zig binary")
9090set(ZIG_PREFER_LLVM_CONFIG off CACHE BOOL "(when cross compiling) use llvm-config to find target llvm dependencies if needed")
9191set(ZIG_SINGLE_THREADED off CACHE BOOL "limit the zig compiler to use only 1 thread")
92set(ZIG_OMIT_STAGE2 off CACHE BOOL "omit the stage2 backend from stage1")
9293
9394find_package(llvm)
9495find_package(clang)
......@@ -587,6 +588,12 @@ if(MSVC)
587588 endif()
588589endif()
589590
591if(ZIG_OMIT_STAGE2)
592 set(ZIG_OMIT_STAGE2_BOOL "true")
593else()
594 set(ZIG_OMIT_STAGE2_BOOL "false")
595endif()
596
590597configure_file (
591598 "${CMAKE_SOURCE_DIR}/src/stage1/config.h.in"
592599 "${ZIG_CONFIG_H_OUT}"
build.zig+2-1
......@@ -125,7 +125,6 @@ pub fn build(b: *Builder) !void {
125125 try addCmakeCfgOptionsToExe(b, cfg, tracy, test_stage2);
126126 } else {
127127 // Here we are -Denable-llvm but no cmake integration.
128
129128 try addStaticLlvmOptionsToExe(exe);
130129 try addStaticLlvmOptionsToExe(test_stage2);
131130 }
......@@ -194,6 +193,7 @@ pub fn build(b: *Builder) !void {
194193 exe.addBuildOption([]const []const u8, "log_scopes", log_scopes);
195194 exe.addBuildOption(bool, "enable_tracy", tracy != null);
196195 exe.addBuildOption(bool, "is_stage1", is_stage1);
196 exe.addBuildOption(bool, "omit_stage2", false);
197197 if (tracy) |tracy_path| {
198198 const client_cpp = fs.path.join(
199199 b.allocator,
......@@ -216,6 +216,7 @@ pub fn build(b: *Builder) !void {
216216
217217 test_stage2.addBuildOption(bool, "skip_non_native", skip_non_native);
218218 test_stage2.addBuildOption(bool, "is_stage1", is_stage1);
219 test_stage2.addBuildOption(bool, "omit_stage2", false);
219220 test_stage2.addBuildOption(bool, "have_llvm", enable_llvm);
220221 test_stage2.addBuildOption(bool, "enable_qemu", is_qemu_enabled);
221222 test_stage2.addBuildOption(bool, "enable_wine", is_wine_enabled);
ci/azure/windows_msvc_script.bat+3-2
......@@ -23,11 +23,12 @@ git.exe fetch --tags
2323
2424mkdir %ZIGBUILDDIR%
2525cd %ZIGBUILDDIR%
26cmake.exe .. -Thost=x64 -G"Visual Studio 16 2019" -A x64 "-DCMAKE_INSTALL_PREFIX=%ZIGINSTALLDIR%" "-DCMAKE_PREFIX_PATH=%ZIGPREFIXPATH%" -DCMAKE_BUILD_TYPE=Release || exit /b
26cmake.exe .. -Thost=x64 -G"Visual Studio 16 2019" -A x64 "-DCMAKE_INSTALL_PREFIX=%ZIGINSTALLDIR%" "-DCMAKE_PREFIX_PATH=%ZIGPREFIXPATH%" -DCMAKE_BUILD_TYPE=Release -DZIG_OMIT_STAGE2=ON || exit /b
2727msbuild /maxcpucount /p:Configuration=Release INSTALL.vcxproj || exit /b
2828
2929"%ZIGINSTALLDIR%\bin\zig.exe" build test-behavior -Dskip-non-native || exit /b
30"%ZIGINSTALLDIR%\bin\zig.exe" build test-stage2 -Dskip-non-native || exit /b
30REM Disabled to prevent OOM
31REM "%ZIGINSTALLDIR%\bin\zig.exe" build test-stage2 -Dskip-non-native || exit /b
3132"%ZIGINSTALLDIR%\bin\zig.exe" build test-fmt -Dskip-non-native || exit /b
3233"%ZIGINSTALLDIR%\bin\zig.exe" build test-std -Dskip-non-native || exit /b
3334"%ZIGINSTALLDIR%\bin\zig.exe" build test-compiler-rt -Dskip-non-native || exit /b
src/Compilation.zig+6
......@@ -1461,6 +1461,8 @@ pub fn performAllTheWork(self: *Compilation) error{ TimerUnsupported, OutOfMemor
14611461 => continue,
14621462
14631463 .complete, .codegen_failure_retryable => {
1464 if (build_options.omit_stage2)
1465 @panic("sadly stage2 is omitted from this build to save memory on the CI server");
14641466 const module = self.bin_file.options.module.?;
14651467 if (decl.typed_value.most_recent.typed_value.val.castTag(.function)) |payload| {
14661468 const func = payload.data;
......@@ -1532,6 +1534,8 @@ pub fn performAllTheWork(self: *Compilation) error{ TimerUnsupported, OutOfMemor
15321534 },
15331535 },
15341536 .analyze_decl => |decl| {
1537 if (build_options.omit_stage2)
1538 @panic("sadly stage2 is omitted from this build to save memory on the CI server");
15351539 const module = self.bin_file.options.module.?;
15361540 module.ensureDeclAnalyzed(decl) catch |err| switch (err) {
15371541 error.OutOfMemory => return error.OutOfMemory,
......@@ -1539,6 +1543,8 @@ pub fn performAllTheWork(self: *Compilation) error{ TimerUnsupported, OutOfMemor
15391543 };
15401544 },
15411545 .update_line_number => |decl| {
1546 if (build_options.omit_stage2)
1547 @panic("sadly stage2 is omitted from this build to save memory on the CI server");
15421548 const module = self.bin_file.options.module.?;
15431549 self.bin_file.updateDeclLineNumber(module, decl) catch |err| {
15441550 try module.failed_decls.ensureCapacity(module.gpa, module.failed_decls.items().len + 1);
src/config.zig.in+1
......@@ -5,3 +5,4 @@ pub const log_scopes: []const []const u8 = &[_][]const u8{};
55pub const enable_tracy = false;
66pub const is_stage1 = true;
77pub const skip_non_native = false;
8pub const omit_stage2: bool = @ZIG_OMIT_STAGE2_BOOL@;