-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdist.all.bat
More file actions
77 lines (66 loc) · 3.47 KB
/
Copy pathdist.all.bat
File metadata and controls
77 lines (66 loc) · 3.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
@echo off
REM dist.all.bat - Pack LeXtudio.Windows and sign resulting NuGet packages
REM Ensures ONLY .nupkg files exist in dist folder upon successful completion
SETLOCAL EnableExtensions EnableDelayedExpansion
echo on
REM Configuration
set CONFIG=Release
set DISTDIR=%~dp0dist
set TIMESTAMPER=http://timestamp.digicert.com
echo.
echo ============================================================
echo Pre-cleanup: Removing dist folder completely
echo ============================================================
if exist "%DISTDIR%" (
echo Removing: %DISTDIR%
rmdir /s /q "%DISTDIR%"
if errorlevel 1 (
echo Attempting aggressive cleanup...
for /d %%D in ("%DISTDIR%\*") do rmdir /s /q "%%D" 2>nul
for %%F in ("%DISTDIR%\*") do del /q /f "%%F" 2>nul
)
)
mkdir "%DISTDIR%"
echo.
echo ============================================================
echo Step 1: Packing NuGet packages
echo ============================================================
echo Invoking pack.ps1 to produce nupkgs in "%DISTDIR%" ...
pwsh -NoProfile -NonInteractive -ExecutionPolicy Bypass -File "%~dp0pack.ps1" -OutDir "%DISTDIR%" -Configuration "%CONFIG%"
if errorlevel 1 goto :error_pack
echo.
echo ============================================================
echo Verification: Checking that only .nupkg and .snupkg files exist
echo ============================================================
pwsh -NoProfile -NonInteractive -ExecutionPolicy Bypass -Command ^
"$outdir = '%DISTDIR%'; $files = @(Get-ChildItem -Path $outdir -File -ErrorAction SilentlyContinue | Where-Object { ($_.Extension -ne '.nupkg') -and ($_.Extension -ne '.snupkg') }); if ($files.Count -gt 0) { Write-Error 'ERROR: Non-package files found in dist folder:'; $files | ForEach-Object { Write-Error (' - ' + $_.FullName) }; exit 1 } else { Write-Host 'SUCCESS: Only .nupkg/.snupkg files in dist folder'; exit 0 }"
if errorlevel 1 goto :error_verify
echo.
echo ============================================================
echo Step 2: Signing packages
echo ============================================================
echo Invoking sign.ps1 to sign packages in "%DISTDIR%" ...
pwsh -NoProfile -NonInteractive -ExecutionPolicy Bypass -File "%~dp0sign.ps1" -PackageDir "%DISTDIR%" -TimestampServer "%TIMESTAMPER%" -Overwrite
if errorlevel 1 goto :error_sign
echo.
echo ============================================================
echo Final verification: Checking that only .nupkg and .snupkg files exist
echo ============================================================
pwsh -NoProfile -NonInteractive -ExecutionPolicy Bypass -Command ^
"$outdir = '%DISTDIR%'; $files = @(Get-ChildItem -Path $outdir -File -ErrorAction SilentlyContinue | Where-Object { ($_.Extension -ne '.nupkg') -and ($_.Extension -ne '.snupkg') }); if ($files.Count -gt 0) { Write-Error 'ERROR: Non-package files found in dist folder after signing:'; $files | ForEach-Object { Write-Error (' - ' + $_.FullName) }; exit 1 } else { Write-Host 'SUCCESS: Only .nupkg/.snupkg files in dist folder'; exit 0 }"
if errorlevel 1 goto :error_final_verify
echo.
echo All packages processed successfully and available in "%DISTDIR%"
exit /b 0
:error_pack
echo ERROR: NuGet package creation failed.
exit /b 1
:error_verify
echo ERROR: Post-pack verification failed. Non-.nupkg files found in dist folder.
exit /b 1
:error_sign
echo ERROR: Package signing failed.
exit /b 1
:error_final_verify
echo ERROR: Final verification failed. Non-.nupkg files found in dist folder after signing.
exit /b 1