Skip to content

Commit e993bba

Browse files
Add framework-dependent build support without .NET runtime
Co-authored-by: VictoriousRaptor <[email protected]>
1 parent 557f11b commit e993bba

File tree

4 files changed

+68
-15
lines changed

4 files changed

+68
-15
lines changed

.github/workflows/dotnet.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,14 @@ jobs:
6565
with:
6666
name: Flow Installer
6767
path: |
68-
Output\Packages\Flow-Launcher-*.exe
68+
Output\Packages\Flow-Launcher-Setup.exe
69+
compression-level: 0
70+
- name: Upload Framework-Dependent Setup
71+
uses: actions/upload-artifact@v6
72+
with:
73+
name: Flow Installer Framework-Dependent
74+
path: |
75+
Output\Packages\Flow-Launcher-Setup-FD.exe
6976
compression-level: 0
7077
- name: Upload Portable Version
7178
uses: actions/upload-artifact@v6
@@ -74,6 +81,13 @@ jobs:
7481
path: |
7582
Output\Packages\Flow-Launcher-Portable.zip
7683
compression-level: 0
84+
- name: Upload Framework-Dependent Portable Version
85+
uses: actions/upload-artifact@v6
86+
with:
87+
name: Portable Version Framework-Dependent
88+
path: |
89+
Output\Packages\Flow-Launcher-Portable-FD.zip
90+
compression-level: 0
7791
- name: Upload Full Nupkg
7892
uses: actions/upload-artifact@v6
7993
with:
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
https://go.microsoft.com/fwlink/?LinkID=208121.
4+
-->
5+
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
6+
<PropertyGroup>
7+
<PublishProtocol>FileSystem</PublishProtocol>
8+
<Configuration>Release</Configuration>
9+
<Platform>Any CPU</Platform>
10+
<TargetFramework>net9.0-windows10.0.19041.0</TargetFramework>
11+
<PublishDir>..\Output\Release-FD\</PublishDir>
12+
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
13+
<SelfContained>false</SelfContained>
14+
<PublishSingleFile>False</PublishSingleFile>
15+
<PublishReadyToRun>False</PublishReadyToRun>
16+
<PublishTrimmed>False</PublishTrimmed>
17+
</PropertyGroup>
18+
</Project>

Scripts/post_build.ps1

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -61,18 +61,17 @@ function Validate-Directory ($output) {
6161
}
6262

6363

