Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump #2

Merged
merged 11 commits into from
Jan 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: Setup dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
dotnet-version: 9.0.x

- name: Restore dependencies
run: dotnet restore
Expand Down
4 changes: 2 additions & 2 deletions Analyzers.props
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
</AdditionalFiles>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.VisualStudio.Threading.Analyzers" Version="17.10.48">
<PackageReference Include="Microsoft.VisualStudio.Threading.Analyzers" Version="17.12.19">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="Roslynator.Analyzers" Version="4.12.4">
<PackageReference Include="Roslynator.Analyzers" Version="4.12.10">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ The [Sample](https://github.com/hlaueriksson/Community.PowerToys.Run.Plugin.Upda
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0-windows</TargetFramework>
<TargetFramework>net9.0-windows10.0.22621.0</TargetFramework>
<UseWPF>true</UseWPF>
<Platforms>x64;ARM64</Platforms>
<PlatformTarget>$(Platform)</PlatformTarget>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0-windows</TargetFramework>
<TargetFramework>net9.0-windows10.0.22621.0</TargetFramework>
<UseWPF>true</UseWPF>
<Platforms>x64;ARM64</Platforms>
<PlatformTarget>$(Platform)</PlatformTarget>
Expand Down
77 changes: 77 additions & 0 deletions samples/Community.PowerToys.Run.Plugin.Sample/deploy.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<#PSScriptInfo
.VERSION 0.87.0
.GUID 2d1e62b4-4b98-4fad-98b2-2cc1db4694b8
.AUTHOR Henrik Lau Eriksson
.COMPANYNAME
.COPYRIGHT
.TAGS PowerToys Run Plugins Deploy
.LICENSEURI
.PROJECTURI https://github.com/hlaueriksson/Community.PowerToys.Run.Plugin.Templates
.ICONURI
.EXTERNALMODULEDEPENDENCIES
.REQUIREDSCRIPTS
.EXTERNALSCRIPTDEPENDENCIES
.RELEASENOTES
#>

<#
.Synopsis
Deploys the plugins to PowerToys Run.

.Description
Copies the plugins to the PowerToys Run Plugins folder:
- %LocalAppData%\Microsoft\PowerToys\PowerToys Run\Plugins

.Parameter Platform
Platform: ARM64 | x64

.Example
.\deploy.ps1

.Link
https://github.com/hlaueriksson/Community.PowerToys.Run.Plugin.Templates
#>
param (
[ValidateSet("ARM64", "x64")]
[string]$platform = "x64"
)

#Requires -RunAsAdministrator

Stop-Process -Name "PowerToys" -Force -ErrorAction SilentlyContinue

dotnet build -c Release /p:TF_BUILD=true /p:Platform=$platform

$dependencies = @("PowerToys.Common.UI.*", "PowerToys.ManagedCommon.*", "PowerToys.Settings.UI.Lib.*", "Wox.Infrastructure.*", "Wox.Plugin.*")

# Plugins
$folders = Get-ChildItem -Recurse -Filter "plugin.json" | Where-Object { $_.FullName -notlike "*\bin\*" } | ForEach-Object { $_.Directory } | Sort-Object -Unique

Write-Output "Platform: $platform"

Write-Output "Deploy:"
foreach ($folder in $folders) {
Write-Output "- $($folder.Name)"

$name = $($folder.Name.Split(".")[-1])

# TargetFramework
[xml]$csproj = Get-Content -Path (Join-Path $folder.FullName "*.csproj")
$targetFramework = $csproj.Project.PropertyGroup.TargetFramework

Remove-Item -LiteralPath "$env:LOCALAPPDATA\Microsoft\PowerToys\PowerToys Run\Plugins\$name" -Recurse -Force -ErrorAction SilentlyContinue
Copy-Item -Path "$folder\bin\$platform\Release\$targetFramework" -Destination "$env:LOCALAPPDATA\Microsoft\PowerToys\PowerToys Run\Plugins\$name" -Recurse -Force -Exclude $dependencies
}

$machinePath = "C:\Program Files\PowerToys\PowerToys.exe"
$userPath = "$env:LOCALAPPDATA\PowerToys\PowerToys.exe"

if (Test-Path $machinePath) {
Start-Process -FilePath $machinePath
}
elseif (Test-Path $userPath) {
Start-Process -FilePath $userPath
}
else {
Write-Error "Unable to start PowerToys"
}
68 changes: 37 additions & 31 deletions samples/Community.PowerToys.Run.Plugin.Sample/pack.ps1
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<#PSScriptInfo
.VERSION 0.0.0
.VERSION 0.87.0
.GUID 58d7b8e8-fa18-485d-baaf-4c413181280b
.AUTHOR Henrik Lau Eriksson
.COMPANYNAME
Expand All @@ -16,12 +16,12 @@

<#
.Synopsis
Packs the plugin into release archive.
Packs the plugins into release archives.

.Description
Builds the project in Release configuration,
copies the output files into plugin folder,
packs the plugin folder into release archive.
Builds the solution in Release configuration,
copies the output files into plugin folders,
packs the plugin folders into release archives.

.Example
.\pack.ps1
Expand All @@ -33,38 +33,44 @@
# Clean
Get-ChildItem -Path "." -Directory -Include "bin", "obj" -Recurse | Remove-Item -Recurse -Force

# Name
$folder = Split-Path -Path $PWD -Leaf
$name = $folder.Split(".")[-1]
Write-Output "Pack: $name"
$dependencies = @("PowerToys.Common.UI.*", "PowerToys.ManagedCommon.*", "PowerToys.Settings.UI.Lib.*", "Wox.Infrastructure.*", "Wox.Plugin.*")

# Version
$json = Get-Content -Path "plugin.json" -Raw | ConvertFrom-Json
$version = $json.Version
Write-Output "Version: $version"
# Plugins
$folders = Get-ChildItem -Recurse -Filter "plugin.json" | Where-Object { $_.FullName -notlike "*\bin\*" } | ForEach-Object { $_.Directory } | Sort-Object -Unique

# Platforms
[xml]$csproj = Get-Content -Path "*.csproj"
$platforms = "$($csproj.Project.PropertyGroup.Platforms)".Trim() -split ";"
Write-Output "Pack:"
foreach ($folder in $folders) {
Write-Output "- $($folder.Name)"

$dependencies = @("PowerToys.Common.UI.dll", "PowerToys.ManagedCommon.dll", "PowerToys.Settings.UI.Lib.dll", "Wox.Infrastructure.dll", "Wox.Plugin.dll")
$name = $($folder.Name.Split(".")[-1])

foreach ($platform in $platforms)
{
Write-Output "Platform: $platform"
# Version
$json = Get-Content -Path (Join-Path $folder.FullName "plugin.json") -Raw | ConvertFrom-Json
$version = $json.Version
Write-Output "Version: $version"

# Build
dotnet build -c Release /p:TF_BUILD=true /p:Platform=$platform
# Platforms
[xml]$csproj = Get-Content -Path (Join-Path $folder.FullName "*.csproj")
$targetFramework = $csproj.Project.PropertyGroup.TargetFramework
$platforms = "$($csproj.Project.PropertyGroup.Platforms)".Trim() -split ";"

if (!$?) {
# Build FAILED.
Exit $LastExitCode
}
foreach ($platform in $platforms)
{
Write-Output "Platform: $platform"

# Build
dotnet build $folder -c Release /p:TF_BUILD=true /p:Platform=$platform

$output = ".\bin\$platform\Release\net8.0-windows\"
$destination = ".\bin\$platform\$name"
$zip = ".\bin\$platform\$name-$version-$($platform.ToLower()).zip"
if (!$?) {
# Build FAILED.
Exit $LastExitCode
}

Copy-Item -Path $output -Destination $destination -Recurse -Exclude $dependencies
Compress-Archive -Path $destination -DestinationPath $zip
$output = "$folder\bin\$platform\Release\$targetFramework\"
$destination = "$folder\bin\$platform\$name"
$zip = "$folder\bin\$platform\$name-$version-$($platform.ToLower()).zip"

Copy-Item -Path $output -Destination $destination -Recurse -Exclude $dependencies
Compress-Archive -Path $destination -DestinationPath $zip
}
}
90 changes: 48 additions & 42 deletions samples/Community.PowerToys.Run.Plugin.Sample/releasenotes.ps1
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<#PSScriptInfo
.VERSION 0.0.0
.VERSION 0.87.0
.GUID d790e6d3-96c9-447b-9863-941da73870ea
.AUTHOR Henrik Lau Eriksson
.COMPANYNAME
Expand All @@ -16,10 +16,10 @@

<#
.Synopsis
Generate release notes snippets for the plugin.
Generate release notes snippets for the plugins.

.Description
Gathers information about the plugin and generates a markdown file with release notes snippets.
Gathers information about the plugins and generates a markdown file with release notes snippets.

.Example
.\releasenotes.ps1
Expand All @@ -28,24 +28,6 @@
https://github.com/hlaueriksson/Community.PowerToys.Run.Plugin.Templates
#>

# Name
$folder = Split-Path -Path $PWD -Leaf
$name = $folder.Split(".")[-1]

# Version, Website
$json = Get-Content -Path "plugin.json" -Raw | ConvertFrom-Json
$version = $json.Version
$website = $json.Website

# Platforms
[xml]$csproj = Get-Content -Path "*.csproj"
$platforms = "$($csproj.Project.PropertyGroup.Platforms)".Trim() -split ";"

# Output
$result = "releasenotes.md"

$files = Get-ChildItem -Path . -File -Include "$name-$version*.zip" -Recurse

function Write-Line {
param (
[string]$line
Expand All @@ -67,29 +49,53 @@ function Get-Platform {
}
}

# Output
$result = "releasenotes.md"

Set-Content -Path $result -Value ""

Write-Line "## $name"
Write-Line ""
Write-Line "| Platform | Filename | Downloads"
Write-Line "| --- | --- | ---"
foreach ($file in $files) {
$zip = $file.Name
$platform = Get-Platform $zip
$url = "$website/releases/download/v$version/$zip"
$badge = "https://img.shields.io/github/downloads/$($website.Replace('https://github.com/', ''))/v$version/$zip"

Write-Line "| ``$platform`` | [$zip]($url) | [![$zip]($badge)]($url)"
}
Write-Line ""
# Plugins
$folders = Get-ChildItem -Recurse -Filter "plugin.json" | Where-Object { $_.FullName -notlike "*\bin\*" } | ForEach-Object { $_.Directory } | Sort-Object -Unique

Write-Output "Doc:"
foreach ($folder in $folders) {
Write-Output "- $($folder.Name)"

$name = $($folder.Name.Split(".")[-1])

# Version, Website
$json = Get-Content -Path (Join-Path $folder.FullName "plugin.json") -Raw | ConvertFrom-Json
$version = $json.Version
$website = $json.Website

# Platforms
[xml]$csproj = Get-Content -Path (Join-Path $folder.FullName "*.csproj")
$platforms = "$($csproj.Project.PropertyGroup.Platforms)".Trim() -split ";"

Write-Line "### Installer Hashes"
Write-Line ""
Write-Line "| Filename | SHA256 Hash"
Write-Line "| --- | ---"
foreach ($file in $files) {
$zip = $file.Name
$hash = Get-FileHash $file -Algorithm SHA256 | Select-Object -ExpandProperty Hash
$files = Get-ChildItem -Path $folder -File -Include "$name-$version*.zip" -Recurse

Write-Line "| ``$zip`` | ``$hash``"
Write-Line "## $name"
Write-Line ""
Write-Line "| Platform | Filename | Downloads"
Write-Line "| --- | --- | ---"
foreach ($file in $files) {
$zip = $file.Name
$platform = Get-Platform $zip
$url = "$website/releases/download/v$version/$zip"
$badge = "https://img.shields.io/github/downloads/$($website.Replace('https://github.com/', ''))/v$version/$zip"

Write-Line "| ``$platform`` | [$zip]($url) | [![$zip]($badge)]($url)"
}
Write-Line ""

Write-Line "### Installer Hashes"
Write-Line ""
Write-Line "| Filename | SHA256 Hash"
Write-Line "| --- | ---"
foreach ($file in $files) {
$zip = $file.Name
$hash = Get-FileHash $file -Algorithm SHA256 | Select-Object -ExpandProperty Hash

Write-Line "| ``$zip`` | ``$hash``"
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0-windows</TargetFramework>
<TargetFramework>net9.0-windows</TargetFramework>
<UseWPF>true</UseWPF>
<Platforms>x64;ARM64</Platforms>
<PlatformTarget>$(Platform)</PlatformTarget>
Expand All @@ -20,35 +20,35 @@
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<IncludeBuildOutput>false</IncludeBuildOutput>
<NoWarn>$(NoWarn);NU5110;NU5111</NoWarn>
<NoWarn>NU5110;NU5111;NU5128;PKV0001</NoWarn>
</PropertyGroup>

<Import Project="../../Analyzers.props" />

<ItemGroup>
<None Include="..\..\icon.png" Pack="true" PackagePath="\" />
<None Include="..\..\README.md" Pack="true" PackagePath="\" />
<None Include="Community.PowerToys.Run.Plugin.Update.props" Pack="true" PackagePath="buildTransitive" />
<None Include="Community.PowerToys.Run.Plugin.Update.targets" Pack="true" PackagePath="buildTransitive" />
<None Include="update.dark.png" Pack="true" PackagePath="buildTransitive" />
<None Include="update.light.png" Pack="true" PackagePath="buildTransitive" />
<None Include="update.ps1" Pack="true" PackagePath="buildTransitive" />
<None Include="Community.PowerToys.Run.Plugin.Update.props" Pack="true" PackagePath="buildTransitive" />
<None Include="Community.PowerToys.Run.Plugin.Update.targets" Pack="true" PackagePath="buildTransitive" />
</ItemGroup>

<ItemGroup>
<None Include="bin\ARM64\Release\net8.0-windows\Community.PowerToys.Run.Plugin.Update.dll" Pack="true" PackagePath="lib/net8.0-windows7.0/ARM64/" />
<None Include="bin\ARM64\Release\net8.0-windows\Community.PowerToys.Run.Plugin.Update.pdb" Pack="true" PackagePath="lib/net8.0-windows7.0/ARM64/" />
<None Include="bin\ARM64\Release\net8.0-windows\Community.PowerToys.Run.Plugin.Update.xml" Pack="true" PackagePath="lib/net8.0-windows7.0/ARM64/" />
<None Include="bin\ARM64\Release\net9.0-windows\Community.PowerToys.Run.Plugin.Update.dll" Pack="true" PackagePath="runtimes\win-arm64\lib\net9.0" />
<None Include="bin\ARM64\Release\net9.0-windows\Community.PowerToys.Run.Plugin.Update.pdb" Pack="true" PackagePath="runtimes\win-arm64\lib\net9.0" />
<None Include="bin\ARM64\Release\net9.0-windows\Community.PowerToys.Run.Plugin.Update.xml" Pack="true" PackagePath="runtimes\win-arm64\lib\net9.0" />
</ItemGroup>

<ItemGroup>
<None Include="bin\x64\Release\net8.0-windows\Community.PowerToys.Run.Plugin.Update.dll" Pack="true" PackagePath="lib/net8.0-windows7.0/x64/" />
<None Include="bin\x64\Release\net8.0-windows\Community.PowerToys.Run.Plugin.Update.pdb" Pack="true" PackagePath="lib/net8.0-windows7.0/x64/" />
<None Include="bin\x64\Release\net8.0-windows\Community.PowerToys.Run.Plugin.Update.xml" Pack="true" PackagePath="lib/net8.0-windows7.0/x64/" />
<None Include="bin\x64\Release\net9.0-windows\Community.PowerToys.Run.Plugin.Update.dll" Pack="true" PackagePath="runtimes\win-x64\lib\net9.0" />
<None Include="bin\x64\Release\net9.0-windows\Community.PowerToys.Run.Plugin.Update.pdb" Pack="true" PackagePath="runtimes\win-x64\lib\net9.0" />
<None Include="bin\x64\Release\net9.0-windows\Community.PowerToys.Run.Plugin.Update.xml" Pack="true" PackagePath="runtimes\win-x64\lib\net9.0" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Community.PowerToys.Run.Plugin.Dependencies" Version="0.83.0" />
<PackageReference Include="Community.PowerToys.Run.Plugin.Dependencies" Version="0.87.1" />
</ItemGroup>

<ItemGroup>
Expand Down
Loading