Update scripts to not use .cmd and only using .ps1

This commit is contained in:
Steve Otteson 2021-03-11 08:27:15 -08:00
Родитель b4613cf2ab
Коммит 9547500bc5
9 изменённых файлов: 33 добавлений и 85 удалений

Просмотреть файл

@ -1,23 +0,0 @@
@echo OFF
setlocal
call :setESC
@echo %ESC%[36m*** Building .winmd...%ESC%[0m
powershell.exe -NoLogo -NoProfile -ExecutionPolicy ByPass -Command "& """%~dp0scripts\BuildMetadataBin.ps1""" %*"
if %ERRORLEVEL% neq 0 goto :failed
echo %ESC%[32mSucceeded.%ESC%[0m
exit /B %ERRORLEVEL%
:failed
echo %ESC%[31mFailed.%ESC%[0m
exit /B %ERRORLEVEL%
:setESC
for /F "tokens=1,2 delims=#" %%a in ('"prompt #$H#$E# & echo on & for %%b in (1) do rem"') do (
set ESC=%%b
exit /B 0
)
exit /B 0

Просмотреть файл

@ -1,12 +0,0 @@
@echo off
call GenerateMetadataSource.cmd
if %ERRORLEVEL% neq 0 exit /B %ERRORLEVEL%
call BuildMetadataBin.cmd
if %ERRORLEVEL% neq 0 exit /B %ERRORLEVEL%
call TestMetadataBin.cmd
if %ERRORLEVEL% neq 0 exit /B %ERRORLEVEL%
exit 0

17
DoAll.ps1 Normal file
Просмотреть файл

@ -0,0 +1,17 @@
.\scripts\GenerateMetadataSource.ps1
if ($LastExitCode -lt 0)
{
exit $LastExitCode
}
.\scripts\BuildMetadataBin.ps1
if ($LastExitCode -lt 0)
{
exit $LastExitCode
}
.\scripts\TestWinmdBinary.ps1
if ($LastExitCode -lt 0)
{
exit $LastExitCode
}

Просмотреть файл

@ -1,23 +0,0 @@
@echo off
setlocal
call :setESC
@echo %ESC%[36m*** Generating source with ClangSharp...%ESC%[0m
pwsh.exe -NoLogo -NoProfile -ExecutionPolicy ByPass -Command "& """%~dp0scripts\GenerateMetadataSource.ps1""" %*"
if %ERRORLEVEL% neq 0 goto :failed
echo %ESC%[32mSucceeded.%ESC%[0m
exit /B %ERRORLEVEL%
:failed
echo %ESC%[31mFailed.%ESC%[0m
exit /B %ERRORLEVEL%
:setESC
for /F "tokens=1,2 delims=#" %%a in ('"prompt #$H#$E# & echo on & for %%b in (1) do rem"') do (
set ESC=%%b
exit /B 0
)
exit /B 0

Просмотреть файл

@ -151,14 +151,14 @@ The partitions are meant to break up headers into namespaces. However, some head
# How to Generate the .winmd
PowerShell Core is required to run the generation scripts. Open a PowerShell Core window and:
1) GenerateMetadataSource.cmd: This loops over the directories under generation\Partitions, running ClangSharp for each one. There are base settings for all partitions: name remaps are found in [generation/scraper/baseRemap.rsp](generation/scraper/baseRemap.rsp) and other settings are found in [generation/scraper/baseSettings.rsp](generation/scraper/baseSettings.rsp). Each partitions folder contains a main.cpp, remap.rsp, and settings.rsp. ClangSharp writes C# files to generation\emitter\manual\generated (these files are not checked in).
2) BuildMetadataBin.cmd: This builds the emitter and points it at the [generation/emitter](generation/emitter) directory. Again, the "generated" subdirectory contains the files that ClangSharp created in step 1.
3) Once the .winmd is built, run TestMetadataBin.cmd which checks for regressions.
1) [.\scripts\GenerateMetadataSource.ps1](.\scripts\GenerateMetadataSource.ps1): This loops over the directories under generation\Partitions, running ClangSharp for each one. There are base settings for all partitions: name remaps are found in [generation/scraper/baseRemap.rsp](generation/scraper/baseRemap.rsp) and other settings are found in [generation/scraper/baseSettings.rsp](generation/scraper/baseSettings.rsp). Each partitions folder contains a main.cpp, remap.rsp, and settings.rsp. ClangSharp writes C# files to generation\emitter\manual\generated (these files are not checked in).
2) [.\scripts\BuildMetadataBin.ps1](.\scripts\BuildMetadataBin.ps1): This builds the emitter and points it at the [generation/emitter](generation/emitter) directory. Again, the "generated" subdirectory contains the files that ClangSharp created in step 1.
3) Once the .winmd is built, run [.\scripts\TestMetadataBin.ps1](.\scripts\TestMetadataBin.ps1) which checks for regressions.
...or if you can do it all in one shot with:
...or if you can do it all in one shot in a PowerShell Core window:
```winbatch
DoAll.cmd
.\DoAll.ps1
```
 

Просмотреть файл

@ -1,22 +0,0 @@
@echo OFF
setlocal
call :setESC
@echo %ESC%[36m*** Testing .winmd...%ESC%[0m
powershell.exe -NoLogo -NoProfile -ExecutionPolicy ByPass -Command "& """%~dp0scripts\CompareBinaryAgainstBaseline.ps1""" %*"
if %ERRORLEVEL% neq 0 goto :failed
echo %ESC%[32mSucceeded.%ESC%[0m
exit /B %ERRORLEVEL%
:failed
echo %ESC%[31mFailed.%ESC%[0m
exit /B %ERRORLEVEL%
:setESC
for /F "tokens=1,2 delims=#" %%a in ('"prompt #$H#$E# & echo on & for %%b in (1) do rem"') do (
set ESC=%%b
exit /B 0
)
exit /B 0

Просмотреть файл

@ -6,6 +6,8 @@ param
. "$PSScriptRoot\CommonUtils.ps1"
Write-Output "`e[36m*** Building .winmd`e[0m"
if (!$assemblyVersion)
{
$assemblyVersion = $defaultWinSDKNugetVersion
@ -71,3 +73,4 @@ if ($LastExitCode -ne 0)
exit $LastExitCode
}
Write-Output "`n`e[32mGenerating .winmd succeeded`e[0m"

Просмотреть файл

@ -60,6 +60,8 @@ if (!$artifactsDir)
Create-Directory $artifactsDir
}
Write-Output "`e[36m*** Generating source files`e[0m"
Write-Output "Making sure cpp NuGet packages are installed..."
$nugetSrcPackagesDir = Join-Path -Path $artifactsDir "NuGetPackages"
@ -221,4 +223,6 @@ $totalTime = $stopwatch.Elapsed.ToString("c")
Write-Output "Total time taken for all partitions: $totalTime"
Write-Output "`n`e[32mGenerating source files succeeded`e[0m"
exit 0

Просмотреть файл

@ -9,6 +9,8 @@ param
. "$PSScriptRoot\CommonUtils.ps1"
Write-Output "`e[36m*** Running tests on .winmd`e[0m"
if (!$assemblyVersion)
{
$assemblyVersion = $defaultWinSDKNugetVersion
@ -97,3 +99,5 @@ if ($failed)
{
exit -1
}
Write-Output "`n`e[32mTesting .winmd succeeded`e[0m"