Skip to content

Commit 28d3e3a

Browse files
committed
feat: prettified dev scripts
1 parent 0447787 commit 28d3e3a

File tree

4 files changed

+81
-35
lines changed

4 files changed

+81
-35
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# debugging
2+
*.log
3+
14
# bazel
25
/bazel-*
36
/user.bazelrc

CopyDist.ps1

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,21 @@
22

33
$ErrorActionPreference = 'Stop'
44

5-
git clean dist -fdx
6-
bazel build //:copy_dist_include //:copy_dist_bin //:copy_dist_codegen_plugins //:copy_dist_images -c opt
7-
bazel run --ui_event_filters=-info --noshow_progress //:copy_dist_include -c opt
8-
bazel run --ui_event_filters=-info --noshow_progress //:copy_dist_images -c opt
9-
bazel run --ui_event_filters=-info --noshow_progress //:copy_dist_bin -c opt
10-
bazel run --ui_event_filters=-info --noshow_progress //:copy_dist_codegen_plugins -c opt
11-
bazel run --ui_event_filters=-info --noshow_progress //:copy_dist_recipe_bundles -c opt
5+
$RunCopyTargets = @(
6+
'//:copy_dist_include',
7+
'//:copy_dist_bin',
8+
'//:copy_dist_codegen_plugins',
9+
'//:copy_dist_images',
10+
'//:copy_dist_recipe_bundles'
11+
);
12+
13+
git clean dist -fdx *> CopyDist.log
14+
15+
Write-Progress -Status "Building copy targets..." -Activity "Copying distribution files"
16+
bazel build $RunCopyTargets *>> CopyDist.log
17+
18+
foreach($Target in $RunCopyTargets)
19+
{
20+
Write-Progress -Status "$Target" -Activity "Copying distribution files"
21+
bazel run --ui_event_filters=-info --noshow_progress $Target *>> CopyDist.log
22+
}

CreateMsix.ps1

Lines changed: 47 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -14,56 +14,80 @@ $MakePriPath = "${env:ProgramFiles(x86)}\Windows Kits\10\bin\10.0.22621.0\x64\ma
1414

1515
$CertPasswordPlain = ConvertFrom-SecureString -SecureString $CertPassword -AsPlainText
1616

