Skip to content

Commit

Permalink
Fix build script paths to work with new merged repository structure
Browse files Browse the repository at this point in the history
Co-Authored-By: Geod24 <[email protected]>
Co-Authored-By: Martin Kinkelin <[email protected]>
Co-Authored-By: Vladimir Panteleev <[email protected]>
  • Loading branch information
4 people committed Jul 9, 2022
1 parent 69ab16a commit 09d0494
Show file tree
Hide file tree
Showing 56 changed files with 499 additions and 209 deletions.
2 changes: 1 addition & 1 deletion .azure-pipelines/lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ clone_repos() {
local REPO_BRANCH="$SYSTEM_PULLREQUEST_TARGETBRANCH"
fi

for proj in druntime phobos; do
for proj in phobos; do
if [ "$REPO_BRANCH" != master ] && [ "$REPO_BRANCH" != stable ] &&
! git ls-remote --exit-code --heads "https://github.com/dlang/$proj.git" "$REPO_BRANCH" > /dev/null; then
# use master as fallback for other repos to test feature branches
Expand Down
16 changes: 8 additions & 8 deletions .azure-pipelines/windows-msbuild.bat
Original file line number Diff line number Diff line change
Expand Up @@ -37,22 +37,22 @@ REM configure LDC path
if "%D_COMPILER%" == "ldc" reg add "HKLM\SOFTWARE\LDC" /v InstallationFolder /t REG_SZ /d "%LDC_DIR%" /reg:32 /f

echo [STEP]: Building DMD via VS projects
cd src
cd compiler\src
if "%D_COMPILER%" == "ldc" set LDC_ARGS=%LDC_ARGS% /p:DCompiler=LDC
msbuild /target:dmd /p:Configuration=%CONFIGURATION% /p:Platform=%PLATFORM% %LDC_ARGS% vcbuild\dmd.sln || exit /B 1
%DMD% --version

echo [STEP]: Building druntime
cd "%DMD_DIR%\..\druntime"
cd "%DMD_DIR%\druntime"
"%DM_MAKE%" -f win64.mak MODEL=%MODEL% "DMD=%DMD%" "VCDIR=%VCINSTALLDIR%." "CC=%MSVC_CC%" "MAKE=%DM_MAKE%" "HOST_DMD=%HOST_DMD%" target || exit /B 2

echo [STEP]: Building phobos
cd "%DMD_DIR%\..\phobos"
"%DM_MAKE%" -f win64.mak MODEL=%MODEL% "DMD=%DMD%" "VCDIR=%VCINSTALLDIR%." "CC=%MSVC_CC%" "AR=%MSVC_AR%" "MAKE=%DM_MAKE%" || exit /B 3
"%DM_MAKE%" -f win64.mak MODEL=%MODEL% "DMD=%DMD%" "VCDIR=%VCINSTALLDIR%." "CC=%MSVC_CC%" "AR=%MSVC_AR%" "MAKE=%DM_MAKE%" "DRUNTIME=%DMD_DIR%\druntime" || exit /B 3

echo [STEP]: Building run.d testrunner and its tools
REM needs to be done before tampering with LIB and DFLAGS env variables (affecting the ldmd2 host compiler too)
cd "%DMD_DIR%\test"
cd "%DMD_DIR%\compiler\test"
"%HOST_DMD%" -m%MODEL% -g -i run.d || exit /B 4
run.exe tools "BUILD=%CONFIGURATION%" "DMD_MODEL=%PLATFORM%" || exit /B 4

Expand All @@ -77,17 +77,17 @@ if not "%C_RUNTIME%" == "mingw" goto not_mingw
rem skip runnable_cxx tests (incompatible MSVC runtime versions - 2017 (cl.exe) vs. 2013)
set DMD_TESTS=runnable compilable fail_compilation dshell unit_tests
rem FIXME: debug info incomplete when linking through lld-link
del test\runnable\testpdb.d
del compiler\test\runnable\testpdb.d

set DRUNTIME_TESTS=test_mingw
:not_mingw

echo [STEP]: Building and running druntime tests
cd "%DMD_DIR%\..\druntime"
cd "%DMD_DIR%\druntime"
"%DM_MAKE%" -f win64.mak MODEL=%MODEL% "DMD=%DMD%" "VCDIR=%VCINSTALLDIR%." "CC=%MSVC_CC%" "MAKE=%DM_MAKE%" unittest %DRUNTIME_TESTS% || exit /B 5

echo [STEP]: Running DMD testsuite
cd "%DMD_DIR%\test"
cd "%DMD_DIR%\compiler\test"
set CC=%MSVC_CC%
run.exe --environment --jobs=%N% %DMD_TESTS% "ARGS=-O -inline -g" "BUILD=%CONFIGURATION%" "DMD_MODEL=%PLATFORM%" || exit /B 6

Expand All @@ -99,4 +99,4 @@ if "%D_COMPILER%_%MODEL%" == "ldc_64" copy %LDC_DIR%\lib64\libcurl.dll .
if "%D_COMPILER%_%MODEL%" == "ldc_32mscoff" copy %LDC_DIR%\lib32\libcurl.dll .
if "%D_COMPILER%_%MODEL%" == "dmd_64" copy %DMD_DIR%\dmd2\windows\bin64\libcurl.dll .
if "%D_COMPILER%_%MODEL%" == "dmd_32mscoff" copy %DMD_DIR%\dmd2\windows\bin\libcurl.dll .
"%DM_MAKE%" -f win64.mak MODEL=%MODEL% "DMD=%DMD%" "VCDIR=%VCINSTALLDIR%." "CC=%MSVC_CC%" "MAKE=%DM_MAKE%" unittest || exit /B 7
"%DM_MAKE%" -f win64.mak MODEL=%MODEL% "DMD=%DMD%" "VCDIR=%VCINSTALLDIR%." "CC=%MSVC_CC%" "MAKE=%DM_MAKE%" "DRUNTIME=%DMD_DIR%\druntime" unittest || exit /B 7
25 changes: 12 additions & 13 deletions .azure-pipelines/windows.sh
Original file line number Diff line number Diff line change
Expand Up @@ -80,30 +80,29 @@ else
DMD_BIN_PATH="$DMD_DIR/generated/windows/release/$MODEL/dmd"
fi

cd "$DMD_DIR/src"
cd "$DMD_DIR/compiler/src"
"$DM_MAKE" -f "$MAKE_FILE" MAKE="$DM_MAKE" BUILD=debug unittest
DFLAGS="-L-LARGEADDRESSAWARE" "$DM_MAKE" -f "$MAKE_FILE" MAKE="$DM_MAKE" reldmd-asserts
DFLAGS="-L-LARGEADDRESSAWARE" "$DM_MAKE" -f "$MAKE_FILE" MAKE="$DM_MAKE" GEN="$DMD_DIR\generated" reldmd-asserts

################################################################################
# Build Druntime and Phobos
################################################################################

LIBS_MAKE_ARGS=(-f "$MAKE_FILE" MODEL=$MODEL DMD="$DMD_BIN_PATH" VCDIR=. CC="$CC" AR="$AR" MAKE="$DM_MAKE")

for proj in druntime phobos; do
cd "$DMD_DIR/../$proj"
"$DM_MAKE" "${LIBS_MAKE_ARGS[@]}"
done
cd "$DMD_DIR/druntime"
"$DM_MAKE" "${LIBS_MAKE_ARGS[@]}"

cd "$DMD_DIR/../phobos"
"$DM_MAKE" "${LIBS_MAKE_ARGS[@]}" DRUNTIME="$DMD_DIR\druntime"

################################################################################
# Run DMD testsuite
################################################################################

cd "$DMD_DIR/test"
cd "$DMD_DIR/compiler/test"

# build run.d testrunner and its tools while host compiler is untampered
cd ../test

if [ "$MODEL" == "32omf" ] ; then
TOOL_MODEL=32;
else
Expand All @@ -118,8 +117,8 @@ if [ "${DMD_TEST_COVERAGE:-0}" = "1" ] ; then

# Recompile debug dmd + unittests
rm -rf "$DMD_DIR/generated/windows"
DFLAGS="-L-LARGEADDRESSAWARE" ../generated/build.exe --jobs=$N ENABLE_DEBUG=1 ENABLE_COVERAGE=1 dmd
DFLAGS="-L-LARGEADDRESSAWARE" ../generated/build.exe --jobs=$N ENABLE_DEBUG=1 ENABLE_COVERAGE=1 unittest
DFLAGS="-L-LARGEADDRESSAWARE" ../../generated/build.exe --jobs=$N ENABLE_DEBUG=1 ENABLE_COVERAGE=1 dmd
DFLAGS="-L-LARGEADDRESSAWARE" ../../generated/build.exe --jobs=$N ENABLE_DEBUG=1 ENABLE_COVERAGE=1 unittest
fi

if [ "$MODEL" == "32omf" ] ; then
Expand Down Expand Up @@ -152,7 +151,7 @@ fi
# Build and run druntime tests
################################################################################

cd "$DMD_DIR/../druntime"
cd "$DMD_DIR/druntime"
"$DM_MAKE" "${LIBS_MAKE_ARGS[@]}" unittest test_all

################################################################################
Expand All @@ -168,7 +167,7 @@ else
else
cp "$DMD_DIR/tools/dmd2/windows/bin/libcurl.dll" .
fi
"$DM_MAKE" "${LIBS_MAKE_ARGS[@]}" unittest
"$DM_MAKE" "${LIBS_MAKE_ARGS[@]}" DRUNTIME="$DMD_DIR\druntime" unittest
fi

################################################################################
Expand Down
30 changes: 15 additions & 15 deletions .circleci/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ setup_repos() {
git checkout -f FETCH_HEAD
fi

for proj in druntime phobos; do
for proj in phobos; do
if [ $base_branch != master ] && [ $base_branch != stable ] &&
! git ls-remote --exit-code --heads https://github.com/dlang/$proj.git $base_branch > /dev/null; then
# use master as fallback for other repos to test feature branches
Expand All @@ -114,10 +114,10 @@ coverage()
local build_path=generated/linux/$BUILD/$MODEL
local builder=generated/build

dmd -g -od=generated -of=$builder src/build
dmd -g -od=generated -of=$builder compiler/src/build
# build dmd, druntime, and phobos
$builder MODEL=$MODEL HOST_DMD=$DMD BUILD=$BUILD all
make -j$N -C ../druntime -f posix.mak MODEL=$MODEL BUILD=$BUILD
make -j$N -C druntime -f posix.mak MODEL=$MODEL BUILD=$BUILD
make -j$N -C ../phobos -f posix.mak MODEL=$MODEL BUILD=$BUILD

# save the built dmd as host compiler this time
Expand All @@ -134,28 +134,28 @@ coverage()

# FIXME
# Temporarily the failing long file name test has been removed
rm -rf test/compilable/issue17167.sh
rm -rf compiler/test/compilable/issue17167.sh

# rebuild dmd with coverage enabled
$builder MODEL=$MODEL BUILD=$BUILD HOST_DMD=$PWD/_${build_path}/host_dmd ENABLE_COVERAGE=1

cp $build_path/dmd _${build_path}/host_dmd_cov
$builder MODEL=$MODEL BUILD=$BUILD HOST_DMD=$PWD/_${build_path}/host_dmd ENABLE_COVERAGE=1 unittest
_${build_path}/host_dmd -Itest -i -run ./test/run.d -j$N MODEL=$MODEL BUILD=$BUILD ARGS="-O -inline -release" DMD_TEST_COVERAGE=1 HOST_DMD=$PWD/_${build_path}/host_dmd
_${build_path}/host_dmd -Icompiler/test -i -run ./compiler/test/run.d -j$N MODEL=$MODEL BUILD=$BUILD ARGS="-O -inline -release" DMD_TEST_COVERAGE=1 HOST_DMD=$PWD/_${build_path}/host_dmd
}

# Checks that all files have been committed and no temporary, untracked files exist.
# See: https://github.com/dlang/dmd/pull/7483
check_clean_git()
{
# Restore temporarily removed files
git checkout test/compilable/issue17167.sh
git checkout compiler/test/compilable/issue17167.sh
# Remove temporary directory + install script
rm -rf _generated
rm -f install.sh
# auto-removal of these files doesn't work on CirleCi
rm -f test/compilable/vcg-ast.d.cg
rm -f test/compilable/vcg-ast-arraylength.d.cg
rm -f compiler/test/compilable/vcg-ast.d.cg
rm -f compiler/test/compilable/vcg-ast-arraylength.d.cg
# Ensure that there are no untracked changes
make -f posix.mak check-clean-git
}
Expand All @@ -164,7 +164,7 @@ check_clean_git()
check_run_individual()
{
local build_path=generated/linux/$BUILD/$MODEL
"${build_path}/dmd" -I./test -i -run ./test/run.d "BUILD=$BUILD" "MODEL=$MODEL" test/runnable/template2962.d ./test/compilable/test14275.d
"${build_path}/dmd" -Icompiler/test -i -run ./compiler/test/run.d "BUILD=$BUILD" "MODEL=$MODEL" compiler/test/runnable/template2962.d ./compiler/test/compilable/test14275.d
}

# Checks the D build.d script
Expand All @@ -173,12 +173,12 @@ check_d_builder()
echo "Testing D build"
# load environment for bootstrap compiler
source "$(CURL_USER_AGENT=\"$CURL_USER_AGENT\" bash ~/dlang/install.sh dmd-$HOST_DMD_VER --activate)"
./src/build.d clean
./compiler/src/build.d clean
rm -rf generated # just to be sure
# TODO: add support for 32-bit builds
./src/build.d MODEL=64
./compiler/src/build.d MODEL=64
./generated/linux/release/64/dmd --version | grep -v "dirty"
./src/build.d clean
./compiler/src/build.d clean
deactivate
}

