From 8020ded64288641620c14bf1426f81140548805b Mon Sep 17 00:00:00 2001 From: Michael Bucari-Tovo Date: Sat, 30 Jul 2022 13:42:11 -0600 Subject: [PATCH] Add platform preprocessor definitions --- Source/AppScaffolding/AppScaffolding.csproj | 7 +++++++ Source/AppScaffolding/LibationScaffolding.cs | 13 ++++++++++++- .../PublishProfiles/WindowsProfile.pubxml | 1 + .../Properties/PublishProfiles/LinuxProfile.pubxml | 2 +- .../Properties/PublishProfiles/MacOSProfile.pubxml | 2 +- .../PublishProfiles/WindowsProfile.pubxml | 3 +-- .../Views/MainWindow/MainWindow.axaml.cs | 8 ++++++-- Source/LibationCli/LibationCli.csproj | 3 +-- .../Properties/PublishProfiles/LinuxProfile.pubxml | 2 +- .../Properties/PublishProfiles/MacOSProfile.pubxml | 2 +- .../PublishProfiles/WindowsProfile.pubxml | 2 +- 11 files changed, 33 insertions(+), 12 deletions(-) diff --git a/Source/AppScaffolding/AppScaffolding.csproj b/Source/AppScaffolding/AppScaffolding.csproj index 91ae4d61..06e37351 100644 --- a/Source/AppScaffolding/AppScaffolding.csproj +++ b/Source/AppScaffolding/AppScaffolding.csproj @@ -11,6 +11,13 @@ + + + $(DefineConstants);WINDOWS + $(DefineConstants);LINUX + $(DefineConstants);MACOS + + embedded diff --git a/Source/AppScaffolding/LibationScaffolding.cs b/Source/AppScaffolding/LibationScaffolding.cs index 825df95e..56f6e781 100644 --- a/Source/AppScaffolding/LibationScaffolding.cs +++ b/Source/AppScaffolding/LibationScaffolding.cs @@ -17,6 +17,7 @@ namespace AppScaffolding public enum ReleaseIdentifier { + None, WindowsClassic, WindowsAvalonia, LinuxAvalonia, @@ -289,13 +290,23 @@ namespace AppScaffolding if (System.Diagnostics.Debugger.IsAttached) mode += " (Debugger attached)"; +#if MACOS + var os = "MacOS"; +#elif LINUX + var os = "Linux"; +#else + var os = "Windows"; +#endif + + // begin logging session with a form feed Log.Logger.Information("\r\n\f"); Log.Logger.Information("Begin. {@DebugInfo}", new { AppName = EntryAssembly.GetName().Name, - ReleaseIdentifier = ReleaseIdentifier, Version = BuildVersion.ToString(), + ReleaseIdentifier = ReleaseIdentifier, + OS = os, Mode = mode, LogLevel_Verbose_Enabled = Log.Logger.IsVerboseEnabled(), LogLevel_Debug_Enabled = Log.Logger.IsDebugEnabled(), diff --git a/Source/Hangover/Properties/PublishProfiles/WindowsProfile.pubxml b/Source/Hangover/Properties/PublishProfiles/WindowsProfile.pubxml index 796e806b..bdb7559e 100644 --- a/Source/Hangover/Properties/PublishProfiles/WindowsProfile.pubxml +++ b/Source/Hangover/Properties/PublishProfiles/WindowsProfile.pubxml @@ -12,5 +12,6 @@ https://go.microsoft.com/fwlink/?LinkID=208121. win-x64 true false + false \ No newline at end of file diff --git a/Source/LibationAvalonia/Properties/PublishProfiles/LinuxProfile.pubxml b/Source/LibationAvalonia/Properties/PublishProfiles/LinuxProfile.pubxml index 4f12172b..a846a327 100644 --- a/Source/LibationAvalonia/Properties/PublishProfiles/LinuxProfile.pubxml +++ b/Source/LibationAvalonia/Properties/PublishProfiles/LinuxProfile.pubxml @@ -6,7 +6,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121. Release Any CPU - ..\bin-Avalonia\publish\linux-x64\ + ..\bin\Release\linux-chardonnay FileSystem net6.0 linux-x64 diff --git a/Source/LibationAvalonia/Properties/PublishProfiles/MacOSProfile.pubxml b/Source/LibationAvalonia/Properties/PublishProfiles/MacOSProfile.pubxml index 2fc8471a..5d1e98f9 100644 --- a/Source/LibationAvalonia/Properties/PublishProfiles/MacOSProfile.pubxml +++ b/Source/LibationAvalonia/Properties/PublishProfiles/MacOSProfile.pubxml @@ -6,7 +6,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121. Release Any CPU - ..\bin-Avalonia\publish\osx-x64\ + ..\bin\Release\macos-chardonnay FileSystem net6.0 osx-x64 diff --git a/Source/LibationAvalonia/Properties/PublishProfiles/WindowsProfile.pubxml b/Source/LibationAvalonia/Properties/PublishProfiles/WindowsProfile.pubxml index 34da8075..1490c0a5 100644 --- a/Source/LibationAvalonia/Properties/PublishProfiles/WindowsProfile.pubxml +++ b/Source/LibationAvalonia/Properties/PublishProfiles/WindowsProfile.pubxml @@ -6,8 +6,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121. Release Any CPU - - ..\bin\publish\win-avalonia-x64\ + ..\bin\Release\win-chardonnay FileSystem net6.0 win-x64 diff --git a/Source/LibationAvalonia/Views/MainWindow/MainWindow.axaml.cs b/Source/LibationAvalonia/Views/MainWindow/MainWindow.axaml.cs index 611220d1..e1bc1879 100644 --- a/Source/LibationAvalonia/Views/MainWindow/MainWindow.axaml.cs +++ b/Source/LibationAvalonia/Views/MainWindow/MainWindow.axaml.cs @@ -70,7 +70,7 @@ namespace LibationAvalonia.Views #if !DEBUG //This is temporaty until we have a solution for linux/mac so that //Libation doesn't download a zip every time it runs. - if (App.IsUnix) + if (!App.IsWindows) return; try @@ -89,7 +89,11 @@ namespace LibationAvalonia.Views { runWindowsUpgrader(zipFile); } - else if (App.IsUnix) + else if (App.IsLinux) + { + + } + else if (App.IsMacOs) { } diff --git a/Source/LibationCli/LibationCli.csproj b/Source/LibationCli/LibationCli.csproj index 9aa6ab5f..25cad950 100644 --- a/Source/LibationCli/LibationCli.csproj +++ b/Source/LibationCli/LibationCli.csproj @@ -5,7 +5,6 @@ Exe net6.0 true - win-x64 false false True @@ -30,7 +29,7 @@ bottom: manually check LibationCli edit debug and release output paths - --> + --> ..\bin\Debug embedded diff --git a/Source/LibationCli/Properties/PublishProfiles/LinuxProfile.pubxml b/Source/LibationCli/Properties/PublishProfiles/LinuxProfile.pubxml index 4f12172b..a846a327 100644 --- a/Source/LibationCli/Properties/PublishProfiles/LinuxProfile.pubxml +++ b/Source/LibationCli/Properties/PublishProfiles/LinuxProfile.pubxml @@ -6,7 +6,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121. Release Any CPU - ..\bin-Avalonia\publish\linux-x64\ + ..\bin\Release\linux-chardonnay FileSystem net6.0 linux-x64 diff --git a/Source/LibationCli/Properties/PublishProfiles/MacOSProfile.pubxml b/Source/LibationCli/Properties/PublishProfiles/MacOSProfile.pubxml index 2fc8471a..5d1e98f9 100644 --- a/Source/LibationCli/Properties/PublishProfiles/MacOSProfile.pubxml +++ b/Source/LibationCli/Properties/PublishProfiles/MacOSProfile.pubxml @@ -6,7 +6,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121. Release Any CPU - ..\bin-Avalonia\publish\osx-x64\ + ..\bin\Release\macos-chardonnay FileSystem net6.0 osx-x64 diff --git a/Source/LibationCli/Properties/PublishProfiles/WindowsProfile.pubxml b/Source/LibationCli/Properties/PublishProfiles/WindowsProfile.pubxml index 257cfc2b..1490c0a5 100644 --- a/Source/LibationCli/Properties/PublishProfiles/WindowsProfile.pubxml +++ b/Source/LibationCli/Properties/PublishProfiles/WindowsProfile.pubxml @@ -6,7 +6,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121. Release Any CPU - ..\bin\publish\ + ..\bin\Release\win-chardonnay FileSystem net6.0 win-x64