Skip to content

Commit

Permalink
Merge pull request #294 from TimLariviere/55bis-testing-templates
Browse files Browse the repository at this point in the history
Added testing for macOS & GTK templates
  • Loading branch information
TimLariviere authored Jan 24, 2019
2 parents 0f76787 + b5ec642 commit c625f2c
Show file tree
Hide file tree
Showing 3 changed files with 97 additions and 98 deletions.
3 changes: 3 additions & 0 deletions .paket/Paket.Restore.targets
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@
<!-- see https://github.com/fsharp/fslang-design/blob/master/RFCs/FS-1032-fsharp-in-dotnet-sdk.md -->
<DisableImplicitFSharpCoreReference>true</DisableImplicitFSharpCoreReference>
<DisableImplicitSystemValueTupleReference>true</DisableImplicitSystemValueTupleReference>

<!-- Disable Paket restore under NCrunch build -->
<PaketRestoreDisabled Condition="'$(NCrunch)' == '1'">True</PaketRestoreDisabled>
</PropertyGroup>

<Target Name="PaketBootstrapping" Condition="Exists('$(PaketToolsPath)paket.bootstrapper.proj')">
Expand Down
54 changes: 25 additions & 29 deletions build.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ Target.create "RunGenerator" (fun _ ->
)
)

Target.create "Build" (fun _ ->
Target.create "BuildFabulous" (fun _ ->
projects |> List.iter buildProject
)

Expand All @@ -169,42 +169,40 @@ 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 "Build" ignore
Target.create "Test" ignore

open Fake.Core.TargetOperators
Expand All @@ -216,15 +214,13 @@ open Fake.Core.TargetOperators
==> "BuildTools"
==> "BuildControls"
==> "RunGenerator"
==> "Build"

"Build"
==> "BuildFabulous"
==> "RunTests"
==> "BuildSamples"
==> "Test"
==> "Build"

"Build"
==> "TestTemplatesNuGet"
==> "BuildSamples"
==> "Test"

Target.runOrDefault "Build"
138 changes: 69 additions & 69 deletions build.fsx.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down

0 comments on commit c625f2c

Please sign in to comment.