diff --git a/build/.vscode/launch.json b/build/.vscode/launch.json index 999cbb1f..7167cccb 100644 --- a/build/.vscode/launch.json +++ b/build/.vscode/launch.json @@ -8,7 +8,7 @@ "program": "dotnet", "args": [ "exec", - "/Users/bernhardrichter/.dotnet/tools/.store/dotnet-script/0.27.1/dotnet-script/0.27.1/tools/netcoreapp2.1/any/dotnet-script.dll" + "/Users/bernhardrichter/.dotnet/tools/.store/dotnet-script/0.28.0/dotnet-script/0.28.0/tools/netcoreapp2.1/any/dotnet-script.dll" "${file}" ], "cwd": "${workspaceRoot}", diff --git a/build/LightInject.Source.nuspec b/build/LightInject.Source.nuspec index d1f6a2cc..5ef882ee 100644 --- a/build/LightInject.Source.nuspec +++ b/build/LightInject.Source.nuspec @@ -12,12 +12,15 @@ http://www.lightinject.net/#whatsnew Bernhard Richter Ioc Dependency-Injection Inversion-of-Control WinRT Windows-Runtime - - - - + + + + + - - - + + + + + diff --git a/build/build.csx b/build/build.csx index c12c16ce..76cfe2c7 100644 --- a/build/build.csx +++ b/build/build.csx @@ -7,25 +7,26 @@ using static xUnit; using static DotNet; using static ChangeLog; using static ReleaseManagement; +using System.Text.RegularExpressions; Build(projectFolder); Test(testProjectFolder); -//AnalyzeCodeCoverage(pathToTestAssembly, $"+[{projectName}]*"); +AnalyzeCodeCoverage(pathToTestAssembly, $"+[{projectName}]*"); Pack(projectFolder, nuGetArtifactsFolder, Git.Default.GetCurrentShortCommitHash()); -using(var sourceRepoFolder = new DisposableFolder()) +using (var sourceRepoFolder = new DisposableFolder()) { string pathToSourceProjectFolder = Path.Combine(sourceRepoFolder.Path,"src","LightInject"); + string pathToSourceFile = Path.Combine(pathToSourceProjectFolder, "LightInject.cs"); Copy(repoFolder, sourceRepoFolder.Path, new [] {".vs", "obj"}); Internalize(pathToSourceProjectFolder, exceptTheseTypes); DotNet.Build(Path.Combine(sourceRepoFolder.Path,"src","LightInject")); using(var nugetPackFolder = new DisposableFolder()) { - var contentFolder = CreateDirectory(nugetPackFolder.Path, "content","net45", "LightInject"); Copy("LightInject.Source.nuspec", nugetPackFolder.Path); - string pathToSourceFileTemplate = Path.Combine(contentFolder, "LightInject.cs.pp"); - Copy(Path.Combine(pathToSourceProjectFolder, "LightInject.cs"), pathToSourceFileTemplate); - FileUtils.ReplaceInFile(@"namespace \S*", $"namespace $rootnamespace$.{projectName}", pathToSourceFileTemplate); + PrepareSourceFile(nugetPackFolder.Path, pathToSourceFile, "netcoreapp2.0"); + PrepareSourceFile(nugetPackFolder.Path, pathToSourceFile, "netstandard2.0"); + PrepareSourceFile(nugetPackFolder.Path, pathToSourceFile, "net46"); NuGet.Pack(nugetPackFolder.Path, nuGetArtifactsFolder, version); } } @@ -43,7 +44,7 @@ if (BuildEnvironment.IsSecure) } } - private async Task CreateReleaseNotes() +private async Task CreateReleaseNotes() { Logger.Log("Creating release notes"); var generator = ChangeLogFrom(owner, projectName, BuildEnvironment.GitHubAccessToken).SinceLatestTag(); @@ -52,4 +53,16 @@ if (BuildEnvironment.IsSecure) generator = generator.IncludeUnreleased(); } await generator.Generate(pathToReleaseNotes, FormattingOptions.Default.WithPullRequestBody()); +} + +private void PrepareSourceFile(string nugetPackFolder, string pathToSourceFile ,string targetFramework) +{ + var contentFolder = CreateDirectory(nugetPackFolder, "contentFiles", "cs", targetFramework, "LightInject"); + string pathToSourceFileTemplate = Path.Combine(contentFolder, "LightInject.cs.pp"); + Copy(pathToSourceFile, pathToSourceFileTemplate); + var frameworkConstant = targetFramework.ToUpper().Replace(".","_"); + var lines = File.ReadAllLines(pathToSourceFileTemplate).ToList(); + lines.Insert(0, $"#define {frameworkConstant}"); + File.WriteAllLines(pathToSourceFileTemplate, lines); + FileUtils.ReplaceInFile(@"namespace \S*", $"namespace $rootnamespace$.{projectName}", pathToSourceFileTemplate); } \ No newline at end of file diff --git a/src/LightInject/LightInject.cs b/src/LightInject/LightInject.cs index 1387f930..ca21e0f3 100644 --- a/src/LightInject/LightInject.cs +++ b/src/LightInject/LightInject.cs @@ -1,7 +1,7 @@ /********************************************************************************* The MIT License (MIT) - Copyright (c) 2018 bernhard.richter@gmail.com + Copyright (c) 2019 bernhard.richter@gmail.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -21,7 +21,7 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ****************************************************************************** - LightInject version 5.3.0 + LightInject version 5.4.0 http://www.lightinject.net/ http://twitter.com/bernhardrichter ******************************************************************************/ @@ -34,7 +34,6 @@ LightInject version 5.3.0 [module: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1401:FieldsMustBePrivate", Justification = "Performance")] [module: System.Diagnostics.CodeAnalysis.SuppressMessage("MaintainabilityRules", "SA1403", Justification = "One source file")] [module: System.Diagnostics.CodeAnalysis.SuppressMessage("DocumentationRules", "SA1649", Justification = "One source file")] - namespace LightInject { using System;