diff --git a/Directory.Build.props b/Directory.Build.props index ccbdc39b..5c09be7a 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -4,26 +4,29 @@ $(MSBuildThisFileDirectory) + Reuben Bond Hagar - 0.0.1 + 0.2.1 Copyright © Reuben Bond 2018 - + https://github.com/ReubenBond/Hagar git true true true - pdbonly en-US - latest + true + true + + + + true False $(SourceRoot)SigningKey.snk @@ -31,8 +34,9 @@ + latest true - $(NoWarn);1591 + $(NoWarn);1591;FS2003 true true @@ -48,9 +52,24 @@ $(SourceRoot)/Artifacts/$(Configuration) + - - - + + + + + $(MSBuildThisFileDirectory)src/Hagar.CodeGenerator.MSBuild.Bootstrap/bin/publish/$(Configuration)/netcoreapp2.1/Hagar.CodeGenerator.MSBuild.Bootstrap.dll + + + + false + netcoreapp2.1 + true + TargetFramework + false + + + + diff --git a/Directory.Build.targets b/Directory.Build.targets deleted file mode 100644 index 6a6cd811..00000000 --- a/Directory.Build.targets +++ /dev/null @@ -1,18 +0,0 @@ - - - Hagar.CodeGenerator.MSBuild.Bootstrap - $(MSBuildThisFileDirectory)src/$(Asm)/bin/publish/$(Configuration)/net47/$(Asm).exe - $(MSBuildThisFileDirectory)src/$(Asm)/bin/publish/$(Configuration)/netcoreapp2.1/$(Asm).dll - - - - - false - netcoreapp2.1 - false - - - - - - diff --git a/Hagar.sln b/Hagar.sln index adc4f7ef..bd5f6d10 100644 --- a/Hagar.sln +++ b/Hagar.sln @@ -45,6 +45,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution README.md = README.md EndProjectSection EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Hagar.CodeGenerator.MSBuild.Tasks", "src\Hagar.CodeGenerator.MSBuild.Tasks\Hagar.CodeGenerator.MSBuild.Tasks.csproj", "{5656539A-233B-45BC-ADF1-9C804820FFCC}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -99,6 +101,10 @@ Global {6023811E-B6F6-4879-ABB2-77515FEA6C5F}.Debug|Any CPU.Build.0 = Debug|Any CPU {6023811E-B6F6-4879-ABB2-77515FEA6C5F}.Release|Any CPU.ActiveCfg = Release|Any CPU {6023811E-B6F6-4879-ABB2-77515FEA6C5F}.Release|Any CPU.Build.0 = Release|Any CPU + {5656539A-233B-45BC-ADF1-9C804820FFCC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5656539A-233B-45BC-ADF1-9C804820FFCC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5656539A-233B-45BC-ADF1-9C804820FFCC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5656539A-233B-45BC-ADF1-9C804820FFCC}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -116,6 +122,7 @@ Global {1FCCA413-929B-447A-839D-E69510E9C1E5} = {2A14EA5B-AB5E-4486-A746-B834A1C0F290} {633EF412-DF66-4FD5-8D0B-D5CD91E1D208} = {2A14EA5B-AB5E-4486-A746-B834A1C0F290} {6023811E-B6F6-4879-ABB2-77515FEA6C5F} = {9CA57753-5824-4D32-825A-F9D0C6CABFBA} + {5656539A-233B-45BC-ADF1-9C804820FFCC} = {2A14EA5B-AB5E-4486-A746-B834A1C0F290} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {8125413B-1B31-40F0-BA6B-BFD0C6925F6C} diff --git a/src/Hagar.Abstractions/Hagar.Abstractions.csproj b/src/Hagar.Abstractions/Hagar.Abstractions.csproj index 914114a0..8e200103 100644 --- a/src/Hagar.Abstractions/Hagar.Abstractions.csproj +++ b/src/Hagar.Abstractions/Hagar.Abstractions.csproj @@ -1,12 +1,9 @@ - + - netstandard1.3 + netstandard2.0 Hagar + Fast, flexible, and version-tolerant serializer for .NET - - - - diff --git a/src/Hagar.CodeGenerator.MSBuild.Bootstrap/Hagar.CodeGenerator.MSBuild.Bootstrap.csproj b/src/Hagar.CodeGenerator.MSBuild.Bootstrap/Hagar.CodeGenerator.MSBuild.Bootstrap.csproj index 5dae847f..6927ca06 100644 --- a/src/Hagar.CodeGenerator.MSBuild.Bootstrap/Hagar.CodeGenerator.MSBuild.Bootstrap.csproj +++ b/src/Hagar.CodeGenerator.MSBuild.Bootstrap/Hagar.CodeGenerator.MSBuild.Bootstrap.csproj @@ -1,8 +1,7 @@  - netcoreapp2.1 - netcoreapp2.1;net47 + netcoreapp2.1 win10-x64 Exe false @@ -27,6 +26,7 @@ false + @@ -62,7 +62,6 @@ - diff --git a/src/Hagar.CodeGenerator.MSBuild.Tasks/DotNetMuxer.cs b/src/Hagar.CodeGenerator.MSBuild.Tasks/DotNetMuxer.cs new file mode 100644 index 00000000..7215f93e --- /dev/null +++ b/src/Hagar.CodeGenerator.MSBuild.Tasks/DotNetMuxer.cs @@ -0,0 +1,51 @@ +using System; +using System.Diagnostics; +using System.IO; +using System.Runtime.InteropServices; + +namespace Hagar.CodeGenerator.MSBuild.Tasks +{ + /// + /// Utilities for finding the "dotnet.exe" file from the currently running .NET Core application + /// + internal static class DotNetMuxer + { + private const string MuxerName = "dotnet"; + + static DotNetMuxer() + { + MuxerPath = TryFindMuxerPath(); + } + + /// + /// The full filepath to the .NET Core muxer. + /// + public static string MuxerPath { get; } + + /// + /// Finds the full filepath to the .NET Core muxer, + /// or returns a string containing the default name of the .NET Core muxer ('dotnet'). + /// + /// The path or a string named 'dotnet'. + public static string MuxerPathOrDefault() + => MuxerPath ?? MuxerName; + + private static string TryFindMuxerPath() + { + var fileName = MuxerName; + if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + { + fileName += ".exe"; + } + + var mainModule = Process.GetCurrentProcess().MainModule; + if (!string.IsNullOrEmpty(mainModule?.FileName) + && Path.GetFileName(mainModule.FileName).Equals(fileName, StringComparison.OrdinalIgnoreCase)) + { + return mainModule.FileName; + } + + return null; + } + } +} \ No newline at end of file diff --git a/src/Hagar.CodeGenerator.MSBuild.Tasks/GetDotNetHost.cs b/src/Hagar.CodeGenerator.MSBuild.Tasks/GetDotNetHost.cs new file mode 100644 index 00000000..54980801 --- /dev/null +++ b/src/Hagar.CodeGenerator.MSBuild.Tasks/GetDotNetHost.cs @@ -0,0 +1,19 @@ +using Microsoft.Build.Framework; +using MSBuildTask = Microsoft.Build.Utilities.Task; + +namespace Hagar.CodeGenerator.MSBuild.Tasks +{ + public class GetDotNetHost : MSBuildTask + { + [Output] + public string DotNetHost { get; set; } + + public override bool Execute() + { + this.DotNetHost = TryFindDotNetExePath(); + return true; + } + + private static string TryFindDotNetExePath() => DotNetMuxer.MuxerPathOrDefault(); + } +} \ No newline at end of file diff --git a/src/Hagar.CodeGenerator.MSBuild.Tasks/Hagar.CodeGenerator.MSBuild.Tasks.csproj b/src/Hagar.CodeGenerator.MSBuild.Tasks/Hagar.CodeGenerator.MSBuild.Tasks.csproj new file mode 100644 index 00000000..dbdca1e7 --- /dev/null +++ b/src/Hagar.CodeGenerator.MSBuild.Tasks/Hagar.CodeGenerator.MSBuild.Tasks.csproj @@ -0,0 +1,13 @@ + + + netstandard2.0 + + + + false + + + + + + \ No newline at end of file diff --git a/src/Hagar.CodeGenerator.MSBuild/Hagar.CodeGenerator.MSBuild.csproj b/src/Hagar.CodeGenerator.MSBuild/Hagar.CodeGenerator.MSBuild.csproj index 128ce8d7..9a37b4cf 100644 --- a/src/Hagar.CodeGenerator.MSBuild/Hagar.CodeGenerator.MSBuild.csproj +++ b/src/Hagar.CodeGenerator.MSBuild/Hagar.CodeGenerator.MSBuild.csproj @@ -1,8 +1,8 @@  - netcoreapp2.1 - netcoreapp2.1;net47 + netcoreapp2.1 + Code generator for projects using Hagar with MSBuild Exe true tasks @@ -17,10 +17,6 @@ $(PublishRoot)$(TargetFramework) - - - - true @@ -36,8 +32,9 @@ + - + @@ -57,7 +54,7 @@ - + @@ -71,7 +68,6 @@ - @@ -79,16 +75,18 @@ - + - - + + + <_PackageFiles Include="@(PublishedFiles)"> tasks/$(RecursiveDir) false @@ -96,4 +94,5 @@ + \ No newline at end of file diff --git a/src/Hagar.CodeGenerator.MSBuild/build/Hagar.CodeGenerator.MSBuild.targets b/src/Hagar.CodeGenerator.MSBuild/build/Hagar.CodeGenerator.MSBuild.targets index e51bfbc1..679279f8 100644 --- a/src/Hagar.CodeGenerator.MSBuild/build/Hagar.CodeGenerator.MSBuild.targets +++ b/src/Hagar.CodeGenerator.MSBuild/build/Hagar.CodeGenerator.MSBuild.targets @@ -2,31 +2,26 @@ Hagar_ArgsFile; Hagar_CodeGenDirectory; Hagar_CodeGeneratorEnabled; - Hagar_CoreAssembly; Hagar_DotNetHost; Hagar_FullAssembly; Hagar_GeneratorAssembly; Hagar_MSBuildIsCore; Hagar_OutputFileName; Hagar_TaskAssembly;"> - - - dotnet - $(HagarCodeGenCoreAssembly) - $(HagarCodeGenFullAssembly) - $(MSBuildThisFileDirectory)..\tasks\netcoreapp2.1\Hagar.CodeGenerator.MSBuild.dll - $(MSBuildThisFileDirectory)..\tasks\net47\Hagar.CodeGenerator.MSBuild.exe + true - $(Hagar_CoreAssembly) + $(MSBuildThisFileDirectory)..\tasks\netcoreapp2.1\Hagar.CodeGenerator.MSBuild.Tasks.dll + dotnet dotnet $(DotNetHost) - $(Hagar_CoreAssembly) + $(HagarCodeGenCoreAssembly) + $(MSBuildThisFileDirectory)..\tasks\netcoreapp2.1\Hagar.CodeGenerator.MSBuild.dll @@ -34,18 +29,55 @@ $(IntermediateOutputPath) $(ProjectDir)$(IntermediateOutputPath) $(Hagar_CodeGenDirectory)$(TargetName).hagar.g.cs - true + true $(Hagar_CodeGenDirectory)$(TargetName).hagar.g.args.txt - $(IntermediateOutputPath)$(MSBuildProjectFile).CoreCompileInputs.cache + $(HagarGenerateCodeDependsOn);ResolveReferences;HagarGenerateInputCache + + + + + + + + + + + + $(IntermediateOutputPath)$(MSBuildProjectFile).HagarCodeGenInputs.cache + + + + + + + + + + + + + + + diff --git a/src/Hagar.CodeGenerator/Hagar.CodeGenerator.csproj b/src/Hagar.CodeGenerator/Hagar.CodeGenerator.csproj index 0da4cece..2e9c27bd 100644 --- a/src/Hagar.CodeGenerator/Hagar.CodeGenerator.csproj +++ b/src/Hagar.CodeGenerator/Hagar.CodeGenerator.csproj @@ -2,18 +2,11 @@ netstandard2.0 + Code generation library for Hagar - - - - - - - - diff --git a/src/Hagar.ISerializable/Hagar.ISerializable.csproj b/src/Hagar.ISerializable/Hagar.ISerializable.csproj index d07354b4..479d149c 100644 --- a/src/Hagar.ISerializable/Hagar.ISerializable.csproj +++ b/src/Hagar.ISerializable/Hagar.ISerializable.csproj @@ -2,6 +2,7 @@ netstandard2.0 + Support for serializing ISerializable types using Hagar diff --git a/src/Hagar.Json/Hagar.Json.csproj b/src/Hagar.Json/Hagar.Json.csproj index e2b40b69..61a84167 100644 --- a/src/Hagar.Json/Hagar.Json.csproj +++ b/src/Hagar.Json/Hagar.Json.csproj @@ -1,7 +1,8 @@ - + netstandard2.0 + Newtonsoft.Json integration for Hagar @@ -12,8 +13,4 @@ - - - - \ No newline at end of file diff --git a/src/Hagar.ObjectModel/Hagar.ObjectModel.fsproj b/src/Hagar.ObjectModel/Hagar.ObjectModel.fsproj index 789c56d5..47b92191 100644 --- a/src/Hagar.ObjectModel/Hagar.ObjectModel.fsproj +++ b/src/Hagar.ObjectModel/Hagar.ObjectModel.fsproj @@ -1,4 +1,4 @@ - + netstandard2.0 @@ -14,7 +14,6 @@ - diff --git a/src/Hagar.TestKit/Hagar.TestKit.csproj b/src/Hagar.TestKit/Hagar.TestKit.csproj index 19da7a56..bbf4647c 100644 --- a/src/Hagar.TestKit/Hagar.TestKit.csproj +++ b/src/Hagar.TestKit/Hagar.TestKit.csproj @@ -1,7 +1,8 @@ - + netstandard2.0 + Test kit for projects using Hagar @@ -14,8 +15,4 @@ - - - - \ No newline at end of file diff --git a/src/Hagar/Hagar.csproj b/src/Hagar/Hagar.csproj index 2244ac93..93085f8a 100644 --- a/src/Hagar/Hagar.csproj +++ b/src/Hagar/Hagar.csproj @@ -2,7 +2,8 @@ netstandard2.0;netcoreapp2.1 - True + true + Fast, flexible, and version-tolerant serializer for .NET @@ -17,8 +18,4 @@ - - - - \ No newline at end of file