Skip to content

Commit

Permalink
refactor shell extension project
Browse files Browse the repository at this point in the history
  • Loading branch information
Marc-André Moreau authored and awakecoding committed Aug 27, 2024
1 parent 15f544c commit 8428088
Show file tree
Hide file tree
Showing 27 changed files with 363 additions and 292 deletions.
13 changes: 9 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -532,8 +532,11 @@ jobs:
$DAgentPedmDesktopExecutable = Join-Path $TargetOutputPath "DevolutionsPedmDesktop.exe"
echo "dagent-pedm-desktop-executable=$DAgentPedmDesktopExecutable" >> $Env:GITHUB_OUTPUT
$DAgentPedmContextMenuMsix = Join-Path $TargetOutputPath "devolutions-pedm-contextmenu.msix"
echo "dagent-pedm-context-menu-msix=$DAgentPedmContextMenuMsix" >> $Env:GITHUB_OUTPUT
$DAgentPedmShellExtDll = Join-Path $TargetOutputPath "DevolutionsPedmShellExt.dll"
echo "dagent-pedm-shell-ext-dll=$DAgentPedmShellExtDll" >> $Env:GITHUB_OUTPUT
$DAgentPedmShellExtMsix = Join-Path $TargetOutputPath "DevolutionsPedmShellExt.msix"
echo "dagent-pedm-shell-ext-msix=$DAgentPedmShellExtMsix" >> $Env:GITHUB_OUTPUT
$DAgentPedmHook = Join-Path $TargetOutputPath "devolutions_pedm_hook.dll"
echo "dagent-pedm-hook=$DAgentPedmHook" >> $Env:GITHUB_OUTPUT
Expand Down Expand Up @@ -598,7 +601,8 @@ jobs:
if ($Env:RUNNER_OS -eq "Windows") {
$Env:DAGENT_PEDM_DESKTOP_EXECUTABLE = "${{ steps.load-variables.outputs.dagent-pedm-desktop-executable }}"
$Env:DAGENT_PEDM_HOOK = "${{ steps.load-variables.outputs.dagent-pedm-hook }}"
$Env:DAGENT_PEDM_CONTEXT_MENU_MSIX = "${{ steps.load-variables.outputs.dagent-pedm-context-menu-msix }}"
$Env:DAGENT_PEDM_SHELL_EXT_DLL = "${{ steps.load-variables.outputs.dagent-pedm-shell-ext-dll }}"
$Env:DAGENT_PEDM_SHELL_EXT_MSIX = "${{ steps.load-variables.outputs.dagent-pedm-shell-ext-msix }}"
}
./ci/tlk.ps1 build -Product agent -Platform ${{ matrix.os }} -Architecture ${{ matrix.arch }} -CargoProfile ${{ needs.preflight.outputs.rust-profile }}
Expand All @@ -614,7 +618,8 @@ jobs:
$Env:DAGENT_PACKAGE = "${{ steps.load-variables.outputs.dagent-package }}"
$Env:DAGENT_PEDM_DESKTOP_EXECUTABLE = "${{ steps.load-variables.outputs.dagent-pedm-desktop-executable }}"
$Env:DAGENT_PEDM_HOOK = "${{ steps.load-variables.outputs.dagent-pedm-hook }}"
$Env:DAGENT_PEDM_CONTEXT_MENU_MSIX = "${{ steps.load-variables.outputs.dagent-pedm-context-menu-msix }}"
$Env:DAGENT_PEDM_SHELL_EXT_DLL = "${{ steps.load-variables.outputs.dagent-pedm-shell-ext-dll }}"
$Env:DAGENT_PEDM_SHELL_EXT_MSIX = "${{ steps.load-variables.outputs.dagent-pedm-shell-ext-msix }}"
}
./ci/tlk.ps1 package -Product agent -Platform ${{ matrix.os }} -Architecture ${{ matrix.arch }} -CargoProfile ${{ needs.preflight.outputs.rust-profile }}
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -227,13 +227,14 @@ jobs:
run: |
$IncludePattern = switch ('${{ matrix.project }}') {
'devolutions-gateway' { 'DevolutionsGateway_*.exe' }
'devolutions-agent' { 'DevolutionsAgent_*.exe', 'devolutions-pedm-contextmenu.msix', 'DevolutionsPedmDesktop.exe', 'devolutions_pedm_hook.dll' }
'devolutions-agent' { 'DevolutionsAgent_*.exe', 'DevolutionsPedmShellExt.dll',
'DevolutionsPedmShellExt.msix', 'DevolutionsPedmDesktop.exe', 'devolutions_pedm_hook.dll' }
'jetsocat' { 'jetsocat_*' }
}
$ExcludePattern = "*.pdb"
Get-ChildItem -Path ${{ runner.temp }} -Recurse -Include $IncludePattern -Exclude $ExcludePattern | % {
if ('${{ matrix.os }}' -Eq 'windows') {
if ($_.Name -Eq 'devolutions-pedm-contextmenu.msix') {
if ($_.Name -Eq 'DevolutionsPedmShellExt.msix') {
$PackagePublisher = '${{ secrets.CODE_SIGNING_APPX_PUBLISHER }}'
$UnpackedMsix = Join-Path ${{ runner.temp }} "unpacked-context-menu-msix"
$AppxManifest = Join-Path $UnpackedMsix "AppxManifest.xml"
Expand Down Expand Up @@ -322,7 +323,8 @@ jobs:
$PackageRoot = Join-Path ${{ runner.temp }} ${{ matrix.project}}
$Env:DAGENT_EXECUTABLE = Get-ChildItem -Path $PackageRoot -Recurse -Include '*DevolutionsAgent*.exe' | Select -First 1
$Env:DAGENT_PEDM_DESKTOP_EXECUTABLE = Get-ChildItem -Path $PackageRoot -Recurse -Include 'DevolutionsPedmDesktop.exe' | Select -First 1
$Env:DAGENT_PEDM_CONTEXT_MENU_MSIX = Get-ChildItem -Path $PackageRoot -Recurse -Include 'devolutions-pedm-contextmenu.msix' | Select -First 1
$Env:DAGENT_PEDM_SHELL_EXT_DLL = Get-ChildItem -Path $PackageRoot -Recurse -Include 'DevolutionsPedmShellExt.dll' | Select -First 1
$Env:DAGENT_PEDM_SHELL_EXT_MSIX = Get-ChildItem -Path $PackageRoot -Recurse -Include 'DevolutionsPedmShellExt.msix' | Select -First 1
$Env:DAGENT_PEDM_HOOK = Get-ChildItem -Path $PackageRoot -Recurse -Include 'devolutions_pedm_hook.dll' | Select -First 1
./ci/tlk.ps1 package -Product agent -PackageOption generate
Expand Down
34 changes: 13 additions & 21 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 7 additions & 18 deletions ci/tlk.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ class TlkRecipe

if ($this.Target.IsWindows()) {
$agentPackages += [TlkPackage]::new("devolutions-pedm-hook", "crates/devolutions-pedm-hook", $true)
$agentPackages += [TlkPackage]::new("devolutions-pedm-contextmenu", "crates/devolutions-pedm-contextmenu", $true)
$agentPackages += [TlkPackage]::new("devolutions-pedm-shell-ext", "crates/devolutions-pedm-shell-ext", $true)
}

$agentPackages
Expand Down Expand Up @@ -429,6 +429,8 @@ class TlkRecipe
$Env:DAGENT_EXECUTABLE
} elseif ($CargoPackage.Name -Eq "devolutions-pedm-hook" -And (Test-Path Env:DAGENT_PEDM_HOOK)) {
$Env:DAGENT_PEDM_HOOK
} elseif ($CargoPackage.Name -Eq "devolutions-pedm-shell-ext" -And (Test-Path Env:DAGENT_PEDM_SHELL_EXT_DLL)) {
$Env:DAGENT_PEDM_SHELL_EXT_DLL
} else {
$null
}
Expand Down Expand Up @@ -461,7 +463,7 @@ class TlkRecipe
Copy-Item -Path $SrcBinaryPath -Destination $DestinationExecutable
}

if ($CargoPackage.Name -Eq 'devolutions-pedm-contextmenu') {
if ($CargoPackage.Name -Eq 'devolutions-pedm-shell-ext') {
if ($Null -Eq (Get-Command "MakeAppx.exe" -ErrorAction SilentlyContinue)) {
throw 'MakeAppx was not found in the PATH'
}
Expand All @@ -471,27 +473,15 @@ class TlkRecipe
Push-Location
Set-Location $CargoOutputPath

$MakeAppxOutput = & 'MakeAppx.exe' 'pack' '/f' "${CargoPackagePath}/mapping.txt" '/p' "./devolutions-pedm-contextmenu.msix" '/nv' '/o'
$MakeAppxOutput = & 'MakeAppx.exe' 'pack' '/f' "${CargoPackagePath}/mapping.txt" '/p' "./DevolutionsPedmShellExt.msix" '/nv' '/o'
if (!$?) {
throw "MakeAppx package creation failed: ${MakeAppxOutput}"
}

if ($Env:DAGENT_PEDM_PFX -And (Test-Path $Env:DAGENT_PEDM_PFX) -And $Env:DAGENT_PEDM_PFX_PASSWORD -And (Get-Command "SignTool.exe" -ErrorAction SilentlyContinue)) {
$SignToolOutput = & 'SignTool.exe' 'sign' '/fd' 'SHA256' '/a' '/f' "${Env:DAGENT_PEDM_PFX}" '/p' "${Env:DAGENT_PEDM_PFX_PASSWORD}" (Get-Item "./devolutions-pedm-contextmenu.msix").FullName
if (!$?) {
throw "SignTool failed: ${SignToolOutput}"
}
}

Pop-Location

if (Test-Path Env:DAGENT_PEDM_CONTEXT_MENU_MSIX) {
Copy-Item -Path $(Join-Path $CargoOutputPath "devolutions-pedm-contextmenu.msix") -Destination $Env:DAGENT_PEDM_CONTEXT_MENU_MSIX

$DestinationSymbolsFolder = Split-Path $Env:DAGENT_PEDM_CONTEXT_MENU_MSIX -Parent
Copy-Item "${CargoOutputPath}/devolutions_pedm_contextmenu.pdb" -Destination $DestinationSymbolsFolder
Copy-Item "${CargoOutputPath}/deps/devolutions_pedm_contextmenu_shell.pdb" -Destination $DestinationSymbolsFolder

if (Test-Path Env:DAGENT_PEDM_SHELL_EXT_MSIX) {
Copy-Item -Path $(Join-Path $CargoOutputPath "DevolutionsPedmShellExt.msix") -Destination $Env:DAGENT_PEDM_SHELL_EXT_MSIX
}
}

Expand All @@ -506,7 +496,6 @@ class TlkRecipe
$builtDesktopPdb = Get-ChildItem -Recurse -Include 'DevolutionsPedmDesktop.pdb' | Select-Object -First 1

Copy-Item -Path $builtDesktopExe -Destination $Env:DAGENT_PEDM_DESKTOP_EXECUTABLE

Copy-Item -Path $builtDesktopPdb -Destination $(Get-DestinationSymbolFile $Env:DAGENT_PEDM_DESKTOP_EXECUTABLE $this.Target)

}
Expand Down
15 changes: 0 additions & 15 deletions crates/devolutions-pedm-contextmenu/Cargo.toml

This file was deleted.

22 changes: 0 additions & 22 deletions crates/devolutions-pedm-contextmenu/build.rs

This file was deleted.

This file was deleted.

This file was deleted.

2 changes: 0 additions & 2 deletions crates/devolutions-pedm-contextmenu/src/main.rs

This file was deleted.

Loading

0 comments on commit 8428088

Please sign in to comment.