17-
try {
17+
try
18+
{
1819
((Get-Content -path .\dist\AppxManifest.xml -Raw) -replace '0.0.0.0-placeholder',"$($Version).0") | Set-Content -Path .\dist\AppxManifest.xml
1920
$MsixPath = "ecsact_sdk_$($Version)_windows_x64.msix"
2021

22+
Write-Output "Creating $MsixPath" *> CreateMsix.log
23+
2124
Copy-Item ".\dist\images\ecsact-color44.png" ".\dist\images\ecsact-color44.targetsize-44_altform-unplated.png" -Force
2225
Copy-Item ".\dist\images\ecsact-color150.png" ".\dist\images\ecsact-color150.targetsize-150_altform-unplated.png" -Force
2326

2427
& $MakePriPath createconfig /cf .\dist\priconfig.xml /dq en-US /o
25-
if(-not $?) {
28+
if(-not $?)
29+
{
2630
throw "$MakePriPath createconfig failed with exit code ${LastExitCode}"
2731
}
2832

29-
& $MakePriPath new /pr .\dist /cf .\dist\priconfig.xml /dq en-US /o /OutputFile ".\dist\resources.pri"
30-
if(-not $?) {
33+
& $MakePriPath new /pr .\dist /cf .\dist\priconfig.xml /dq en-US /o /OutputFile ".\dist\resources.pri" *>> CopyMsix.log
34+
if(-not $?)
35+
{
3136
throw "$MakePriPath new failed with exit code ${LastExitCode}"
3237
}
3338

34-
Set-ItemProperty -Path .\dist\bin\ecsact.exe -Name IsReadOnly -Value $false
35-
Set-ItemProperty -Path .\dist\bin\ecsact_lsp_server.exe -Name IsReadOnly -Value $false
39+
$ExecutablesToSign = @(
40+
'.\dist\bin\ecsact.exe',
41+
'.\dist\bin\ecsact_lsp_server.exe'
42+
)
3643

37-
& $SignToolPath sign `
38-
/debug /fd SHA384 `
39-
/f $CertPath `
40-
/p $CertPasswordPlain `
41-
/tr http://timestamp.sectigo.com /td SHA256 `
42-
.\dist\bin\ecsact.exe `
43-
.\dist\bin\ecsact_lsp_server.exe
44+
foreach($Executable in $ExecutablesToSign)
45+
{
46+
Set-ItemProperty -Path $Executable -Name IsReadOnly -Value $false
47+
}
48+
49+
foreach($Executable in $ExecutablesToSign)
50+
{
51+
Write-Progress -Status "Signing distribution files" -Activity "$Executable"
52+
53+
& $SignToolPath sign `
54+
/debug /fd SHA384 `
55+
/f $CertPath `
56+
/p $CertPasswordPlain `
57+
/tr http://timestamp.sectigo.com /td SHA256 `
58+
$Executable *>> CopyMsix.log
4459

45-
if(-not $?) {
46-
throw "Signing dist binaries failed with exit code ${LastExitCode}"
60+
if(-not $?)
61+
{
62+
throw "Signing dist binaries failed with exit code ${LastExitCode}"
63+
}
4764
}
4865

49-
Set-ItemProperty -Path .\dist\bin\ecsact.exe -Name IsReadOnly -Value $true
50-
Set-ItemProperty -Path .\dist\bin\ecsact_lsp_server.exe -Name IsReadOnly -Value $true
66+
foreach($Executable in $ExecutablesToSign)
67+
{
68+
Set-ItemProperty -Path $Executable -Name IsReadOnly -Value $true
69+
}
5170

52-
& $MakeAppxPath pack /v /o /h SHA384 /d .\dist\ /p $MsixPath
71+
& $MakeAppxPath pack /v /o /h SHA384 /d .\dist\ /p $MsixPath *>> CopyMsix.log
5372

54-
if(-not $?) {
73+
if(-not $?)
74+
{
5575
throw "$MakeAppxPath exited with ${LastExitCode}"
5676
}
5777

78+
Write-Progress -Status "Signing distribution files" -Activity "$MsixPath"
79+
5880
& $SignToolPath sign `
5981
/debug /fd SHA384 `
6082
/f $CertPath `
6183
/p $CertPasswordPlain `
6284
/tr http://timestamp.sectigo.com /td SHA256 `
63-
$MsixPath
64-
if(-not $?) {
85+
$MsixPath *>> CopyMsix.log
86+
if(-not $?)
87+
{
6588
throw "Signing ${MsixPath} failed with exit code ${LastExitCode}"
6689
}
67-
} finally {
68-
git checkout .\dist\AppxManifest.xml
90+
} finally
91+
{
92+
git checkout .\dist\AppxManifest.xml *>> CopyMsix.log
6993
}

DevInstall.ps1

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,29 @@ $IncrementedVersion = $GitTagSplit[0] + "." + $GitTagSplit[1] + "." + (([int]$Gi
1414
# Simulate a release to set the correct version
1515
$Env:GITHUB_REF=$IncrementedVersion
1616

17+
Write-Output 'Starting DevInstall' *> DevInstall.log
18+
1719
. .\CopyDist.ps1
1820

19-
if ([System.Environment]::OSVersion.Platform -eq 'Unix') {
21+
if ([System.Environment]::OSVersion.Platform -eq 'Unix')
22+
{
2023
# TODO(zaucy): Check if developer machine can install .deb files and give
2124
# a nice error if they can't.
2225
. ./CreateDeb.ps1 -Version $IncrementedVersion
2326
sudo dpkg -i $DebPath
24-
} else {
27+
} else
28+
{
2529
$ExistingPackage = Get-AppPackage EcsactSdk
2630

27-
if ($ExistingPackage) {
28-
Remove-AppPackage -Package $ExistingPackage.PackageFullName
31+
if ($ExistingPackage)
32+
{
33+
Remove-AppPackage -Package $ExistingPackage.PackageFullName *>> DevInstall.log
2934
}
3035

3136
. .\CreateMsix.ps1 -Version $IncrementedVersion -CertPassword $CertPassword -CertPath $CertPath
32-
Add-AppPackage -Path $MsixPath
37+
Add-AppPackage -Path $MsixPath *>> DevInstall.log
38+
39+
Write-Progress -Status "DevInstall Success" -Activity "$MsixPath Installed"
40+
Write-Host "Successfully installed Ecsact SDK $Version" -ForegroundColor Green
3341
}
3442

0 commit comments

Comments
 (0)