Skip to content

Commit 15162e4

Browse files
committed
Fix AOT linking and fix app version access on Linux and bump version
1 parent d43089d commit 15162e4

File tree

3 files changed

+22
-21
lines changed

3 files changed

+22
-21
lines changed

Caly.Core/Utilities/CalyExtensions.cs

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
using System.Collections;
2323
using System.Collections.ObjectModel;
2424
using System.Diagnostics;
25+
using System.Reflection;
2526
using System.Runtime.InteropServices;
2627
using Avalonia;
2728
using Avalonia.Controls;
@@ -30,22 +31,25 @@ namespace Caly.Core.Utilities
3031
{
3132
internal static class CalyExtensions
3233
{
33-
private static readonly int[] _versionParts = new int[4];
34-
34+
public static readonly string CalyVersion;
35+
3536
static CalyExtensions()
3637
{
37-
var assemblyName = Process.GetCurrentProcess().MainModule.FileName;
38-
FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(assemblyName);
39-
40-
_versionParts[0] = fvi.ProductMajorPart;
41-
_versionParts[1] = fvi.ProductMinorPart;
42-
_versionParts[2] = fvi.ProductBuildPart;
43-
_versionParts[3] = fvi.ProductPrivatePart;
44-
}
38+
var assembly = Assembly.GetEntryAssembly();
39+
if (assembly is null)
40+
{
41+
assembly = Assembly.GetExecutingAssembly();
42+
}
4543

46-
public static string GetCalyVersion()
47-
{
48-
return string.Join('.', _versionParts);
44+
string? version = assembly.GetName().Version?.ToString().Trim();
45+
if (!string.IsNullOrEmpty(version))
46+
{
47+
CalyVersion = version;
48+
}
49+
else
50+
{
51+
CalyVersion = @"n/a";
52+
}
4953
}
5054

5155
public static bool IsMobilePlatform()

Caly.Core/ViewModels/MainViewModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public sealed partial class MainViewModel : ViewModelBase
4848

4949
[ObservableProperty] private bool _isPaneOpen;
5050

51-
[ObservableProperty] private string _version = CalyExtensions.GetCalyVersion();
51+
public string Version => CalyExtensions.CalyVersion;
5252

5353
partial void OnSelectedDocumentIndexChanged(int oldValue, int newValue)
5454
{

Caly.Desktop/Caly.Desktop.csproj

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<BuiltInComInteropSupport>true</BuiltInComInteropSupport>
99
<ApplicationManifest>app.manifest</ApplicationManifest>
1010
<AssemblyName>Caly</AssemblyName>
11-
<Version>0.0.1</Version>
11+
<Version>0.1.0.0</Version>
1212
<JsonSerializerIsReflectionEnabledByDefault>false</JsonSerializerIsReflectionEnabledByDefault>
1313
</PropertyGroup>
1414

@@ -17,14 +17,13 @@
1717
<!--https://learn.microsoft.com/en-us/dotnet/core/deploying/trimming/trimming-options?pivots=dotnet-8-0-->
1818

1919
<ItemGroup>
20-
<DirectPInvoke Include="libSkiaSharp" />
20+
<DirectPInvoke Include="libSkiaSharp" Condition="$(RuntimeIdentifier.StartsWith('win'))" />
2121
<NativeLibrary Include="..\native\skia.lib" Condition="$(RuntimeIdentifier.StartsWith('win'))" />
2222
<NativeLibrary Include="..\native\SkiaSharp.lib" Condition="$(RuntimeIdentifier.StartsWith('win'))" />
23-
<NativeLibrary Include="TBD.a" Condition="!$(RuntimeIdentifier.StartsWith('win'))" />
23+
<!--<NativeLibrary Include="TBD.a" Condition="!$(RuntimeIdentifier.StartsWith('win'))" />-->
2424

25-
<DirectPInvoke Include="libHarfBuzzSharp" />
25+
<DirectPInvoke Include="libHarfBuzzSharp" Condition="$(RuntimeIdentifier.StartsWith('win'))" />
2626
<NativeLibrary Include="..\native\libHarfBuzzSharp.lib" Condition="$(RuntimeIdentifier.StartsWith('win'))" />
27-
<NativeLibrary Include="TBD.a" Condition="!$(RuntimeIdentifier.StartsWith('win'))" />
2827
</ItemGroup>
2928

3029
<PropertyGroup Condition="'$(Configuration)'=='Release'">
@@ -48,13 +47,11 @@
4847

4948
<StripSymbols>true</StripSymbols>
5049

51-
<!--
5250
<XmlResolverIsNetworkingEnabledByDefault>false</XmlResolverIsNetworkingEnabledByDefault>
5351
<UseSystemResourceKeys>true</UseSystemResourceKeys>
5452
<DebuggerSupport>false</DebuggerSupport>
5553
<TrimmerRemoveSymbols>true</TrimmerRemoveSymbols>
5654
<StackTraceSupport>false</StackTraceSupport>
57-
-->
5855
</PropertyGroup>
5956

6057
<PropertyGroup>

0 commit comments

Comments
 (0)