From d01a6f9901ae8572589dea0b5fb49272b6be4748 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9=20LARIVIERE?= Date: Fri, 18 Jan 2019 23:10:44 +0100 Subject: [PATCH 1/2] Gtk/macOS Templates testing --- .paket/Paket.Restore.targets | 3 + build.fsx | 43 +++++------ build.fsx.lock | 138 +++++++++++++++++------------------ 3 files changed, 92 insertions(+), 92 deletions(-) diff --git a/.paket/Paket.Restore.targets b/.paket/Paket.Restore.targets index 7f30c7ef8..c9506cc71 100644 --- a/.paket/Paket.Restore.targets +++ b/.paket/Paket.Restore.targets @@ -62,6 +62,9 @@ true true + + + True diff --git a/build.fsx b/build.fsx index 8d0405369..6883b38ad 100644 --- a/build.fsx +++ b/build.fsx @@ -169,40 +169,37 @@ Target.create "RunTests" (fun _ -> ) Target.create "TestTemplatesNuGet" (fun _ -> - // Globally install the templates from the template nuget package we just built - DotNet.exec id "new" ("-i " + buildDir + "/Fabulous.Templates." + release.NugetVersion + ".nupkg") |> ignore + let restorePackageDotnetCli appName projectName pkgs = + DotNet.exec id "restore" (sprintf "%s/%s/%s.fsproj --source https://api.nuget.org/v3/index.json --source %s" appName projectName projectName pkgs) |> ignore let testAppName = "testapp2" + string (abs (hash System.DateTime.Now.Ticks) % 100) - // Instantiate the template. TODO: additional parameters and variations + + // Globally install the templates from the template nuget package we just built + DotNet.exec id "new" (sprintf "-i %s/Fabulous.Templates.%s.nupkg" buildDir release.NugetVersion) |> ignore + + // Instantiate the template. Shell.cleanDir testAppName - let extraArgs = if Environment.isUnix then "" else " --WPF" - DotNet.exec id "new fabulous-app" (sprintf "-n %s -lang F#%s" testAppName extraArgs) |> ignore - let pkgs = Path.GetFullPath(buildDir) + let extraArgs = + if Environment.isWindows then " --WPF" + elif Environment.isMacOS then " --macOS" + else "" + + DotNet.exec id "new fabulous-app" (sprintf "-n %s -lang F# --GTK%s" testAppName extraArgs) |> ignore + + // The shared project and WPF need to be restored manually as they're using the new SDK-style format // When restoring, using the build_output as a package source to pick up the package we just compiled - DotNet.exec id "restore" (sprintf "%s/%s/%s.fsproj --source https://api.nuget.org/v3/index.json --source %s" testAppName testAppName testAppName pkgs) |> ignore - if not Environment.isUnix then - DotNet.exec id "restore" (sprintf "%s/%s.WPF/%s.WPF.fsproj --source https://api.nuget.org/v3/index.json --source %s" testAppName testAppName testAppName pkgs) |> ignore - + let pkgs = Path.GetFullPath(buildDir) + restorePackageDotnetCli testAppName testAppName pkgs + if Environment.isWindows then restorePackageDotnetCli testAppName (testAppName + ".WPF") pkgs + + // Build for all combinations let slash = if Environment.isUnix then "\\" else "" for c in ["Debug"; "Release"] do for p in ["Any CPU"; "iPhoneSimulator"] do let args = (sprintf "%s/%s.sln /p:Platform=\"%s\" /p:Configuration=%s /p:PackageSources=%s\"https://api.nuget.org/v3/index.json;%s%s\"" testAppName testAppName p c slash pkgs slash) let code = Shell.Exec("msbuild", args) if code <> 0 then failwithf "%s %s failed, error code %d" "msbuild" args code - - (* Manual steps without building nupkg - .\build LibraryNuGet - dotnet new -i templates - rmdir /s /q testapp2 - dotnet new fabulous-app -n testapp2 -lang F# - dotnet restore testapp2/testapp2/testapp2.fsproj -s build_output/ - dotnet new -i templates && rmdir /s /q testapp2 && dotnet new fabulous-app -n testapp2 -lang F# && dotnet restore testapp2/testapp2/testapp2.fsproj && msbuild testapp2/testapp2.Android/testapp2.Android.fsproj /t:RestorePackages && msbuild testapp2/testapp2.Android/testapp2.Android.fsproj - dotnet new -i templates && rmdir /s /q testapp2 && dotnet new fabulous-app -n testapp2 -lang F# && dotnet restore testapp2/testapp2/testapp2.fsproj && msbuild testapp2/testapp2.iOS/testapp2.iOS.fsproj /t:RestorePackages && msbuild testapp2/testapp2.iOS/testapp2.iOS.fsproj - dotnet new -i templates && rmdir /s /q testapp2 && dotnet new fabulous-app -n testapp2 -lang F# --macOS && dotnet restore testapp2/testapp2/testapp2.fsproj && msbuild testapp2/testapp2.macOS/testapp2.macOS.fsproj /t:RestorePackages && msbuild testapp2/testapp2.macOS/testapp2.macOS.fsproj - - dotnet restore testapp265/testapp265.WPF/testapp265.WPF.fsproj --source https://api.nuget.org/v3/index.json -s build_output - *) ) Target.create "Test" ignore diff --git a/build.fsx.lock b/build.fsx.lock index 8054ac89e..5648e99ec 100644 --- a/build.fsx.lock +++ b/build.fsx.lock @@ -4,103 +4,103 @@ NUGET remote: https://api.nuget.org/v3/index.json BlackFox.VsWhere (1.0) FSharp.Core (>= 4.2.3) - Fake.Core.CommandLineParsing (5.11.1) + Fake.Core.CommandLineParsing (5.12) FParsec (>= 1.0.3) FSharp.Core (>= 4.3.4) - Fake.Core.Context (5.11.1) + Fake.Core.Context (5.12) FSharp.Core (>= 4.3.4) - Fake.Core.Environment (5.11.1) + Fake.Core.Environment (5.12) FSharp.Core (>= 4.3.4) - Fake.Core.FakeVar (5.11.1) - Fake.Core.Context (>= 5.11.1) + Fake.Core.FakeVar (5.12) + Fake.Core.Context (>= 5.12) FSharp.Core (>= 4.3.4) - Fake.Core.Process (5.11.1) - Fake.Core.Environment (>= 5.11.1) - Fake.Core.FakeVar (>= 5.11.1) - Fake.Core.String (>= 5.11.1) - Fake.Core.Trace (>= 5.11.1) - Fake.IO.FileSystem (>= 5.11.1) + Fake.Core.Process (5.12) + Fake.Core.Environment (>= 5.12) + Fake.Core.FakeVar (>= 5.12) + Fake.Core.String (>= 5.12) + Fake.Core.Trace (>= 5.12) + Fake.IO.FileSystem (>= 5.12) FSharp.Core (>= 4.3.4) System.Diagnostics.Process (>= 4.3) - Fake.Core.ReleaseNotes (5.11.1) - Fake.Core.SemVer (>= 5.11.1) - Fake.Core.String (>= 5.11.1) + Fake.Core.ReleaseNotes (5.12) + Fake.Core.SemVer (>= 5.12) + Fake.Core.String (>= 5.12) FSharp.Core (>= 4.3.4) - Fake.Core.SemVer (5.11.1) + Fake.Core.SemVer (5.12) FSharp.Core (>= 4.3.4) System.Runtime.Numerics (>= 4.3) - Fake.Core.String (5.11.1) + Fake.Core.String (5.12) FSharp.Core (>= 4.3.4) - Fake.Core.Target (5.11.1) - Fake.Core.CommandLineParsing (>= 5.11.1) - Fake.Core.Context (>= 5.11.1) - Fake.Core.Environment (>= 5.11.1) - Fake.Core.FakeVar (>= 5.11.1) - Fake.Core.Process (>= 5.11.1) - Fake.Core.String (>= 5.11.1) - Fake.Core.Trace (>= 5.11.1) + Fake.Core.Target (5.12) + Fake.Core.CommandLineParsing (>= 5.12) + Fake.Core.Context (>= 5.12) + Fake.Core.Environment (>= 5.12) + Fake.Core.FakeVar (>= 5.12) + Fake.Core.Process (>= 5.12) + Fake.Core.String (>= 5.12) + Fake.Core.Trace (>= 5.12) FSharp.Control.Reactive (>= 4.1) FSharp.Core (>= 4.3.4) System.Reactive.Compatibility (>= 4.1.2) - Fake.Core.Tasks (5.11.1) - Fake.Core.Trace (>= 5.11.1) + Fake.Core.Tasks (5.12) + Fake.Core.Trace (>= 5.12) FSharp.Core (>= 4.3.4) - Fake.Core.Trace (5.11.1) - Fake.Core.Environment (>= 5.11.1) - Fake.Core.FakeVar (>= 5.11.1) + Fake.Core.Trace (5.12) + Fake.Core.Environment (>= 5.12) + Fake.Core.FakeVar (>= 5.12) FSharp.Core (>= 4.3.4) - Fake.Core.Xml (5.11.1) - Fake.Core.String (>= 5.11.1) + Fake.Core.Xml (5.12) + Fake.Core.String (>= 5.12) FSharp.Core (>= 4.3.4) System.Xml.ReaderWriter (>= 4.3.1) System.Xml.XDocument (>= 4.3) System.Xml.XPath (>= 4.3) System.Xml.XPath.XDocument (>= 4.3) System.Xml.XPath.XmlDocument (>= 4.3) - Fake.DotNet.Cli (5.11.1) - Fake.Core.Environment (>= 5.11.1) - Fake.Core.Process (>= 5.11.1) - Fake.Core.String (>= 5.11.1) - Fake.Core.Trace (>= 5.11.1) - Fake.DotNet.MSBuild (>= 5.11.1) - Fake.IO.FileSystem (>= 5.11.1) + Fake.DotNet.Cli (5.12) + Fake.Core.Environment (>= 5.12) + Fake.Core.Process (>= 5.12) + Fake.Core.String (>= 5.12) + Fake.Core.Trace (>= 5.12) + Fake.DotNet.MSBuild (>= 5.12) + Fake.IO.FileSystem (>= 5.12) FSharp.Core (>= 4.3.4) Newtonsoft.Json (>= 12.0.1) - Fake.DotNet.MSBuild (5.11.1) + Fake.DotNet.MSBuild (5.12) BlackFox.VsWhere (>= 1.0) - Fake.Core.Environment (>= 5.11.1) - Fake.Core.Process (>= 5.11.1) - Fake.Core.String (>= 5.11.1) - Fake.Core.Trace (>= 5.11.1) - Fake.IO.FileSystem (>= 5.11.1) + Fake.Core.Environment (>= 5.12) + Fake.Core.Process (>= 5.12) + Fake.Core.String (>= 5.12) + Fake.Core.Trace (>= 5.12) + Fake.IO.FileSystem (>= 5.12) FSharp.Core (>= 4.3.4) MSBuild.StructuredLogger (>= 2.0.61) - Fake.Dotnet.NuGet (5.11.1) - Fake.Core.Environment (>= 5.11.1) - Fake.Core.Process (>= 5.11.1) - Fake.Core.SemVer (>= 5.11.1) - Fake.Core.String (>= 5.11.1) - Fake.Core.Tasks (>= 5.11.1) - Fake.Core.Trace (>= 5.11.1) - Fake.Core.Xml (>= 5.11.1) - Fake.IO.FileSystem (>= 5.11.1) - Fake.Net.Http (>= 5.11.1) + Fake.Dotnet.NuGet (5.12) + Fake.Core.Environment (>= 5.12) + Fake.Core.Process (>= 5.12) + Fake.Core.SemVer (>= 5.12) + Fake.Core.String (>= 5.12) + Fake.Core.Tasks (>= 5.12) + Fake.Core.Trace (>= 5.12) + Fake.Core.Xml (>= 5.12) + Fake.IO.FileSystem (>= 5.12) + Fake.Net.Http (>= 5.12) FSharp.Core (>= 4.3.4) Newtonsoft.Json (>= 12.0.1) System.Net.Http (>= 4.3.4) - Fake.DotNet.Paket (5.11.1) - Fake.Core.Process (>= 5.11.1) - Fake.Core.String (>= 5.11.1) - Fake.Core.Trace (>= 5.11.1) - Fake.IO.FileSystem (>= 5.11.1) + Fake.DotNet.Paket (5.12) + Fake.Core.Process (>= 5.12) + Fake.Core.String (>= 5.12) + Fake.Core.Trace (>= 5.12) + Fake.IO.FileSystem (>= 5.12) FSharp.Core (>= 4.3.4) - Fake.IO.FileSystem (5.11.1) - Fake.Core.String (>= 5.11.1) + Fake.IO.FileSystem (5.12) + Fake.Core.String (>= 5.12) FSharp.Core (>= 4.3.4) System.Diagnostics.FileVersionInfo (>= 4.3) System.IO.FileSystem.Watcher (>= 4.3) - Fake.Net.Http (5.11.1) - Fake.Core.Trace (>= 5.11.1) + Fake.Net.Http (5.12) + Fake.Core.Trace (>= 5.12) FSharp.Core (>= 4.3.4) System.Net.Http (>= 4.3.4) FParsec (1.0.3) @@ -361,10 +361,10 @@ NUGET System.Runtime.Extensions (>= 4.3) System.Threading (>= 4.3) System.Threading.Tasks (>= 4.3) - System.Memory (4.5.1) + System.Memory (4.5.2) System.Buffers (>= 4.4) System.Numerics.Vectors (>= 4.4) - System.Runtime.CompilerServices.Unsafe (>= 4.5) + System.Runtime.CompilerServices.Unsafe (>= 4.5.2) System.Net.Http (4.3.4) Microsoft.NETCore.Platforms (>= 1.1.1) runtime.native.System (>= 4.3) @@ -579,8 +579,8 @@ NUGET Microsoft.NETCore.Platforms (>= 1.1) Microsoft.NETCore.Targets (>= 1.1) System.Runtime (>= 4.3) - System.Text.Encoding.CodePages (4.5) - System.Runtime.CompilerServices.Unsafe (>= 4.5) + System.Text.Encoding.CodePages (4.5.1) + System.Runtime.CompilerServices.Unsafe (>= 4.5.2) System.Text.Encoding.Extensions (4.3) Microsoft.NETCore.Platforms (>= 1.1) Microsoft.NETCore.Targets (>= 1.1) @@ -606,8 +606,8 @@ NUGET Microsoft.NETCore.Targets (>= 1.1) System.Runtime (>= 4.3) System.Threading.Tasks.Dataflow (4.9) - System.Threading.Tasks.Extensions (4.5.1) - System.Runtime.CompilerServices.Unsafe (>= 4.5) + System.Threading.Tasks.Extensions (4.5.2) + System.Runtime.CompilerServices.Unsafe (>= 4.5.2) System.Threading.Thread (4.3) System.Runtime (>= 4.3) System.Threading.ThreadPool (4.3) From b5ec642c243d1f65fcd8afd2d066da60732ae9d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9=20LARIVIERE?= Date: Wed, 23 Jan 2019 18:55:16 +0100 Subject: [PATCH 2/2] Changed build script to execute unit tests as part of "Build" target --- build.fsx | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/build.fsx b/build.fsx index 6883b38ad..e5baae207 100644 --- a/build.fsx +++ b/build.fsx @@ -154,7 +154,7 @@ Target.create "RunGenerator" (fun _ -> ) ) -Target.create "Build" (fun _ -> +Target.create "BuildFabulous" (fun _ -> projects |> List.iter buildProject ) @@ -202,6 +202,7 @@ Target.create "TestTemplatesNuGet" (fun _ -> if code <> 0 then failwithf "%s %s failed, error code %d" "msbuild" args code ) +Target.create "Build" ignore Target.create "Test" ignore open Fake.Core.TargetOperators @@ -213,15 +214,13 @@ open Fake.Core.TargetOperators ==> "BuildTools" ==> "BuildControls" ==> "RunGenerator" - ==> "Build" - -"Build" + ==> "BuildFabulous" ==> "RunTests" - ==> "BuildSamples" - ==> "Test" + ==> "Build" "Build" ==> "TestTemplatesNuGet" + ==> "BuildSamples" ==> "Test" Target.runOrDefault "Build"