64-
function Pack-Squirrel-Installer ($path, $version, $output) {
64+
function Pack-Squirrel-Installer ($path, $version, $output, $inputPath = "$path\Output\Release", $suffix = "") {
6565
# msbuild based installer generation is not working in appveyor, not sure why
6666
Write-Host "Begin pack squirrel installer"
6767

6868
$spec = "$path\Scripts\flowlauncher.nuspec"
69-
$input = "$path\Output\Release"
7069

7170
Write-Host "Packing: $spec"
72-
Write-Host "Input path: $input"
71+
Write-Host "Input path: $inputPath"
7372

7473
# dotnet pack is not used because ran into issues, need to test installation and starting up if to use it.
75-
nuget pack $spec -Version $version -BasePath $input -OutputDirectory $output -Properties Configuration=Release
74+
nuget pack $spec -Version $version -BasePath $inputPath -OutputDirectory $output -Properties Configuration=Release
7675

7776
$nupkg = "$output\FlowLauncher.$version.nupkg"
7877
Write-Host "nupkg path: $nupkg"
@@ -82,13 +81,13 @@ function Pack-Squirrel-Installer ($path, $version, $output) {
8281
New-Alias Squirrel $env:USERPROFILE\.nuget\packages\squirrel.windows\1.9.0\tools\Squirrel.exe -Force
8382
# why we need Write-Output: https://github.com/Squirrel/Squirrel.Windows/issues/489#issuecomment-156039327
8483
# directory of releaseDir in squirrel can't be same as directory ($nupkg) in releasify
85-
$temp = "$output\Temp"
84+
$temp = "$output\Temp$suffix"
8685

8786
Squirrel --releasify $nupkg --releaseDir $temp --setupIcon $icon --no-msi | Write-Output
8887
Move-Item $temp\* $output -Force
8988
Remove-Item $temp
9089

91-
$file = "$output\Flow-Launcher-Setup.exe"
90+
$file = "$output\Flow-Launcher-Setup$suffix.exe"
9291
Write-Host "Filename: $file"
9392

9493
Move-Item "$output\Setup.exe" $file -Force
@@ -106,11 +105,22 @@ function Publish-Self-Contained ($p) {
106105
dotnet publish -c Release $csproj /p:PublishProfile=$profile
107106
}
108107

109-
function Publish-Portable ($outputLocation, $version) {
108+
function Publish-Framework-Dependent ($p) {
110109

111-
& $outputLocation\Flow-Launcher-Setup.exe --silent | Out-Null
110+
$csproj = Join-Path "$p" "Flow.Launcher/Flow.Launcher.csproj" -Resolve
111+
$profile = Join-Path "$p" "Flow.Launcher/Properties/PublishProfiles/Net9.0-FrameworkDependent.pubxml" -Resolve
112+
113+
# we call dotnet publish on the main project.
114+
# The other projects should have been built in Release at this point.
115+
dotnet publish -c Release $csproj /p:PublishProfile=$profile
116+
}
117+
118+
function Publish-Portable ($outputLocation, $version, $suffix = "") {
119+
120+
& "$outputLocation\Flow-Launcher-Setup$suffix.exe" --silent | Out-Null
112121
mkdir "$env:LocalAppData\FlowLauncher\app-$version\UserData"
113-
Compress-Archive -Path $env:LocalAppData\FlowLauncher -DestinationPath $outputLocation\Flow-Launcher-Portable.zip
122+
Compress-Archive -Path $env:LocalAppData\FlowLauncher -DestinationPath "$outputLocation\Flow-Launcher-Portable$suffix.zip" -Force
123+
Remove-Item "$env:LocalAppData\FlowLauncher" -Recurse -Force
114124
}
115125

116126
function Main {
@@ -122,15 +132,22 @@ function Main {
122132

123133
Delete-Unused $p $config
124134

135+
# Build self-contained version (includes .NET runtime)
136+
Write-Host "Building self-contained version..."
125137
Publish-Self-Contained $p
126-
127138
Remove-CreateDumpExe $p $config
128139

129140
$o = "$p\Output\Packages"
130141
Validate-Directory $o
131142
Pack-Squirrel-Installer $p $v $o
132-
133143
Publish-Portable $o $v
144+
145+
# Build framework-dependent version (requires .NET runtime to be installed)
146+
Write-Host "Building framework-dependent version..."
147+
Publish-Framework-Dependent $p
148+
Remove-CreateDumpExe $p "Release-FD"
149+
Pack-Squirrel-Installer $p $v $o "$p\Output\Release-FD" "-FD"
150+
Publish-Portable $o $v "-FD"
134151
}
135152
}
136153

appveyor.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,14 @@ after_test:
4949
artifacts:
5050
- path: 'Output\Release\Flow.Launcher.Plugin.*.nupkg'
5151
name: Plugin nupkg
52-
- path: 'Output\Packages\Flow-Launcher-*.exe'
52+
- path: 'Output\Packages\Flow-Launcher-Setup.exe'
5353
name: Squirrel Installer
54+
- path: 'Output\Packages\Flow-Launcher-Setup-FD.exe'
55+
name: Squirrel Installer Framework-Dependent
5456
- path: Output\Packages\Flow-Launcher-Portable.zip
5557
name: Portable Version
58+
- path: Output\Packages\Flow-Launcher-Portable-FD.zip
59+
name: Portable Version Framework-Dependent
5660
- path: 'Output\Packages\FlowLauncher-*-full.nupkg'
5761
name: Squirrel nupkg
5862
- path: 'Output\Packages\RELEASES'
@@ -82,7 +86,7 @@ deploy:
8286
Please report any bugs or issues over at the [main repository](https://github.com/Flow-Launcher/Flow.Launcher/issues)'
8387
auth_token:
8488
secure: ij4UeXUYQBDJxn2YRAAhUOjklOGVKDB87Hn5J8tKIzj13yatoI7sLM666QDQFEgv
85-
artifact: Squirrel Installer, Portable Version, Squirrel nupkg, Squirrel RELEASES
89+
artifact: Squirrel Installer, Squirrel Installer Framework-Dependent, Portable Version, Portable Version Framework-Dependent, Squirrel nupkg, Squirrel RELEASES
8690
force_update: true
8791
on:
8892
branch: dev
@@ -91,7 +95,7 @@ deploy:
9195
release: v$(flowVersion)
9296
auth_token:
9397
secure: ij4UeXUYQBDJxn2YRAAhUOjklOGVKDB87Hn5J8tKIzj13yatoI7sLM666QDQFEgv
94-
artifact: Squirrel Installer, Portable Version, Squirrel nupkg, Squirrel RELEASES
98+
artifact: Squirrel Installer, Squirrel Installer Framework-Dependent, Portable Version, Portable Version Framework-Dependent, Squirrel nupkg, Squirrel RELEASES
9599
draft: true
96100
force_update: true
97101
on:

0 commit comments

Comments
 (0)