From 0a57c88cc3b26f785758c81a8a890564effc3f84 Mon Sep 17 00:00:00 2001 From: Matthew John Cheetham Date: Tue, 8 Oct 2019 14:03:05 +0100 Subject: [PATCH 01/24] Upgrade common/pre build items and targets --- Dependencies.props | 26 +++ Directory.Build.props | 64 +++++- Directory.Build.targets | 18 ++ Scalar.Build/.gitignore | 1 - Scalar.Build/GenerateG4WNugetReference.cs | 31 --- Scalar.Build/GenerateGitVersionConstants.cs | 190 ---------------- Scalar.Build/GenerateInstallScripts.cs | 61 ----- .../GenerateScalarInstallersNuspec.cs | 53 ----- Scalar.Build/GenerateVersionInfo.cs | 63 ------ Scalar.Build/Scalar.PreBuild.csproj | 213 ------------------ Scalar.Build/Scalar.cpp.props | 11 - Scalar.Build/Scalar.cs.props | 28 --- Scalar.Build/Scalar.props | 17 -- Scalar.Build/Scalar.ruleset | 67 ------ Scalar.MSBuild/CompileTemplatedFile.cs | 88 ++++++++ Scalar.MSBuild/GenerateScalarConstants.cs | 95 ++++++++ .../GenerateWindowsAppManifest.cs | 13 +- Scalar.MSBuild/GetGitHubReleaseAssets.cs | 159 +++++++++++++ Scalar.MSBuild/GetGitInstallerVersion.cs | 59 +++++ Scalar.MSBuild/Scalar.MSBuild.csproj | 13 ++ Scalar.MSBuild/Scalar.targets | 51 +++++ Scalar.MSBuild/Scalar.tasks | 31 +++ global.json | 6 + nuget.config | 9 - 24 files changed, 610 insertions(+), 757 deletions(-) create mode 100644 Dependencies.props create mode 100644 Directory.Build.targets delete mode 100644 Scalar.Build/.gitignore delete mode 100644 Scalar.Build/GenerateG4WNugetReference.cs delete mode 100644 Scalar.Build/GenerateGitVersionConstants.cs delete mode 100644 Scalar.Build/GenerateInstallScripts.cs delete mode 100644 Scalar.Build/GenerateScalarInstallersNuspec.cs delete mode 100644 Scalar.Build/GenerateVersionInfo.cs delete mode 100644 Scalar.Build/Scalar.PreBuild.csproj delete mode 100644 Scalar.Build/Scalar.cpp.props delete mode 100644 Scalar.Build/Scalar.cs.props delete mode 100644 Scalar.Build/Scalar.props delete mode 100644 Scalar.Build/Scalar.ruleset create mode 100644 Scalar.MSBuild/CompileTemplatedFile.cs create mode 100644 Scalar.MSBuild/GenerateScalarConstants.cs rename Scalar.Build/GenerateApplicationManifests.cs => Scalar.MSBuild/GenerateWindowsAppManifest.cs (81%) create mode 100644 Scalar.MSBuild/GetGitHubReleaseAssets.cs create mode 100644 Scalar.MSBuild/GetGitInstallerVersion.cs create mode 100644 Scalar.MSBuild/Scalar.MSBuild.csproj create mode 100644 Scalar.MSBuild/Scalar.targets create mode 100644 Scalar.MSBuild/Scalar.tasks create mode 100644 global.json diff --git a/Dependencies.props b/Dependencies.props new file mode 100644 index 0000000000..7e1c7d8696 --- /dev/null +++ b/Dependencies.props @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Directory.Build.props b/Directory.Build.props index 2129a09159..d9ba02e7d5 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,9 +1,61 @@ - - - + - $(MSBuildThisFileDirectory)\..\BuildOutput\$(MSBuildProjectName)\obj + + windows + osx + linux + true + false + + + Debug + + + $(MSBuildThisFileDirectory) + $(RepoPath) + $(RepoPath)..\out\ + $(RepoSrcPath)Scalar.MSBuild\ + + + $(RepoOutPath)$(MSBuildProjectName)\ + $(ProjectOutPath)bin\ + $(ProjectOutPath)obj\ + + + win-x64;osx-x64 + true + true + $(RepoPath)Scalar.ruleset + + + Scalar + Microsoft Corporation (c) + + + 0.2.173.2 + 2.20191106.6-sc + + + Microsoft400 + 8003 + + + + + + + + + + $(AuthenticodeCert) + false + + + false + + diff --git a/Directory.Build.targets b/Directory.Build.targets new file mode 100644 index 0000000000..8c9828f413 --- /dev/null +++ b/Directory.Build.targets @@ -0,0 +1,18 @@ + + + + $(ScalarVersion) + $(OutputPath) + + + + + + + + + + + + + diff --git a/Scalar.Build/.gitignore b/Scalar.Build/.gitignore deleted file mode 100644 index 249d139c0d..0000000000 --- a/Scalar.Build/.gitignore +++ /dev/null @@ -1 +0,0 @@ -packages.config diff --git a/Scalar.Build/GenerateG4WNugetReference.cs b/Scalar.Build/GenerateG4WNugetReference.cs deleted file mode 100644 index 89bcdcf25d..0000000000 --- a/Scalar.Build/GenerateG4WNugetReference.cs +++ /dev/null @@ -1,31 +0,0 @@ -using Microsoft.Build.Framework; -using Microsoft.Build.Utilities; -using System; -using System.IO; - -namespace Scalar.PreBuild -{ - public class GenerateG4WNugetReference : Task - { - [Required] - public string GitPackageVersion { get; set; } - - public override bool Execute() - { - this.Log.LogMessage(MessageImportance.High, "Creating packages.config for G4W package version " + this.GitPackageVersion); - - File.WriteAllText( - Path.Combine(Environment.CurrentDirectory, "packages.config"), - string.Format( -@" - - - - -", - this.GitPackageVersion)); - - return true; - } - } -} diff --git a/Scalar.Build/GenerateGitVersionConstants.cs b/Scalar.Build/GenerateGitVersionConstants.cs deleted file mode 100644 index 692e33e9b4..0000000000 --- a/Scalar.Build/GenerateGitVersionConstants.cs +++ /dev/null @@ -1,190 +0,0 @@ -using Microsoft.Build.Framework; -using Microsoft.Build.Utilities; -using System; -using System.IO; -using System.Linq; - -namespace Scalar.PreBuild -{ - public class GenerateGitVersionConstants : Task - { - [Required] - public string GitPackageVersion { get; set; } - - [Required] - public string PackagesPath { get; set; } - - [Required] - public string OutputFile {get; set; } - - [Output] - public string LatestInstaller { get; set; } - - [Output] - public string LatestInstallerFilename { get; set; } - - public override bool Execute() - { - this.Log.LogMessage(MessageImportance.High, "Creating constants for Git package " + this.GitPackageVersion); - - string installerDirectory = Path.Combine( - this.PackagesPath, - "GitForWindows.GVFS.Installer." + this.GitPackageVersion, - "tools"); - - if (!Directory.Exists(installerDirectory)) - { - this.Log.LogError("Git package not found. Re-run your build to allow the package to be downloaded by Visual Studio."); - return false; - } - - this.LatestInstaller = Path.GetFullPath(Directory.EnumerateFiles(installerDirectory).Single()); - this.LatestInstallerFilename = Path.GetFileName(this.LatestInstaller); - GitVersion version; - if (!GitVersion.TryParseInstallerName(this.LatestInstallerFilename, out version)) - { - this.Log.LogError("Unable to parse git version: " + this.LatestInstallerFilename); - return false; - } - - this.Log.LogMessage(MessageImportance.High, "Found Git version " + version.ToString()); - - string projectOutputPath = Path.GetDirectoryName(this.OutputFile); - if (!Directory.Exists(projectOutputPath)) - { - Directory.CreateDirectory(projectOutputPath); - } - - File.WriteAllText( - this.OutputFile, - string.Format( -@"// This file is auto-generated by Scalar.PreBuild.GenerateGitVersionConstants. Any changes made directly in this file will be lost. -using Scalar.Common.Git; - -namespace Scalar.Common -{{ - public static partial class ScalarConstants - {{ - public static readonly GitVersion SupportedGitVersion = new GitVersion({0}, {1}, {2}, ""{3}"", {4}, {5}); - }} -}}", - version.Major, - version.Minor, - version.Build, - version.Platform, - version.Revision, - version.MinorRevision)); - - return true; - } - - // This class was partially copied from Scalar.Common.Git.GitVersion for the parsing - private class GitVersion - { - private GitVersion(int major, int minor, int build, string platform, int revision, int minorRevision) - { - this.Major = major; - this.Minor = minor; - this.Build = build; - this.Platform = platform; - this.Revision = revision; - this.MinorRevision = minorRevision; - } - - public int Major { get; private set; } - public int Minor { get; private set; } - public string Platform { get; private set; } - public int Build { get; private set; } - public int Revision { get; private set; } - public int MinorRevision { get; private set; } - - public static bool TryParseInstallerName(string input, out GitVersion version) - { - // Installer name is of the form - // Git-2.14.1.scalar.1.1.gb16030b-64-bit.exe - - version = null; - - if (!input.StartsWith("Git-", StringComparison.InvariantCultureIgnoreCase)) - { - return false; - } - - if (!input.EndsWith("-64-bit.exe", StringComparison.InvariantCultureIgnoreCase)) - { - return false; - } - - return TryParseVersion(input.Substring(4, input.Length - 15), out version); - } - - private static bool TryParseVersion(string input, out GitVersion version) - { - version = null; - int major, minor, build, revision, minorRevision; - - if (string.IsNullOrWhiteSpace(input)) - { - return false; - } - - string[] parsedComponents = input.Split(new char[] { '.' }); - int parsedComponentsLength = parsedComponents.Length; - if (parsedComponentsLength < 5) - { - return false; - } - - if (!TryParseComponent(parsedComponents[0], out major)) - { - return false; - } - - if (!TryParseComponent(parsedComponents[1], out minor)) - { - return false; - } - - if (!TryParseComponent(parsedComponents[2], out build)) - { - return false; - } - - if (!TryParseComponent(parsedComponents[4], out revision)) - { - return false; - } - - if (parsedComponentsLength < 6 || !TryParseComponent(parsedComponents[5], out minorRevision)) - { - minorRevision = 0; - } - - string platform = parsedComponents[3]; - - version = new GitVersion(major, minor, build, platform, revision, minorRevision); - return true; - } - - public override string ToString() - { - return string.Format("{0}.{1}.{2}.{3}.{4}.{5}", this.Major, this.Minor, this.Build, this.Platform, this.Revision, this.MinorRevision); - } - - private static bool TryParseComponent(string component, out int parsedComponent) - { - if (!int.TryParse(component, out parsedComponent)) - { - return false; - } - - if (parsedComponent < 0) - { - return false; - } - - return true; - } - } - } -} diff --git a/Scalar.Build/GenerateInstallScripts.cs b/Scalar.Build/GenerateInstallScripts.cs deleted file mode 100644 index 968bcc6532..0000000000 --- a/Scalar.Build/GenerateInstallScripts.cs +++ /dev/null @@ -1,61 +0,0 @@ -using Microsoft.Build.Framework; -using Microsoft.Build.Utilities; -using System.IO; -using System.Text; - -namespace Scalar.PreBuild -{ - public class GenerateInstallScripts : Task - { - [Required] - public string GitInstallerFilename { get; set; } - - [Required] - public string ScalarSetupFilename { get; set; } - - [Required] - public string GitInstallBatPath { get; set; } - - [Required] - public string ScalarInstallBatPath { get; set; } - - [Required] - public string UnifiedInstallBatPath { get; set; } - - public override bool Execute() - { - this.Log.LogMessage(MessageImportance.High, "Creating install scripts for " + this.GitInstallerFilename); - - File.WriteAllText( - this.GitInstallBatPath, - this.GetGitInstallCommand()); - - File.WriteAllText( - this.ScalarInstallBatPath, - this.GetScalarInstallCommand()); - - StringBuilder sb = new StringBuilder(); - sb.AppendLine("REM AUTOGENERATED DO NOT EDIT"); - sb.AppendLine(); - sb.AppendLine(this.GetGitInstallCommand()); - sb.AppendLine(); - sb.AppendLine(this.GetScalarInstallCommand()); - - File.WriteAllText( - this.UnifiedInstallBatPath, - sb.ToString()); - - return true; - } - - public string GetGitInstallCommand() - { - return "%~dp0\\" + this.GitInstallerFilename + @" /DIR=""C:\Program Files\Git"" /NOICONS /COMPONENTS=""ext,ext\shellhere,ext\guihere,assoc,assoc_sh"" /GROUP=""Git"" /VERYSILENT /SUPPRESSMSGBOXES /NORESTART"; - } - - public string GetScalarInstallCommand() - { - return "%~dp0\\" + this.ScalarSetupFilename + " /VERYSILENT /SUPPRESSMSGBOXES /NORESTART"; - } - } -} diff --git a/Scalar.Build/GenerateScalarInstallersNuspec.cs b/Scalar.Build/GenerateScalarInstallersNuspec.cs deleted file mode 100644 index ab3da38c56..0000000000 --- a/Scalar.Build/GenerateScalarInstallersNuspec.cs +++ /dev/null @@ -1,53 +0,0 @@ -using Microsoft.Build.Framework; -using Microsoft.Build.Utilities; -using System.IO; - -namespace Scalar.PreBuild -{ - public class GenerateScalarInstallersNuspec : Task - { - [Required] - public string ScalarSetupPath { get; set; } - - [Required] - public string GitPackageVersion { get; set; } - - [Required] - public string PackagesPath { get; set; } - - [Required] - public string OutputFile { get; set; } - - public override bool Execute() - { - this.Log.LogMessage(MessageImportance.High, "Generating Scalar.Installers.nuspec"); - - this.ScalarSetupPath = Path.GetFullPath(this.ScalarSetupPath); - this.PackagesPath = Path.GetFullPath(this.PackagesPath); - - File.WriteAllText( - this.OutputFile, - string.Format( -@" - - - Scalar.Installers - $ScalarVersion$ - Microsoft - false - Scalar and G4W installers - - - - - - -", - this.ScalarSetupPath, - this.PackagesPath, - this.GitPackageVersion)); - - return true; - } - } -} diff --git a/Scalar.Build/GenerateVersionInfo.cs b/Scalar.Build/GenerateVersionInfo.cs deleted file mode 100644 index 1895ecde1e..0000000000 --- a/Scalar.Build/GenerateVersionInfo.cs +++ /dev/null @@ -1,63 +0,0 @@ -using Microsoft.Build.Framework; -using Microsoft.Build.Utilities; -using System.IO; - -namespace Scalar.PreBuild -{ - public class GenerateVersionInfo : Task - { - [Required] - public string Version { get; set; } - - [Required] - public string BuildOutputPath { get; set; } - - [Required] - public string AssemblyVersion { get; set; } - - [Required] - public string VersionHeader { get; set; } - - public override bool Execute() - { - this.Log.LogMessage(MessageImportance.High, "Creating version files"); - - EnsureParentDirectoryExistsFor(this.AssemblyVersion); - File.WriteAllText( - this.AssemblyVersion, - string.Format( -@"using System.Reflection; - -[assembly: AssemblyVersion(""{0}"")] -[assembly: AssemblyFileVersion(""{0}"")] -", - this.Version)); - - string commaDelimetedVersion = this.Version.Replace('.', ','); - EnsureParentDirectoryExistsFor(this.VersionHeader); - File.WriteAllText( - this.VersionHeader, - string.Format( -@" -#define SCALAR_FILE_VERSION {0} -#define SCALAR_FILE_VERSION_STRING ""{1}"" -#define SCALAR_PRODUCT_VERSION {0} -#define SCALAR_PRODUCT_VERSION_STRING ""{1}"" -", - commaDelimetedVersion, - this.Version)); - - return true; - } - - private void EnsureParentDirectoryExistsFor(string filename) - { - string directory = Path.GetDirectoryName(filename); - if (!Directory.Exists(directory)) - { - Directory.CreateDirectory(directory); - } - - } - } -} diff --git a/Scalar.Build/Scalar.PreBuild.csproj b/Scalar.Build/Scalar.PreBuild.csproj deleted file mode 100644 index cebfb95367..0000000000 --- a/Scalar.Build/Scalar.PreBuild.csproj +++ /dev/null @@ -1,213 +0,0 @@ - - - - - - {A4984251-840E-4622-AD0C-66DFCE2B2574} - Library - Properties - Scalar.PreBuild - Scalar.PreBuild - v4.6.1 - 512 - - - true - DEBUG;TRACE - full - x64 - prompt - MinimumRecommendedRules.ruleset - true - - - TRACE - true - pdbonly - x64 - prompt - MinimumRecommendedRules.ruleset - - - - - - - - - - - - Designer - - - Designer - - - Designer - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SetupScalar.$(ScalarVersion).exe - $(BuildOutputDir)\Scalar.Installer.Windows\bin\x64\$(Configuration)\SetupScalar.$(ScalarVersion).exe - $(BuildOutputDir)\Scalar.Build\ - $(OutDir)ScalarConstants.GitVersion.cs - $(OutDir)InstallG4W.bat - $(OutDir)InstallScalar.bat - $(OutDir)InstallProduct.bat - $(OutDir)Scalar.Installers.nuspec - $(BuildOutputDir)\CommonAssemblyVersion.cs - $(BuildOutputDir)\CommonVersionHeader.h - $(BuildOutputDir)\restore.timestamp - - - - - - - - - - - - - false - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Scalar.Build/Scalar.cpp.props b/Scalar.Build/Scalar.cpp.props deleted file mode 100644 index 9b2d260549..0000000000 --- a/Scalar.Build/Scalar.cpp.props +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - $(BuildOutputDir)\$(MSBuildProjectName)\bin\$(Platform)\$(Configuration)\ - $(BuildOutputDir)\$(MSBuildProjectName)\intermediate\$(Platform)\$(Configuration)\ - - - diff --git a/Scalar.Build/Scalar.cs.props b/Scalar.Build/Scalar.cs.props deleted file mode 100644 index 08537feae6..0000000000 --- a/Scalar.Build/Scalar.cs.props +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - $(BuildOutputDir)\$(MSBuildProjectName)\bin\$(Platform)\$(Configuration)\ - $(BuildOutputDir)\$(MSBuildProjectName)\obj\$(Platform)\$(Configuration)\ - $(BuildOutputDir)\$(MSBuildProjectName)\intermediate\$(Platform)\$(Configuration)\ - - - - true - $(MSBuildThisFileDirectory)\Scalar.ruleset - false - - - - - CommonAssemblyVersion.cs - - - - - $(DefaultItemExcludes);StyleCop.Cache;TestResults.xml - - - diff --git a/Scalar.Build/Scalar.props b/Scalar.Build/Scalar.props deleted file mode 100644 index 5ccd5698cb..0000000000 --- a/Scalar.Build/Scalar.props +++ /dev/null @@ -1,17 +0,0 @@ - - - - - 0.2.173.2 - 2.20191106.6-sc - - - - Debug - x64 - ..\ - $(SolutionDir)..\BuildOutput - $(SolutionDir)..\packages - - - diff --git a/Scalar.Build/Scalar.ruleset b/Scalar.Build/Scalar.ruleset deleted file mode 100644 index cc2030332c..0000000000 --- a/Scalar.Build/Scalar.ruleset +++ /dev/null @@ -1,67 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Scalar.MSBuild/CompileTemplatedFile.cs b/Scalar.MSBuild/CompileTemplatedFile.cs new file mode 100644 index 0000000000..5081200ca6 --- /dev/null +++ b/Scalar.MSBuild/CompileTemplatedFile.cs @@ -0,0 +1,88 @@ +using System; +using Microsoft.Build.Framework; +using Microsoft.Build.Utilities; +using System.Collections.Generic; +using System.IO; +using System.Text; + +namespace Scalar.MSBuild +{ + public class CompileTemplatedFile : Task + { + [Required] + public ITaskItem Template { get; set; } + + [Required] + public string OutputFile { get; set; } + + [Output] + public ITaskItem CompiledTemplate { get; set; } + + public override bool Execute() + { + string templateFilePath = this.Template.ItemSpec; + IDictionary properties = ParseProperties(this.Template.GetMetadata("Properties")); + + string outputFileDirectory = Path.GetDirectoryName(this.OutputFile); + + if (!File.Exists(templateFilePath)) + { + this.Log.LogError("Failed to find template file '{0}'.", templateFilePath); + return false; + } + + // Copy the template to the destination to keep the same file mode bits/ACLs as the template + File.Copy(templateFilePath, this.OutputFile, true); + + this.Log.LogMessage(MessageImportance.Low, "Reading template contents"); + string template = File.ReadAllText(this.OutputFile); + + this.Log.LogMessage(MessageImportance.Normal, "Compiling template '{0}'", templateFilePath); + string compiled = Compile(template, properties); + + if (!Directory.Exists(outputFileDirectory)) + { + this.Log.LogMessage(MessageImportance.Low, "Creating output directory '{0}'", outputFileDirectory); + Directory.CreateDirectory(outputFileDirectory); + } + + this.Log.LogMessage(MessageImportance.Normal, "Writing compiled template to '{0}'", this.OutputFile); + File.WriteAllText(this.OutputFile, compiled); + + this.CompiledTemplate = new TaskItem(this.OutputFile, this.Template.CloneCustomMetadata()); + + return true; + } + + private IDictionary ParseProperties(string propertiesStr) + { + string[] properties = propertiesStr?.Split(';') ?? new string[0]; + var dict = new Dictionary(); + + foreach (string propertyStr in properties) + { + string[] kvp = propertyStr.Split(new[] {'='}, count: 2); + if (kvp.Length > 1) + { + string key = kvp[0].Trim(); + dict[key] = kvp[1].Trim(); + } + } + + return dict; + } + + private string Compile(string template, IDictionary properties) + { + var sb = new StringBuilder(template); + + foreach (var kvp in properties) + { + this.Log.LogMessage(MessageImportance.Low, "Replacing \"{0}\" -> \"{1}\"", kvp.Key, kvp.Value); + sb.Replace(kvp.Key, kvp.Value); + } + + return sb.ToString(); + } + } +} diff --git a/Scalar.MSBuild/GenerateScalarConstants.cs b/Scalar.MSBuild/GenerateScalarConstants.cs new file mode 100644 index 0000000000..1435aae17a --- /dev/null +++ b/Scalar.MSBuild/GenerateScalarConstants.cs @@ -0,0 +1,95 @@ +using Microsoft.Build.Framework; +using Microsoft.Build.Utilities; +using System.IO; +using System.Text.RegularExpressions; + +namespace Scalar.MSBuild +{ + public class GenerateScalarConstants : Task + { + [Required] + public string MinimumGitVersion { get; set; } + + [Required] + public string OutputFile { get; set; } + + public override bool Execute() + { + this.Log.LogMessage(MessageImportance.Normal, "Creating Scalar constants file with minimum Git version '{0}' at '{1}'...", this.MinimumGitVersion, this.OutputFile); + + if (!TryParseVersion(this.MinimumGitVersion, out var version)) + { + this.Log.LogError("Failed to parse Git version '{0}'.", this.MinimumGitVersion); + return false; + } + + string outputDirectory = Path.GetDirectoryName(this.OutputFile); + if (!Directory.Exists(outputDirectory)) + { + Directory.CreateDirectory(outputDirectory); + } + + string template = +@"// +// This file is auto-generated by Scalar.Build.GenerateScalarConstants. +// Any changes made directly in this file will be lost. +// +using Scalar.Common.Git; + +namespace Scalar.Common +{{ + public static partial class ScalarConstants + {{ + public static readonly GitVersion SupportedGitVersion = new GitVersion({0}, {1}, {2}, ""{3}"", {4}, {5}); + }} +}}"; + + File.WriteAllText( + this.OutputFile, + string.Format( + template, + version.Major, + version.Minor, + version.Build, + version.Platform, + version.Revision, + version.MinorRevision)); + + return true; + } + + private static bool TryParseVersion(string versionString, out GitVersion version) + { + const string pattern = @"(\d+)\.(\d+)\.(\d+)\.([A-Z]+)\.(\d+)\.(\d+)"; + + Match match = Regex.Match(versionString, pattern, RegexOptions.IgnoreCase); + if (match.Success) + { + version = new GitVersion + { + Major = int.Parse(match.Groups[1].Value), + Minor = int.Parse(match.Groups[2].Value), + Build = int.Parse(match.Groups[3].Value), + Platform = match.Groups[4].Value, + Revision = int.Parse(match.Groups[5].Value), + MinorRevision = int.Parse(match.Groups[6].Value) + }; + + return true; + } + + version = default(GitVersion); + return false; + } + + private struct GitVersion + { + public int Major { get; set; } + public int Minor { get; set; } + public int Build { get; set; } + public string Platform { get; set; } + public int Revision { get; set; } + public int MinorRevision { get; set; } + } + } +} diff --git a/Scalar.Build/GenerateApplicationManifests.cs b/Scalar.MSBuild/GenerateWindowsAppManifest.cs similarity index 81% rename from Scalar.Build/GenerateApplicationManifests.cs rename to Scalar.MSBuild/GenerateWindowsAppManifest.cs index 68588db840..2322dd4ab5 100644 --- a/Scalar.Build/GenerateApplicationManifests.cs +++ b/Scalar.MSBuild/GenerateWindowsAppManifest.cs @@ -2,9 +2,9 @@ using Microsoft.Build.Utilities; using System.IO; -namespace Scalar.PreBuild +namespace Scalar.MSBuild { - public class GenerateApplicationManifests : Task + public class GenerateWindowsAppManifest : Task { [Required] public string Version { get; set; } @@ -13,13 +13,13 @@ public class GenerateApplicationManifests : Task public string ApplicationName { get; set; } [Required] - public string ManifestPath { get; set; } + public string OutputFile { get; set; } public override bool Execute() { - this.Log.LogMessage(MessageImportance.High, "Creating application manifest file for {0}", ApplicationName); + this.Log.LogMessage(MessageImportance.Normal, "Creating application manifest file for '{0}'...", this.ApplicationName); - string manifestDirectory = Path.GetDirectoryName(this.ManifestPath); + string manifestDirectory = Path.GetDirectoryName(this.OutputFile); if (!Directory.Exists(manifestDirectory)) { Directory.CreateDirectory(manifestDirectory); @@ -28,7 +28,7 @@ public override bool Execute() // Any application that calls GetVersionEx must have an application manifest in order to get an accurate response. // See https://msdn.microsoft.com/en-us/library/windows/desktop/ms724451(v=vs.85).aspx for details File.WriteAllText( - this.ManifestPath, + this.OutputFile, string.Format( @" @@ -48,4 +48,3 @@ public override bool Execute() } } } - diff --git a/Scalar.MSBuild/GetGitHubReleaseAssets.cs b/Scalar.MSBuild/GetGitHubReleaseAssets.cs new file mode 100644 index 0000000000..1ea8ca3d43 --- /dev/null +++ b/Scalar.MSBuild/GetGitHubReleaseAssets.cs @@ -0,0 +1,159 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Net; +using System.Runtime.Serialization; +using System.Runtime.Serialization.Json; +using System.Text; +using System.Text.RegularExpressions; +using Microsoft.Build.Framework; +using Microsoft.Build.Utilities; + +namespace Scalar.MSBuild +{ + public class GetGitHubReleaseAssets : Task + { + private const string GitHubApiBase = "https://api.github.com/"; + + [Required] + public string Repository { get; set; } + + [Required] + public string Version { get; set; } + + public string Filter { get; set; } + + [Output] + public ITaskItem[] Assets { get; set; } + + public override bool Execute() + { + var assetItems = new List(); + + ReleaseInfo releaseInfo; + + try + { + this.Log.LogMessage(MessageImportance.Normal, $"Getting release information for '{this.Repository}' (tag: '{this.Version}')"); + releaseInfo = GetReleaseInfo(this.Repository, this.Version); + } + catch (Exception ex) + { + var errorMessage = new StringBuilder(); + errorMessage.AppendLine($"Failed to retrieve release information for '{this.Repository}' (tag: {this.Version}):"); + errorMessage.AppendLine(ex.ToString()); + + if (ex is WebException wex) + { + using (var rs = wex.Response.GetResponseStream()) + { + if (rs != null) + { + using (var reader = new StreamReader(rs)) + { + errorMessage.AppendLine("Response:"); + errorMessage.Append(reader.ReadToEnd()); + } + } + } + } + + this.Log.LogError(errorMessage.ToString()); + return false; + } + + this.Log.LogMessage(MessageImportance.Low, $"Release contains {releaseInfo.Assets.Length} assets:"); + + if (!string.IsNullOrWhiteSpace(this.Filter)) + { + this.Log.LogMessage(MessageImportance.Low, $"(Filtering assets with pattern: '{this.Filter}')"); + } + + foreach (AssetInfo asset in releaseInfo.Assets) + { + if (!string.IsNullOrWhiteSpace(this.Filter) && !Regex.IsMatch(asset.Name, this.Filter)) + { + this.Log.LogMessage(MessageImportance.Low, $" [skipped] {asset.Name} ({asset.Size} bytes)"); + } + else + { + this.Log.LogMessage(MessageImportance.Low, $" [include] {asset.Name} ({asset.Size} bytes)"); + + var item = new TaskItem(asset.Name, new Dictionary + { + ["Repository"] = this.Repository, + ["Version"] = this.Version, + ["Size"] = asset.Size.ToString(), + ["Url"] = asset.DownloadUrl + }); + + assetItems.Add(item); + } + } + + this.Assets = assetItems.ToArray(); + return true; + } + + private ReleaseInfo GetReleaseInfo(string repository, string version) + { + var client = new WebClient + { + Headers = new WebHeaderCollection + { + {HttpRequestHeader.UserAgent, "MSBuild"}, + {HttpRequestHeader.Accept, "application/json"} + } + }; + + Uri releaseTagUri = CreateApiUri($"repos/{repository}/releases/tags/{version}"); + + this.Log.LogMessage(MessageImportance.Low, $"GET {releaseTagUri}"); + string releaseJson = client.DownloadString(releaseTagUri); + + this.Log.LogMessage(MessageImportance.Low, $"Response: {releaseJson}"); + return Deserialize(releaseJson); + } + + private static Uri CreateApiUri(string uriStem) + { + return new Uri(new Uri(GitHubApiBase), uriStem); + } + + private static T Deserialize(string json) + { + var serializer = new DataContractJsonSerializer(typeof(T), new DataContractJsonSerializerSettings + { + DateTimeFormat = new DateTimeFormat("yyyy-MM-dd'T'HH:mm:ssZ") + }); + + byte[] bytes = Encoding.UTF8.GetBytes(json); + using (var ms = new MemoryStream(bytes)) + { + return (T)serializer.ReadObject(ms); + } + } + +#pragma warning disable CS0649 + [DataContract] + private class ReleaseInfo + { + [DataMember(Name = "assets")] + public AssetInfo[] Assets; + } + + [DataContract] + private class AssetInfo + { + [DataMember(Name = "name")] + public string Name; + + [DataMember(Name = "browser_download_url")] + public string DownloadUrl; + + [DataMember(Name = "size")] + public int Size; + } +#pragma warning restore CS0649 + } +} diff --git a/Scalar.MSBuild/GetGitInstallerVersion.cs b/Scalar.MSBuild/GetGitInstallerVersion.cs new file mode 100644 index 0000000000..2dc7795927 --- /dev/null +++ b/Scalar.MSBuild/GetGitInstallerVersion.cs @@ -0,0 +1,59 @@ +using Microsoft.Build.Framework; +using Microsoft.Build.Utilities; +using System.IO; +using System.Text.RegularExpressions; + +namespace Scalar.MSBuild +{ + public class GetGitInstallerVersion : Task + { + [Required] + public string PackagePath { get; set; } + + [Required] + public string InstallerExtension { get; set; } + + [Output] + public string GitVersion { get; set; } + + public override bool Execute() + { + this.Log.LogMessage(MessageImportance.Normal, "Getting Git version from installer in package {0}...", this.PackagePath); + + string toolsPath = Path.Combine(this.PackagePath, "tools"); + + if (!Directory.Exists(toolsPath)) + { + this.Log.LogError("Could not find tools directory in NuGet package '{0}'.", toolsPath); + return false; + } + + string[] installerFiles = Directory.GetFiles(toolsPath, $"*{this.InstallerExtension}", SearchOption.TopDirectoryOnly); + if (installerFiles.Length == 0) + { + this.Log.LogError( "Failed to find installer in package with file extension '{0}'.", this.InstallerExtension); + return false; + } + + if (installerFiles.Length > 1) + { + this.Log.LogWarning("Found multiple file with extension '{0}'. Using first found '{1}'.", this.InstallerExtension, installerFiles[0]); + } + + string installerFileName = Path.GetFileName(installerFiles[0]); + this.Log.LogMessage(MessageImportance.Low, "Extracting Git version from file '{0}'", installerFileName); + + var match = Regex.Match(installerFileName, @"(\d+\.\d+\.\d+\.[A-Z]+\.\d+\.\d+)", RegexOptions.IgnoreCase); + if (!match.Success) + { + this.Log.LogError( "Failed to extract Git version from file name '{0}'...", installerFileName); + return false; + } + + this.GitVersion = match.Groups[0].Value; + this.Log.LogMessage(MessageImportance.Low, "Extracted Git version '{0}'", this.GitVersion); + + return true; + } + } +} diff --git a/Scalar.MSBuild/Scalar.MSBuild.csproj b/Scalar.MSBuild/Scalar.MSBuild.csproj new file mode 100644 index 0000000000..a85130c970 --- /dev/null +++ b/Scalar.MSBuild/Scalar.MSBuild.csproj @@ -0,0 +1,13 @@ + + + + netcoreapp3.0 + + + + + + + + + diff --git a/Scalar.MSBuild/Scalar.targets b/Scalar.MSBuild/Scalar.targets new file mode 100644 index 0000000000..4667afc292 --- /dev/null +++ b/Scalar.MSBuild/Scalar.targets @@ -0,0 +1,51 @@ + + + + + + + $(IntermediateOutputPath)app.manifest + + + + + + + + + + + + + $(HOME)\.githubassets\ + $(USERPROFILE)\.githubassets\ + + + + + + + + + + + + + + + + + diff --git a/Scalar.MSBuild/Scalar.tasks b/Scalar.MSBuild/Scalar.tasks new file mode 100644 index 0000000000..16845c4227 --- /dev/null +++ b/Scalar.MSBuild/Scalar.tasks @@ -0,0 +1,31 @@ + + + <_TaskAssembly>$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll + <_TaskFactory>CodeTaskFactory + + + <_TaskAssembly>$(MSBuildToolsPath)\Microsoft.Build.Tasks.Core.dll + <_TaskFactory>RoslynCodeTaskFactory + + + + + + + + + + + + + + + + + + + + + + + diff --git a/global.json b/global.json new file mode 100644 index 0000000000..c31242965b --- /dev/null +++ b/global.json @@ -0,0 +1,6 @@ +{ + "msbuild-sdks": { + "Microsoft.Build.Traversal": "2.0.19", + "Microsoft.Build.NoTargets": "1.0.85" + } +} diff --git a/nuget.config b/nuget.config index 6997505944..2f31e8fc54 100644 --- a/nuget.config +++ b/nuget.config @@ -1,17 +1,8 @@ - - - - - - - - - From 3ab834a5a6120ec9a2fe044cac4f92e9663d3d3b Mon Sep 17 00:00:00 2001 From: Matthew John Cheetham Date: Tue, 8 Oct 2019 14:13:13 +0100 Subject: [PATCH 02/24] Upgrade Scalar project --- Scalar/App.config | 14 --- Scalar/Properties/AssemblyInfo.cs | 23 ---- Scalar/Scalar.Mac.csproj | 27 ----- Scalar/Scalar.Windows.csproj | 173 ------------------------------ Scalar/Scalar.csproj | 23 ++++ Scalar/packages.config | 27 ----- 6 files changed, 23 insertions(+), 264 deletions(-) delete mode 100644 Scalar/App.config delete mode 100644 Scalar/Properties/AssemblyInfo.cs delete mode 100644 Scalar/Scalar.Mac.csproj delete mode 100644 Scalar/Scalar.Windows.csproj create mode 100644 Scalar/Scalar.csproj delete mode 100644 Scalar/packages.config diff --git a/Scalar/App.config b/Scalar/App.config deleted file mode 100644 index 8cca790893..0000000000 --- a/Scalar/App.config +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - - diff --git a/Scalar/Properties/AssemblyInfo.cs b/Scalar/Properties/AssemblyInfo.cs deleted file mode 100644 index f535b6418b..0000000000 --- a/Scalar/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("Scalar")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Scalar")] -[assembly: AssemblyCopyright("Copyright © Microsoft 2019")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("32220664-594c-4425-b9a0-88e0be2f3d2a")] diff --git a/Scalar/Scalar.Mac.csproj b/Scalar/Scalar.Mac.csproj deleted file mode 100644 index 81808e5145..0000000000 --- a/Scalar/Scalar.Mac.csproj +++ /dev/null @@ -1,27 +0,0 @@ - - - - Exe - scalar - netcoreapp2.1 - x64 - osx-x64 - - - - $(ScalarVersion) - - - $(ScalarVersion) - - - - all - - - - - - - - diff --git a/Scalar/Scalar.Windows.csproj b/Scalar/Scalar.Windows.csproj deleted file mode 100644 index 38542c46ca..0000000000 --- a/Scalar/Scalar.Windows.csproj +++ /dev/null @@ -1,173 +0,0 @@ - - - - - - {32220664-594C-4425-B9A0-88E0BE2F3D2A} - Exe - Properties - Scalar - Scalar - v4.6.1 - 512 - true - - - - - true - DEBUG;TRACE - full - x64 - prompt - true - - - TRACE - true - pdbonly - x64 - prompt - true - - - - False - ..\..\packages\CommandLineParser.2.1.1-beta\lib\net45\CommandLine.dll - True - - - ..\..\packages\Microsoft.Data.Sqlite.Core.2.2.4\lib\netstandard2.0\Microsoft.Data.Sqlite.dll - - - False - ..\..\packages\Newtonsoft.Json.11.0.2\lib\net45\Newtonsoft.Json.dll - True - - - ..\..\packages\NuGet.Commands.4.9.2\lib\net46\NuGet.Commands.dll - - - ..\..\packages\NuGet.Common.4.9.2\lib\net46\NuGet.Common.dll - - - ..\..\packages\NuGet.Configuration.4.9.2\lib\net46\NuGet.Configuration.dll - - - ..\..\packages\NuGet.Credentials.4.9.2\lib\net46\NuGet.Credentials.dll - - - ..\..\packages\NuGet.DependencyResolver.Core.4.9.2\lib\net46\NuGet.DependencyResolver.Core.dll - - - ..\..\packages\NuGet.Frameworks.4.9.2\lib\net46\NuGet.Frameworks.dll - - - ..\..\packages\NuGet.LibraryModel.4.9.2\lib\net46\NuGet.LibraryModel.dll - - - ..\..\packages\NuGet.Packaging.4.9.2\lib\net46\NuGet.Packaging.dll - - - ..\..\packages\NuGet.Packaging.Core.4.9.2\lib\net46\NuGet.Packaging.Core.dll - - - ..\..\packages\NuGet.ProjectModel.4.9.2\lib\net46\NuGet.ProjectModel.dll - - - ..\..\packages\NuGet.Protocol.4.9.2\lib\net46\NuGet.Protocol.dll - - - ..\..\packages\NuGet.Versioning.4.9.2\lib\net46\NuGet.Versioning.dll - - - ..\..\packages\SQLitePCLRaw.bundle_green.1.1.12\lib\net45\SQLitePCLRaw.batteries_green.dll - - - ..\..\packages\SQLitePCLRaw.bundle_green.1.1.12\lib\net45\SQLitePCLRaw.batteries_v2.dll - - - ..\..\packages\SQLitePCLRaw.core.1.1.12\lib\net45\SQLitePCLRaw.core.dll - - - ..\..\packages\SQLitePCLRaw.provider.e_sqlite3.net45.1.1.12\lib\net45\SQLitePCLRaw.provider.e_sqlite3.dll - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - PlatformLoader.Windows.cs - - - - - - - Designer - - - PreserveNewest - - - - - {374bf1e5-0b2d-4d4a-bd5e-4212299def09} - Scalar.Common - - - {4ce404e7-d3fc-471c-993c-64615861ea63} - Scalar.Platform.Windows - - - - - - - - - - - - - - - This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - - - - - - \ No newline at end of file diff --git a/Scalar/Scalar.csproj b/Scalar/Scalar.csproj new file mode 100644 index 0000000000..9252decb49 --- /dev/null +++ b/Scalar/Scalar.csproj @@ -0,0 +1,23 @@ + + + + Exe + netcoreapp3.0 + scalar + + + + + PreserveNewest + + + + + + + + + + + + diff --git a/Scalar/packages.config b/Scalar/packages.config deleted file mode 100644 index 7bc2625259..0000000000 --- a/Scalar/packages.config +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - From 4f19ba526c32ccf6b0839866c719439a5fb6988e Mon Sep 17 00:00:00 2001 From: Matthew John Cheetham Date: Tue, 8 Oct 2019 14:23:03 +0100 Subject: [PATCH 03/24] Upgrade Scalar.Common project --- Scalar.Common/DirectoryEx.cs | 26 +++++++++ ...{AssemblyInfo.cs => InternalsVisibleTo.cs} | 1 - Scalar.Common/NuGetUpgrade/NuGetFeed.cs | 3 +- Scalar.Common/Platforms/PlatformLoader.cs | 27 +++++++++ Scalar.Common/Properties/AssemblyInfo.cs | 22 -------- Scalar.Common/Scalar.Common.csproj | 56 ++++++++++--------- Scalar.Platform.Windows/WindowsPlatform.cs | 1 + 7 files changed, 87 insertions(+), 49 deletions(-) create mode 100644 Scalar.Common/DirectoryEx.cs rename Scalar.Common/{AssemblyInfo.cs => InternalsVisibleTo.cs} (60%) create mode 100644 Scalar.Common/Platforms/PlatformLoader.cs delete mode 100644 Scalar.Common/Properties/AssemblyInfo.cs diff --git a/Scalar.Common/DirectoryEx.cs b/Scalar.Common/DirectoryEx.cs new file mode 100644 index 0000000000..6445bc0c2f --- /dev/null +++ b/Scalar.Common/DirectoryEx.cs @@ -0,0 +1,26 @@ +using System.IO; +using System.Security.AccessControl; + +namespace Scalar.Common +{ + public static class DirectoryEx + { + public static DirectorySecurity GetAccessControl(string path) + { + return new DirectorySecurity(path, AccessControlSections.All); + } + + public static void SetAccessControl(string path, DirectorySecurity security) + { + var di = new DirectoryInfo(path); + di.SetAccessControl(security); + } + + public static void CreateDirectory(string path, DirectorySecurity security) + { + var di = new DirectoryInfo(path); + di.Create(); + di.SetAccessControl(security); + } + } +} diff --git a/Scalar.Common/AssemblyInfo.cs b/Scalar.Common/InternalsVisibleTo.cs similarity index 60% rename from Scalar.Common/AssemblyInfo.cs rename to Scalar.Common/InternalsVisibleTo.cs index 514010382c..ac7bc57a09 100644 --- a/Scalar.Common/AssemblyInfo.cs +++ b/Scalar.Common/InternalsVisibleTo.cs @@ -1,4 +1,3 @@ using System.Runtime.CompilerServices; [assembly: InternalsVisibleTo("Scalar.UnitTests")] -[assembly: InternalsVisibleTo("Scalar.UnitTests.Windows")] diff --git a/Scalar.Common/NuGetUpgrade/NuGetFeed.cs b/Scalar.Common/NuGetUpgrade/NuGetFeed.cs index 162ec1ca2f..5669ef1909 100644 --- a/Scalar.Common/NuGetUpgrade/NuGetFeed.cs +++ b/Scalar.Common/NuGetUpgrade/NuGetFeed.cs @@ -169,7 +169,8 @@ private static PackageSourceCredential BuildCredentialsFromPAT(string personalAc "VfsForGitNugetUpgrader", "PersonalAccessToken", personalAccessToken, - storePasswordInClearText: storePasswordInClearText); + storePasswordInClearText: storePasswordInClearText, + validAuthenticationTypesText: null); // null means "all" } private void SetSourceRepository() diff --git a/Scalar.Common/Platforms/PlatformLoader.cs b/Scalar.Common/Platforms/PlatformLoader.cs new file mode 100644 index 0000000000..73a1f60eb2 --- /dev/null +++ b/Scalar.Common/Platforms/PlatformLoader.cs @@ -0,0 +1,27 @@ +using System; +using System.Runtime.InteropServices; +using Scalar.Common; +using Scalar.Platform.Mac; +using Scalar.Platform.Windows; + +namespace Scalar.PlatformLoader +{ + public static class ScalarPlatformLoader + { + public static void Initialize() + { + if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + { + ScalarPlatform.Register(new WindowsPlatform()); + } + else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) + { + ScalarPlatform.Register(new MacPlatform()); + } + else + { + throw new NotImplementedException(); + } + } + } +} diff --git a/Scalar.Common/Properties/AssemblyInfo.cs b/Scalar.Common/Properties/AssemblyInfo.cs deleted file mode 100644 index 4e841363cf..0000000000 --- a/Scalar.Common/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System.Reflection; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("Scalar.Common")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Scalar.Common")] -[assembly: AssemblyCopyright("Copyright © Microsoft 2019")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("9ea6ff63-6bb0-4440-9bfb-0ae79a8f9ba9")] diff --git a/Scalar.Common/Scalar.Common.csproj b/Scalar.Common/Scalar.Common.csproj index 0f694e3d05..fa393c79a5 100644 --- a/Scalar.Common/Scalar.Common.csproj +++ b/Scalar.Common/Scalar.Common.csproj @@ -1,34 +1,40 @@ - - - + - netcoreapp2.1;netstandard2.0 - x64 + netcoreapp3.0 true - true - - - $(ScalarVersion) - - - $(ScalarVersion) + scalar.common - + + + + + + - - - - - all - - - - - - - + + + + + + + + + + + + + + + + diff --git a/Scalar.Platform.Windows/WindowsPlatform.cs b/Scalar.Platform.Windows/WindowsPlatform.cs index 2b6f02bf4e..74f1f63730 100644 --- a/Scalar.Platform.Windows/WindowsPlatform.cs +++ b/Scalar.Platform.Windows/WindowsPlatform.cs @@ -149,6 +149,7 @@ public override void StartBackgroundScalarProcess(ITracer tracer, string program programArguments = string.Join(" ", args.Select(arg => arg.Contains(' ') ? "\"" + arg + "\"" : arg)); ProcessStartInfo processInfo = new ProcessStartInfo(programName, programArguments); processInfo.WindowStyle = ProcessWindowStyle.Hidden; + processInfo.UseShellExecute = true; Process executingProcess = new Process(); executingProcess.StartInfo = processInfo; From 15d44272fdc059044725f6fcff82bcb4a166922d Mon Sep 17 00:00:00 2001 From: Matthew John Cheetham Date: Tue, 8 Oct 2019 14:26:29 +0100 Subject: [PATCH 04/24] Upgrade Scalar.Platform.* projects --- .../MacDiskLayoutUpgradeData.cs | 0 .../Platforms/Mac}/MacDaemonController.cs | 0 .../Platforms/Mac}/MacFileBasedLock.cs | 0 .../Platforms/Mac}/MacFileSystem.cs | 0 .../Platforms/Mac}/MacPlatform.Shared.cs | 0 .../Platforms/Mac}/MacPlatform.cs | 0 .../MacProductUpgraderPlatformStrategy.cs | 0 .../POSIX}/POSIXFileSystem.Shared.cs | 0 .../Platforms/POSIX}/POSIXFileSystem.cs | 0 .../Platforms/POSIX}/POSIXGitInstallation.cs | 0 .../Platforms/POSIX}/POSIXPlatform.Shared.cs | 0 .../Platforms/POSIX}/POSIXPlatform.cs | 0 .../Platforms/Windows}/CurrentUser.cs | 0 .../WindowsDiskLayoutUpgradeData.cs | 0 .../Windows}/WindowsFileBasedLock.cs | 0 .../Windows}/WindowsFileSystem.Shared.cs | 0 .../Platforms/Windows}/WindowsFileSystem.cs | 0 .../Windows}/WindowsGitInstallation.cs | 0 .../Windows}/WindowsPhysicalDiskInfo.cs | 0 .../Windows}/WindowsPlatform.Shared.cs | 0 .../Platforms/Windows}/WindowsPlatform.cs | 0 .../WindowsProductUpgraderPlatformStrategy.cs | 0 .../Properties/AssemblyInfo.cs | 22 ----- .../Scalar.Platform.Mac.csproj | 32 ------- .../Scalar.Platform.POSIX.csproj | 31 ------- .../Properties/AssemblyInfo.cs | 22 ----- .../Scalar.Platform.Windows.csproj | 86 ------------------- Scalar.Platform.Windows/packages.config | 7 -- Scalar.PlatformLoader/PlatformLoader.Mac.cs | 15 ---- .../PlatformLoader.Windows.cs | 14 --- 30 files changed, 229 deletions(-) rename {Scalar.Platform.Mac => Scalar.Common/Platforms/Mac}/DiskLayoutUpgrades/MacDiskLayoutUpgradeData.cs (100%) rename {Scalar.Platform.Mac => Scalar.Common/Platforms/Mac}/MacDaemonController.cs (100%) rename {Scalar.Platform.Mac => Scalar.Common/Platforms/Mac}/MacFileBasedLock.cs (100%) rename {Scalar.Platform.Mac => Scalar.Common/Platforms/Mac}/MacFileSystem.cs (100%) rename {Scalar.Platform.Mac => Scalar.Common/Platforms/Mac}/MacPlatform.Shared.cs (100%) rename {Scalar.Platform.Mac => Scalar.Common/Platforms/Mac}/MacPlatform.cs (100%) rename {Scalar.Platform.Mac => Scalar.Common/Platforms/Mac}/MacProductUpgraderPlatformStrategy.cs (100%) rename {Scalar.Platform.POSIX => Scalar.Common/Platforms/POSIX}/POSIXFileSystem.Shared.cs (100%) rename {Scalar.Platform.POSIX => Scalar.Common/Platforms/POSIX}/POSIXFileSystem.cs (100%) rename {Scalar.Platform.POSIX => Scalar.Common/Platforms/POSIX}/POSIXGitInstallation.cs (100%) rename {Scalar.Platform.POSIX => Scalar.Common/Platforms/POSIX}/POSIXPlatform.Shared.cs (100%) rename {Scalar.Platform.POSIX => Scalar.Common/Platforms/POSIX}/POSIXPlatform.cs (100%) rename {Scalar.Platform.Windows => Scalar.Common/Platforms/Windows}/CurrentUser.cs (100%) rename {Scalar.Platform.Windows => Scalar.Common/Platforms/Windows}/DiskLayoutUpgrades/WindowsDiskLayoutUpgradeData.cs (100%) rename {Scalar.Platform.Windows => Scalar.Common/Platforms/Windows}/WindowsFileBasedLock.cs (100%) rename {Scalar.Platform.Windows => Scalar.Common/Platforms/Windows}/WindowsFileSystem.Shared.cs (100%) rename {Scalar.Platform.Windows => Scalar.Common/Platforms/Windows}/WindowsFileSystem.cs (100%) rename {Scalar.Platform.Windows => Scalar.Common/Platforms/Windows}/WindowsGitInstallation.cs (100%) rename {Scalar.Platform.Windows => Scalar.Common/Platforms/Windows}/WindowsPhysicalDiskInfo.cs (100%) rename {Scalar.Platform.Windows => Scalar.Common/Platforms/Windows}/WindowsPlatform.Shared.cs (100%) rename {Scalar.Platform.Windows => Scalar.Common/Platforms/Windows}/WindowsPlatform.cs (100%) rename {Scalar.Platform.Windows => Scalar.Common/Platforms/Windows}/WindowsProductUpgraderPlatformStrategy.cs (100%) delete mode 100644 Scalar.Platform.Mac/Properties/AssemblyInfo.cs delete mode 100644 Scalar.Platform.Mac/Scalar.Platform.Mac.csproj delete mode 100644 Scalar.Platform.POSIX/Scalar.Platform.POSIX.csproj delete mode 100644 Scalar.Platform.Windows/Properties/AssemblyInfo.cs delete mode 100644 Scalar.Platform.Windows/Scalar.Platform.Windows.csproj delete mode 100644 Scalar.Platform.Windows/packages.config delete mode 100644 Scalar.PlatformLoader/PlatformLoader.Mac.cs delete mode 100644 Scalar.PlatformLoader/PlatformLoader.Windows.cs diff --git a/Scalar.Platform.Mac/DiskLayoutUpgrades/MacDiskLayoutUpgradeData.cs b/Scalar.Common/Platforms/Mac/DiskLayoutUpgrades/MacDiskLayoutUpgradeData.cs similarity index 100% rename from Scalar.Platform.Mac/DiskLayoutUpgrades/MacDiskLayoutUpgradeData.cs rename to Scalar.Common/Platforms/Mac/DiskLayoutUpgrades/MacDiskLayoutUpgradeData.cs diff --git a/Scalar.Platform.Mac/MacDaemonController.cs b/Scalar.Common/Platforms/Mac/MacDaemonController.cs similarity index 100% rename from Scalar.Platform.Mac/MacDaemonController.cs rename to Scalar.Common/Platforms/Mac/MacDaemonController.cs diff --git a/Scalar.Platform.Mac/MacFileBasedLock.cs b/Scalar.Common/Platforms/Mac/MacFileBasedLock.cs similarity index 100% rename from Scalar.Platform.Mac/MacFileBasedLock.cs rename to Scalar.Common/Platforms/Mac/MacFileBasedLock.cs diff --git a/Scalar.Platform.Mac/MacFileSystem.cs b/Scalar.Common/Platforms/Mac/MacFileSystem.cs similarity index 100% rename from Scalar.Platform.Mac/MacFileSystem.cs rename to Scalar.Common/Platforms/Mac/MacFileSystem.cs diff --git a/Scalar.Platform.Mac/MacPlatform.Shared.cs b/Scalar.Common/Platforms/Mac/MacPlatform.Shared.cs similarity index 100% rename from Scalar.Platform.Mac/MacPlatform.Shared.cs rename to Scalar.Common/Platforms/Mac/MacPlatform.Shared.cs diff --git a/Scalar.Platform.Mac/MacPlatform.cs b/Scalar.Common/Platforms/Mac/MacPlatform.cs similarity index 100% rename from Scalar.Platform.Mac/MacPlatform.cs rename to Scalar.Common/Platforms/Mac/MacPlatform.cs diff --git a/Scalar.Platform.Mac/MacProductUpgraderPlatformStrategy.cs b/Scalar.Common/Platforms/Mac/MacProductUpgraderPlatformStrategy.cs similarity index 100% rename from Scalar.Platform.Mac/MacProductUpgraderPlatformStrategy.cs rename to Scalar.Common/Platforms/Mac/MacProductUpgraderPlatformStrategy.cs diff --git a/Scalar.Platform.POSIX/POSIXFileSystem.Shared.cs b/Scalar.Common/Platforms/POSIX/POSIXFileSystem.Shared.cs similarity index 100% rename from Scalar.Platform.POSIX/POSIXFileSystem.Shared.cs rename to Scalar.Common/Platforms/POSIX/POSIXFileSystem.Shared.cs diff --git a/Scalar.Platform.POSIX/POSIXFileSystem.cs b/Scalar.Common/Platforms/POSIX/POSIXFileSystem.cs similarity index 100% rename from Scalar.Platform.POSIX/POSIXFileSystem.cs rename to Scalar.Common/Platforms/POSIX/POSIXFileSystem.cs diff --git a/Scalar.Platform.POSIX/POSIXGitInstallation.cs b/Scalar.Common/Platforms/POSIX/POSIXGitInstallation.cs similarity index 100% rename from Scalar.Platform.POSIX/POSIXGitInstallation.cs rename to Scalar.Common/Platforms/POSIX/POSIXGitInstallation.cs diff --git a/Scalar.Platform.POSIX/POSIXPlatform.Shared.cs b/Scalar.Common/Platforms/POSIX/POSIXPlatform.Shared.cs similarity index 100% rename from Scalar.Platform.POSIX/POSIXPlatform.Shared.cs rename to Scalar.Common/Platforms/POSIX/POSIXPlatform.Shared.cs diff --git a/Scalar.Platform.POSIX/POSIXPlatform.cs b/Scalar.Common/Platforms/POSIX/POSIXPlatform.cs similarity index 100% rename from Scalar.Platform.POSIX/POSIXPlatform.cs rename to Scalar.Common/Platforms/POSIX/POSIXPlatform.cs diff --git a/Scalar.Platform.Windows/CurrentUser.cs b/Scalar.Common/Platforms/Windows/CurrentUser.cs similarity index 100% rename from Scalar.Platform.Windows/CurrentUser.cs rename to Scalar.Common/Platforms/Windows/CurrentUser.cs diff --git a/Scalar.Platform.Windows/DiskLayoutUpgrades/WindowsDiskLayoutUpgradeData.cs b/Scalar.Common/Platforms/Windows/DiskLayoutUpgrades/WindowsDiskLayoutUpgradeData.cs similarity index 100% rename from Scalar.Platform.Windows/DiskLayoutUpgrades/WindowsDiskLayoutUpgradeData.cs rename to Scalar.Common/Platforms/Windows/DiskLayoutUpgrades/WindowsDiskLayoutUpgradeData.cs diff --git a/Scalar.Platform.Windows/WindowsFileBasedLock.cs b/Scalar.Common/Platforms/Windows/WindowsFileBasedLock.cs similarity index 100% rename from Scalar.Platform.Windows/WindowsFileBasedLock.cs rename to Scalar.Common/Platforms/Windows/WindowsFileBasedLock.cs diff --git a/Scalar.Platform.Windows/WindowsFileSystem.Shared.cs b/Scalar.Common/Platforms/Windows/WindowsFileSystem.Shared.cs similarity index 100% rename from Scalar.Platform.Windows/WindowsFileSystem.Shared.cs rename to Scalar.Common/Platforms/Windows/WindowsFileSystem.Shared.cs diff --git a/Scalar.Platform.Windows/WindowsFileSystem.cs b/Scalar.Common/Platforms/Windows/WindowsFileSystem.cs similarity index 100% rename from Scalar.Platform.Windows/WindowsFileSystem.cs rename to Scalar.Common/Platforms/Windows/WindowsFileSystem.cs diff --git a/Scalar.Platform.Windows/WindowsGitInstallation.cs b/Scalar.Common/Platforms/Windows/WindowsGitInstallation.cs similarity index 100% rename from Scalar.Platform.Windows/WindowsGitInstallation.cs rename to Scalar.Common/Platforms/Windows/WindowsGitInstallation.cs diff --git a/Scalar.Platform.Windows/WindowsPhysicalDiskInfo.cs b/Scalar.Common/Platforms/Windows/WindowsPhysicalDiskInfo.cs similarity index 100% rename from Scalar.Platform.Windows/WindowsPhysicalDiskInfo.cs rename to Scalar.Common/Platforms/Windows/WindowsPhysicalDiskInfo.cs diff --git a/Scalar.Platform.Windows/WindowsPlatform.Shared.cs b/Scalar.Common/Platforms/Windows/WindowsPlatform.Shared.cs similarity index 100% rename from Scalar.Platform.Windows/WindowsPlatform.Shared.cs rename to Scalar.Common/Platforms/Windows/WindowsPlatform.Shared.cs diff --git a/Scalar.Platform.Windows/WindowsPlatform.cs b/Scalar.Common/Platforms/Windows/WindowsPlatform.cs similarity index 100% rename from Scalar.Platform.Windows/WindowsPlatform.cs rename to Scalar.Common/Platforms/Windows/WindowsPlatform.cs diff --git a/Scalar.Platform.Windows/WindowsProductUpgraderPlatformStrategy.cs b/Scalar.Common/Platforms/Windows/WindowsProductUpgraderPlatformStrategy.cs similarity index 100% rename from Scalar.Platform.Windows/WindowsProductUpgraderPlatformStrategy.cs rename to Scalar.Common/Platforms/Windows/WindowsProductUpgraderPlatformStrategy.cs diff --git a/Scalar.Platform.Mac/Properties/AssemblyInfo.cs b/Scalar.Platform.Mac/Properties/AssemblyInfo.cs deleted file mode 100644 index 57d0ce15b9..0000000000 --- a/Scalar.Platform.Mac/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System.Reflection; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("Scalar.Platform.Mac")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Scalar.Platform.Mac")] -[assembly: AssemblyCopyright("Copyright © Microsoft 2019")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("4ce404e7-d3fc-471c-993c-64615861ea63")] diff --git a/Scalar.Platform.Mac/Scalar.Platform.Mac.csproj b/Scalar.Platform.Mac/Scalar.Platform.Mac.csproj deleted file mode 100644 index d0eeac107b..0000000000 --- a/Scalar.Platform.Mac/Scalar.Platform.Mac.csproj +++ /dev/null @@ -1,32 +0,0 @@ - - - - netcoreapp2.1;netstandard2.0 - x64 - true - true - - - - $(ScalarVersion) - - - $(ScalarVersion) - - - - $(ScalarVersion) - - - - - - - - - - - all - - - diff --git a/Scalar.Platform.POSIX/Scalar.Platform.POSIX.csproj b/Scalar.Platform.POSIX/Scalar.Platform.POSIX.csproj deleted file mode 100644 index 13545099cd..0000000000 --- a/Scalar.Platform.POSIX/Scalar.Platform.POSIX.csproj +++ /dev/null @@ -1,31 +0,0 @@ - - - - netcoreapp2.1;netstandard2.0 - x64 - true - true - - - - $(ScalarVersion) - - - $(ScalarVersion) - - - - $(ScalarVersion) - - - - - - - - - - all - - - diff --git a/Scalar.Platform.Windows/Properties/AssemblyInfo.cs b/Scalar.Platform.Windows/Properties/AssemblyInfo.cs deleted file mode 100644 index fa7187c1e1..0000000000 --- a/Scalar.Platform.Windows/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System.Reflection; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("Scalar.Platform.Windows")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Scalar.Platform.Windows")] -[assembly: AssemblyCopyright("Copyright © Microsoft 2019")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("4ce404e7-d3fc-471c-993c-64615861ea63")] diff --git a/Scalar.Platform.Windows/Scalar.Platform.Windows.csproj b/Scalar.Platform.Windows/Scalar.Platform.Windows.csproj deleted file mode 100644 index e958b24e47..0000000000 --- a/Scalar.Platform.Windows/Scalar.Platform.Windows.csproj +++ /dev/null @@ -1,86 +0,0 @@ - - - - - - {4CE404E7-D3FC-471C-993C-64615861EA63} - Library - Properties - Scalar.Platform.Windows - Scalar.Platform.Windows - v4.6.1 - 512 - - - - - true - DEBUG;TRACE - full - x64 - prompt - - - TRACE - true - pdbonly - x64 - prompt - - - - - - - ..\..\packages\System.Management.Automation.dll.10.0.10586.0\lib\net40\System.Management.Automation.dll - - - - - - - - - - - - - - - - - - - - - - - - - Designer - - - - - {374bf1e5-0b2d-4d4a-bd5e-4212299def09} - Scalar.Common - - - - - - - - - - This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - diff --git a/Scalar.Platform.Windows/packages.config b/Scalar.Platform.Windows/packages.config deleted file mode 100644 index 7e7d0cf886..0000000000 --- a/Scalar.Platform.Windows/packages.config +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/Scalar.PlatformLoader/PlatformLoader.Mac.cs b/Scalar.PlatformLoader/PlatformLoader.Mac.cs deleted file mode 100644 index 2cc43af27b..0000000000 --- a/Scalar.PlatformLoader/PlatformLoader.Mac.cs +++ /dev/null @@ -1,15 +0,0 @@ -using Scalar.Common; -using Scalar.Common.Git; -using Scalar.Platform.Mac; - -namespace Scalar.PlatformLoader -{ - public static class ScalarPlatformLoader - { - public static void Initialize() - { - ScalarPlatform.Register(new MacPlatform()); - return; - } - } -} diff --git a/Scalar.PlatformLoader/PlatformLoader.Windows.cs b/Scalar.PlatformLoader/PlatformLoader.Windows.cs deleted file mode 100644 index ef92ee1770..0000000000 --- a/Scalar.PlatformLoader/PlatformLoader.Windows.cs +++ /dev/null @@ -1,14 +0,0 @@ -using Scalar.Common; -using Scalar.Platform.Windows; - -namespace Scalar.PlatformLoader -{ - public static class ScalarPlatformLoader - { - public static void Initialize() - { - ScalarPlatform.Register(new WindowsPlatform()); - return; - } - } -} From 6c3def3ae8b4bc61540df0f572f345c0a3c7959d Mon Sep 17 00:00:00 2001 From: Matthew John Cheetham Date: Tue, 8 Oct 2019 15:20:08 +0100 Subject: [PATCH 05/24] Upgrade Scalar.Mount project --- Scalar.Mount/Properties/AssemblyInfo.cs | 22 ---- Scalar.Mount/Scalar.Mount.Mac.csproj | 35 ------- Scalar.Mount/Scalar.Mount.Windows.csproj | 122 ----------------------- Scalar.Mount/Scalar.Mount.csproj | 17 ++++ Scalar.Mount/app.config | 6 -- Scalar.Mount/packages.config | 14 --- 6 files changed, 17 insertions(+), 199 deletions(-) delete mode 100644 Scalar.Mount/Properties/AssemblyInfo.cs delete mode 100644 Scalar.Mount/Scalar.Mount.Mac.csproj delete mode 100644 Scalar.Mount/Scalar.Mount.Windows.csproj create mode 100644 Scalar.Mount/Scalar.Mount.csproj delete mode 100644 Scalar.Mount/app.config delete mode 100644 Scalar.Mount/packages.config diff --git a/Scalar.Mount/Properties/AssemblyInfo.cs b/Scalar.Mount/Properties/AssemblyInfo.cs deleted file mode 100644 index 1590f8f1f1..0000000000 --- a/Scalar.Mount/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System.Reflection; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("Scalar.Mount")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Scalar.Mount")] -[assembly: AssemblyCopyright("Copyright © Microsoft 2019")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("b8c1dfbd-cafd-4f7e-a1a3-e11907b5467b")] diff --git a/Scalar.Mount/Scalar.Mount.Mac.csproj b/Scalar.Mount/Scalar.Mount.Mac.csproj deleted file mode 100644 index a728110041..0000000000 --- a/Scalar.Mount/Scalar.Mount.Mac.csproj +++ /dev/null @@ -1,35 +0,0 @@ - - - - Exe - scalar.mount - netcoreapp2.1 - x64 - osx-x64 - - - - $(ScalarVersion) - - - $(ScalarVersion) - - - - - PlatformLoader.Mac.cs - - - - - - - - - - - all - - - - diff --git a/Scalar.Mount/Scalar.Mount.Windows.csproj b/Scalar.Mount/Scalar.Mount.Windows.csproj deleted file mode 100644 index 955d04fa32..0000000000 --- a/Scalar.Mount/Scalar.Mount.Windows.csproj +++ /dev/null @@ -1,122 +0,0 @@ - - - - - - {17498502-AEFF-4E70-90CC-1D0B56A8ADF5} - Exe - Properties - Scalar.Mount - Scalar.Mount - v4.6.1 - 512 - true - - - - - x64 - true - full - false - DEBUG;TRACE - prompt - 4 - false - - - x64 - pdbonly - TRACE - true - prompt - 4 - - - - False - ..\..\packages\CommandLineParser.2.1.1-beta\lib\net45\CommandLine.dll - True - - - ..\..\packages\Microsoft.Data.Sqlite.Core.2.2.4\lib\netstandard2.0\Microsoft.Data.Sqlite.dll - - - False - ..\..\packages\Newtonsoft.Json.11.0.2\lib\net45\Newtonsoft.Json.dll - True - - - ..\..\packages\SQLitePCLRaw.bundle_green.1.1.12\lib\net45\SQLitePCLRaw.batteries_green.dll - - - ..\..\packages\SQLitePCLRaw.bundle_green.1.1.12\lib\net45\SQLitePCLRaw.batteries_v2.dll - - - ..\..\packages\SQLitePCLRaw.core.1.1.12\lib\net45\SQLitePCLRaw.core.dll - - - ..\..\packages\SQLitePCLRaw.provider.e_sqlite3.net45.1.1.12\lib\net45\SQLitePCLRaw.provider.e_sqlite3.dll - - - - - - - - - - - - - - PlatformLoader.Windows.cs - - - - - - - - - - - Designer - - - - - {374bf1e5-0b2d-4d4a-bd5e-4212299def09} - Scalar.Common - - - {4ce404e7-d3fc-471c-993c-64615861ea63} - Scalar.Platform.Windows - - - - - - - - - - This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - - - - - - - - - diff --git a/Scalar.Mount/Scalar.Mount.csproj b/Scalar.Mount/Scalar.Mount.csproj new file mode 100644 index 0000000000..01807f8e66 --- /dev/null +++ b/Scalar.Mount/Scalar.Mount.csproj @@ -0,0 +1,17 @@ + + + + Exe + netcoreapp3.0 + scalar.mount + + + + + + + + + + + diff --git a/Scalar.Mount/app.config b/Scalar.Mount/app.config deleted file mode 100644 index bd27edc04e..0000000000 --- a/Scalar.Mount/app.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/Scalar.Mount/packages.config b/Scalar.Mount/packages.config deleted file mode 100644 index a0646c24e1..0000000000 --- a/Scalar.Mount/packages.config +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - - From 7127617a668df513703c4783f0780efdd22e599a Mon Sep 17 00:00:00 2001 From: Matthew John Cheetham Date: Tue, 8 Oct 2019 15:28:40 +0100 Subject: [PATCH 06/24] Upgrade Scalar.Service project --- ...ndler.Mac.cs => MacNotificationHandler.cs} | 6 +- ...ndows.cs => WindowsNotificationHandler.cs} | 50 ++++---- ...alarService.Mac.cs => MacScalarService.cs} | 8 +- ...rbRunner.Mac.cs => MacScalarVerbRunner.cs} | 6 +- Scalar.Service/Program.Mac.cs | 68 ----------- Scalar.Service/Program.Windows.cs | 40 ------- Scalar.Service/Program.cs | 100 ++++++++++++++++ Scalar.Service/Properties/AssemblyInfo.cs | 22 ---- Scalar.Service/Scalar.Service.Mac.csproj | 56 --------- Scalar.Service/Scalar.Service.Windows.csproj | 113 ------------------ Scalar.Service/Scalar.Service.csproj | 14 +++ ...ice.Windows.cs => WindowsScalarService.cs} | 100 ++++++++-------- ....Windows.cs => WindowsScalarVerbRunner.cs} | 4 +- Scalar.Service/app.config | 6 - Scalar.Service/packages.config | 5 - .../Service/Mac/MacServiceTests.cs | 4 +- 16 files changed, 203 insertions(+), 399 deletions(-) rename Scalar.Service/Handlers/{NotificationHandler.Mac.cs => MacNotificationHandler.cs} (89%) rename Scalar.Service/Handlers/{NotificationHandler.Windows.cs => WindowsNotificationHandler.cs} (92%) rename Scalar.Service/{ScalarService.Mac.cs => MacScalarService.cs} (95%) rename Scalar.Service/{ScalarVerbRunner.Mac.cs => MacScalarVerbRunner.cs} (93%) delete mode 100644 Scalar.Service/Program.Mac.cs delete mode 100644 Scalar.Service/Program.Windows.cs create mode 100644 Scalar.Service/Program.cs delete mode 100644 Scalar.Service/Properties/AssemblyInfo.cs delete mode 100644 Scalar.Service/Scalar.Service.Mac.csproj delete mode 100644 Scalar.Service/Scalar.Service.Windows.csproj create mode 100644 Scalar.Service/Scalar.Service.csproj rename Scalar.Service/{ScalarService.Windows.cs => WindowsScalarService.cs} (97%) rename Scalar.Service/{ScalarVerbRunner.Windows.cs => WindowsScalarVerbRunner.cs} (92%) delete mode 100644 Scalar.Service/app.config delete mode 100644 Scalar.Service/packages.config diff --git a/Scalar.Service/Handlers/NotificationHandler.Mac.cs b/Scalar.Service/Handlers/MacNotificationHandler.cs similarity index 89% rename from Scalar.Service/Handlers/NotificationHandler.Mac.cs rename to Scalar.Service/Handlers/MacNotificationHandler.cs index 15fb0b187b..a3c441c610 100644 --- a/Scalar.Service/Handlers/NotificationHandler.Mac.cs +++ b/Scalar.Service/Handlers/MacNotificationHandler.cs @@ -5,12 +5,12 @@ namespace Scalar.Service.Handlers { - public class NotificationHandler : INotificationHandler + public class MacNotificationHandler : INotificationHandler { private const string NotificationServerPipeName = "scalar.notification"; private ITracer tracer; - public NotificationHandler(ITracer tracer) + public MacNotificationHandler(ITracer tracer) { this.tracer = tracer; } @@ -29,7 +29,7 @@ public void SendNotification(NamedPipeMessages.Notification.Request request) catch (Exception ex) { EventMetadata metadata = new EventMetadata(); - metadata.Add("Area", nameof(NotificationHandler)); + metadata.Add("Area", "NotificationHandler"); metadata.Add("Exception", ex.ToString()); metadata.Add(TracingConstants.MessageKey.ErrorMessage, "MacOS notification display error"); this.tracer.RelatedError(metadata, $"MacOS notification: {request.Title} - {request.Message}."); diff --git a/Scalar.Service/Handlers/NotificationHandler.Windows.cs b/Scalar.Service/Handlers/WindowsNotificationHandler.cs similarity index 92% rename from Scalar.Service/Handlers/NotificationHandler.Windows.cs rename to Scalar.Service/Handlers/WindowsNotificationHandler.cs index b5b2c0fe0e..173eb5045c 100644 --- a/Scalar.Service/Handlers/NotificationHandler.Windows.cs +++ b/Scalar.Service/Handlers/WindowsNotificationHandler.cs @@ -7,40 +7,40 @@ namespace Scalar.Service.Handlers { - public class NotificationHandler : INotificationHandler + public class WindowsNotificationHandler : INotificationHandler { private ITracer tracer; - public NotificationHandler(ITracer tracer) + public WindowsNotificationHandler(ITracer tracer) { this.tracer = tracer; } public void SendNotification(NamedPipeMessages.Notification.Request request) { - using (NamedPipeClient client = new NamedPipeClient(ScalarConstants.Service.UIName)) - { - if (client.Connect()) - { - try - { - if (!client.TrySendRequest(request.ToMessage())) - { - this.tracer.RelatedInfo("Failed to send notification request to " + ScalarConstants.Service.UIName); - } - } - catch (Exception ex) - { - EventMetadata metadata = new EventMetadata(); - metadata.Add("Exception", ex.ToString()); - metadata.Add("Identifier", request.Id); - this.tracer.RelatedError(metadata, $"{nameof(this.SendNotification)}- Could not send notification request({request.Id}. {ex.ToString()}"); - } - } - else - { - this.tracer.RelatedError($"{nameof(this.SendNotification)}- Could not connect with GVFS.Service.UI, failed to send notification request({request.Id}."); - } + using (NamedPipeClient client = new NamedPipeClient(ScalarConstants.Service.UIName)) + { + if (client.Connect()) + { + try + { + if (!client.TrySendRequest(request.ToMessage())) + { + this.tracer.RelatedInfo("Failed to send notification request to " + ScalarConstants.Service.UIName); + } + } + catch (Exception ex) + { + EventMetadata metadata = new EventMetadata(); + metadata.Add("Exception", ex.ToString()); + metadata.Add("Identifier", request.Id); + this.tracer.RelatedError(metadata, $"{nameof(this.SendNotification)}- Could not send notification request({request.Id}. {ex.ToString()}"); + } + } + else + { + this.tracer.RelatedError($"{nameof(this.SendNotification)}- Could not connect with GVFS.Service.UI, failed to send notification request({request.Id}."); + } } } } diff --git a/Scalar.Service/ScalarService.Mac.cs b/Scalar.Service/MacScalarService.cs similarity index 95% rename from Scalar.Service/ScalarService.Mac.cs rename to Scalar.Service/MacScalarService.cs index 390b16c51e..3a0d01b6a2 100644 --- a/Scalar.Service/ScalarService.Mac.cs +++ b/Scalar.Service/MacScalarService.cs @@ -7,11 +7,11 @@ namespace Scalar.Service { - public class ScalarService + public class MacScalarService { public const string ServiceNameArgPrefix = "--servicename="; - private const string EtwArea = nameof(ScalarService); + private const string EtwArea = "ScalarService"; private ITracer tracer; private Thread serviceThread; @@ -21,7 +21,7 @@ public class ScalarService private RequestHandler requestHandler; private MaintenanceTaskScheduler maintenanceTaskScheduler; - public ScalarService( + public MacScalarService( ITracer tracer, string serviceName, IRepoRegistry repoRegistry) @@ -85,7 +85,7 @@ private void ServiceThreadMain() EventMetadata metadata = new EventMetadata(); metadata.Add("Version", ProcessHelper.GetCurrentProcessVersion()); metadata.Add(nameof(currentUser), currentUser); - this.tracer.RelatedEvent(EventLevel.Informational, $"{nameof(ScalarService)}_{nameof(this.ServiceThreadMain)}", metadata); + this.tracer.RelatedEvent(EventLevel.Informational, $"ScalarService_{nameof(this.ServiceThreadMain)}", metadata); if (int.TryParse(currentUser, out int sessionId)) { diff --git a/Scalar.Service/ScalarVerbRunner.Mac.cs b/Scalar.Service/MacScalarVerbRunner.cs similarity index 93% rename from Scalar.Service/ScalarVerbRunner.Mac.cs rename to Scalar.Service/MacScalarVerbRunner.cs index ee8faf4bf2..2af573ea93 100644 --- a/Scalar.Service/ScalarVerbRunner.Mac.cs +++ b/Scalar.Service/MacScalarVerbRunner.cs @@ -6,7 +6,7 @@ namespace Scalar.Service { - public class ScalarVerbRunner : IScalarVerbRunner + public class MacScalarVerbRunner : IScalarVerbRunner { private const string ExecutablePath = "/bin/launchctl"; @@ -16,7 +16,7 @@ public class ScalarVerbRunner : IScalarVerbRunner private ScalarProcessLauncher processLauncher; private ITracer tracer; - public ScalarVerbRunner(ITracer tracer, ScalarProcessLauncher processLauncher = null) + public MacScalarVerbRunner(ITracer tracer, ScalarProcessLauncher processLauncher = null) { this.tracer = tracer; this.processLauncher = processLauncher ?? new ScalarProcessLauncher(tracer); @@ -39,7 +39,7 @@ public bool CallMaintenance(MaintenanceTasks.Task task, string repoRoot, int ses if (result.ExitCode != 0) { EventMetadata metadata = new EventMetadata(); - metadata.Add("Area", nameof(ScalarVerbRunner)); + metadata.Add("Area", "ScalarVerbRunner"); metadata.Add(nameof(ExecutablePath), ExecutablePath); metadata.Add(nameof(arguments), arguments); metadata.Add(nameof(repoRoot), repoRoot); diff --git a/Scalar.Service/Program.Mac.cs b/Scalar.Service/Program.Mac.cs deleted file mode 100644 index ef5f7901a3..0000000000 --- a/Scalar.Service/Program.Mac.cs +++ /dev/null @@ -1,68 +0,0 @@ -using Scalar.Common; -using Scalar.Common.FileSystem; -using Scalar.Common.Tracing; -using Scalar.PlatformLoader; -using Scalar.Service.Handlers; -using System; -using System.IO; -using System.Linq; - -namespace Scalar.Service -{ - public static class Program - { - public static void Main(string[] args) - { - ScalarPlatformLoader.Initialize(); - - AppDomain.CurrentDomain.UnhandledException += UnhandledExceptionHandler; - - using (JsonTracer tracer = new JsonTracer(ScalarConstants.Service.ServiceName, ScalarConstants.Service.ServiceName)) - { - CreateService(tracer, args).Run(); - } - } - - private static ScalarService CreateService(JsonTracer tracer, string[] args) - { - string serviceName = args.FirstOrDefault(arg => arg.StartsWith(ScalarService.ServiceNameArgPrefix, StringComparison.OrdinalIgnoreCase)); - if (serviceName != null) - { - serviceName = serviceName.Substring(ScalarService.ServiceNameArgPrefix.Length); - } - else - { - serviceName = ScalarConstants.Service.ServiceName; - } - - ScalarPlatform scalarPlatform = ScalarPlatform.Instance; - - string logFilePath = Path.Combine( - scalarPlatform.GetDataRootForScalarComponent(serviceName), - ScalarConstants.Service.LogDirectory); - Directory.CreateDirectory(logFilePath); - - tracer.AddLogFileEventListener( - ScalarEnlistment.GetNewScalarLogFileName(logFilePath, ScalarConstants.LogFileTypes.Service), - EventLevel.Informational, - Keywords.Any); - - string serviceDataLocation = scalarPlatform.GetDataRootForScalarComponent(serviceName); - RepoRegistry repoRegistry = new RepoRegistry( - tracer, - new PhysicalFileSystem(), - serviceDataLocation, - new ScalarVerbRunner(tracer)); - - return new ScalarService(tracer, serviceName, repoRegistry); - } - - private static void UnhandledExceptionHandler(object sender, UnhandledExceptionEventArgs e) - { - using (JsonTracer tracer = new JsonTracer(ScalarConstants.Service.ServiceName, ScalarConstants.Service.ServiceName)) - { - tracer.RelatedError($"Unhandled exception in Scalar.Service: {e.ExceptionObject.ToString()}"); - } - } - } -} diff --git a/Scalar.Service/Program.Windows.cs b/Scalar.Service/Program.Windows.cs deleted file mode 100644 index ac2f35c970..0000000000 --- a/Scalar.Service/Program.Windows.cs +++ /dev/null @@ -1,40 +0,0 @@ -using Scalar.Common; -using Scalar.Common.Tracing; -using Scalar.PlatformLoader; -using System; -using System.Diagnostics; -using System.ServiceProcess; - -namespace Scalar.Service -{ - public static class Program - { - public static void Main(string[] args) - { - ScalarPlatformLoader.Initialize(); - - AppDomain.CurrentDomain.UnhandledException += UnhandledExceptionHandler; - - using (JsonTracer tracer = new JsonTracer(ScalarConstants.Service.ServiceName, ScalarConstants.Service.ServiceName)) - { - using (ScalarService service = new ScalarService(tracer)) - { - // This will fail with a popup from a command prompt. To install as a service, run: - // %windir%\Microsoft.NET\Framework64\v4.0.30319\installutil Scalar.Service.exe - ServiceBase.Run(service); - } - } - } - - private static void UnhandledExceptionHandler(object sender, UnhandledExceptionEventArgs e) - { - using (EventLog eventLog = new EventLog("Application")) - { - eventLog.Source = "Application"; - eventLog.WriteEntry( - "Unhandled exception in Scalar.Service: " + e.ExceptionObject.ToString(), - EventLogEntryType.Error); - } - } - } -} diff --git a/Scalar.Service/Program.cs b/Scalar.Service/Program.cs new file mode 100644 index 0000000000..b7714bd552 --- /dev/null +++ b/Scalar.Service/Program.cs @@ -0,0 +1,100 @@ +using Scalar.Common; +using Scalar.Common.FileSystem; +using Scalar.Common.Tracing; +using Scalar.PlatformLoader; +using Scalar.Service.Handlers; +using System; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Runtime.InteropServices; +using System.ServiceProcess; + +namespace Scalar.Service +{ + public static class Program + { + public static void Main(string[] args) + { + ScalarPlatformLoader.Initialize(); + + using (JsonTracer tracer = new JsonTracer(ScalarConstants.Service.ServiceName, ScalarConstants.Service.ServiceName)) + { + if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + { + AppDomain.CurrentDomain.UnhandledException += EventLogUnhandledExceptionHandler; + + using (WindowsScalarService service = new WindowsScalarService(tracer)) + { + // This will fail with a popup from a command prompt. To install as a service, run: + // %windir%\Microsoft.NET\Framework64\v4.0.30319\installutil Scalar.Service.exe + ServiceBase.Run(service); + } + } + else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) + { + AppDomain.CurrentDomain.UnhandledException += JsonUnhandledExceptionHandler; + + CreateMacService(tracer, args).Run(); + } + else + { + throw new NotImplementedException(); + } + } + } + + private static MacScalarService CreateMacService(JsonTracer tracer, string[] args) + { + string serviceName = args.FirstOrDefault(arg => arg.StartsWith(MacScalarService.ServiceNameArgPrefix, StringComparison.OrdinalIgnoreCase)); + if (serviceName != null) + { + serviceName = serviceName.Substring(MacScalarService.ServiceNameArgPrefix.Length); + } + else + { + serviceName = ScalarConstants.Service.ServiceName; + } + + ScalarPlatform scalarPlatform = ScalarPlatform.Instance; + + string logFilePath = Path.Combine( + scalarPlatform.GetDataRootForScalarComponent(serviceName), + ScalarConstants.Service.LogDirectory); + Directory.CreateDirectory(logFilePath); + + tracer.AddLogFileEventListener( + ScalarEnlistment.GetNewScalarLogFileName(logFilePath, ScalarConstants.LogFileTypes.Service), + EventLevel.Informational, + Keywords.Any); + + string serviceDataLocation = scalarPlatform.GetDataRootForScalarComponent(serviceName); + RepoRegistry repoRegistry = new RepoRegistry( + tracer, + new PhysicalFileSystem(), + serviceDataLocation, + new MacScalarVerbRunner(tracer)); + + return new MacScalarService(tracer, serviceName, repoRegistry); + } + + private static void JsonUnhandledExceptionHandler(object sender, UnhandledExceptionEventArgs e) + { + using (JsonTracer tracer = new JsonTracer(ScalarConstants.Service.ServiceName, ScalarConstants.Service.ServiceName)) + { + tracer.RelatedError($"Unhandled exception in Scalar.Service: {e.ExceptionObject.ToString()}"); + } + } + + private static void EventLogUnhandledExceptionHandler(object sender, UnhandledExceptionEventArgs e) + { + using (EventLog eventLog = new EventLog("Application")) + { + eventLog.Source = "Application"; + eventLog.WriteEntry( + "Unhandled exception in Scalar.Service: " + e.ExceptionObject.ToString(), + EventLogEntryType.Error); + } + } + } +} diff --git a/Scalar.Service/Properties/AssemblyInfo.cs b/Scalar.Service/Properties/AssemblyInfo.cs deleted file mode 100644 index 948ab9e072..0000000000 --- a/Scalar.Service/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System.Reflection; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("Scalar.Service")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Scalar.Service")] -[assembly: AssemblyCopyright("Copyright © Microsoft 2019")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("b8c1dfba-cafd-4f7e-a1a3-e11907b5467b")] diff --git a/Scalar.Service/Scalar.Service.Mac.csproj b/Scalar.Service/Scalar.Service.Mac.csproj deleted file mode 100644 index 7c0ee5df85..0000000000 --- a/Scalar.Service/Scalar.Service.Mac.csproj +++ /dev/null @@ -1,56 +0,0 @@ - - - - Exe - Scalar.Service - Scalar.Service - - netcoreapp2.1; netstandard2.0 - x64 - osx-x64 - false - true - - - - $(ScalarVersion) - - - $(ScalarVersion) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - all - - - diff --git a/Scalar.Service/Scalar.Service.Windows.csproj b/Scalar.Service/Scalar.Service.Windows.csproj deleted file mode 100644 index f15c2e7922..0000000000 --- a/Scalar.Service/Scalar.Service.Windows.csproj +++ /dev/null @@ -1,113 +0,0 @@ - - - - - - {B8C1DFBA-CAFD-4F7E-A1A3-E11907B5467B} - Exe - Properties - Scalar.Service - Scalar.Service - v4.6.1 - 512 - true - - - - - x64 - true - full - false - DEBUG;TRACE - prompt - 4 - - - x64 - pdbonly - true - TRACE - prompt - 4 - - - - - - $(BuildOutputDir)\Scalar.Service.exe.manifest - - - - False - ..\..\packages\Newtonsoft.Json.11.0.2\lib\net45\Newtonsoft.Json.dll - True - - - - - - - - - - - - - - - - - - - Component - - - - - - - - - - - - - - - - - - - - - - {374bf1e5-0b2d-4d4a-bd5e-4212299def09} - Scalar.Common - - - {4ce404e7-d3fc-471c-993c-64615861ea63} - Scalar.Platform.Windows - - - {93b403fd-dafb-46c5-9636-b122792a548a} - Scalar.Service.UI - - - - - - Scalar.Service.exe.manifest - - - - - - - - - - - - - diff --git a/Scalar.Service/Scalar.Service.csproj b/Scalar.Service/Scalar.Service.csproj new file mode 100644 index 0000000000..5fb04f3897 --- /dev/null +++ b/Scalar.Service/Scalar.Service.csproj @@ -0,0 +1,14 @@ + + + + Exe + netcoreapp3.0 + scalar.service + true + + + + + + + diff --git a/Scalar.Service/ScalarService.Windows.cs b/Scalar.Service/WindowsScalarService.cs similarity index 97% rename from Scalar.Service/ScalarService.Windows.cs rename to Scalar.Service/WindowsScalarService.cs index 53037c8a24..8146e18487 100644 --- a/Scalar.Service/ScalarService.Windows.cs +++ b/Scalar.Service/WindowsScalarService.cs @@ -14,10 +14,10 @@ namespace Scalar.Service { - public class ScalarService : ServiceBase + public class WindowsScalarService : ServiceBase { private const string ServiceNameArgPrefix = "--servicename="; - private const string EtwArea = nameof(ScalarService); + private const string EtwArea = "ScalarService"; private JsonTracer tracer; private Thread serviceThread; @@ -30,12 +30,12 @@ public class ScalarService : ServiceBase private MaintenanceTaskScheduler maintenanceTaskScheduler; private INotificationHandler notificationHandler; - public ScalarService(JsonTracer tracer) + public WindowsScalarService(JsonTracer tracer) { this.tracer = tracer; this.serviceName = ScalarConstants.Service.ServiceName; this.CanHandleSessionChangeEvent = true; - this.notificationHandler = new NotificationHandler(tracer); + this.notificationHandler = new WindowsNotificationHandler(tracer); this.productUpgradeTimer = new ProductUpgradeTimer(tracer, this.notificationHandler); } @@ -45,13 +45,13 @@ public void Run() { EventMetadata metadata = new EventMetadata(); metadata.Add("Version", ProcessHelper.GetCurrentProcessVersion()); - this.tracer.RelatedEvent(EventLevel.Informational, $"{nameof(ScalarService)}_{nameof(this.Run)}", metadata); + this.tracer.RelatedEvent(EventLevel.Informational, $"ScalarService_{nameof(this.Run)}", metadata); this.repoRegistry = new RepoRegistry( this.tracer, new PhysicalFileSystem(), this.serviceDataLocation, - new ScalarVerbRunner(this.tracer)); + new WindowsScalarVerbRunner(this.tracer)); this.maintenanceTaskScheduler = new MaintenanceTaskScheduler(this.tracer, this.repoRegistry); @@ -317,50 +317,50 @@ private DirectorySecurity GetServiceDirectorySecurity(string serviceDataRootPath return serviceDataRootSecurity; } - private void LaunchServiceUIIfNotRunning(int sessionId) - { - NamedPipeClient client; - using (client = new NamedPipeClient(ScalarConstants.Service.UIName)) - { - if (!client.Connect()) - { - this.tracer.RelatedError($"Could not connect with {ScalarConstants.Service.UIName}. Attempting to relaunch."); - - this.TerminateExistingProcess(ScalarConstants.Service.UIName, sessionId); - - CurrentUser currentUser = new CurrentUser(this.tracer, sessionId); - if (!currentUser.RunAs( - Configuration.Instance.ScalarServiceUILocation, - string.Empty)) - { - this.tracer.RelatedError("Could not start " + ScalarConstants.Service.UIName); - } - else - { - this.tracer.RelatedInfo($"Successfully launched {ScalarConstants.Service.UIName}. "); - } - } - } - } - - private void TerminateExistingProcess(string processName, int sessionId) - { - try - { - foreach (Process process in Process.GetProcessesByName(processName)) - { - if (process.SessionId == sessionId) - { - this.tracer.RelatedInfo($"{nameof(this.TerminateExistingProcess)}- Stopping {processName}, in session {sessionId}."); - - process.Kill(); - } - } - } - catch (Exception ex) - { - this.tracer.RelatedError("Could not find and kill existing instances of {0}: {1}", processName, ex.Message); - } + private void LaunchServiceUIIfNotRunning(int sessionId) + { + NamedPipeClient client; + using (client = new NamedPipeClient(ScalarConstants.Service.UIName)) + { + if (!client.Connect()) + { + this.tracer.RelatedError($"Could not connect with {ScalarConstants.Service.UIName}. Attempting to relaunch."); + + this.TerminateExistingProcess(ScalarConstants.Service.UIName, sessionId); + + CurrentUser currentUser = new CurrentUser(this.tracer, sessionId); + if (!currentUser.RunAs( + Configuration.Instance.ScalarServiceUILocation, + string.Empty)) + { + this.tracer.RelatedError("Could not start " + ScalarConstants.Service.UIName); + } + else + { + this.tracer.RelatedInfo($"Successfully launched {ScalarConstants.Service.UIName}. "); + } + } + } + } + + private void TerminateExistingProcess(string processName, int sessionId) + { + try + { + foreach (Process process in Process.GetProcessesByName(processName)) + { + if (process.SessionId == sessionId) + { + this.tracer.RelatedInfo($"{nameof(this.TerminateExistingProcess)}- Stopping {processName}, in session {sessionId}."); + + process.Kill(); + } + } + } + catch (Exception ex) + { + this.tracer.RelatedError("Could not find and kill existing instances of {0}: {1}", processName, ex.Message); + } } } } diff --git a/Scalar.Service/ScalarVerbRunner.Windows.cs b/Scalar.Service/WindowsScalarVerbRunner.cs similarity index 92% rename from Scalar.Service/ScalarVerbRunner.Windows.cs rename to Scalar.Service/WindowsScalarVerbRunner.cs index caec693836..6a9df59a55 100644 --- a/Scalar.Service/ScalarVerbRunner.Windows.cs +++ b/Scalar.Service/WindowsScalarVerbRunner.cs @@ -5,12 +5,12 @@ namespace Scalar.Service { - public class ScalarVerbRunner : IScalarVerbRunner + public class WindowsScalarVerbRunner : IScalarVerbRunner { private readonly ITracer tracer; private readonly string internalVerbJson; - public ScalarVerbRunner(ITracer tracer) + public WindowsScalarVerbRunner(ITracer tracer) { this.tracer = tracer; diff --git a/Scalar.Service/app.config b/Scalar.Service/app.config deleted file mode 100644 index bd27edc04e..0000000000 --- a/Scalar.Service/app.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/Scalar.Service/packages.config b/Scalar.Service/packages.config deleted file mode 100644 index 7e38df55c1..0000000000 --- a/Scalar.Service/packages.config +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/Scalar.UnitTests/Service/Mac/MacServiceTests.cs b/Scalar.UnitTests/Service/Mac/MacServiceTests.cs index cebad8993f..123c0ad617 100644 --- a/Scalar.UnitTests/Service/Mac/MacServiceTests.cs +++ b/Scalar.UnitTests/Service/Mac/MacServiceTests.cs @@ -86,14 +86,14 @@ public void MaintenanceVerbLaunchedUsingCorrectArgs() string expectedArgs = $"asuser {ExpectedActiveUserId} {scalarBinPath} maintenance \"{ExpectedActiveRepoPath}\" --{ScalarConstants.VerbParameters.Maintenance.Task} {taskVerbName} --{ScalarConstants.VerbParameters.InternalUseOnly} {new InternalVerbParameters(startedByService: true).ToJson()}"; - Mock mountLauncherMock = new Mock(MockBehavior.Strict, this.tracer); + Mock mountLauncherMock = new Mock(MockBehavior.Strict, this.tracer); mountLauncherMock.Setup(mp => mp.LaunchProcess( executable, expectedArgs, ExpectedActiveRepoPath)) .Returns(new ProcessResult(output: string.Empty, errors: string.Empty, exitCode: 0)); - ScalarVerbRunner verbProcess = new ScalarVerbRunner(this.tracer, mountLauncherMock.Object); + MacScalarVerbRunner verbProcess = new MacScalarVerbRunner(this.tracer, mountLauncherMock.Object); verbProcess.CallMaintenance(task, ExpectedActiveRepoPath, ExpectedActiveUserId); mountLauncherMock.VerifyAll(); From 60b19f200449b2ffcbf63cd6e7dbff17deba1bf1 Mon Sep 17 00:00:00 2001 From: Matthew John Cheetham Date: Tue, 8 Oct 2019 15:31:17 +0100 Subject: [PATCH 07/24] Upgrade Scalar.Upgrader project --- Scalar.Upgrader/App.config | 14 ----- Scalar.Upgrader/Properties/AssemblyInfo.cs | 22 ------- Scalar.Upgrader/Scalar.Upgrader.csproj | 57 +------------------ Scalar.Upgrader/UpgradeOrchestratorFactory.cs | 2 +- Scalar.Upgrader/packages.config | 18 ------ 5 files changed, 4 insertions(+), 109 deletions(-) delete mode 100644 Scalar.Upgrader/App.config delete mode 100644 Scalar.Upgrader/Properties/AssemblyInfo.cs delete mode 100644 Scalar.Upgrader/packages.config diff --git a/Scalar.Upgrader/App.config b/Scalar.Upgrader/App.config deleted file mode 100644 index ece138ecf8..0000000000 --- a/Scalar.Upgrader/App.config +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - - diff --git a/Scalar.Upgrader/Properties/AssemblyInfo.cs b/Scalar.Upgrader/Properties/AssemblyInfo.cs deleted file mode 100644 index 952f1cdf81..0000000000 --- a/Scalar.Upgrader/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System.Reflection; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("Scalar.Upgrader")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Scalar.Upgrader")] -[assembly: AssemblyCopyright("Copyright © Microsoft 2019")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("aecec217-2499-403d-b0bb-2962b9be5970")] diff --git a/Scalar.Upgrader/Scalar.Upgrader.csproj b/Scalar.Upgrader/Scalar.Upgrader.csproj index e09fe352fc..b9c716326f 100644 --- a/Scalar.Upgrader/Scalar.Upgrader.csproj +++ b/Scalar.Upgrader/Scalar.Upgrader.csproj @@ -1,68 +1,17 @@ - Exe - Scalar.Upgrader - - x64 - x64 - Scalar.Upgrader - false - - true - - - - $(ScalarVersion) - - - $(ScalarVersion) + netcoreapp3.0 + scalar.upgrader - - - - - net461;netcoreapp2.1 - $(DefineConstants);WINDOWS_BUILD - - - - - PlatformLoader.Windows.cs - - - - - - netcoreapp2.1 - osx-x64 - $(DefineConstants);MACOS_BUILD - - - - - PlatformLoader.Mac.cs - - - - - - - - - - - - all - + diff --git a/Scalar.Upgrader/UpgradeOrchestratorFactory.cs b/Scalar.Upgrader/UpgradeOrchestratorFactory.cs index 8cd10d388f..21637d3d96 100644 --- a/Scalar.Upgrader/UpgradeOrchestratorFactory.cs +++ b/Scalar.Upgrader/UpgradeOrchestratorFactory.cs @@ -9,7 +9,7 @@ public static UpgradeOrchestrator Create(UpgradeOptions options) #elif WINDOWS_BUILD return new WindowsUpgradeOrchestrator(options); #else - throw new NotImplementedException(); + throw new System.NotImplementedException(); #endif } } diff --git a/Scalar.Upgrader/packages.config b/Scalar.Upgrader/packages.config deleted file mode 100644 index 3bdbcd90e8..0000000000 --- a/Scalar.Upgrader/packages.config +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - - - From a7ea6a3566f7a982f1ab6e250396c1d79d376a8e Mon Sep 17 00:00:00 2001 From: Matthew John Cheetham Date: Tue, 8 Oct 2019 15:44:22 +0100 Subject: [PATCH 08/24] Upgrade Scalar.Tests project (rename: test infra) --- .../DataSources.cs | 0 .../Scalar.TestInfrastructure.csproj | 12 +++ .../Should/EnumerableShouldExtensions.cs | 0 .../Should/StringExtensions.cs | 0 .../Should/StringShouldExtensions.cs | 0 .../Should/ValueShouldExtensions.cs | 0 Scalar.Tests/NUnitRunner.cs | 79 ------------------- Scalar.Tests/Scalar.Tests.csproj | 24 ------ 8 files changed, 12 insertions(+), 103 deletions(-) rename {Scalar.Tests => Scalar.TestInfrastructure}/DataSources.cs (100%) create mode 100644 Scalar.TestInfrastructure/Scalar.TestInfrastructure.csproj rename {Scalar.Tests => Scalar.TestInfrastructure}/Should/EnumerableShouldExtensions.cs (100%) rename {Scalar.Tests => Scalar.TestInfrastructure}/Should/StringExtensions.cs (100%) rename {Scalar.Tests => Scalar.TestInfrastructure}/Should/StringShouldExtensions.cs (100%) rename {Scalar.Tests => Scalar.TestInfrastructure}/Should/ValueShouldExtensions.cs (100%) delete mode 100644 Scalar.Tests/NUnitRunner.cs delete mode 100644 Scalar.Tests/Scalar.Tests.csproj diff --git a/Scalar.Tests/DataSources.cs b/Scalar.TestInfrastructure/DataSources.cs similarity index 100% rename from Scalar.Tests/DataSources.cs rename to Scalar.TestInfrastructure/DataSources.cs diff --git a/Scalar.TestInfrastructure/Scalar.TestInfrastructure.csproj b/Scalar.TestInfrastructure/Scalar.TestInfrastructure.csproj new file mode 100644 index 0000000000..d43ea7fbd8 --- /dev/null +++ b/Scalar.TestInfrastructure/Scalar.TestInfrastructure.csproj @@ -0,0 +1,12 @@ + + + + netcoreapp3.0 + false + + + + + + + diff --git a/Scalar.Tests/Should/EnumerableShouldExtensions.cs b/Scalar.TestInfrastructure/Should/EnumerableShouldExtensions.cs similarity index 100% rename from Scalar.Tests/Should/EnumerableShouldExtensions.cs rename to Scalar.TestInfrastructure/Should/EnumerableShouldExtensions.cs diff --git a/Scalar.Tests/Should/StringExtensions.cs b/Scalar.TestInfrastructure/Should/StringExtensions.cs similarity index 100% rename from Scalar.Tests/Should/StringExtensions.cs rename to Scalar.TestInfrastructure/Should/StringExtensions.cs diff --git a/Scalar.Tests/Should/StringShouldExtensions.cs b/Scalar.TestInfrastructure/Should/StringShouldExtensions.cs similarity index 100% rename from Scalar.Tests/Should/StringShouldExtensions.cs rename to Scalar.TestInfrastructure/Should/StringShouldExtensions.cs diff --git a/Scalar.Tests/Should/ValueShouldExtensions.cs b/Scalar.TestInfrastructure/Should/ValueShouldExtensions.cs similarity index 100% rename from Scalar.Tests/Should/ValueShouldExtensions.cs rename to Scalar.TestInfrastructure/Should/ValueShouldExtensions.cs diff --git a/Scalar.Tests/NUnitRunner.cs b/Scalar.Tests/NUnitRunner.cs deleted file mode 100644 index a768b49cc1..0000000000 --- a/Scalar.Tests/NUnitRunner.cs +++ /dev/null @@ -1,79 +0,0 @@ -using NUnitLite; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; - -namespace Scalar.Tests -{ - public class NUnitRunner - { - private List args; - - public NUnitRunner(string[] args) - { - this.args = new List(args); - } - - public string GetCustomArgWithParam(string arg) - { - string match = this.args.Where(a => a.StartsWith(arg + "=")).SingleOrDefault(); - if (match == null) - { - return null; - } - - this.args.Remove(match); - return match.Substring(arg.Length + 1); - } - - public bool HasCustomArg(string arg) - { - // We also remove it as we're checking, because nunit wouldn't understand what it means - return this.args.Remove(arg); - } - - public void AddGlobalSetupIfNeeded(string globalSetup) - { - // If there are any test filters, the GlobalSetup still needs to run so add it. - if (this.args.Any(x => x.StartsWith("--test="))) - { - this.args.Add($"--test={globalSetup}"); - } - } - - public int RunTests(ICollection includeCategories, ICollection excludeCategories) - { - string filters = GetFiltersArgument(includeCategories, excludeCategories); - if (filters.Length > 0) - { - this.args.Add("--where"); - this.args.Add(filters); - } - - DateTime now = DateTime.Now; - int result = new AutoRun(Assembly.GetEntryAssembly()).Execute(this.args.ToArray()); - - Console.WriteLine("Completed test pass in {0}", DateTime.Now - now); - Console.WriteLine(); - - return result; - } - - private static string GetFiltersArgument(ICollection includeCategories, ICollection excludeCategories) - { - string filters = string.Empty; - if (includeCategories != null && includeCategories.Any()) - { - filters = "(" + string.Join("||", includeCategories.Select(x => $"cat=={x}")) + ")"; - } - - if (excludeCategories != null && excludeCategories.Any()) - { - filters += (filters.Length > 0 ? "&&" : string.Empty) + string.Join("&&", excludeCategories.Select(x => $"cat!={x}")); - } - - return filters; - } - } -} diff --git a/Scalar.Tests/Scalar.Tests.csproj b/Scalar.Tests/Scalar.Tests.csproj deleted file mode 100644 index 106d6b858b..0000000000 --- a/Scalar.Tests/Scalar.Tests.csproj +++ /dev/null @@ -1,24 +0,0 @@ - - - - - netcoreapp2.1;netstandard2.0 - x64 - true - true - win-x64;osx-x64 - - - $(ScalarVersion) - - - $(ScalarVersion) - - - - - - all - - - From 2b6c3301ff500c70dab9352086cf9c4f4c8eca2e Mon Sep 17 00:00:00 2001 From: Matthew John Cheetham Date: Tue, 8 Oct 2019 15:37:11 +0100 Subject: [PATCH 09/24] Upgrade Scalar.UnitTests project --- Scalar.UnitTests.Windows/App.config | 22 -- .../Properties/AssemblyInfo.cs | 23 -- .../Scalar.UnitTests.Windows.csproj | 197 ------------------ Scalar.UnitTests.Windows/packages.config | 25 --- .../Mac}/MacDaemonControllerTests.cs | 0 Scalar.UnitTests/Program.cs | 32 --- Scalar.UnitTests/Readme.md | 35 +--- Scalar.UnitTests/Scalar.UnitTests.csproj | 69 ++---- .../Windows/Mock/MockProcessLauncher.cs | 0 .../ScalarToastRequestHandlerTests.cs | 0 .../Windows/Upgrader/UpgradeVerbTests.cs | 0 .../Upgrader/WindowsNuGetUpgraderTests.cs | 0 .../Windows/WindowsFileBasedLockTests.cs | 0 13 files changed, 30 insertions(+), 373 deletions(-) delete mode 100644 Scalar.UnitTests.Windows/App.config delete mode 100644 Scalar.UnitTests.Windows/Properties/AssemblyInfo.cs delete mode 100644 Scalar.UnitTests.Windows/Scalar.UnitTests.Windows.csproj delete mode 100644 Scalar.UnitTests.Windows/packages.config rename Scalar.UnitTests/{Platform.Mac => Common/Mac}/MacDaemonControllerTests.cs (100%) delete mode 100644 Scalar.UnitTests/Program.cs rename {Scalar.UnitTests.Windows => Scalar.UnitTests}/Windows/Mock/MockProcessLauncher.cs (100%) rename {Scalar.UnitTests.Windows => Scalar.UnitTests}/Windows/ServiceUI/ScalarToastRequestHandlerTests.cs (100%) rename {Scalar.UnitTests.Windows => Scalar.UnitTests}/Windows/Upgrader/UpgradeVerbTests.cs (100%) rename {Scalar.UnitTests.Windows => Scalar.UnitTests}/Windows/Upgrader/WindowsNuGetUpgraderTests.cs (100%) rename {Scalar.UnitTests.Windows => Scalar.UnitTests}/Windows/WindowsFileBasedLockTests.cs (100%) diff --git a/Scalar.UnitTests.Windows/App.config b/Scalar.UnitTests.Windows/App.config deleted file mode 100644 index d71110415a..0000000000 --- a/Scalar.UnitTests.Windows/App.config +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/Scalar.UnitTests.Windows/Properties/AssemblyInfo.cs b/Scalar.UnitTests.Windows/Properties/AssemblyInfo.cs deleted file mode 100644 index 773508bd03..0000000000 --- a/Scalar.UnitTests.Windows/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("Scalar.UnitTests.Windows")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Scalar.UnitTests.Windows")] -[assembly: AssemblyCopyright("Copyright © Microsoft 2019")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("8e0d0989-21f6-4dd8-946c-39f992523cc6")] diff --git a/Scalar.UnitTests.Windows/Scalar.UnitTests.Windows.csproj b/Scalar.UnitTests.Windows/Scalar.UnitTests.Windows.csproj deleted file mode 100644 index 55a3e1853a..0000000000 --- a/Scalar.UnitTests.Windows/Scalar.UnitTests.Windows.csproj +++ /dev/null @@ -1,197 +0,0 @@ - - - - - - - - {8E0D0989-21F6-4DD8-946C-39F992523CC6} - Exe - Properties - Scalar.UnitTests.Windows - Scalar.UnitTests.Windows - v4.6.1 - 512 - true - - - - - true - DEBUG;TRACE - full - x64 - prompt - true - true - - - TRACE - true - pdbonly - x64 - prompt - true - true - - - - ..\..\packages\Castle.Core.4.3.1\lib\net45\Castle.Core.dll - - - ..\..\packages\Microsoft.Data.Sqlite.Core.2.2.4\lib\netstandard2.0\Microsoft.Data.Sqlite.dll - - - ..\..\packages\Moq.4.10.1\lib\net45\Moq.dll - - - ..\..\packages\Newtonsoft.Json.11.0.2\lib\net45\Newtonsoft.Json.dll - True - - - ..\..\packages\NuGet.Common.4.9.2\lib\net46\NuGet.Common.dll - - - ..\..\packages\NuGet.Configuration.4.9.2\lib\net46\NuGet.Configuration.dll - - - ..\..\packages\NuGet.Frameworks.4.9.2\lib\net46\NuGet.Frameworks.dll - - - ..\..\packages\NuGet.Packaging.4.9.2\lib\net46\NuGet.Packaging.dll - - - ..\..\packages\NuGet.Packaging.Core.4.9.2\lib\net46\NuGet.Packaging.Core.dll - - - ..\..\packages\NuGet.Protocol.4.9.2\lib\net46\NuGet.Protocol.dll - - - ..\..\packages\NuGet.Versioning.4.9.2\lib\net46\NuGet.Versioning.dll - - - ..\..\packages\NUnit.3.12.0\lib\net45\nunit.framework.dll - - - ..\..\packages\NUnitLite.3.12.0\lib\net45\nunitlite.dll - - - ..\..\packages\SQLitePCLRaw.bundle_green.1.1.12\lib\net45\SQLitePCLRaw.batteries_green.dll - - - ..\..\packages\SQLitePCLRaw.bundle_green.1.1.12\lib\net45\SQLitePCLRaw.batteries_v2.dll - - - ..\..\packages\SQLitePCLRaw.core.1.1.12\lib\net45\SQLitePCLRaw.core.dll - - - ..\..\packages\SQLitePCLRaw.provider.e_sqlite3.net45.1.1.12\lib\net45\SQLitePCLRaw.provider.e_sqlite3.dll - - - - - - ..\..\packages\System.Runtime.CompilerServices.Unsafe.4.5.0\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll - - - - - - - - ..\..\packages\System.Threading.Tasks.Extensions.4.5.1\lib\netstandard2.0\System.Threading.Tasks.Extensions.dll - - - - - - - - - - - - - - - - - - - - Designer - - - - - {374bf1e5-0b2d-4d4a-bd5e-4212299def09} - Scalar.Common - - - {1dac3da6-3d21-4917-b9a8-d60c8712252a} - Scalar.Platform.Mac - - - {15fae44c-0d21-4312-9fd3-28f05a5ab7a6} - Scalar.Platform.POSIX - - - {4ce404e7-d3fc-471c-993c-64615861ea63} - Scalar.Platform.Windows - - - {93b403fd-dafb-46c5-9636-b122792a548a} - Scalar.Service.UI - - - {03769a07-f216-456b-886b-e07caf6c5e81} - Scalar.Service.Mac - - - {72701bc3-5da9-4c7a-bf10-9e98c9fc8eac} - Scalar.Tests - - - {aecec217-2499-403d-b0bb-2962b9be5970} - Scalar.Upgrader - - - {32220664-594C-4425-B9A0-88E0BE2F3D2A} - Scalar.Windows - - - - - - - - NetCore\%(RecursiveDir)\%(Filename)%(Extension) - - - Data\%(RecursiveDir)\%(Filename)%(Extension) - Always - - - Readme.md - - - - - - - - - - This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - - - diff --git a/Scalar.UnitTests.Windows/packages.config b/Scalar.UnitTests.Windows/packages.config deleted file mode 100644 index a8790266f6..0000000000 --- a/Scalar.UnitTests.Windows/packages.config +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Scalar.UnitTests/Platform.Mac/MacDaemonControllerTests.cs b/Scalar.UnitTests/Common/Mac/MacDaemonControllerTests.cs similarity index 100% rename from Scalar.UnitTests/Platform.Mac/MacDaemonControllerTests.cs rename to Scalar.UnitTests/Common/Mac/MacDaemonControllerTests.cs diff --git a/Scalar.UnitTests/Program.cs b/Scalar.UnitTests/Program.cs deleted file mode 100644 index bc57bb2e7f..0000000000 --- a/Scalar.UnitTests/Program.cs +++ /dev/null @@ -1,32 +0,0 @@ -using Scalar.Tests; -using Scalar.UnitTests.Category; -using System; -using System.Collections.Generic; -using System.Diagnostics; - -namespace Scalar.UnitTests -{ - public class Program - { - public static void Main(string[] args) - { - NUnitRunner runner = new NUnitRunner(args); - runner.AddGlobalSetupIfNeeded("Scalar.UnitTests.Setup"); - - List excludeCategories = new List(); - - if (Debugger.IsAttached) - { - excludeCategories.Add(CategoryConstants.ExceptionExpected); - } - - Environment.ExitCode = runner.RunTests(includeCategories: null, excludeCategories: excludeCategories); - - if (Debugger.IsAttached) - { - Console.WriteLine("Tests completed. Press Enter to exit."); - Console.ReadLine(); - } - } - } -} diff --git a/Scalar.UnitTests/Readme.md b/Scalar.UnitTests/Readme.md index 59919fac03..564dd94ed9 100644 --- a/Scalar.UnitTests/Readme.md +++ b/Scalar.UnitTests/Readme.md @@ -1,40 +1,19 @@ # Scalar Unit Tests -## Unit Test Projects - -### Scalar.UnitTests - * Targets .NET Core -* Contains all unit tests that are .NET Standard compliant - -### Scalar.UnitTests.Windows - -* Targets .NET Framework -* Contains all unit tests that depend on .NET Framework assemblies -* Has links (in the `NetCore` folder) to all of the unit tests in Scalar.UnitTests - -Scalar.UnitTests.Windows links in all of the tests from Scalar.UnitTests to ensure that they pass on both the .NET Core and .Net Framework platforms. +* Contains all unit tests that OS agnostic +* Conditionally includes the Windows\\** directory when running on Windows. ## Running Unit Tests -**Option 1: `Scripts\RunUnitTests.bat`** +**Option 1: `dotnet test`** -`RunUnitTests.bat` will run both Scalar.UnitTests and Scalar.UnitTests.Windows +`dotnet test` will run Scalar.UnitTests, and if on Windows also the Windows-only tests. -**Option 2: Run individual projects from Visual Studio** +**Option 2: Run individual tests from Visual Studio** -Scalar.UnitTests and Scalar.UnitTests.Windows can both be run from Visual Studio. Simply set either as the StartUp project and run them from the IDE. +Unit tests can both be run from Visual Studio. Simply open the Test Explorer (VS for Windows) or Unit Tests Pad (VS for Mac) and run or debug the tests you wish. ## Adding New Tests -### Scalar.UnitTests or Scalar.UnitTests.Windows? - -Whenever possible new unit tests should be added to Scalar.UnitTests. If the new tests are for a .NET Framework assembly (e.g. `Scalar.Platform.Windows`) -then they will need to be added to Scalar.UnitTests.Windows. - -### Adding New Test Files - -When adding new test files, keep the following in mind: - -* New test files that are added to Scalar.UnitTests will not appear in the `NetCore` folder of Scalar.UnitTests.Windows until the Scalar solution is reloaded. -* New test files that are meant to be run on both .NET platforms should be added to the **Scalar.UnitTests** project. +Whenever possible new unit tests should be added to the root Scalar.UnitTests direcotry. If the new tests are specific to the Window OS then they will need to be added to the Scalar.UnitTests\\Windows directory. diff --git a/Scalar.UnitTests/Scalar.UnitTests.csproj b/Scalar.UnitTests/Scalar.UnitTests.csproj index cc9c650b38..75f068c0e4 100644 --- a/Scalar.UnitTests/Scalar.UnitTests.csproj +++ b/Scalar.UnitTests/Scalar.UnitTests.csproj @@ -1,59 +1,36 @@ - - - - Exe - netcoreapp2.1 - x64 - false - true - win-x64;osx-x64 - + - true - Scalar.UnitTests - Scalar.UnitTests - - - $(ScalarVersion) - - - $(ScalarVersion) + netcoreapp3.0 + false - - Always - - - Always - - - Always - - - Always - + + + + + + - - - - - - - - - all - + + + + - - - - - + + + PreserveNewest + + + + + + + diff --git a/Scalar.UnitTests.Windows/Windows/Mock/MockProcessLauncher.cs b/Scalar.UnitTests/Windows/Mock/MockProcessLauncher.cs similarity index 100% rename from Scalar.UnitTests.Windows/Windows/Mock/MockProcessLauncher.cs rename to Scalar.UnitTests/Windows/Mock/MockProcessLauncher.cs diff --git a/Scalar.UnitTests.Windows/Windows/ServiceUI/ScalarToastRequestHandlerTests.cs b/Scalar.UnitTests/Windows/ServiceUI/ScalarToastRequestHandlerTests.cs similarity index 100% rename from Scalar.UnitTests.Windows/Windows/ServiceUI/ScalarToastRequestHandlerTests.cs rename to Scalar.UnitTests/Windows/ServiceUI/ScalarToastRequestHandlerTests.cs diff --git a/Scalar.UnitTests.Windows/Windows/Upgrader/UpgradeVerbTests.cs b/Scalar.UnitTests/Windows/Upgrader/UpgradeVerbTests.cs similarity index 100% rename from Scalar.UnitTests.Windows/Windows/Upgrader/UpgradeVerbTests.cs rename to Scalar.UnitTests/Windows/Upgrader/UpgradeVerbTests.cs diff --git a/Scalar.UnitTests.Windows/Windows/Upgrader/WindowsNuGetUpgraderTests.cs b/Scalar.UnitTests/Windows/Upgrader/WindowsNuGetUpgraderTests.cs similarity index 100% rename from Scalar.UnitTests.Windows/Windows/Upgrader/WindowsNuGetUpgraderTests.cs rename to Scalar.UnitTests/Windows/Upgrader/WindowsNuGetUpgraderTests.cs diff --git a/Scalar.UnitTests.Windows/Windows/WindowsFileBasedLockTests.cs b/Scalar.UnitTests/Windows/WindowsFileBasedLockTests.cs similarity index 100% rename from Scalar.UnitTests.Windows/Windows/WindowsFileBasedLockTests.cs rename to Scalar.UnitTests/Windows/WindowsFileBasedLockTests.cs From 23c8dfbac1dee87f12641df8337d811497bff4eb Mon Sep 17 00:00:00 2001 From: Matthew John Cheetham Date: Tue, 8 Oct 2019 15:39:48 +0100 Subject: [PATCH 10/24] Integrate Scalar.Notification Xcode project --- .../Scalar.Notifications.Mac.csproj | 20 +++++++++ .../Scalar.UnitTests/Info.plist | 0 .../Mocks/ScalarMockAboutWindowController.h | 0 .../Mocks/ScalarMockAboutWindowController.m | 0 .../Mocks/ScalarMockNotificationCenter.h | 0 .../Mocks/ScalarMockNotificationCenter.m | 0 .../Mocks/ScalarMockProductInfoFetcher.h | 0 .../Mocks/ScalarMockProductInfoFetcher.m | 0 .../ScalarAboutWindowControllerTests.m | 0 .../ScalarMessageParserTests.m | 0 .../ScalarNotificationTests.m | 0 .../ScalarStatusBarItemTests.m | 0 .../Scalar.xcodeproj/project.pbxproj | 0 .../contents.xcworkspacedata | 0 .../xcshareddata/IDEWorkspaceChecks.plist | 0 .../IPC/ScalarMessageListener.h | 0 .../IPC/ScalarMessageListener.m | 0 .../StatusMenuItem/IPC/ScalarMessageParser.h | 0 .../StatusMenuItem/IPC/ScalarMessageParser.m | 0 .../StatusMenuItem/IPC/ScalarNotification.h | 0 .../StatusMenuItem/IPC/ScalarNotification.m | 0 .../StatusMenuItem/Info.plist | 0 .../StatusMenuItem/Scalar.entitlements | 0 .../UI/Assets.xcassets/Contents.json | 0 .../Scalar.appiconset/Contents.json | 0 .../Scalar.appiconset/Scalar_1024.png | Bin .../Scalar.appiconset/Scalar_128.png | Bin .../Scalar.appiconset/Scalar_16.png | Bin .../Scalar.appiconset/Scalar_256-1.png | Bin .../Scalar.appiconset/Scalar_256.png | Bin .../Scalar.appiconset/Scalar_32-1.png | Bin .../Scalar.appiconset/Scalar_32.png | Bin .../Scalar.appiconset/Scalar_512-1.png | Bin .../Scalar.appiconset/Scalar_512.png | Bin .../Scalar.appiconset/Scalar_64.png | Bin .../StatusItem.imageset/Contents.json | 0 .../StatusItem.imageset/Scalar_16.png | Bin .../StatusItem.imageset/Scalar_32.png | Bin .../StatusItem.imageset/Scalar_64.png | Bin .../StatusMenuItem/UI/Base.lproj/MainMenu.xib | 0 .../UI/ScalarAboutWindowController.h | 0 .../UI/ScalarAboutWindowController.m | 0 .../UI/ScalarAboutWindowController.xib | 0 .../StatusMenuItem/UI/ScalarAppDelegate.h | 0 .../StatusMenuItem/UI/ScalarAppDelegate.m | 0 .../UI/ScalarNotificationDisplay.h | 0 .../UI/ScalarNotificationDisplay.m | 0 .../StatusMenuItem/UI/ScalarStatusBarItem.h | 0 .../StatusMenuItem/UI/ScalarStatusBarItem.m | 0 .../Utilities/ScalarNotificationErrors.h | 0 .../Utilities/ScalarNotificationErrors.m | 0 .../Utilities/ScalarProcessRunner.h | 0 .../Utilities/ScalarProcessRunner.m | 0 .../Utilities/ScalarProductInfoFetcher.h | 0 .../Utilities/ScalarProductInfoFetcher.m | 0 .../StatusMenuItem/main.m | 0 Scalar.Notifications.Mac/build.sh | 41 ++++++++++++++++++ .../org.scalar.usernotification.plist | 0 Scalar.Notifications.Mac/test.sh | 16 +++++++ 59 files changed, 77 insertions(+) create mode 100644 Scalar.Notifications.Mac/Scalar.Notifications.Mac.csproj rename {Scalar.Notifications/Scalar.Mac => Scalar.Notifications.Mac}/Scalar.UnitTests/Info.plist (100%) rename {Scalar.Notifications/Scalar.Mac => Scalar.Notifications.Mac}/Scalar.UnitTests/Mocks/ScalarMockAboutWindowController.h (100%) rename {Scalar.Notifications/Scalar.Mac => Scalar.Notifications.Mac}/Scalar.UnitTests/Mocks/ScalarMockAboutWindowController.m (100%) rename {Scalar.Notifications/Scalar.Mac => Scalar.Notifications.Mac}/Scalar.UnitTests/Mocks/ScalarMockNotificationCenter.h (100%) rename {Scalar.Notifications/Scalar.Mac => Scalar.Notifications.Mac}/Scalar.UnitTests/Mocks/ScalarMockNotificationCenter.m (100%) rename {Scalar.Notifications/Scalar.Mac => Scalar.Notifications.Mac}/Scalar.UnitTests/Mocks/ScalarMockProductInfoFetcher.h (100%) rename {Scalar.Notifications/Scalar.Mac => Scalar.Notifications.Mac}/Scalar.UnitTests/Mocks/ScalarMockProductInfoFetcher.m (100%) rename {Scalar.Notifications/Scalar.Mac => Scalar.Notifications.Mac}/Scalar.UnitTests/ScalarAboutWindowControllerTests.m (100%) rename {Scalar.Notifications/Scalar.Mac => Scalar.Notifications.Mac}/Scalar.UnitTests/ScalarMessageParserTests.m (100%) rename {Scalar.Notifications/Scalar.Mac => Scalar.Notifications.Mac}/Scalar.UnitTests/ScalarNotificationTests.m (100%) rename {Scalar.Notifications/Scalar.Mac => Scalar.Notifications.Mac}/Scalar.UnitTests/ScalarStatusBarItemTests.m (100%) rename {Scalar.Notifications/Scalar.Mac => Scalar.Notifications.Mac}/Scalar.xcodeproj/project.pbxproj (100%) rename {Scalar.Notifications/Scalar.Mac => Scalar.Notifications.Mac}/Scalar.xcodeproj/project.xcworkspace/contents.xcworkspacedata (100%) rename {Scalar.Notifications/Scalar.Mac => Scalar.Notifications.Mac}/Scalar.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist (100%) rename {Scalar.Notifications/Scalar.Mac => Scalar.Notifications.Mac}/StatusMenuItem/IPC/ScalarMessageListener.h (100%) rename {Scalar.Notifications/Scalar.Mac => Scalar.Notifications.Mac}/StatusMenuItem/IPC/ScalarMessageListener.m (100%) rename {Scalar.Notifications/Scalar.Mac => Scalar.Notifications.Mac}/StatusMenuItem/IPC/ScalarMessageParser.h (100%) rename {Scalar.Notifications/Scalar.Mac => Scalar.Notifications.Mac}/StatusMenuItem/IPC/ScalarMessageParser.m (100%) rename {Scalar.Notifications/Scalar.Mac => Scalar.Notifications.Mac}/StatusMenuItem/IPC/ScalarNotification.h (100%) rename {Scalar.Notifications/Scalar.Mac => Scalar.Notifications.Mac}/StatusMenuItem/IPC/ScalarNotification.m (100%) rename {Scalar.Notifications/Scalar.Mac => Scalar.Notifications.Mac}/StatusMenuItem/Info.plist (100%) rename {Scalar.Notifications/Scalar.Mac => Scalar.Notifications.Mac}/StatusMenuItem/Scalar.entitlements (100%) rename {Scalar.Notifications/Scalar.Mac => Scalar.Notifications.Mac}/StatusMenuItem/UI/Assets.xcassets/Contents.json (100%) rename {Scalar.Notifications/Scalar.Mac => Scalar.Notifications.Mac}/StatusMenuItem/UI/Assets.xcassets/Scalar.appiconset/Contents.json (100%) rename {Scalar.Notifications/Scalar.Mac => Scalar.Notifications.Mac}/StatusMenuItem/UI/Assets.xcassets/Scalar.appiconset/Scalar_1024.png (100%) rename {Scalar.Notifications/Scalar.Mac => Scalar.Notifications.Mac}/StatusMenuItem/UI/Assets.xcassets/Scalar.appiconset/Scalar_128.png (100%) rename {Scalar.Notifications/Scalar.Mac => Scalar.Notifications.Mac}/StatusMenuItem/UI/Assets.xcassets/Scalar.appiconset/Scalar_16.png (100%) rename {Scalar.Notifications/Scalar.Mac => Scalar.Notifications.Mac}/StatusMenuItem/UI/Assets.xcassets/Scalar.appiconset/Scalar_256-1.png (100%) rename {Scalar.Notifications/Scalar.Mac => Scalar.Notifications.Mac}/StatusMenuItem/UI/Assets.xcassets/Scalar.appiconset/Scalar_256.png (100%) rename {Scalar.Notifications/Scalar.Mac => Scalar.Notifications.Mac}/StatusMenuItem/UI/Assets.xcassets/Scalar.appiconset/Scalar_32-1.png (100%) rename {Scalar.Notifications/Scalar.Mac => Scalar.Notifications.Mac}/StatusMenuItem/UI/Assets.xcassets/Scalar.appiconset/Scalar_32.png (100%) rename {Scalar.Notifications/Scalar.Mac => Scalar.Notifications.Mac}/StatusMenuItem/UI/Assets.xcassets/Scalar.appiconset/Scalar_512-1.png (100%) rename {Scalar.Notifications/Scalar.Mac => Scalar.Notifications.Mac}/StatusMenuItem/UI/Assets.xcassets/Scalar.appiconset/Scalar_512.png (100%) rename {Scalar.Notifications/Scalar.Mac => Scalar.Notifications.Mac}/StatusMenuItem/UI/Assets.xcassets/Scalar.appiconset/Scalar_64.png (100%) rename {Scalar.Notifications/Scalar.Mac => Scalar.Notifications.Mac}/StatusMenuItem/UI/Assets.xcassets/StatusItem.imageset/Contents.json (100%) rename {Scalar.Notifications/Scalar.Mac => Scalar.Notifications.Mac}/StatusMenuItem/UI/Assets.xcassets/StatusItem.imageset/Scalar_16.png (100%) rename {Scalar.Notifications/Scalar.Mac => Scalar.Notifications.Mac}/StatusMenuItem/UI/Assets.xcassets/StatusItem.imageset/Scalar_32.png (100%) rename {Scalar.Notifications/Scalar.Mac => Scalar.Notifications.Mac}/StatusMenuItem/UI/Assets.xcassets/StatusItem.imageset/Scalar_64.png (100%) rename {Scalar.Notifications/Scalar.Mac => Scalar.Notifications.Mac}/StatusMenuItem/UI/Base.lproj/MainMenu.xib (100%) rename {Scalar.Notifications/Scalar.Mac => Scalar.Notifications.Mac}/StatusMenuItem/UI/ScalarAboutWindowController.h (100%) rename {Scalar.Notifications/Scalar.Mac => Scalar.Notifications.Mac}/StatusMenuItem/UI/ScalarAboutWindowController.m (100%) rename {Scalar.Notifications/Scalar.Mac => Scalar.Notifications.Mac}/StatusMenuItem/UI/ScalarAboutWindowController.xib (100%) rename {Scalar.Notifications/Scalar.Mac => Scalar.Notifications.Mac}/StatusMenuItem/UI/ScalarAppDelegate.h (100%) rename {Scalar.Notifications/Scalar.Mac => Scalar.Notifications.Mac}/StatusMenuItem/UI/ScalarAppDelegate.m (100%) rename {Scalar.Notifications/Scalar.Mac => Scalar.Notifications.Mac}/StatusMenuItem/UI/ScalarNotificationDisplay.h (100%) rename {Scalar.Notifications/Scalar.Mac => Scalar.Notifications.Mac}/StatusMenuItem/UI/ScalarNotificationDisplay.m (100%) rename {Scalar.Notifications/Scalar.Mac => Scalar.Notifications.Mac}/StatusMenuItem/UI/ScalarStatusBarItem.h (100%) rename {Scalar.Notifications/Scalar.Mac => Scalar.Notifications.Mac}/StatusMenuItem/UI/ScalarStatusBarItem.m (100%) rename {Scalar.Notifications/Scalar.Mac => Scalar.Notifications.Mac}/StatusMenuItem/Utilities/ScalarNotificationErrors.h (100%) rename {Scalar.Notifications/Scalar.Mac => Scalar.Notifications.Mac}/StatusMenuItem/Utilities/ScalarNotificationErrors.m (100%) rename {Scalar.Notifications/Scalar.Mac => Scalar.Notifications.Mac}/StatusMenuItem/Utilities/ScalarProcessRunner.h (100%) rename {Scalar.Notifications/Scalar.Mac => Scalar.Notifications.Mac}/StatusMenuItem/Utilities/ScalarProcessRunner.m (100%) rename {Scalar.Notifications/Scalar.Mac => Scalar.Notifications.Mac}/StatusMenuItem/Utilities/ScalarProductInfoFetcher.h (100%) rename {Scalar.Notifications/Scalar.Mac => Scalar.Notifications.Mac}/StatusMenuItem/Utilities/ScalarProductInfoFetcher.m (100%) rename {Scalar.Notifications/Scalar.Mac => Scalar.Notifications.Mac}/StatusMenuItem/main.m (100%) create mode 100755 Scalar.Notifications.Mac/build.sh rename {Scalar.Notifications/Scalar.Mac => Scalar.Notifications.Mac}/org.scalar.usernotification.plist (100%) create mode 100755 Scalar.Notifications.Mac/test.sh diff --git a/Scalar.Notifications.Mac/Scalar.Notifications.Mac.csproj b/Scalar.Notifications.Mac/Scalar.Notifications.Mac.csproj new file mode 100644 index 0000000000..eda8503b1d --- /dev/null +++ b/Scalar.Notifications.Mac/Scalar.Notifications.Mac.csproj @@ -0,0 +1,20 @@ + + + + netcoreapp3.0 + osx-x64 + + + + + + + + + + + + + diff --git a/Scalar.Notifications/Scalar.Mac/Scalar.UnitTests/Info.plist b/Scalar.Notifications.Mac/Scalar.UnitTests/Info.plist similarity index 100% rename from Scalar.Notifications/Scalar.Mac/Scalar.UnitTests/Info.plist rename to Scalar.Notifications.Mac/Scalar.UnitTests/Info.plist diff --git a/Scalar.Notifications/Scalar.Mac/Scalar.UnitTests/Mocks/ScalarMockAboutWindowController.h b/Scalar.Notifications.Mac/Scalar.UnitTests/Mocks/ScalarMockAboutWindowController.h similarity index 100% rename from Scalar.Notifications/Scalar.Mac/Scalar.UnitTests/Mocks/ScalarMockAboutWindowController.h rename to Scalar.Notifications.Mac/Scalar.UnitTests/Mocks/ScalarMockAboutWindowController.h diff --git a/Scalar.Notifications/Scalar.Mac/Scalar.UnitTests/Mocks/ScalarMockAboutWindowController.m b/Scalar.Notifications.Mac/Scalar.UnitTests/Mocks/ScalarMockAboutWindowController.m similarity index 100% rename from Scalar.Notifications/Scalar.Mac/Scalar.UnitTests/Mocks/ScalarMockAboutWindowController.m rename to Scalar.Notifications.Mac/Scalar.UnitTests/Mocks/ScalarMockAboutWindowController.m diff --git a/Scalar.Notifications/Scalar.Mac/Scalar.UnitTests/Mocks/ScalarMockNotificationCenter.h b/Scalar.Notifications.Mac/Scalar.UnitTests/Mocks/ScalarMockNotificationCenter.h similarity index 100% rename from Scalar.Notifications/Scalar.Mac/Scalar.UnitTests/Mocks/ScalarMockNotificationCenter.h rename to Scalar.Notifications.Mac/Scalar.UnitTests/Mocks/ScalarMockNotificationCenter.h diff --git a/Scalar.Notifications/Scalar.Mac/Scalar.UnitTests/Mocks/ScalarMockNotificationCenter.m b/Scalar.Notifications.Mac/Scalar.UnitTests/Mocks/ScalarMockNotificationCenter.m similarity index 100% rename from Scalar.Notifications/Scalar.Mac/Scalar.UnitTests/Mocks/ScalarMockNotificationCenter.m rename to Scalar.Notifications.Mac/Scalar.UnitTests/Mocks/ScalarMockNotificationCenter.m diff --git a/Scalar.Notifications/Scalar.Mac/Scalar.UnitTests/Mocks/ScalarMockProductInfoFetcher.h b/Scalar.Notifications.Mac/Scalar.UnitTests/Mocks/ScalarMockProductInfoFetcher.h similarity index 100% rename from Scalar.Notifications/Scalar.Mac/Scalar.UnitTests/Mocks/ScalarMockProductInfoFetcher.h rename to Scalar.Notifications.Mac/Scalar.UnitTests/Mocks/ScalarMockProductInfoFetcher.h diff --git a/Scalar.Notifications/Scalar.Mac/Scalar.UnitTests/Mocks/ScalarMockProductInfoFetcher.m b/Scalar.Notifications.Mac/Scalar.UnitTests/Mocks/ScalarMockProductInfoFetcher.m similarity index 100% rename from Scalar.Notifications/Scalar.Mac/Scalar.UnitTests/Mocks/ScalarMockProductInfoFetcher.m rename to Scalar.Notifications.Mac/Scalar.UnitTests/Mocks/ScalarMockProductInfoFetcher.m diff --git a/Scalar.Notifications/Scalar.Mac/Scalar.UnitTests/ScalarAboutWindowControllerTests.m b/Scalar.Notifications.Mac/Scalar.UnitTests/ScalarAboutWindowControllerTests.m similarity index 100% rename from Scalar.Notifications/Scalar.Mac/Scalar.UnitTests/ScalarAboutWindowControllerTests.m rename to Scalar.Notifications.Mac/Scalar.UnitTests/ScalarAboutWindowControllerTests.m diff --git a/Scalar.Notifications/Scalar.Mac/Scalar.UnitTests/ScalarMessageParserTests.m b/Scalar.Notifications.Mac/Scalar.UnitTests/ScalarMessageParserTests.m similarity index 100% rename from Scalar.Notifications/Scalar.Mac/Scalar.UnitTests/ScalarMessageParserTests.m rename to Scalar.Notifications.Mac/Scalar.UnitTests/ScalarMessageParserTests.m diff --git a/Scalar.Notifications/Scalar.Mac/Scalar.UnitTests/ScalarNotificationTests.m b/Scalar.Notifications.Mac/Scalar.UnitTests/ScalarNotificationTests.m similarity index 100% rename from Scalar.Notifications/Scalar.Mac/Scalar.UnitTests/ScalarNotificationTests.m rename to Scalar.Notifications.Mac/Scalar.UnitTests/ScalarNotificationTests.m diff --git a/Scalar.Notifications/Scalar.Mac/Scalar.UnitTests/ScalarStatusBarItemTests.m b/Scalar.Notifications.Mac/Scalar.UnitTests/ScalarStatusBarItemTests.m similarity index 100% rename from Scalar.Notifications/Scalar.Mac/Scalar.UnitTests/ScalarStatusBarItemTests.m rename to Scalar.Notifications.Mac/Scalar.UnitTests/ScalarStatusBarItemTests.m diff --git a/Scalar.Notifications/Scalar.Mac/Scalar.xcodeproj/project.pbxproj b/Scalar.Notifications.Mac/Scalar.xcodeproj/project.pbxproj similarity index 100% rename from Scalar.Notifications/Scalar.Mac/Scalar.xcodeproj/project.pbxproj rename to Scalar.Notifications.Mac/Scalar.xcodeproj/project.pbxproj diff --git a/Scalar.Notifications/Scalar.Mac/Scalar.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/Scalar.Notifications.Mac/Scalar.xcodeproj/project.xcworkspace/contents.xcworkspacedata similarity index 100% rename from Scalar.Notifications/Scalar.Mac/Scalar.xcodeproj/project.xcworkspace/contents.xcworkspacedata rename to Scalar.Notifications.Mac/Scalar.xcodeproj/project.xcworkspace/contents.xcworkspacedata diff --git a/Scalar.Notifications/Scalar.Mac/Scalar.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/Scalar.Notifications.Mac/Scalar.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist similarity index 100% rename from Scalar.Notifications/Scalar.Mac/Scalar.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist rename to Scalar.Notifications.Mac/Scalar.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist diff --git a/Scalar.Notifications/Scalar.Mac/StatusMenuItem/IPC/ScalarMessageListener.h b/Scalar.Notifications.Mac/StatusMenuItem/IPC/ScalarMessageListener.h similarity index 100% rename from Scalar.Notifications/Scalar.Mac/StatusMenuItem/IPC/ScalarMessageListener.h rename to Scalar.Notifications.Mac/StatusMenuItem/IPC/ScalarMessageListener.h diff --git a/Scalar.Notifications/Scalar.Mac/StatusMenuItem/IPC/ScalarMessageListener.m b/Scalar.Notifications.Mac/StatusMenuItem/IPC/ScalarMessageListener.m similarity index 100% rename from Scalar.Notifications/Scalar.Mac/StatusMenuItem/IPC/ScalarMessageListener.m rename to Scalar.Notifications.Mac/StatusMenuItem/IPC/ScalarMessageListener.m diff --git a/Scalar.Notifications/Scalar.Mac/StatusMenuItem/IPC/ScalarMessageParser.h b/Scalar.Notifications.Mac/StatusMenuItem/IPC/ScalarMessageParser.h similarity index 100% rename from Scalar.Notifications/Scalar.Mac/StatusMenuItem/IPC/ScalarMessageParser.h rename to Scalar.Notifications.Mac/StatusMenuItem/IPC/ScalarMessageParser.h diff --git a/Scalar.Notifications/Scalar.Mac/StatusMenuItem/IPC/ScalarMessageParser.m b/Scalar.Notifications.Mac/StatusMenuItem/IPC/ScalarMessageParser.m similarity index 100% rename from Scalar.Notifications/Scalar.Mac/StatusMenuItem/IPC/ScalarMessageParser.m rename to Scalar.Notifications.Mac/StatusMenuItem/IPC/ScalarMessageParser.m diff --git a/Scalar.Notifications/Scalar.Mac/StatusMenuItem/IPC/ScalarNotification.h b/Scalar.Notifications.Mac/StatusMenuItem/IPC/ScalarNotification.h similarity index 100% rename from Scalar.Notifications/Scalar.Mac/StatusMenuItem/IPC/ScalarNotification.h rename to Scalar.Notifications.Mac/StatusMenuItem/IPC/ScalarNotification.h diff --git a/Scalar.Notifications/Scalar.Mac/StatusMenuItem/IPC/ScalarNotification.m b/Scalar.Notifications.Mac/StatusMenuItem/IPC/ScalarNotification.m similarity index 100% rename from Scalar.Notifications/Scalar.Mac/StatusMenuItem/IPC/ScalarNotification.m rename to Scalar.Notifications.Mac/StatusMenuItem/IPC/ScalarNotification.m diff --git a/Scalar.Notifications/Scalar.Mac/StatusMenuItem/Info.plist b/Scalar.Notifications.Mac/StatusMenuItem/Info.plist similarity index 100% rename from Scalar.Notifications/Scalar.Mac/StatusMenuItem/Info.plist rename to Scalar.Notifications.Mac/StatusMenuItem/Info.plist diff --git a/Scalar.Notifications/Scalar.Mac/StatusMenuItem/Scalar.entitlements b/Scalar.Notifications.Mac/StatusMenuItem/Scalar.entitlements similarity index 100% rename from Scalar.Notifications/Scalar.Mac/StatusMenuItem/Scalar.entitlements rename to Scalar.Notifications.Mac/StatusMenuItem/Scalar.entitlements diff --git a/Scalar.Notifications/Scalar.Mac/StatusMenuItem/UI/Assets.xcassets/Contents.json b/Scalar.Notifications.Mac/StatusMenuItem/UI/Assets.xcassets/Contents.json similarity index 100% rename from Scalar.Notifications/Scalar.Mac/StatusMenuItem/UI/Assets.xcassets/Contents.json rename to Scalar.Notifications.Mac/StatusMenuItem/UI/Assets.xcassets/Contents.json diff --git a/Scalar.Notifications/Scalar.Mac/StatusMenuItem/UI/Assets.xcassets/Scalar.appiconset/Contents.json b/Scalar.Notifications.Mac/StatusMenuItem/UI/Assets.xcassets/Scalar.appiconset/Contents.json similarity index 100% rename from Scalar.Notifications/Scalar.Mac/StatusMenuItem/UI/Assets.xcassets/Scalar.appiconset/Contents.json rename to Scalar.Notifications.Mac/StatusMenuItem/UI/Assets.xcassets/Scalar.appiconset/Contents.json diff --git a/Scalar.Notifications/Scalar.Mac/StatusMenuItem/UI/Assets.xcassets/Scalar.appiconset/Scalar_1024.png b/Scalar.Notifications.Mac/StatusMenuItem/UI/Assets.xcassets/Scalar.appiconset/Scalar_1024.png similarity index 100% rename from Scalar.Notifications/Scalar.Mac/StatusMenuItem/UI/Assets.xcassets/Scalar.appiconset/Scalar_1024.png rename to Scalar.Notifications.Mac/StatusMenuItem/UI/Assets.xcassets/Scalar.appiconset/Scalar_1024.png diff --git a/Scalar.Notifications/Scalar.Mac/StatusMenuItem/UI/Assets.xcassets/Scalar.appiconset/Scalar_128.png b/Scalar.Notifications.Mac/StatusMenuItem/UI/Assets.xcassets/Scalar.appiconset/Scalar_128.png similarity index 100% rename from Scalar.Notifications/Scalar.Mac/StatusMenuItem/UI/Assets.xcassets/Scalar.appiconset/Scalar_128.png rename to Scalar.Notifications.Mac/StatusMenuItem/UI/Assets.xcassets/Scalar.appiconset/Scalar_128.png diff --git a/Scalar.Notifications/Scalar.Mac/StatusMenuItem/UI/Assets.xcassets/Scalar.appiconset/Scalar_16.png b/Scalar.Notifications.Mac/StatusMenuItem/UI/Assets.xcassets/Scalar.appiconset/Scalar_16.png similarity index 100% rename from Scalar.Notifications/Scalar.Mac/StatusMenuItem/UI/Assets.xcassets/Scalar.appiconset/Scalar_16.png rename to Scalar.Notifications.Mac/StatusMenuItem/UI/Assets.xcassets/Scalar.appiconset/Scalar_16.png diff --git a/Scalar.Notifications/Scalar.Mac/StatusMenuItem/UI/Assets.xcassets/Scalar.appiconset/Scalar_256-1.png b/Scalar.Notifications.Mac/StatusMenuItem/UI/Assets.xcassets/Scalar.appiconset/Scalar_256-1.png similarity index 100% rename from Scalar.Notifications/Scalar.Mac/StatusMenuItem/UI/Assets.xcassets/Scalar.appiconset/Scalar_256-1.png rename to Scalar.Notifications.Mac/StatusMenuItem/UI/Assets.xcassets/Scalar.appiconset/Scalar_256-1.png diff --git a/Scalar.Notifications/Scalar.Mac/StatusMenuItem/UI/Assets.xcassets/Scalar.appiconset/Scalar_256.png b/Scalar.Notifications.Mac/StatusMenuItem/UI/Assets.xcassets/Scalar.appiconset/Scalar_256.png similarity index 100% rename from Scalar.Notifications/Scalar.Mac/StatusMenuItem/UI/Assets.xcassets/Scalar.appiconset/Scalar_256.png rename to Scalar.Notifications.Mac/StatusMenuItem/UI/Assets.xcassets/Scalar.appiconset/Scalar_256.png diff --git a/Scalar.Notifications/Scalar.Mac/StatusMenuItem/UI/Assets.xcassets/Scalar.appiconset/Scalar_32-1.png b/Scalar.Notifications.Mac/StatusMenuItem/UI/Assets.xcassets/Scalar.appiconset/Scalar_32-1.png similarity index 100% rename from Scalar.Notifications/Scalar.Mac/StatusMenuItem/UI/Assets.xcassets/Scalar.appiconset/Scalar_32-1.png rename to Scalar.Notifications.Mac/StatusMenuItem/UI/Assets.xcassets/Scalar.appiconset/Scalar_32-1.png diff --git a/Scalar.Notifications/Scalar.Mac/StatusMenuItem/UI/Assets.xcassets/Scalar.appiconset/Scalar_32.png b/Scalar.Notifications.Mac/StatusMenuItem/UI/Assets.xcassets/Scalar.appiconset/Scalar_32.png similarity index 100% rename from Scalar.Notifications/Scalar.Mac/StatusMenuItem/UI/Assets.xcassets/Scalar.appiconset/Scalar_32.png rename to Scalar.Notifications.Mac/StatusMenuItem/UI/Assets.xcassets/Scalar.appiconset/Scalar_32.png diff --git a/Scalar.Notifications/Scalar.Mac/StatusMenuItem/UI/Assets.xcassets/Scalar.appiconset/Scalar_512-1.png b/Scalar.Notifications.Mac/StatusMenuItem/UI/Assets.xcassets/Scalar.appiconset/Scalar_512-1.png similarity index 100% rename from Scalar.Notifications/Scalar.Mac/StatusMenuItem/UI/Assets.xcassets/Scalar.appiconset/Scalar_512-1.png rename to Scalar.Notifications.Mac/StatusMenuItem/UI/Assets.xcassets/Scalar.appiconset/Scalar_512-1.png diff --git a/Scalar.Notifications/Scalar.Mac/StatusMenuItem/UI/Assets.xcassets/Scalar.appiconset/Scalar_512.png b/Scalar.Notifications.Mac/StatusMenuItem/UI/Assets.xcassets/Scalar.appiconset/Scalar_512.png similarity index 100% rename from Scalar.Notifications/Scalar.Mac/StatusMenuItem/UI/Assets.xcassets/Scalar.appiconset/Scalar_512.png rename to Scalar.Notifications.Mac/StatusMenuItem/UI/Assets.xcassets/Scalar.appiconset/Scalar_512.png diff --git a/Scalar.Notifications/Scalar.Mac/StatusMenuItem/UI/Assets.xcassets/Scalar.appiconset/Scalar_64.png b/Scalar.Notifications.Mac/StatusMenuItem/UI/Assets.xcassets/Scalar.appiconset/Scalar_64.png similarity index 100% rename from Scalar.Notifications/Scalar.Mac/StatusMenuItem/UI/Assets.xcassets/Scalar.appiconset/Scalar_64.png rename to Scalar.Notifications.Mac/StatusMenuItem/UI/Assets.xcassets/Scalar.appiconset/Scalar_64.png diff --git a/Scalar.Notifications/Scalar.Mac/StatusMenuItem/UI/Assets.xcassets/StatusItem.imageset/Contents.json b/Scalar.Notifications.Mac/StatusMenuItem/UI/Assets.xcassets/StatusItem.imageset/Contents.json similarity index 100% rename from Scalar.Notifications/Scalar.Mac/StatusMenuItem/UI/Assets.xcassets/StatusItem.imageset/Contents.json rename to Scalar.Notifications.Mac/StatusMenuItem/UI/Assets.xcassets/StatusItem.imageset/Contents.json diff --git a/Scalar.Notifications/Scalar.Mac/StatusMenuItem/UI/Assets.xcassets/StatusItem.imageset/Scalar_16.png b/Scalar.Notifications.Mac/StatusMenuItem/UI/Assets.xcassets/StatusItem.imageset/Scalar_16.png similarity index 100% rename from Scalar.Notifications/Scalar.Mac/StatusMenuItem/UI/Assets.xcassets/StatusItem.imageset/Scalar_16.png rename to Scalar.Notifications.Mac/StatusMenuItem/UI/Assets.xcassets/StatusItem.imageset/Scalar_16.png diff --git a/Scalar.Notifications/Scalar.Mac/StatusMenuItem/UI/Assets.xcassets/StatusItem.imageset/Scalar_32.png b/Scalar.Notifications.Mac/StatusMenuItem/UI/Assets.xcassets/StatusItem.imageset/Scalar_32.png similarity index 100% rename from Scalar.Notifications/Scalar.Mac/StatusMenuItem/UI/Assets.xcassets/StatusItem.imageset/Scalar_32.png rename to Scalar.Notifications.Mac/StatusMenuItem/UI/Assets.xcassets/StatusItem.imageset/Scalar_32.png diff --git a/Scalar.Notifications/Scalar.Mac/StatusMenuItem/UI/Assets.xcassets/StatusItem.imageset/Scalar_64.png b/Scalar.Notifications.Mac/StatusMenuItem/UI/Assets.xcassets/StatusItem.imageset/Scalar_64.png similarity index 100% rename from Scalar.Notifications/Scalar.Mac/StatusMenuItem/UI/Assets.xcassets/StatusItem.imageset/Scalar_64.png rename to Scalar.Notifications.Mac/StatusMenuItem/UI/Assets.xcassets/StatusItem.imageset/Scalar_64.png diff --git a/Scalar.Notifications/Scalar.Mac/StatusMenuItem/UI/Base.lproj/MainMenu.xib b/Scalar.Notifications.Mac/StatusMenuItem/UI/Base.lproj/MainMenu.xib similarity index 100% rename from Scalar.Notifications/Scalar.Mac/StatusMenuItem/UI/Base.lproj/MainMenu.xib rename to Scalar.Notifications.Mac/StatusMenuItem/UI/Base.lproj/MainMenu.xib diff --git a/Scalar.Notifications/Scalar.Mac/StatusMenuItem/UI/ScalarAboutWindowController.h b/Scalar.Notifications.Mac/StatusMenuItem/UI/ScalarAboutWindowController.h similarity index 100% rename from Scalar.Notifications/Scalar.Mac/StatusMenuItem/UI/ScalarAboutWindowController.h rename to Scalar.Notifications.Mac/StatusMenuItem/UI/ScalarAboutWindowController.h diff --git a/Scalar.Notifications/Scalar.Mac/StatusMenuItem/UI/ScalarAboutWindowController.m b/Scalar.Notifications.Mac/StatusMenuItem/UI/ScalarAboutWindowController.m similarity index 100% rename from Scalar.Notifications/Scalar.Mac/StatusMenuItem/UI/ScalarAboutWindowController.m rename to Scalar.Notifications.Mac/StatusMenuItem/UI/ScalarAboutWindowController.m diff --git a/Scalar.Notifications/Scalar.Mac/StatusMenuItem/UI/ScalarAboutWindowController.xib b/Scalar.Notifications.Mac/StatusMenuItem/UI/ScalarAboutWindowController.xib similarity index 100% rename from Scalar.Notifications/Scalar.Mac/StatusMenuItem/UI/ScalarAboutWindowController.xib rename to Scalar.Notifications.Mac/StatusMenuItem/UI/ScalarAboutWindowController.xib diff --git a/Scalar.Notifications/Scalar.Mac/StatusMenuItem/UI/ScalarAppDelegate.h b/Scalar.Notifications.Mac/StatusMenuItem/UI/ScalarAppDelegate.h similarity index 100% rename from Scalar.Notifications/Scalar.Mac/StatusMenuItem/UI/ScalarAppDelegate.h rename to Scalar.Notifications.Mac/StatusMenuItem/UI/ScalarAppDelegate.h diff --git a/Scalar.Notifications/Scalar.Mac/StatusMenuItem/UI/ScalarAppDelegate.m b/Scalar.Notifications.Mac/StatusMenuItem/UI/ScalarAppDelegate.m similarity index 100% rename from Scalar.Notifications/Scalar.Mac/StatusMenuItem/UI/ScalarAppDelegate.m rename to Scalar.Notifications.Mac/StatusMenuItem/UI/ScalarAppDelegate.m diff --git a/Scalar.Notifications/Scalar.Mac/StatusMenuItem/UI/ScalarNotificationDisplay.h b/Scalar.Notifications.Mac/StatusMenuItem/UI/ScalarNotificationDisplay.h similarity index 100% rename from Scalar.Notifications/Scalar.Mac/StatusMenuItem/UI/ScalarNotificationDisplay.h rename to Scalar.Notifications.Mac/StatusMenuItem/UI/ScalarNotificationDisplay.h diff --git a/Scalar.Notifications/Scalar.Mac/StatusMenuItem/UI/ScalarNotificationDisplay.m b/Scalar.Notifications.Mac/StatusMenuItem/UI/ScalarNotificationDisplay.m similarity index 100% rename from Scalar.Notifications/Scalar.Mac/StatusMenuItem/UI/ScalarNotificationDisplay.m rename to Scalar.Notifications.Mac/StatusMenuItem/UI/ScalarNotificationDisplay.m diff --git a/Scalar.Notifications/Scalar.Mac/StatusMenuItem/UI/ScalarStatusBarItem.h b/Scalar.Notifications.Mac/StatusMenuItem/UI/ScalarStatusBarItem.h similarity index 100% rename from Scalar.Notifications/Scalar.Mac/StatusMenuItem/UI/ScalarStatusBarItem.h rename to Scalar.Notifications.Mac/StatusMenuItem/UI/ScalarStatusBarItem.h diff --git a/Scalar.Notifications/Scalar.Mac/StatusMenuItem/UI/ScalarStatusBarItem.m b/Scalar.Notifications.Mac/StatusMenuItem/UI/ScalarStatusBarItem.m similarity index 100% rename from Scalar.Notifications/Scalar.Mac/StatusMenuItem/UI/ScalarStatusBarItem.m rename to Scalar.Notifications.Mac/StatusMenuItem/UI/ScalarStatusBarItem.m diff --git a/Scalar.Notifications/Scalar.Mac/StatusMenuItem/Utilities/ScalarNotificationErrors.h b/Scalar.Notifications.Mac/StatusMenuItem/Utilities/ScalarNotificationErrors.h similarity index 100% rename from Scalar.Notifications/Scalar.Mac/StatusMenuItem/Utilities/ScalarNotificationErrors.h rename to Scalar.Notifications.Mac/StatusMenuItem/Utilities/ScalarNotificationErrors.h diff --git a/Scalar.Notifications/Scalar.Mac/StatusMenuItem/Utilities/ScalarNotificationErrors.m b/Scalar.Notifications.Mac/StatusMenuItem/Utilities/ScalarNotificationErrors.m similarity index 100% rename from Scalar.Notifications/Scalar.Mac/StatusMenuItem/Utilities/ScalarNotificationErrors.m rename to Scalar.Notifications.Mac/StatusMenuItem/Utilities/ScalarNotificationErrors.m diff --git a/Scalar.Notifications/Scalar.Mac/StatusMenuItem/Utilities/ScalarProcessRunner.h b/Scalar.Notifications.Mac/StatusMenuItem/Utilities/ScalarProcessRunner.h similarity index 100% rename from Scalar.Notifications/Scalar.Mac/StatusMenuItem/Utilities/ScalarProcessRunner.h rename to Scalar.Notifications.Mac/StatusMenuItem/Utilities/ScalarProcessRunner.h diff --git a/Scalar.Notifications/Scalar.Mac/StatusMenuItem/Utilities/ScalarProcessRunner.m b/Scalar.Notifications.Mac/StatusMenuItem/Utilities/ScalarProcessRunner.m similarity index 100% rename from Scalar.Notifications/Scalar.Mac/StatusMenuItem/Utilities/ScalarProcessRunner.m rename to Scalar.Notifications.Mac/StatusMenuItem/Utilities/ScalarProcessRunner.m diff --git a/Scalar.Notifications/Scalar.Mac/StatusMenuItem/Utilities/ScalarProductInfoFetcher.h b/Scalar.Notifications.Mac/StatusMenuItem/Utilities/ScalarProductInfoFetcher.h similarity index 100% rename from Scalar.Notifications/Scalar.Mac/StatusMenuItem/Utilities/ScalarProductInfoFetcher.h rename to Scalar.Notifications.Mac/StatusMenuItem/Utilities/ScalarProductInfoFetcher.h diff --git a/Scalar.Notifications/Scalar.Mac/StatusMenuItem/Utilities/ScalarProductInfoFetcher.m b/Scalar.Notifications.Mac/StatusMenuItem/Utilities/ScalarProductInfoFetcher.m similarity index 100% rename from Scalar.Notifications/Scalar.Mac/StatusMenuItem/Utilities/ScalarProductInfoFetcher.m rename to Scalar.Notifications.Mac/StatusMenuItem/Utilities/ScalarProductInfoFetcher.m diff --git a/Scalar.Notifications/Scalar.Mac/StatusMenuItem/main.m b/Scalar.Notifications.Mac/StatusMenuItem/main.m similarity index 100% rename from Scalar.Notifications/Scalar.Mac/StatusMenuItem/main.m rename to Scalar.Notifications.Mac/StatusMenuItem/main.m diff --git a/Scalar.Notifications.Mac/build.sh b/Scalar.Notifications.Mac/build.sh new file mode 100755 index 0000000000..4923710886 --- /dev/null +++ b/Scalar.Notifications.Mac/build.sh @@ -0,0 +1,41 @@ +#!/bin/bash + +CONFIGURATION=$1 +if [ -z $CONFIGURATION ]; then + echo "Error: Build configuration not specified" + exit 1 +fi + +INT_DIR=$2 +if [ -z "${INT_DIR}" ]; then + echo "Error: Intermediate output directory not specified" + exit 1 +fi + +OUT_DIR=$3 +if [ -z "${OUT_DIR}" ]; then + echo "Error: Output directory not specified" + exit 1 +fi + +VERSION=$4 +if [ -z "${VERSION}" ]; then + echo "Info: Version not set; not updating version number" +fi + +THIS_DIR="$( cd "$(dirname "$0")" ; pwd -P )" + +# Set the version if not the default 'developer version' +if [ -n "$VERSION" ] && [ "$VERSION" != "0.2.173.2" ]; then + updateAppVersionCmd="(cd \"${THIS_DIR}\" && /usr/bin/xcrun agvtool new-marketing-version \"$VERSION\")" + eval $updateAppVersionCmd || exit 1 +fi + +# Build the product +xcodebuild -configuration "$CONFIGURATION" -project "${THIS_DIR}/Scalar.xcodeproj" build -scheme "Scalar" -derivedDataPath "$INT_DIR" || exit 1 + +# Ensure the output directory exists +mkdir -p "$OUT_DIR" || exit 1 + +# Copy output from intermediate output to final binary output directory +cp -Rf "$INT_DIR/Build/Products/$CONFIGURATION/Scalar.app" "$OUT_DIR" || exit 1 diff --git a/Scalar.Notifications/Scalar.Mac/org.scalar.usernotification.plist b/Scalar.Notifications.Mac/org.scalar.usernotification.plist similarity index 100% rename from Scalar.Notifications/Scalar.Mac/org.scalar.usernotification.plist rename to Scalar.Notifications.Mac/org.scalar.usernotification.plist diff --git a/Scalar.Notifications.Mac/test.sh b/Scalar.Notifications.Mac/test.sh new file mode 100755 index 0000000000..1c371642e4 --- /dev/null +++ b/Scalar.Notifications.Mac/test.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +CONFIGURATION=$1 +if [ -z $CONFIGURATION ]; then + echo "Error: Build configuration not specified" + exit 1 +fi + +INT_DIR=$2 +if [ -z $INT_DIR ]; then + echo "Error: Intermediate output directory not specified" + exit 1 +fi + +# Run tests +xcodebuild -configuration "$CONFIGURATION" -project "Scalar.xcodeproj" test -scheme "Scalar" -derivedDataPath "$INT_DIR" || exit 1 From 013b7f7319c4b3004109a2e6b1da864ecd1a3b9a Mon Sep 17 00:00:00 2001 From: Matthew John Cheetham Date: Tue, 8 Oct 2019 15:42:50 +0100 Subject: [PATCH 11/24] Upgrade Scalar.Service.UI (Windows) project --- Scalar.Service.UI/Scalar.Service.UI.csproj | 91 +++------------------- Scalar.Service.UI/app.config | 6 -- Scalar.Service.UI/packages.config | 4 - 3 files changed, 10 insertions(+), 91 deletions(-) delete mode 100644 Scalar.Service.UI/app.config delete mode 100644 Scalar.Service.UI/packages.config diff --git a/Scalar.Service.UI/Scalar.Service.UI.csproj b/Scalar.Service.UI/Scalar.Service.UI.csproj index fc44458cde..28ec66bec8 100644 --- a/Scalar.Service.UI/Scalar.Service.UI.csproj +++ b/Scalar.Service.UI/Scalar.Service.UI.csproj @@ -1,90 +1,19 @@ - - - - + + - {93B403FD-DAFB-46C5-9636-B122792A548A} Exe - Properties + netcoreapp3.0 + win-x64 + scalar.service.ui Scalar.Service.UI - Scalar.Service.UI - v4.6.1 - 512 - true - - - - x64 - true - full - false - DEBUG;TRACE - prompt - 4 - false - - - x64 - pdbonly - true - TRACE - prompt - 4 - - - - - - - - - - - - - C:\Program Files (x86)\Windows Kits\10\App Certification Kit\winmds\windows81\Windows.winmd - - - - - PlatformLoader.Windows.cs - - - - - - - - - - - - - - - - - - - - - {374bf1e5-0b2d-4d4a-bd5e-4212299def09} - Scalar.Common - - - {4ce404e7-d3fc-471c-993c-64615861ea63} - Scalar.Platform.Windows - - + - - PreserveNewest - + + - - + - + diff --git a/Scalar.Service.UI/app.config b/Scalar.Service.UI/app.config deleted file mode 100644 index bd27edc04e..0000000000 --- a/Scalar.Service.UI/app.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/Scalar.Service.UI/packages.config b/Scalar.Service.UI/packages.config deleted file mode 100644 index c64139aa40..0000000000 --- a/Scalar.Service.UI/packages.config +++ /dev/null @@ -1,4 +0,0 @@ - - - - From 08c1d87092c76db65566dc2a1b6e699d89a2d52b Mon Sep 17 00:00:00 2001 From: Matthew John Cheetham Date: Tue, 8 Oct 2019 15:46:24 +0100 Subject: [PATCH 12/24] Upgrade Scalar.FunctionalTests project --- Scalar.FunctionalTests/NUnitRunner.cs | 79 +++++++++++++++++++ .../Scalar.FunctionalTests.csproj | 48 ++--------- 2 files changed, 87 insertions(+), 40 deletions(-) create mode 100644 Scalar.FunctionalTests/NUnitRunner.cs diff --git a/Scalar.FunctionalTests/NUnitRunner.cs b/Scalar.FunctionalTests/NUnitRunner.cs new file mode 100644 index 0000000000..a768b49cc1 --- /dev/null +++ b/Scalar.FunctionalTests/NUnitRunner.cs @@ -0,0 +1,79 @@ +using NUnitLite; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; + +namespace Scalar.Tests +{ + public class NUnitRunner + { + private List args; + + public NUnitRunner(string[] args) + { + this.args = new List(args); + } + + public string GetCustomArgWithParam(string arg) + { + string match = this.args.Where(a => a.StartsWith(arg + "=")).SingleOrDefault(); + if (match == null) + { + return null; + } + + this.args.Remove(match); + return match.Substring(arg.Length + 1); + } + + public bool HasCustomArg(string arg) + { + // We also remove it as we're checking, because nunit wouldn't understand what it means + return this.args.Remove(arg); + } + + public void AddGlobalSetupIfNeeded(string globalSetup) + { + // If there are any test filters, the GlobalSetup still needs to run so add it. + if (this.args.Any(x => x.StartsWith("--test="))) + { + this.args.Add($"--test={globalSetup}"); + } + } + + public int RunTests(ICollection includeCategories, ICollection excludeCategories) + { + string filters = GetFiltersArgument(includeCategories, excludeCategories); + if (filters.Length > 0) + { + this.args.Add("--where"); + this.args.Add(filters); + } + + DateTime now = DateTime.Now; + int result = new AutoRun(Assembly.GetEntryAssembly()).Execute(this.args.ToArray()); + + Console.WriteLine("Completed test pass in {0}", DateTime.Now - now); + Console.WriteLine(); + + return result; + } + + private static string GetFiltersArgument(ICollection includeCategories, ICollection excludeCategories) + { + string filters = string.Empty; + if (includeCategories != null && includeCategories.Any()) + { + filters = "(" + string.Join("||", includeCategories.Select(x => $"cat=={x}")) + ")"; + } + + if (excludeCategories != null && excludeCategories.Any()) + { + filters += (filters.Length > 0 ? "&&" : string.Empty) + string.Join("&&", excludeCategories.Select(x => $"cat!={x}")); + } + + return filters; + } + } +} diff --git a/Scalar.FunctionalTests/Scalar.FunctionalTests.csproj b/Scalar.FunctionalTests/Scalar.FunctionalTests.csproj index 77da6dfc27..1a678b910d 100644 --- a/Scalar.FunctionalTests/Scalar.FunctionalTests.csproj +++ b/Scalar.FunctionalTests/Scalar.FunctionalTests.csproj @@ -1,52 +1,20 @@ - - - Exe - netcoreapp2.1 - x64 - - true - true - win-x64;osx-x64 - - Scalar.FunctionalTests - Scalar.FunctionalTests - - - $(ScalarVersion) - - - $(ScalarVersion) + Exe + netcoreapp3.0 + false - - - - - all - - - - - - + - - - - - - - + + + + - - - - From 5adb59b290298f86f0deb659f06765f8c7372775 Mon Sep 17 00:00:00 2001 From: Matthew John Cheetham Date: Tue, 8 Oct 2019 16:14:55 +0100 Subject: [PATCH 13/24] Upgrade Scalar.Installer.Windows project --- .../Scalar.Installer.Windows.csproj | 95 ++++++++----------- Scalar.Installer.Windows/Setup.iss | 82 +++------------- Scalar.Installer.Windows/packages.config | 5 - 3 files changed, 52 insertions(+), 130 deletions(-) delete mode 100644 Scalar.Installer.Windows/packages.config diff --git a/Scalar.Installer.Windows/Scalar.Installer.Windows.csproj b/Scalar.Installer.Windows/Scalar.Installer.Windows.csproj index c1da9fe09c..5a4e27f8ec 100644 --- a/Scalar.Installer.Windows/Scalar.Installer.Windows.csproj +++ b/Scalar.Installer.Windows/Scalar.Installer.Windows.csproj @@ -1,65 +1,50 @@ - - - - - + + - {3AB4FB1F-9E23-4CD8-BFAC-8A2221C8F893} - Library - Properties - Scalar.Installer.Windows - Scalar.Installer.Windows - v4.6.1 - 512 - - + netcoreapp3.0 + win-x64 + $(ProjectOutPath)layout\$(Configuration)\ + $(ProjectOutPath)installer\$(Configuration)\ - - true - DEBUG;TRACE - full - x64 - prompt - MinimumRecommendedRules.ruleset - - - TRACE - true - pdbonly - x64 - prompt - MinimumRecommendedRules.ruleset - - - - Microsoft400 - false - - + + + + + - + + + + + + - - Designer - + - - - - - - - - - - - + + + + - This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + bin\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\publish\ - - + + <_PublishFiles Include="$(RepoOutPath)%(ProjectReference.Filename)\$(PublishPathFragment)\**\*" /> + + + + + + + + + + + - + diff --git a/Scalar.Installer.Windows/Setup.iss b/Scalar.Installer.Windows/Setup.iss index 71ec1740e6..b0ad720359 100644 --- a/Scalar.Installer.Windows/Setup.iss +++ b/Scalar.Installer.Windows/Setup.iss @@ -3,15 +3,7 @@ ; General documentation on how to use InnoSetup scripts: http://www.jrsoftware.org/ishelp/index.php -#define ScalarDir BuildOutputDir + "\Scalar.Windows\bin\" + PlatformAndConfiguration -#define ScalarCommonDir BuildOutputDir + "\Scalar.Common\bin\" + PlatformAndConfiguration + "\netstandard2.0" -#define ServiceDir BuildOutputDir + "\Scalar.Service.Windows\bin\" + PlatformAndConfiguration -#define ServiceUIDir BuildOutputDir + "\Scalar.Service.UI\bin\" + PlatformAndConfiguration -#define ScalarMountDir BuildOutputDir + "\Scalar.Mount.Windows\bin\" + PlatformAndConfiguration -#define ScalarUpgraderDir BuildOutputDir + "\Scalar.Upgrader\bin\" + PlatformAndConfiguration + "\net461" - #define MyAppName "Scalar" -#define MyAppInstallerVersion GetFileVersion(ScalarDir + "\Scalar.exe") #define MyAppPublisher "Microsoft Corporation" #define MyAppPublisherURL "http://www.microsoft.com" #define MyAppURL "https://github.com/microsoft/Scalar" @@ -22,13 +14,13 @@ [Setup] AppId={{82F731CB-1CFC-406D-8D84-8467BF6040C7} AppName={#MyAppName} -AppVersion={#MyAppInstallerVersion} -VersionInfoVersion={#MyAppInstallerVersion} +AppVersion={#ScalarVersion} +VersionInfoVersion={#ScalarVersion} AppPublisher={#MyAppPublisher} AppPublisherURL={#MyAppPublisherURL} AppSupportURL={#MyAppURL} AppUpdatesURL={#MyAppURL} -AppCopyright=Copyright � Microsoft 2019 +AppCopyright=Copyright © Microsoft 2019 BackColor=clWhite BackSolid=yes DefaultDirName={pf}\{#MyAppName} @@ -40,14 +32,14 @@ SolidCompression=yes MinVersion=10.0.14374 DisableDirPage=yes DisableReadyPage=yes -SetupIconFile="{#ScalarDir}\Images\scalar.ico" +SetupIconFile="{#LayoutPath}\Images\scalar.ico" ArchitecturesInstallIn64BitMode=x64 ArchitecturesAllowed=x64 WizardImageStretch=no WindowResizable=no CloseApplications=yes ChangesEnvironment=yes -RestartIfNeededByRun=yes +RestartIfNeededByRun=yes [Languages] Name: "english"; MessagesFile: "compiler:Default.isl"; @@ -62,59 +54,8 @@ Name: "full"; Description: "Full installation"; Flags: iscustom; Type: files; Name: "{app}\ucrtbase.dll" [Files] - -; Scalar.Mount Files -DestDir: "{app}"; Flags: ignoreversion; Source:"{#ScalarMountDir}\Scalar.Mount.pdb" -DestDir: "{app}"; Flags: ignoreversion; Source:"{#ScalarMountDir}\Scalar.Mount.exe" -DestDir: "{app}"; Flags: ignoreversion; Source:"{#ScalarMountDir}\Scalar.Mount.exe.config" - -; Scalar.Upgrader Files -DestDir: "{app}"; Flags: ignoreversion; Source:"{#ScalarUpgraderDir}\Scalar.Upgrader.pdb" -DestDir: "{app}"; Flags: ignoreversion; Source:"{#ScalarUpgraderDir}\Scalar.Upgrader.exe" -DestDir: "{app}"; Flags: ignoreversion; Source:"{#ScalarUpgraderDir}\Scalar.Upgrader.exe.config" - -; Scalar PDB's -DestDir: "{app}"; Flags: ignoreversion; Source:"{#ScalarDir}\Scalar.Common.pdb" -DestDir: "{app}"; Flags: ignoreversion; Source:"{#ScalarDir}\Scalar.Platform.Windows.pdb" -DestDir: "{app}"; Flags: ignoreversion; Source:"{#ScalarDir}\Scalar.pdb" - -; Scalar.Service.UI Files -DestDir: "{app}"; Flags: ignoreversion; Source:"{#ServiceUIDir}\Scalar.Service.UI.exe" -DestDir: "{app}"; Flags: ignoreversion; Source:"{#ServiceUIDir}\Scalar.Service.UI.exe.config" -DestDir: "{app}"; Flags: ignoreversion; Source:"{#ServiceUIDir}\Scalar.Service.UI.pdb" -DestDir: "{app}"; Flags: ignoreversion; Source:"{#ServiceUIDir}\scalar.ico" -DestDir: "{app}"; Flags: ignoreversion; Source:"{#ServiceUIDir}\System.Runtime.dll" - -; Scalar Files -DestDir: "{app}"; Flags: ignoreversion; Source:"{#ScalarDir}\CommandLine.dll" -DestDir: "{app}"; Flags: ignoreversion; Source:"{#ScalarDir}\Scalar.Common.dll" -DestDir: "{app}"; Flags: ignoreversion; Source:"{#ScalarDir}\Scalar.Platform.Windows.dll" -DestDir: "{app}"; Flags: ignoreversion; Source:"{#ScalarDir}\Newtonsoft.Json.dll" -DestDir: "{app}"; Flags: ignoreversion; Source:"{#ScalarDir}\Scalar.exe.config" -DestDir: "{app}"; Flags: ignoreversion; Source:"{#ScalarDir}\Images\scalar.ico" -DestDir: "{app}"; Flags: ignoreversion; Source:"{#ScalarDir}\Scalar.exe" - -; NuGet support DLLs -DestDir: "{app}"; Flags: ignoreversion; Source:"{#ScalarDir}\NuGet.Commands.dll" -DestDir: "{app}"; Flags: ignoreversion; Source:"{#ScalarDir}\NuGet.Common.dll" -DestDir: "{app}"; Flags: ignoreversion; Source:"{#ScalarDir}\NuGet.Configuration.dll" -DestDir: "{app}"; Flags: ignoreversion; Source:"{#ScalarDir}\NuGet.Frameworks.dll" -DestDir: "{app}"; Flags: ignoreversion; Source:"{#ScalarDir}\NuGet.Packaging.Core.dll" -DestDir: "{app}"; Flags: ignoreversion; Source:"{#ScalarDir}\NuGet.Packaging.dll" -DestDir: "{app}"; Flags: ignoreversion; Source:"{#ScalarDir}\NuGet.Protocol.dll" -DestDir: "{app}"; Flags: ignoreversion; Source:"{#ScalarDir}\NuGet.Versioning.dll" - -; .NET Standard Files -; See https://github.com/dotnet/standard/issues/415 for a discussion on why this are copied -DestDir: "{app}"; Flags: ignoreversion; Source:"{#ScalarDir}\netstandard.dll" -DestDir: "{app}"; Flags: ignoreversion; Source:"{#ScalarDir}\System.Net.Http.dll" -DestDir: "{app}"; Flags: ignoreversion; Source:"{#ScalarDir}\System.ValueTuple.dll" -DestDir: "{app}"; Flags: ignoreversion; Source:"{#ScalarDir}\System.IO.Compression.dll" - -; Scalar.Service Files and PDB's -DestDir: "{app}"; Flags: ignoreversion; Source:"{#ServiceDir}\Scalar.Service.pdb" -DestDir: "{app}"; Flags: ignoreversion; Source:"{#ServiceDir}\Scalar.Service.exe.config" -DestDir: "{app}"; Flags: ignoreversion; Source:"{#ServiceDir}\Scalar.Service.exe"; AfterInstall: InstallScalarService +; Include all files (recursively) from the layout directory +DestDir: "{app}"; Flags: ignoreversion recursesubdirs; Source:"{#LayoutPath}\*"; [Icons] Name: "{commonstartmenu}\{#ServiceUIName}"; Filename: "{app}\Scalar.Service.UI.exe"; AppUserModelID: "Scalar" @@ -145,7 +86,7 @@ begin exit; end; // look for the path with leading and trailing semicolon - // Pos() returns 0 if not found + // Pos() returns 0 if not found Result := Pos(';' + Param + ';', ';' + OrigPath + ';') = 0; end; @@ -240,11 +181,11 @@ var InstallSuccessful: Boolean; begin InstallSuccessful := False; - + StatusText := WizardForm.StatusLabel.Caption; WizardForm.StatusLabel.Caption := 'Installing Scalar.Service.'; WizardForm.ProgressGauge.Style := npbstMarquee; - + try if Exec(ExpandConstant('{sys}\SC.EXE'), ExpandConstant('create Scalar.Service binPath="{app}\Scalar.Service.exe" start=auto'), '', SW_HIDE, ewWaitUntilTerminated, ResultCode) and (ResultCode = 0) then begin @@ -384,7 +325,7 @@ begin Result := True; end; -// Below are EVENT FUNCTIONS -> The main entry points of InnoSetup into the code region +// Below are EVENT FUNCTIONS -> The main entry points of InnoSetup into the code region // Documentation : http://www.jrsoftware.org/ishelp/index.php?topic=scriptevents function InitializeUninstall(): Boolean; @@ -413,6 +354,7 @@ begin end; ssPostInstall: begin + InstallScalarService(); RegisterUserWithService(); end; end; diff --git a/Scalar.Installer.Windows/packages.config b/Scalar.Installer.Windows/packages.config deleted file mode 100644 index b27bb19f10..0000000000 --- a/Scalar.Installer.Windows/packages.config +++ /dev/null @@ -1,5 +0,0 @@ - - - - - From 6dd6fce5704cee7c841661e2afb8ba13545ad6b3 Mon Sep 17 00:00:00 2001 From: Matthew John Cheetham Date: Tue, 8 Oct 2019 16:18:24 +0100 Subject: [PATCH 14/24] Upgrade Scalar.Installer.Mac project --- Scalar.Installer.Mac/CreateMacInstaller.sh | 208 ------------------ .../Scalar.Installer.Mac.csproj | 57 +++-- ...ribution.xml => distribution.template.xml} | 6 +- Scalar.Installer.Mac/layout.sh | 137 ++++++++++++ Scalar.Installer.Mac/pack.sh | 92 ++++++++ 5 files changed, 256 insertions(+), 244 deletions(-) delete mode 100755 Scalar.Installer.Mac/CreateMacInstaller.sh rename Scalar.Installer.Mac/{scripts/Distribution.xml => distribution.template.xml} (84%) create mode 100755 Scalar.Installer.Mac/layout.sh create mode 100755 Scalar.Installer.Mac/pack.sh diff --git a/Scalar.Installer.Mac/CreateMacInstaller.sh b/Scalar.Installer.Mac/CreateMacInstaller.sh deleted file mode 100755 index 1d8f998b91..0000000000 --- a/Scalar.Installer.Mac/CreateMacInstaller.sh +++ /dev/null @@ -1,208 +0,0 @@ -#!/bin/bash - -SOURCEDIRECTORY=$1 -if [ -z $SOURCEDIRECTORY ]; then - echo "Error: Source directory not specified" - exit 1 -fi - -CONFIGURATION=$2 -if [ -z $CONFIGURATION ]; then - echo "Error: Build configuration not specified" - exit 1 -fi - -PACKAGEVERSION=$3 -if [ -z $PACKAGEVERSION ]; then - echo "Error: Installer package version not specified" - exit 1 -fi - -BUILDOUTPUTDIR=${4%/} -if [ -z $BUILDOUTPUTDIR ]; then - echo "Error: Build output directory not specified" - exit 1 -fi - -if [ -z $Scalar_OUTPUTDIR ]; then - echo "Error: Missing environment variable. Scalar_OUTPUTDIR is not set" - exit 1 -fi - -if [ -z $Scalar_PUBLISHDIR ]; then - echo "Error: Missing environment variable. Scalar_PUBLISHDIR is not set" - exit 1 -fi - -STAGINGDIR="${BUILDOUTPUTDIR}/Staging" -PACKAGESTAGINGDIR="${BUILDOUTPUTDIR}/Packages" -ScalarFORGITDESTINATION="usr/local/scalar" -DAEMONPLISTDESTINATION="Library/LaunchDaemons" -AGENTPLISTDESTINATION="Library/LaunchAgents" -LIBRARYEXTENSIONSDESTINATION="Library/Extensions" -LIBRARYAPPSUPPORTDESTINATION="Library/Application Support/Scalar" -INSTALLERPACKAGENAME="Scalar.$PACKAGEVERSION" -INSTALLERPACKAGEID="com.scalar.pkg" -UNINSTALLERPATH="${SOURCEDIRECTORY}/uninstall_scalar.sh" -SCRIPTSPATH="${SOURCEDIRECTORY}/scripts" -COMPONENTSPLISTPATH="${SOURCEDIRECTORY}/scalar_components.plist" -DIST_FILE_NAME="Distribution.updated.xml" - -function CheckBuildIsAvailable() -{ - if [ ! -d "$Scalar_OUTPUTDIR" ] || [ ! -d "$Scalar_PUBLISHDIR" ]; then - echo "Error: Could not find Scalar Build to package." - exit 1 - fi -} - -function SetPermissions() -{ - chmodCommand="chmod -R 755 \"${STAGINGDIR}\"" - eval $chmodCommand || exit 1 -} - -function CreateInstallerRoot() -{ - mkdirVfsForGit="mkdir -p \"${STAGINGDIR}/$ScalarFORGITDESTINATION\"" - eval $mkdirVfsForGit || exit 1 - - mkdirPkgStaging="mkdir -p \"${PACKAGESTAGINGDIR}\"" - eval $mkdirPkgStaging || exit 1 - - mkdirBin="mkdir -p \"${STAGINGDIR}/usr/local/bin\"" - eval $mkdirBin || exit 1 - - mkdirBin="mkdir -p \"${STAGINGDIR}/$LIBRARYEXTENSIONSDESTINATION\"" - eval $mkdirBin || exit 1 - - mkdirBin="mkdir -p \"${STAGINGDIR}/$LIBRARYAPPSUPPORTDESTINATION\"" - eval $mkdirBin || exit 1 - - mkdirBin="mkdir -p \"${STAGINGDIR}/$DAEMONPLISTDESTINATION\"" - eval $mkdirBin || exit 1 - - mkdirBin="mkdir -p \"${STAGINGDIR}/$AGENTPLISTDESTINATION\"" - eval $mkdirBin || exit 1 -} - -function CopyBinariesToInstall() -{ - copyPublishDirectory="cp -Rf \"${Scalar_PUBLISHDIR}\"/* \"${STAGINGDIR}/${ScalarFORGITDESTINATION}/.\"" - eval $copyPublishDirectory || exit 1 - - removeTestAssemblies="find \"${STAGINGDIR}/${ScalarFORGITDESTINATION}\" -name \"*Scalar.*Tests*\" -exec rm -f \"{}\" \";\"" - eval $removeTestAssemblies || exit 1 - - removeDataDirectory="rm -Rf \"${STAGINGDIR}/${ScalarFORGITDESTINATION}/Data\"" - eval $removeDataDirectory || exit 1 - - copyUnInstaller="cp -f \"${UNINSTALLERPATH}\" \"${STAGINGDIR}/${ScalarFORGITDESTINATION}/.\"" - eval $copyUnInstaller || exit 1 - - copyNotificationApp="cp -Rf \"${Scalar_OUTPUTDIR}/Scalar.Notifications/Scalar.Mac/Build/Products/$CONFIGURATION/Scalar.app\" \"${STAGINGDIR}/${LIBRARYAPPSUPPORTDESTINATION}/.\"" - eval $copyNotificationApp || exit 1 - - copyNotificationPlist="cp -Rf \"${SOURCEDIRECTORY}/../Scalar.Notifications/Scalar.Mac/org.scalar.usernotification.plist\" \"${STAGINGDIR}/${AGENTPLISTDESTINATION}/.\"" - eval $copyNotificationPlist || exit 1 - - copyServicePlist="cp -Rf \"${SOURCEDIRECTORY}/../Scalar.Service/Mac/org.scalar.service.plist\" \"${STAGINGDIR}/${AGENTPLISTDESTINATION}/.\"" - eval $copyServicePlist || exit 1 - - currentDirectory=`pwd` - cd "${STAGINGDIR}/usr/local/bin" - linkCommand="ln -sf ../scalar/scalar scalar" - eval $linkCommand - cd $currentDirectory -} - -function CreateScalarInstaller() -{ - pkgBuildCommand="/usr/bin/pkgbuild --identifier $INSTALLERPACKAGEID --component-plist \"${COMPONENTSPLISTPATH}\" --scripts \"${SCRIPTSPATH}\" --root \"${STAGINGDIR}\" \"${PACKAGESTAGINGDIR}/$INSTALLERPACKAGENAME.pkg\"" - eval $pkgBuildCommand || exit 1 -} - -function UpdateDistributionFile() -{ - ScalarFORGIT_PKG_VERSION=$PACKAGEVERSION - ScalarFORGIT_PKG_NAME="$INSTALLERPACKAGENAME.pkg" - GIT_PKG_NAME=$1 - GIT_PKG_VERSION=$2 - - /usr/bin/sed -e "s|ScalarFORGIT_VERSION_PLACHOLDER|$ScalarFORGIT_PKG_VERSION|g" "$SCRIPTSPATH/Distribution.xml" > "${BUILDOUTPUTDIR}/$DIST_FILE_NAME" - /usr/bin/sed -i.bak "s|ScalarFORGIT_PKG_NAME_PLACEHOLDER|$ScalarFORGIT_PKG_NAME|g" "${BUILDOUTPUTDIR}/$DIST_FILE_NAME" - - if [ ! -z "$GIT_PKG_NAME" ] && [ ! -z "$GIT_PKG_VERSION" ]; then - GIT_CHOICE_OUTLINE_ELEMENT_TEXT="" - GIT_CHOICE_ID_ELEMENT_TEXT=" " - GIT_PKG_REF_ELEMENT_TEXT="$GIT_PKG_NAME" - else - GIT_CHOICE_OUTLINE_ELEMENT_TEXT="" - GIT_CHOICE_ID_ELEMENT_TEXT="" - GIT_PKG_REF_ELEMENT_TEXT="" - fi - - /usr/bin/sed -i.bak "s|GIT_CHOICE_OUTLINE_PLACEHOLDER|$GIT_CHOICE_OUTLINE_ELEMENT_TEXT|g" "${BUILDOUTPUTDIR}/$DIST_FILE_NAME" - /usr/bin/sed -i.bak "s|GIT_CHOICE_ID_PLACEHOLDER|$GIT_CHOICE_ID_ELEMENT_TEXT|g" "${BUILDOUTPUTDIR}/$DIST_FILE_NAME" - /usr/bin/sed -i.bak "s|GIT_PKG_REF_PLACEHOLDER|$GIT_PKG_REF_ELEMENT_TEXT|g" "${BUILDOUTPUTDIR}/$DIST_FILE_NAME" - - /bin/rm -f "${BUILDOUTPUTDIR}/$DIST_FILE_NAME.bak" -} - -function CreateScalarDistribution() -{ - # Update distribution file(removes Git info from template.) - UpdateDistributionFile "" "" - - buildScalarDistCmd="/usr/bin/productbuild --distribution \"${BUILDOUTPUTDIR}/Distribution.updated.xml\" --package-path \"$PACKAGESTAGINGDIR\" \"${BUILDOUTPUTDIR}/$INSTALLERPACKAGENAME.pkg\"" - echo $buildScalarDistCmd - eval $buildScalarDistCmd || exit 1 - - /bin/rm -f "${BUILDOUTPUTDIR}/$DIST_FILE_NAME" -} - -function CreateMetaDistribution() -{ - GITVERSION="$($Scalar_SCRIPTDIR/GetGitVersionNumber.sh)" - GITINSTALLERPKGPATH="$(find $Scalar_PACKAGESDIR/gitformac.gvfs.installer/$GITVERSION -type f -name *.pkg)" || exit 1 - - GITPKGNAME="${GITINSTALLERPKGPATH##*/}" - GITINSTALLERPKGNAME="${GITPKGNAME%.pkg}" - GITVERSIONSTRING=`echo $GITINSTALLERPKGNAME | cut -d"-" -f2` - - if [[ -z "$GITVERSION" || -z "$GITVERSIONSTRING" ]]; then - echo "Error creating metapackage: could not determine Git package version." - exit 1 - fi - - if [ ! -f "$GITINSTALLERPKGPATH" ]; then - echo "Error creating metapackage: could not find Git installer package." - exit 1 - fi - - copyGitInstallerPkgToStgCmd="/bin/cp -Rf \"${GITINSTALLERPKGPATH}\" \"${PACKAGESTAGINGDIR}/.\"" - echo $copyGitInstallerPkgToStgCmd - eval $copyGitInstallerPkgToStgCmd || exit 1 - - UpdateDistributionFile "$GITPKGNAME" "$GITVERSIONSTRING" - - METAPACKAGENAME="$INSTALLERPACKAGENAME-Git.$GITVERSION.pkg" - buildMetapkgCmd="/usr/bin/productbuild --distribution \"${BUILDOUTPUTDIR}/Distribution.updated.xml\" --package-path \"$PACKAGESTAGINGDIR\" \"${BUILDOUTPUTDIR}/$METAPACKAGENAME\"" - echo $buildMetapkgCmd - eval $buildMetapkgCmd || exit 1 - - /bin/rm -f "${BUILDOUTPUTDIR}/$DIST_FILE_NAME" -} - -function Run() -{ - CheckBuildIsAvailable - CreateInstallerRoot - CopyBinariesToInstall - SetPermissions - CreateScalarInstaller - CreateScalarDistribution - CreateMetaDistribution -} - -Run diff --git a/Scalar.Installer.Mac/Scalar.Installer.Mac.csproj b/Scalar.Installer.Mac/Scalar.Installer.Mac.csproj index 5b2c796cf4..c0fcba5550 100644 --- a/Scalar.Installer.Mac/Scalar.Installer.Mac.csproj +++ b/Scalar.Installer.Mac/Scalar.Installer.Mac.csproj @@ -1,37 +1,32 @@ - - - - + + - Scalar.Installer.Mac - Scalar.Installer.Mac - netcoreapp2.1 - x64 - osx-x64 - - - - $(ScalarVersion) + netcoreapp3.0 + osx-x64 + $(ProjectOutPath)layout\$(Configuration)\ + $(ProjectOutPath)installer\$(Configuration)\ - - - $(ScalarVersion) - - - - - - - - - - - - + + + + + + + + + + + + + + + + + - - - + + + diff --git a/Scalar.Installer.Mac/scripts/Distribution.xml b/Scalar.Installer.Mac/distribution.template.xml similarity index 84% rename from Scalar.Installer.Mac/scripts/Distribution.xml rename to Scalar.Installer.Mac/distribution.template.xml index 235df0b759..98121326ee 100644 --- a/Scalar.Installer.Mac/scripts/Distribution.xml +++ b/Scalar.Installer.Mac/distribution.template.xml @@ -2,21 +2,17 @@ Scalar - - GIT_CHOICE_OUTLINE_PLACEHOLDER - ScalarFORGIT_PKG_NAME_PLACEHOLDER - GIT_CHOICE_ID_PLACEHOLDER - GIT_PKG_REF_PLACEHOLDER + SCALAR_PKG_NAME_PLACEHOLDER