From d532223a5a9aadd6004cf31cfbb046cf1b96fc5a Mon Sep 17 00:00:00 2001 From: Nikita Tsukanov Date: Thu, 6 Dec 2018 10:52:40 +0300 Subject: [PATCH] Switched to post-processing nuget packages from AggregatePackage SDK --- .gitignore | 1 + .gitmodules | 3 +++ Directory.Build.props | 2 +- build/ReferenceCoreLibraries.props | 1 - nukebuild/Build.cs | 14 +++++++++++- nukebuild/BuildParameters.cs | 6 +++-- nukebuild/Numerge | 1 + nukebuild/Shims.cs | 14 ++++++++++++ nukebuild/_build.csproj | 2 ++ nukebuild/numerge.config | 22 +++++++++++++++++++ packages/Avalonia/Avalonia.csproj | 6 +---- packages/Avalonia/Avalonia.props | 2 +- .../Avalonia.Animation.csproj | 1 - src/Avalonia.Base/Avalonia.Base.csproj | 1 - .../Avalonia.Build.Tasks.csproj | 1 - .../Avalonia.Controls.csproj | 1 - .../Avalonia.DesignerSupport.csproj | 1 - .../Avalonia.DesktopRuntime.csproj | 1 - .../Avalonia.Diagnostics.csproj | 1 - src/Avalonia.Input/Avalonia.Input.csproj | 1 - .../Avalonia.Interactivity.csproj | 1 - src/Avalonia.Layout/Avalonia.Layout.csproj | 1 - .../Avalonia.Logging.Serilog.csproj | 1 - src/Avalonia.Styling/Avalonia.Styling.csproj | 1 - .../Avalonia.Themes.Default.csproj | 1 - src/Avalonia.Visuals/Avalonia.Visuals.csproj | 1 - .../Avalonia.Markup.Xaml.csproj | 1 - .../Avalonia.Markup/Avalonia.Markup.csproj | 1 - 28 files changed, 63 insertions(+), 27 deletions(-) create mode 160000 nukebuild/Numerge create mode 100644 nukebuild/numerge.config diff --git a/.gitignore b/.gitignore index 6ee6057d5f4..2b2c9c3d0db 100644 --- a/.gitignore +++ b/.gitignore @@ -195,3 +195,4 @@ Logs/ ModuleCache.noindex/ Build/Intermediates.noindex/ info.plist +build-intermediate diff --git a/.gitmodules b/.gitmodules index 2d2a9ac497e..22c56307b03 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@ [submodule "src/Markup/Avalonia.Markup.Xaml/PortableXaml/portable.xaml.github"] path = src/Markup/Avalonia.Markup.Xaml/PortableXaml/portable.xaml.github url = https://github.com/AvaloniaUI/Portable.Xaml.git +[submodule "nukebuild/Numerge"] + path = nukebuild/Numerge + url = https://github.com/kekekeks/Numerge.git diff --git a/Directory.Build.props b/Directory.Build.props index 50476c81f11..1f26df9bbc1 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,5 +1,5 @@ - $(MSBuildThisFileDirectory)artifacts/nuget + $(MSBuildThisFileDirectory)build-intermediate/nuget diff --git a/build/ReferenceCoreLibraries.props b/build/ReferenceCoreLibraries.props index bd9d6ad8431..cffc2e0324f 100644 --- a/build/ReferenceCoreLibraries.props +++ b/build/ReferenceCoreLibraries.props @@ -1,5 +1,4 @@ - diff --git a/nukebuild/Build.cs b/nukebuild/Build.cs index 1014aa1b47d..61944c4dbc8 100644 --- a/nukebuild/Build.cs +++ b/nukebuild/Build.cs @@ -63,6 +63,7 @@ protected override void OnBuildInitialized() DeleteDirectories(Parameters.BuildDirs); EnsureCleanDirectories(Parameters.BuildDirs); EnsureCleanDirectory(Parameters.ArtifactsDir); + EnsureCleanDirectory(Parameters.NugetIntermediateRoot); EnsureCleanDirectory(Parameters.NugetRoot); EnsureCleanDirectory(Parameters.ZipRoot); EnsureCleanDirectory(Parameters.TestResultsRoot); @@ -181,7 +182,7 @@ void RunCoreTest(string project, bool coreOnly = false) GlobFiles(data.ZipSourceControlCatalogDesktopDir, "*.exe"))); }); - Target CreateNugetPackages => _ => _ + Target CreateIntermediateNugetPackages => _ => _ .DependsOn(Compile) .After(RunTests) .Executes(() => @@ -200,6 +201,17 @@ void RunCoreTest(string project, bool coreOnly = false) c.SetConfiguration(Parameters.Configuration) .AddProperty("PackageVersion", Parameters.Version)); }); + + Target CreateNugetPackages => _ => _ + .DependsOn(CreateIntermediateNugetPackages) + .Executes(() => + { + var config = Numerge.MergeConfiguration.LoadFile(RootDirectory / "nukebuild" / "numerge.config"); + EnsureCleanDirectory(Parameters.NugetRoot); + if(!Numerge.NugetPackageMerger.Merge(Parameters.NugetIntermediateRoot, Parameters.NugetRoot, config, + new NumergeNukeLogger())) + throw new Exception("Package merge failed"); + }); Target RunTests => _ => _ .DependsOn(RunCoreLibsTests) diff --git a/nukebuild/BuildParameters.cs b/nukebuild/BuildParameters.cs index 9029aef60d8..5f8ec7267e7 100644 --- a/nukebuild/BuildParameters.cs +++ b/nukebuild/BuildParameters.cs @@ -47,6 +47,7 @@ public class BuildParameters public bool PublishTestResults { get; } public string Version { get; } public AbsolutePath ArtifactsDir { get; } + public AbsolutePath NugetIntermediateRoot { get; } public AbsolutePath NugetRoot { get; } public AbsolutePath ZipRoot { get; } public AbsolutePath BinRoot { get; } @@ -117,6 +118,7 @@ public BuildParameters(Build b) // DIRECTORIES ArtifactsDir = RootDirectory / "artifacts"; NugetRoot = ArtifactsDir / "nuget"; + NugetIntermediateRoot = RootDirectory / "build-intermediate" / "nuget"; ZipRoot = ArtifactsDir / "zip"; BinRoot = ArtifactsDir / "bin"; TestResultsRoot = ArtifactsDir / "test-results"; @@ -130,9 +132,9 @@ public BuildParameters(Build b) ZipTargetControlCatalogDesktopDir = ZipRoot / ("ControlCatalog.Desktop-" + FileZipSuffix); } - private static string GetVersion() + string GetVersion() { - var xdoc = XDocument.Load("./build/SharedVersion.props"); + var xdoc = XDocument.Load(RootDirectory / "build/SharedVersion.props"); return xdoc.Descendants().First(x => x.Name.LocalName == "Version").Value; } } diff --git a/nukebuild/Numerge b/nukebuild/Numerge new file mode 160000 index 00000000000..0d0537750d9 --- /dev/null +++ b/nukebuild/Numerge @@ -0,0 +1 @@ +Subproject commit 0d0537750d96eeb90e18f2a4999defb3593a50e5 diff --git a/nukebuild/Shims.cs b/nukebuild/Shims.cs index 1ba72494d75..461d6176431 100644 --- a/nukebuild/Shims.cs +++ b/nukebuild/Shims.cs @@ -5,6 +5,7 @@ using System.Linq; using Nuke.Common; using Nuke.Common.IO; +using Numerge; public partial class Build { @@ -76,4 +77,17 @@ void AddFile(string path, string relativePath) } } } + + class NumergeNukeLogger : INumergeLogger + { + public void Log(NumergeLogLevel level, string message) + { + if(level == NumergeLogLevel.Error) + Logger.Error(message); + else if (level == NumergeLogLevel.Warning) + Logger.Warn(message); + else + Logger.Info(message); + } + } } diff --git a/nukebuild/_build.csproj b/nukebuild/_build.csproj index ed94116a931..e02acff0070 100644 --- a/nukebuild/_build.csproj +++ b/nukebuild/_build.csproj @@ -30,6 +30,8 @@ + + diff --git a/nukebuild/numerge.config b/nukebuild/numerge.config new file mode 100644 index 00000000000..4ad7dc51f07 --- /dev/null +++ b/nukebuild/numerge.config @@ -0,0 +1,22 @@ +{ + "Packages": + [ + { + "Id": "Avalonia", + "MergeAll": true, + "Exclude": ["Avalonia.Remote.Protocol"], + "Merge": [ + { + "Id": "Avalonia.Build.Tasks", + "IgnoreMissingFrameworkBinaries": true, + "DoNotMergeDependencies": true + }, + { + "Id": "Avalonia.DesktopRuntime", + "IgnoreMissingFrameworkBinaries": true, + "IgnoreMissingFrameworkDependencies": true + } + ] + } + ] +} diff --git a/packages/Avalonia/Avalonia.csproj b/packages/Avalonia/Avalonia.csproj index 30330645944..72625172d4c 100644 --- a/packages/Avalonia/Avalonia.csproj +++ b/packages/Avalonia/Avalonia.csproj @@ -1,4 +1,4 @@ - + netstandard2.0;net461;netcoreapp2.0 @@ -40,10 +40,6 @@ true build\ - - true - tools\ - diff --git a/packages/Avalonia/Avalonia.props b/packages/Avalonia/Avalonia.props index 30e3f93b5c5..6f21971d3d4 100644 --- a/packages/Avalonia/Avalonia.props +++ b/packages/Avalonia/Avalonia.props @@ -2,7 +2,7 @@ $(MSBuildThisFileDirectory)\..\tools\netcoreapp2.0\designer\Avalonia.Designer.HostApp.dll $(MSBuildThisFileDirectory)\..\tools\net461\designer\Avalonia.Designer.HostApp.exe - $(MSBuildThisFileDirectory)\..\tools\Avalonia.Build.Tasks.dll + $(MSBuildThisFileDirectory)\..\tools\netstandard2.0\Avalonia.Build.Tasks.dll false diff --git a/src/Avalonia.Animation/Avalonia.Animation.csproj b/src/Avalonia.Animation/Avalonia.Animation.csproj index 3b6d1c1b336..73c619942ef 100644 --- a/src/Avalonia.Animation/Avalonia.Animation.csproj +++ b/src/Avalonia.Animation/Avalonia.Animation.csproj @@ -1,7 +1,6 @@  netstandard2.0 - false diff --git a/src/Avalonia.Base/Avalonia.Base.csproj b/src/Avalonia.Base/Avalonia.Base.csproj index abc4ed80d8b..cbcf7a7386d 100644 --- a/src/Avalonia.Base/Avalonia.Base.csproj +++ b/src/Avalonia.Base/Avalonia.Base.csproj @@ -4,7 +4,6 @@ Avalonia.Base Avalonia True - false diff --git a/src/Avalonia.Build.Tasks/Avalonia.Build.Tasks.csproj b/src/Avalonia.Build.Tasks/Avalonia.Build.Tasks.csproj index 6b697a9028a..ce767aaa872 100644 --- a/src/Avalonia.Build.Tasks/Avalonia.Build.Tasks.csproj +++ b/src/Avalonia.Build.Tasks/Avalonia.Build.Tasks.csproj @@ -4,7 +4,6 @@ netstandard2.0 tools $(DefineConstants);BUILDTASK - false diff --git a/src/Avalonia.Controls/Avalonia.Controls.csproj b/src/Avalonia.Controls/Avalonia.Controls.csproj index fddd4403e99..32331d29aba 100644 --- a/src/Avalonia.Controls/Avalonia.Controls.csproj +++ b/src/Avalonia.Controls/Avalonia.Controls.csproj @@ -1,7 +1,6 @@  netstandard2.0 - false diff --git a/src/Avalonia.DesignerSupport/Avalonia.DesignerSupport.csproj b/src/Avalonia.DesignerSupport/Avalonia.DesignerSupport.csproj index e732a7eef08..2c5aaf1a707 100644 --- a/src/Avalonia.DesignerSupport/Avalonia.DesignerSupport.csproj +++ b/src/Avalonia.DesignerSupport/Avalonia.DesignerSupport.csproj @@ -1,7 +1,6 @@  netstandard2.0 - false