From 11dad1cd0f736783030ac233e01d873cb6eb63ee Mon Sep 17 00:00:00 2001 From: Patrik Svensson Date: Sun, 14 Oct 2018 13:39:21 +0200 Subject: [PATCH] (build) Fixes AppX packaging Also don't run update service under UWP mode. --- build.cake | 18 +++++++ build.ps1 | 4 +- .../Indexing/FileIndexer.cs | 5 ++ .../Threading/IBackgroundWorker.cs | 1 + src/Jarvis.Package/Jarvis.Package.wapproj | 20 ++----- .../Jarvis.Package_TemporaryKey.pfx | Bin 2512 -> 2568 bytes src/Jarvis.Package/Package.appxmanifest | 6 +-- src/Jarvis.sln | 24 ++++----- src/Jarvis/Bootstrapping/JarvisModule.cs | 3 +- .../Infrastructure/Utilities/UwpUtility.cs | 50 ++++++++++++++++++ src/Jarvis/Jarvis.csproj | 5 +- src/Jarvis/Services/ApplicationService.cs | 5 ++ src/Jarvis/Services/ServiceOrchestrator.cs | 6 +++ src/Jarvis/Services/UpdateService.cs | 9 +++- ...iewModel.cs => UpdateSettingsViewModel.cs} | 4 +- src/Jarvis/ViewModels/SettingsViewModel.cs | 14 ++++- ...tingsView.xaml => UpdateSettingsView.xaml} | 2 +- src/SharedAssemblyInfo.cs | 6 +-- 18 files changed, 135 insertions(+), 47 deletions(-) create mode 100644 src/Jarvis/Infrastructure/Utilities/UwpUtility.cs rename src/Jarvis/ViewModels/Settings/{GeneralSettingsViewModel.cs => UpdateSettingsViewModel.cs} (90%) rename src/Jarvis/Views/Settings/{GeneralSettingsView.xaml => UpdateSettingsView.xaml} (90%) diff --git a/build.cake b/build.cake index 4e0480d..f1e0aab 100644 --- a/build.cake +++ b/build.cake @@ -32,6 +32,7 @@ Task("Clean") { CleanDirectory("./.artifacts"); CleanDirectory("./.artifacts/bin"); + CleanDirectory("./.artifacts/appx"); CleanDirectory("./.artifacts/installer"); CleanDirectory("./.artifacts/installer/bin"); }); @@ -58,12 +59,28 @@ Task("Patch-Version") }); }); +Task("Patch-AppX-Info") + .WithCriteria(() => patch) + .Does(() => +{ + var manifest = File("./src/Jarvis.Package/Package.appxmanifest"); + var settings = new XmlPokeSettings + { + Namespaces = {{ "c", "http://schemas.microsoft.com/appx/manifest/foundation/windows10" }} + }; + + XmlPoke(manifest, "c:Package/c:Identity/@Version", $"{version.MsiVersion}.0", settings); +}); + Task("Build") .IsDependentOn("Restore") .IsDependentOn("Patch-Version") + .IsDependentOn("Patch-AppX-Info") .Does(() => { MSBuild("./src/Jarvis.sln", new MSBuildSettings() + .WithProperty("AppxBundlePlatforms", "neutral") + .WithProperty("AppxBundle", "Always") .SetConfiguration(configuration) .SetVerbosity(Verbosity.Minimal)); }); @@ -81,6 +98,7 @@ Task("Copy-Binaries") { CopyFiles($"./src/Jarvis/bin/{configuration}/*", "./.artifacts/bin"); CopyFiles($"./src/Jarvis/bin/{configuration}/*", "./.artifacts/installer/bin"); + CopyFiles($"./src/Jarvis.Package/AppPackages/Jarvis.Package_{version.MsiVersion}.0_*/**/*", "./.artifacts/appx"); DeleteFiles("./.artifacts/installer/bin/*.xml"); DeleteFiles("./.artifacts/installer/bin/*.pdb"); diff --git a/build.ps1 b/build.ps1 index ab5a17e..7c792c0 100644 --- a/build.ps1 +++ b/build.ps1 @@ -2,7 +2,7 @@ $ENV:CAKE_NUGET_USEINPROCESSCLIENT='true' $ToolPath = Join-Path $PSScriptRoot "tools" $NugetPath = Join-Path $ToolPath "nuget.exe" $NugetUrl = "https://dist.nuget.org/win-x86-commandline/latest/nuget.exe" -$CakeVersion = "0.25.0" +$CakeVersion = "0.30.0" # Make sure tools folder exists $PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent @@ -29,9 +29,7 @@ Function Unzip [System.IO.Compression.ZipFile]::ExtractToDirectory($zipfile, $outpath) } - # Make sure Cake has been installed. -#https://www.nuget.org/api/v2/package $NugetFeed = 'https://www.myget.org/F/cake/api/v2/package' $CakePath = Join-Path $ToolPath "cake.$CakeVersion/Cake.exe" diff --git a/src/Jarvis.Addin.Files/Indexing/FileIndexer.cs b/src/Jarvis.Addin.Files/Indexing/FileIndexer.cs index a0e8693..2701012 100644 --- a/src/Jarvis.Addin.Files/Indexing/FileIndexer.cs +++ b/src/Jarvis.Addin.Files/Indexing/FileIndexer.cs @@ -45,6 +45,11 @@ public FileIndexer(IEventAggregator events, IEnumerable source events.Subscribe(this); } + public bool Enabled() + { + return true; + } + public Task Run(CancellationToken token) { return Task.Run(() => diff --git a/src/Jarvis.Core/Threading/IBackgroundWorker.cs b/src/Jarvis.Core/Threading/IBackgroundWorker.cs index aeedc92..cb5d0fe 100644 --- a/src/Jarvis.Core/Threading/IBackgroundWorker.cs +++ b/src/Jarvis.Core/Threading/IBackgroundWorker.cs @@ -10,6 +10,7 @@ namespace Jarvis.Core.Threading public interface IBackgroundWorker { string Name { get; } + bool Enabled(); Task Run(CancellationToken token); } } \ No newline at end of file diff --git a/src/Jarvis.Package/Jarvis.Package.wapproj b/src/Jarvis.Package/Jarvis.Package.wapproj index 2382775..520d78b 100644 --- a/src/Jarvis.Package/Jarvis.Package.wapproj +++ b/src/Jarvis.Package/Jarvis.Package.wapproj @@ -1,25 +1,10 @@ - + 15.0 + neutral - - Debug - x86 - - - Release - x86 - - - Debug - x64 - - - Release - x64 - Debug AnyCPU @@ -40,6 +25,7 @@ en-US Jarvis.Package_TemporaryKey.pfx ..\Jarvis\Jarvis.csproj + E018FA042C858503529CA2F55A2CF3B1BB569312 diff --git a/src/Jarvis.Package/Jarvis.Package_TemporaryKey.pfx b/src/Jarvis.Package/Jarvis.Package_TemporaryKey.pfx index a0de7b7f294bb3be09f98ec07578396877167e46..fc5eed4d7adca2c3033b9791fb4624089e7b2b55 100644 GIT binary patch delta 2381 zcmV-T39|Ok6NnTdFoFsM0s#Xsf(gI|2`Yw2hW8Bt2LYgh39$r%39T@K38|4HMt@1G zMR(7DkSPKJ2haq91lZ{u)X4N2xJ~EW@1V@OVewicn3~s6SM}h>jq~;vfD+@B=B5Yy zAR*yp)M_M5>$2uuzqyjq^F4!ULTp)WK+fqbQOApmG5lO^qqy93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ectreSystems + Jarvis - Your robotic butler + Spectre Systems AB Images\StoreLogo.png diff --git a/src/Jarvis.sln b/src/Jarvis.sln index 18b7768..63cdc7d 100644 --- a/src/Jarvis.sln +++ b/src/Jarvis.sln @@ -104,21 +104,21 @@ Global {121A7682-EDCA-4031-B9BF-3B01EA6675DD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {121A7682-EDCA-4031-B9BF-3B01EA6675DD}.Debug|Any CPU.Build.0 = Debug|Any CPU {121A7682-EDCA-4031-B9BF-3B01EA6675DD}.Debug|Any CPU.Deploy.0 = Debug|Any CPU - {121A7682-EDCA-4031-B9BF-3B01EA6675DD}.Debug|x64.ActiveCfg = Debug|x64 - {121A7682-EDCA-4031-B9BF-3B01EA6675DD}.Debug|x64.Build.0 = Debug|x64 - {121A7682-EDCA-4031-B9BF-3B01EA6675DD}.Debug|x64.Deploy.0 = Debug|x64 - {121A7682-EDCA-4031-B9BF-3B01EA6675DD}.Debug|x86.ActiveCfg = Debug|x86 - {121A7682-EDCA-4031-B9BF-3B01EA6675DD}.Debug|x86.Build.0 = Debug|x86 - {121A7682-EDCA-4031-B9BF-3B01EA6675DD}.Debug|x86.Deploy.0 = Debug|x86 + {121A7682-EDCA-4031-B9BF-3B01EA6675DD}.Debug|x64.ActiveCfg = Debug|Any CPU + {121A7682-EDCA-4031-B9BF-3B01EA6675DD}.Debug|x64.Build.0 = Debug|Any CPU + {121A7682-EDCA-4031-B9BF-3B01EA6675DD}.Debug|x64.Deploy.0 = Debug|Any CPU + {121A7682-EDCA-4031-B9BF-3B01EA6675DD}.Debug|x86.ActiveCfg = Debug|Any CPU + {121A7682-EDCA-4031-B9BF-3B01EA6675DD}.Debug|x86.Build.0 = Debug|Any CPU + {121A7682-EDCA-4031-B9BF-3B01EA6675DD}.Debug|x86.Deploy.0 = Debug|Any CPU {121A7682-EDCA-4031-B9BF-3B01EA6675DD}.Release|Any CPU.ActiveCfg = Release|Any CPU {121A7682-EDCA-4031-B9BF-3B01EA6675DD}.Release|Any CPU.Build.0 = Release|Any CPU {121A7682-EDCA-4031-B9BF-3B01EA6675DD}.Release|Any CPU.Deploy.0 = Release|Any CPU - {121A7682-EDCA-4031-B9BF-3B01EA6675DD}.Release|x64.ActiveCfg = Release|x64 - {121A7682-EDCA-4031-B9BF-3B01EA6675DD}.Release|x64.Build.0 = Release|x64 - {121A7682-EDCA-4031-B9BF-3B01EA6675DD}.Release|x64.Deploy.0 = Release|x64 - {121A7682-EDCA-4031-B9BF-3B01EA6675DD}.Release|x86.ActiveCfg = Release|x86 - {121A7682-EDCA-4031-B9BF-3B01EA6675DD}.Release|x86.Build.0 = Release|x86 - {121A7682-EDCA-4031-B9BF-3B01EA6675DD}.Release|x86.Deploy.0 = Release|x86 + {121A7682-EDCA-4031-B9BF-3B01EA6675DD}.Release|x64.ActiveCfg = Release|Any CPU + {121A7682-EDCA-4031-B9BF-3B01EA6675DD}.Release|x64.Build.0 = Release|Any CPU + {121A7682-EDCA-4031-B9BF-3B01EA6675DD}.Release|x64.Deploy.0 = Release|Any CPU + {121A7682-EDCA-4031-B9BF-3B01EA6675DD}.Release|x86.ActiveCfg = Release|Any CPU + {121A7682-EDCA-4031-B9BF-3B01EA6675DD}.Release|x86.Build.0 = Release|Any CPU + {121A7682-EDCA-4031-B9BF-3B01EA6675DD}.Release|x86.Deploy.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/Jarvis/Bootstrapping/JarvisModule.cs b/src/Jarvis/Bootstrapping/JarvisModule.cs index bfdd864..33babf7 100644 --- a/src/Jarvis/Bootstrapping/JarvisModule.cs +++ b/src/Jarvis/Bootstrapping/JarvisModule.cs @@ -9,6 +9,7 @@ using Jarvis.Bootstrapping.Seeding; using Jarvis.Core; using Jarvis.Core.Threading; +using Jarvis.Infrastructure.Utilities; using Jarvis.Services; using Jarvis.ViewModels; using Spectre.System.IO; @@ -27,7 +28,7 @@ protected override void Load(ContainerBuilder builder) // Core builder.RegisterType().As().SingleInstance(); - // Background services. + // Background services builder.RegisterType().SingleInstance(); builder.RegisterType().As().SingleInstance(); diff --git a/src/Jarvis/Infrastructure/Utilities/UwpUtility.cs b/src/Jarvis/Infrastructure/Utilities/UwpUtility.cs new file mode 100644 index 0000000..f715c55 --- /dev/null +++ b/src/Jarvis/Infrastructure/Utilities/UwpUtility.cs @@ -0,0 +1,50 @@ +// Licensed to Spectre Systems AB under one or more agreements. +// Spectre Systems AB licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. +// --------------------------------------------------------------------- +// Copyright (c) 2015 Matteo Pagani, licensed under MIT +// https://github.com/qmatteoq/DesktopBridgeHelpers +// --------------------------------------------------------------------- + +using System; +using System.Runtime.InteropServices; +using System.Text; + +namespace Jarvis.Infrastructure.Utilities +{ + public static class UwpUtility + { + [DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)] + public static extern int GetCurrentPackageFullName(ref int packageFullNameLength, StringBuilder packageFullName); + + public static bool IsRunningAsUwp() + { + if (IsWindows7OrLower) + { + return false; + } + else + { + int length = 0; + var builder = new StringBuilder(0); + int result = GetCurrentPackageFullName(ref length, builder); + + builder = new StringBuilder(length); + result = GetCurrentPackageFullName(ref length, builder); + + return result != 15700L; + } + } + + private static bool IsWindows7OrLower + { + get + { + int versionMajor = Environment.OSVersion.Version.Major; + int versionMinor = Environment.OSVersion.Version.Minor; + double version = versionMajor + ((double)versionMinor / 10); + return version <= 6.1; + } + } + } +} diff --git a/src/Jarvis/Jarvis.csproj b/src/Jarvis/Jarvis.csproj index 6bdc8ec..2b87e3d 100644 --- a/src/Jarvis/Jarvis.csproj +++ b/src/Jarvis/Jarvis.csproj @@ -130,6 +130,7 @@ + JarvisApplication.xaml @@ -165,7 +166,7 @@ - + @@ -204,7 +205,7 @@ Designer MSBuild:Compile - + Designer MSBuild:Compile diff --git a/src/Jarvis/Services/ApplicationService.cs b/src/Jarvis/Services/ApplicationService.cs index e32db21..d63a71a 100644 --- a/src/Jarvis/Services/ApplicationService.cs +++ b/src/Jarvis/Services/ApplicationService.cs @@ -22,6 +22,11 @@ public ApplicationService( _application = application; } + public bool IsRunningAsUwp() + { + return UwpUtility.IsRunningAsUwp(); + } + public bool IsWindowsShuttingDown() { return Win32.System.GetSystemMetrics(Win32.System.W32SystemMetric.ShuttingDown) != 0; diff --git a/src/Jarvis/Services/ServiceOrchestrator.cs b/src/Jarvis/Services/ServiceOrchestrator.cs index 1119887..fa73c65 100644 --- a/src/Jarvis/Services/ServiceOrchestrator.cs +++ b/src/Jarvis/Services/ServiceOrchestrator.cs @@ -43,6 +43,12 @@ public void Start() // Start all tasks. foreach (var worker in _workers) { + if (!worker.Enabled()) + { + _log.Information($"Service {worker.Name} will not be started."); + continue; + } + _tasks.Add(new TaskWrapper(worker, _log).Start(_source)); } diff --git a/src/Jarvis/Services/UpdateService.cs b/src/Jarvis/Services/UpdateService.cs index 8e13a33..c3b9439 100644 --- a/src/Jarvis/Services/UpdateService.cs +++ b/src/Jarvis/Services/UpdateService.cs @@ -19,19 +19,26 @@ public sealed class UpdateService : IBackgroundWorker private readonly IUpdateChecker _checker; private readonly ISettingsStore _settings; private readonly IEventAggregator _eventAggregator; + private readonly ApplicationService _application; private readonly IJarvisLog _log; public string Name => "Update service"; public UpdateService(IUpdateChecker checker, ISettingsStore settings, - IEventAggregator eventAggregator, IJarvisLog log) + IEventAggregator eventAggregator, ApplicationService application, IJarvisLog log) { _checker = checker; _settings = settings; _eventAggregator = eventAggregator; + _application = application; _log = new LogDecorator("UpdateService", log); } + public bool Enabled() + { + return !_application.IsRunningAsUwp(); + } + public async Task Run(CancellationToken token) { #if !DEBUG diff --git a/src/Jarvis/ViewModels/Settings/GeneralSettingsViewModel.cs b/src/Jarvis/ViewModels/Settings/UpdateSettingsViewModel.cs similarity index 90% rename from src/Jarvis/ViewModels/Settings/GeneralSettingsViewModel.cs rename to src/Jarvis/ViewModels/Settings/UpdateSettingsViewModel.cs index 722aa94..4800f8d 100644 --- a/src/Jarvis/ViewModels/Settings/GeneralSettingsViewModel.cs +++ b/src/Jarvis/ViewModels/Settings/UpdateSettingsViewModel.cs @@ -7,9 +7,9 @@ namespace Jarvis.ViewModels.Settings { - public sealed class GeneralSettingsViewModel : Screen, ISettings + public sealed class UpdateSettingsViewModel : Screen, ISettings { - public string Name => "General"; + public string Name => "Update"; public bool CheckForUpdates { get; set; } public bool IncludePreviews { get; set; } diff --git a/src/Jarvis/ViewModels/SettingsViewModel.cs b/src/Jarvis/ViewModels/SettingsViewModel.cs index 2bda8c7..09bd676 100644 --- a/src/Jarvis/ViewModels/SettingsViewModel.cs +++ b/src/Jarvis/ViewModels/SettingsViewModel.cs @@ -15,16 +15,26 @@ namespace Jarvis.ViewModels { public sealed class SettingsViewModel : Conductor.Collection.OneActive { + private readonly ApplicationService _application; private readonly SettingsService _settings; public delegate SettingsViewModel Factory(); public string ValidationMessage { get; set; } - public SettingsViewModel(IEnumerable providers, SettingsService settings, ILifetimeScope scope) + public SettingsViewModel( + IEnumerable providers, ApplicationService application, + SettingsService settings, ILifetimeScope scope) { + _application = application; _settings = settings; - Items.Add(new GeneralSettingsViewModel()); + + if (application.IsRunningAsUwp()) + { + // Only show update settings if not running + // as an UWP application. + Items.Add(new UpdateSettingsViewModel()); + } foreach (var provider in providers) { diff --git a/src/Jarvis/Views/Settings/GeneralSettingsView.xaml b/src/Jarvis/Views/Settings/UpdateSettingsView.xaml similarity index 90% rename from src/Jarvis/Views/Settings/GeneralSettingsView.xaml rename to src/Jarvis/Views/Settings/UpdateSettingsView.xaml index b0e8028..40a4d00 100644 --- a/src/Jarvis/Views/Settings/GeneralSettingsView.xaml +++ b/src/Jarvis/Views/Settings/UpdateSettingsView.xaml @@ -1,4 +1,4 @@ -