Expand All @@ -188,10 +188,10 @@ test_cxx()
# load environment for bootstrap compiler
source "$(CURL_USER_AGENT=\"$CURL_USER_AGENT\" bash ~/dlang/install.sh dmd-$HOST_DMD_VER --activate)"
echo "Test CXX frontend.h header generation"
./src/build.d
make -j$N -C ../druntime -f posix.mak MODEL=$MODEL BUILD=$BUILD
./compiler/src/build.d
make -j$N -C druntime -f posix.mak MODEL=$MODEL BUILD=$BUILD
make -j$N -C ../phobos -f posix.mak MODEL=$MODEL BUILD=$BUILD
./src/build.d cxx-headers-test
./compiler/src/build.d cxx-headers-test
deactivate
}

Expand Down
1 change: 1 addition & 0 deletions .cirrus.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Test
common_steps_template: &COMMON_STEPS_TEMPLATE
install_prerequisites_script: ./ci/cirrusci.sh
install_host_compiler_script: ./ci/run.sh install_host_compiler
Expand Down
4 changes: 2 additions & 2 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# The following text files requires strict end of line rules
test/compilable/extra-files/makedeps-import.txt text eol=lf
test/fail_compilation/extra-files/makedeps-import.txt text eol=lf
compiler/test/compilable/extra-files/makedeps-import.txt text eol=lf
compiler/test/fail_compilation/extra-files/makedeps-import.txt text eol=lf
Loading

0 comments on commit 09d0494

Please sign in to comment.