Skip to content

Commit

Permalink
Fix trimmed publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
NicoVIII committed Mar 8, 2024
1 parent 26a4eff commit aae0054
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 11 deletions.
15 changes: 7 additions & 8 deletions run.fs
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,11 @@ module DotNet =
"-o"
outDir
"--self-contained"
"/p:PublishSingleFile=true"
"/p:PublishTrimmed=true"
"/p:EnableCompressionInSingleFile=true"
"/p:IncludeNativeLibrariesForSelfExtract=true"
"/p:DebugType=None"
$"/p:Version=%s{version}"
"-p:PublishSingleFile=true"
"-p:EnableCompressionInSingleFile=true"
"-p:IncludeNativeLibrariesForSelfExtract=true"
"-p:DebugType=None"
$"-p:Version=%s{version}"
project
]

Expand Down Expand Up @@ -91,13 +90,13 @@ module Task =
"-r"
"linux-x64"
"--self-contained"
"-p:PublishTrimmed=true"
"-p:DebugType=None"
$"/p:Version=%s{version}"
$"-p:Version=%s{version}"
Config.mainProject
]

Shell.mkdir "AppDir/usr"
Shell.cleanDir "AppDir/usr"

Shell.mv
$"src/Andromeda/AvaloniaApp/bin/Release/{Config.framework}/linux-x64/publish"
Expand Down
2 changes: 2 additions & 0 deletions src/Andromeda/AvaloniaApp/Andromeda.AvaloniaApp.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@
</PropertyGroup>
<PropertyGroup>
<Version>0</Version>
<PublishTrimmed>true</PublishTrimmed>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="../Core/Andromeda.Core.fsproj" />
<TrimmerRootDescriptor Include="Roots.xml" />
</ItemGroup>

<ItemGroup>
Expand Down
4 changes: 1 addition & 3 deletions src/Andromeda/AvaloniaApp/Program.fs
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,12 @@ open Andromeda.Core
open Elmish
open GogApi

open System
open Avalonia
open Avalonia.Controls
open Avalonia.Controls.ApplicationLifetimes
open Avalonia.FuncUI
open Avalonia.FuncUI.Hosts
open Avalonia.FuncUI.Elmish
open Avalonia.Markup.Xaml.Styling
open Avalonia.Themes.Simple

open Andromeda.AvaloniaApp
Expand Down Expand Up @@ -59,8 +57,8 @@ module Program =

override this.Initialize() =
this.Styles.Add(new SimpleTheme())
this.Styles.Load "avares://Andromeda.AvaloniaApp/Styles.xaml"
this.RequestedThemeVariant <- Styling.ThemeVariant.Dark
this.Styles.Load "avares://Andromeda.AvaloniaApp/Styles.xaml"

override this.OnFrameworkInitializationCompleted() =
match this.ApplicationLifetime with
Expand Down
11 changes: 11 additions & 0 deletions src/Andromeda/AvaloniaApp/Roots.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<linker>
<!-- We need this, because our styles have to be compiled -->
<assembly fullname="Andromeda.AvaloniaApp">
<type fullname="CompiledAvaloniaXaml.!XamlLoader">
<method name="TryLoad" />
</type>
</assembly>
<!-- This stuff uses reflection internally, those have to add support for trimming -->
<assembly fullname="TypedPersistence.Json"/>
<assembly fullname="GogApi"/>
</linker>

0 comments on commit aae0054

Please sign in to comment.