From 51c1f9395996ff6fed6af346ac228f39c55b4840 Mon Sep 17 00:00:00 2001 From: Martin Kinkelin Date: Sun, 3 Mar 2024 14:31:02 +0100 Subject: [PATCH] Windows CI: Make sure building compiler/druntime/Phobos does NOT need an MSVC env anymore After #16248. --- .azure-pipelines/windows-msbuild.bat | 8 ++++---- .azure-pipelines/windows.sh | 3 --- .github/workflows/main.yml | 13 +++++-------- druntime/Makefile | 4 ---- 4 files changed, 9 insertions(+), 19 deletions(-) diff --git a/.azure-pipelines/windows-msbuild.bat b/.azure-pipelines/windows-msbuild.bat index 8c8834164b0c..44509da5b9dd 100644 --- a/.azure-pipelines/windows-msbuild.bat +++ b/.azure-pipelines/windows-msbuild.bat @@ -4,10 +4,6 @@ setlocal :: put bash and GNU tools in front of PATH set PATH=C:\Program Files\Git\usr\bin;%PATH% -:: now set up MSVC environment (=> first link.exe etc. in PATH is MSVC's, not GNU's) -call "%VSINSTALLDIR%\VC\Auxiliary\Build\vcvarsall.bat" %ARCH% -@echo on - set DMD_DIR=%cd% if "%CONFIGURATION%" == "" set CONFIGURATION=RelWithAsserts set PLATFORM=Win32 @@ -85,6 +81,10 @@ if not "%C_RUNTIME%" == "mingw" goto not_mingw set DRUNTIME_TESTS_TARGET=unittest-debug :not_mingw +:: set up MSVC environment (some tests need cl.exe etc. in PATH) +call "%VSINSTALLDIR%\VC\Auxiliary\Build\vcvarsall.bat" %ARCH% +@echo on + echo [STEP]: Building and running druntime tests cd "%DMD_DIR%\druntime" make -j%N% MODEL=%MODEL% "DMD=%DMD%" %DRUNTIME_TESTS_TARGET% || exit /B 5 diff --git a/.azure-pipelines/windows.sh b/.azure-pipelines/windows.sh index 4a48433f8d36..205e49e0719f 100644 --- a/.azure-pipelines/windows.sh +++ b/.azure-pipelines/windows.sh @@ -58,13 +58,10 @@ clone_repos ################################################################################ if [ "$MODEL" == "64" ] ; then - MAKE_FILE="win64.mak" LIBNAME=phobos64.lib elif [ "$MODEL" == "32" ] ; then - MAKE_FILE="win64.mak" LIBNAME=phobos32mscoff.lib else # 32omf - MAKE_FILE="win32.mak" LIBNAME=phobos.lib fi diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 06537a258fcc..80376464f178 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -97,11 +97,6 @@ jobs: - name: 'Posix: Install prerequisites' if: runner.os != 'Windows' run: ${{ runner.os == 'macOS' && 'ci/cirrusci.sh' || 'sudo -E ci/cirrusci.sh' }} - - name: 'Windows: Set up MSVC environment' - if: runner.os == 'Windows' - uses: seanmiddleditch/gha-setup-vsdevenv@v4 - with: - arch: ${{ env.MODEL == '64' && 'x64' || 'x86' }} # NOTE: Linker ICEs with Xcode 15.0.1 (default version on macos-13) # * https://issues.dlang.org/show_bug.cgi?id=24407 @@ -143,12 +138,14 @@ jobs: env: # on Windows, `ci/run.sh build` expects the DMD env var to be set to the DMD-CLI-compatible host compiler DMD: ${{ runner.os == 'Windows' && (startsWith(matrix.host_dmd, 'ldc') && 'ldmd2' || 'dmd') || '' }} - # work around the LDC host compiler on Windows assuming the first link.exe in PATH is the MSVC one - # (VSINSTALLDIR is set, but GHA uses Git's bin\bash.exe for `shell: bash`, which prepends Git's usr\bin to PATH, with GNU link.exe) - LDC_VSDIR_FORCE: ${{ runner.os == 'Windows' && startsWith(matrix.host_dmd, 'ldc') && '1' || '' }} - name: Rebuild dmd (with enabled coverage) if: matrix.coverage run: ENABLE_RELEASE=0 ENABLE_DEBUG=1 ENABLE_COVERAGE=1 ci/run.sh rebuild + - name: 'Windows: Set up MSVC environment' # some tests need cl.exe etc. in PATH + if: runner.os == 'Windows' + uses: seanmiddleditch/gha-setup-vsdevenv@v4 + with: + arch: ${{ env.MODEL == '64' && 'x64' || 'x86' }} - name: Test dmd run: ci/run.sh test_dmd - name: Test druntime diff --git a/druntime/Makefile b/druntime/Makefile index febb25a9f621..5aac2b73ef81 100644 --- a/druntime/Makefile +++ b/druntime/Makefile @@ -374,10 +374,6 @@ $(abspath ../generated/$(OS)/$(BUILD)/$(MODEL)/dmd$(DOTEXE)): ../generated/$(OS) ################### C/ASM Targets ############################ -# Although dmd is compiling the .c files, the preprocessor used on Windows is cl.exe. -# Until https://issues.dlang.org/show_bug.cgi?id=24111 is fixed, the INCLUDE -# enviroment variable needs to be set with the path to the VC system include files. - OBJS:=$(ROOT)/errno_c$(DOTOBJ) ifeq (32omf,$(MODEL)) # minit.asm is only used for -m32omf on Windows; there's a pre-built minit.obj