Skip to content

Commit

Permalink
Normalize RepoRoot path to improve logs readability (#80664)
Browse files Browse the repository at this point in the history
  • Loading branch information
am11 authored Jan 16, 2023
1 parent c435061 commit 852fcbd
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 17 deletions.
13 changes: 5 additions & 8 deletions eng/native/gen-buildsys.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,9 @@ if %argC% lss 4 GOTO :USAGE
if %1=="/?" GOTO :USAGE

setlocal enabledelayedexpansion
set basePath=%~dp0
set __repoRoot=%~dp0..\..\
:: remove quotes
set "basePath=%basePath:"=%"
:: remove trailing slash
if %basePath:~-1%==\ set "basePath=%basePath:~0,-1%"
set "__repoRoot=%~dp0..\.."
:: normalize
for %%i in ("%__repoRoot%") do set "__repoRoot=%%~fi"

set __SourceDir=%1
set __IntermediatesDir=%2
Expand Down Expand Up @@ -53,7 +50,7 @@ if /i "%__Arch%" == "wasm" (
exit /B 1
)

set EMSDK_PATH=%__repoRoot%\src\mono\wasm\emsdk
set "EMSDK_PATH=%__repoRoot%\src\mono\wasm\emsdk"
)
:: replace backslash with forward slash and append last slash
set "EMSDK_PATH=!EMSDK_PATH:\=/!"
Expand All @@ -69,7 +66,7 @@ if /i "%__Arch%" == "wasm" (
exit /B 1
)

set WASI_SDK_PATH=%__repoRoot%src\mono\wasi\wasi-sdk
set "WASI_SDK_PATH=%__repoRoot%src\mono\wasi\wasi-sdk"
)
:: replace backslash with forward slash and append last slash
set "WASI_SDK_PATH=!WASI_SDK_PATH:\=/!"
Expand Down
8 changes: 5 additions & 3 deletions eng/native/version/copy_version_files.cmd
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
@if not defined _echo @echo off
setlocal EnableDelayedExpansion EnableExtensions

set __VersionFolder=%~dp0
set __RepoRoot=%~dp0..\..\..
set __artifactsObjDir=%__RepoRoot%\artifacts\obj
set "__VersionFolder=%~dp0"
set "__RepoRoot=%~dp0..\..\.."
:: normalize
for %%i in ("%__RepoRoot%") do set "__RepoRoot=%%~fi"
set "__artifactsObjDir=%__RepoRoot%\artifacts\obj"

for /r "%__VersionFolder%" %%a in (*.h *.rc) do (
if not exist "%__artifactsObjDir%\%%~nxa" (
Expand Down
2 changes: 2 additions & 0 deletions src/coreclr/build-runtime.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ set "__ProjectDir=%~dp0"
:: remove trailing slash
if %__ProjectDir:~-1%==\ set "__ProjectDir=%__ProjectDir:~0,-1%"
set "__RepoRootDir=%__ProjectDir%\..\.."
:: normalize
for %%i in ("%__RepoRootDir%") do set "__RepoRootDir=%%~fi"

set "__ProjectFilesDir=%__ProjectDir%"
set "__RootBinDir=%__RepoRootDir%\artifacts"
Expand Down
5 changes: 4 additions & 1 deletion src/native/corehost/build.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ set "__sourceDir=%~dp0"
:: remove trailing slash
if %__sourceDir:~-1%==\ set "__ProjectDir=%__sourceDir:~0,-1%"

set __engNativeDir=%__sourceDir%\..\..\..\eng\native
set "__RepoRootDir=%__sourceDir%\..\..\.."
:: normalize
for %%i in ("%__RepoRootDir%") do set "__RepoRootDir=%%~fi"
set "__engNativeDir=%__RepoRootDir%\eng\native"
set __CMakeBinDir=""
set __IntermediatesDir=""
set __BuildArch=x64
Expand Down
12 changes: 8 additions & 4 deletions src/native/libs/build-native.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,14 @@ setlocal

:SetupArgs
:: Initialize the args that will be passed to cmake
set __sourceRootDir=%~dp0
set __repoRoot=%~dp0..\..\..
set __engNativeDir=%__repoRoot%\eng\native
set __artifactsDir=%__repoRoot%\artifacts
set "__sourceRootDir=%~dp0"
:: remove trailing slash
if %__sourceRootDir:~-1%==\ set "__sourceRootDir=%__sourceRootDir:~0,-1%"
set "__repoRoot=%__sourceRootDir%\..\..\.."
:: normalize
for %%i in ("%__repoRoot%") do set "__repoRoot=%%~fi"
set "__engNativeDir=%__repoRoot%\eng\native"
set "__artifactsDir=%__repoRoot%\artifacts"
set __CMakeBinDir=""
set __IntermediatesDir=""
set __BuildArch=x64
Expand Down
3 changes: 2 additions & 1 deletion src/tests/build.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ set "__ProjectDir=%~dp0"
:: remove trailing slash
if %__ProjectDir:~-1%==\ set "__ProjectDir=%__ProjectDir:~0,-1%"
set "__RepoRootDir=%__ProjectDir%\..\.."
for %%i in ("%__RepoRootDir%") do SET "__RepoRootDir=%%~fi"
:: normalize
for %%i in ("%__RepoRootDir%") do set "__RepoRootDir=%%~fi"

set "__TestDir=%__RepoRootDir%\src\tests"

Expand Down
2 changes: 2 additions & 0 deletions src/tests/run.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ set __TargetOS=windows

set "__ProjectDir=%~dp0"
set "__RepoRootDir=%~dp0..\.."
:: normalize
for %%i in ("%__RepoRootDir%") do set "__RepoRootDir=%%~fi"
:: remove trailing slash
if %__ProjectDir:~-1%==\ set "__ProjectDir=%__ProjectDir:~0,-1%"
set "__ProjectFilesDir=%__ProjectDir%"
Expand Down

0 comments on commit 852fcbd

Please sign in to comment.