From efc6e9285fd1099a6eaa4cb1a93c88587f10e904 Mon Sep 17 00:00:00 2001 From: Jesse Date: Thu, 16 Apr 2020 16:22:52 +0200 Subject: [PATCH] Use dotnet CLI in Cake to support building without Mono (#7112) * Fix/suppress pack warnings for CP and MGCB * Support build script on Linux/Mac without Mono * Suppress warning for templates project * Re-add NETFX 4.6 target for Flatpak packager + add ref assemblies * Typos --- ...MonoGame.Framework.Content.Pipeline.csproj | 12 ++++-- .../MonoGame.Framework.DesktopGL.csproj | 8 ++++ .../MonoGame.Templates.CSharp.csproj | 2 + .../MonoGame.Content.Builder.Task.csproj | 7 ++++ .../MonoGame.Content.Builder.csproj | 10 ++++- .../MonoGame.Packaging.Flatpak.csproj | 7 +++- build.cake | 42 +++++++++---------- 7 files changed, 59 insertions(+), 29 deletions(-) diff --git a/MonoGame.Framework.Content.Pipeline/MonoGame.Framework.Content.Pipeline.csproj b/MonoGame.Framework.Content.Pipeline/MonoGame.Framework.Content.Pipeline.csproj index 6271b6e74e6..e03a3aa8b2f 100644 --- a/MonoGame.Framework.Content.Pipeline/MonoGame.Framework.Content.Pipeline.csproj +++ b/MonoGame.Framework.Content.Pipeline/MonoGame.Framework.Content.Pipeline.csproj @@ -267,13 +267,19 @@ This package provides you with the content pipeline for Windows, Mac and Linux w - + + + + NU5100 + - + PreserveNewest - + diff --git a/MonoGame.Framework/MonoGame.Framework.DesktopGL.csproj b/MonoGame.Framework/MonoGame.Framework.DesktopGL.csproj index 6b1cad2ab27..77bc97bf057 100644 --- a/MonoGame.Framework/MonoGame.Framework.DesktopGL.csproj +++ b/MonoGame.Framework/MonoGame.Framework.DesktopGL.csproj @@ -11,6 +11,14 @@ This package provides you with MonoGame Framework that uses OpenGL for rendering MonoGame.Framework.DesktopGL + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + diff --git a/Templates/MonoGame.Templates.CSharp/MonoGame.Templates.CSharp.csproj b/Templates/MonoGame.Templates.CSharp/MonoGame.Templates.CSharp.csproj index f3432e2fdcf..f7d80265b85 100644 --- a/Templates/MonoGame.Templates.CSharp/MonoGame.Templates.CSharp.csproj +++ b/Templates/MonoGame.Templates.CSharp/MonoGame.Templates.CSharp.csproj @@ -12,6 +12,8 @@ true false content + + NU5128 diff --git a/Tools/MonoGame.Content.Builder.Task/MonoGame.Content.Builder.Task.csproj b/Tools/MonoGame.Content.Builder.Task/MonoGame.Content.Builder.Task.csproj index 5487ea1f2ca..56a07f28e67 100644 --- a/Tools/MonoGame.Content.Builder.Task/MonoGame.Content.Builder.Task.csproj +++ b/Tools/MonoGame.Content.Builder.Task/MonoGame.Content.Builder.Task.csproj @@ -13,4 +13,11 @@ + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + diff --git a/Tools/MonoGame.Content.Builder/MonoGame.Content.Builder.csproj b/Tools/MonoGame.Content.Builder/MonoGame.Content.Builder.csproj index cc097e2fed1..98dce2456ec 100644 --- a/Tools/MonoGame.Content.Builder/MonoGame.Content.Builder.csproj +++ b/Tools/MonoGame.Content.Builder/MonoGame.Content.Builder.csproj @@ -17,9 +17,15 @@ - + + + + NU5100 + - + PreserveNewest diff --git a/Tools/MonoGame.Packaging.Flatpak/MonoGame.Packaging.Flatpak.csproj b/Tools/MonoGame.Packaging.Flatpak/MonoGame.Packaging.Flatpak.csproj index 543edc7eccb..9546aced299 100644 --- a/Tools/MonoGame.Packaging.Flatpak/MonoGame.Packaging.Flatpak.csproj +++ b/Tools/MonoGame.Packaging.Flatpak/MonoGame.Packaging.Flatpak.csproj @@ -21,8 +21,13 @@ - + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + diff --git a/build.cake b/build.cake index 58f3e6e4cdc..e748da4d731 100644 --- a/build.cake +++ b/build.cake @@ -17,11 +17,16 @@ MSBuildSettings msPackSettings, mdPackSettings; DotNetCoreMSBuildSettings dnBuildSettings; DotNetCorePackSettings dnPackSettings; -private void PackProject(string filePath) +private void PackMSBuild(string filePath) { MSBuild(filePath, msPackSettings); } +private void PackDotnet(string filePath) +{ + DotNetCorePack(filePath, dnPackSettings); +} + private bool GetMSBuildWith(string requires) { if (IsRunningOnWindows()) @@ -60,6 +65,7 @@ Task("Prep") msPackSettings = new MSBuildSettings(); msPackSettings.Verbosity = Verbosity.Minimal; msPackSettings.Configuration = configuration; + msPackSettings.Restore = true; msPackSettings.WithProperty("Version", version); msPackSettings.WithTarget("Pack"); @@ -83,7 +89,7 @@ Task("BuildDesktopGL") .Does(() => { DotNetCoreRestore("MonoGame.Framework/MonoGame.Framework.DesktopGL.csproj"); - PackProject("MonoGame.Framework/MonoGame.Framework.DesktopGL.csproj"); + PackDotnet("MonoGame.Framework/MonoGame.Framework.DesktopGL.csproj"); }); Task("TestDesktopGL") @@ -104,7 +110,7 @@ Task("BuildWindowsDX") .Does(() => { DotNetCoreRestore("MonoGame.Framework/MonoGame.Framework.WindowsDX.csproj"); - PackProject("MonoGame.Framework/MonoGame.Framework.WindowsDX.csproj"); + PackDotnet("MonoGame.Framework/MonoGame.Framework.WindowsDX.csproj"); }); Task("TestWindowsDX") @@ -130,8 +136,7 @@ Task("BuildAndroid") return DirectoryExists("/Library/Frameworks/Xamarin.Android.framework"); }).Does(() => { - DotNetCoreRestore("MonoGame.Framework/MonoGame.Framework.Android.csproj"); - PackProject("MonoGame.Framework/MonoGame.Framework.Android.csproj"); + PackMSBuild("MonoGame.Framework/MonoGame.Framework.Android.csproj"); }); Task("BuildiOS") @@ -141,8 +146,7 @@ Task("BuildiOS") return DirectoryExists("/Library/Frameworks/Xamarin.iOS.framework"); }).Does(() => { - DotNetCoreRestore("MonoGame.Framework/MonoGame.Framework.iOS.csproj"); - PackProject("MonoGame.Framework/MonoGame.Framework.iOS.csproj"); + PackMSBuild("MonoGame.Framework/MonoGame.Framework.iOS.csproj"); }); Task("BuildUWP") @@ -150,36 +154,29 @@ Task("BuildUWP") .WithCriteria(() => GetMSBuildWith("Microsoft.VisualStudio.Component.Windows10SDK.17763")) .Does(() => { - DotNetCoreRestore("MonoGame.Framework/MonoGame.Framework.WindowsUniversal.csproj"); - PackProject("MonoGame.Framework/MonoGame.Framework.WindowsUniversal.csproj"); + PackMSBuild("MonoGame.Framework/MonoGame.Framework.WindowsUniversal.csproj"); }); Task("BuildContentPipeline") .IsDependentOn("Prep") .Does(() => { - DotNetCoreRestore("MonoGame.Framework.Content.Pipeline/MonoGame.Framework.Content.Pipeline.csproj"); - PackProject("MonoGame.Framework.Content.Pipeline/MonoGame.Framework.Content.Pipeline.csproj"); + PackDotnet("MonoGame.Framework.Content.Pipeline/MonoGame.Framework.Content.Pipeline.csproj"); }); Task("BuildTools") .IsDependentOn("Prep") .Does(() => { - DotNetCoreRestore("Tools/MonoGame.Content.Builder/MonoGame.Content.Builder.csproj"); - PackProject("Tools/MonoGame.Content.Builder/MonoGame.Content.Builder.csproj"); + PackDotnet("Tools/MonoGame.Content.Builder/MonoGame.Content.Builder.csproj"); - DotNetCoreRestore("Tools/MonoGame.Effect.Compiler/MonoGame.Effect.Compiler.csproj"); - PackProject("Tools/MonoGame.Effect.Compiler/MonoGame.Effect.Compiler.csproj"); + PackDotnet("Tools/MonoGame.Effect.Compiler/MonoGame.Effect.Compiler.csproj"); - DotNetCoreRestore("Tools/MonoGame.Content.Builder.Editor/MonoGame.Content.Builder.Editor.csproj"); - PackProject("Tools/MonoGame.Content.Builder.Editor/MonoGame.Content.Builder.Editor.csproj"); + PackDotnet("Tools/MonoGame.Content.Builder.Editor/MonoGame.Content.Builder.Editor.csproj"); - DotNetCoreRestore("Tools/MonoGame.Content.Builder.Task/MonoGame.Content.Builder.Task.csproj"); - PackProject("Tools/MonoGame.Content.Builder.Task/MonoGame.Content.Builder.Task.csproj"); + PackDotnet("Tools/MonoGame.Content.Builder.Task/MonoGame.Content.Builder.Task.csproj"); - DotNetCoreRestore("Tools/MonoGame.Packaging.Flatpak/MonoGame.Packaging.Flatpak.csproj"); - PackProject("Tools/MonoGame.Packaging.Flatpak/MonoGame.Packaging.Flatpak.csproj"); + PackDotnet("Tools/MonoGame.Packaging.Flatpak/MonoGame.Packaging.Flatpak.csproj"); }); Task("TestTools") @@ -198,8 +195,7 @@ Task("PackDotNetTemplates") .IsDependentOn("Prep") .Does(() => { - DotNetCoreRestore("Templates/MonoGame.Templates.CSharp/MonoGame.Templates.CSharp.csproj"); - PackProject("Templates/MonoGame.Templates.CSharp/MonoGame.Templates.CSharp.csproj"); + PackDotnet("Templates/MonoGame.Templates.CSharp/MonoGame.Templates.CSharp.csproj"); }); Task("PackVSTemplates")