Skip to content

Commit

Permalink
Merge pull request #1812 from MangelMaxime/feature/normalize_dotnet_c…
Browse files Browse the repository at this point in the history
…li_api

Fix #1808: Convert DotNet API to "module based"
  • Loading branch information
matthid authored Mar 9, 2018
2 parents ca79b3f + 1650f66 commit 105fc9b
Show file tree
Hide file tree
Showing 4 changed files with 967 additions and 906 deletions.
4 changes: 4 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#### 5.0.0-beta024

* ENHANCEMENT: Refactor Dotnet API - https://github.com/fsharp/FAKE/issues/1808

#### 5.0.0-beta023
* [CORE-PROCESS] ENHANCEMENT: Experiment with new Process API
* [CORE-TRACE] ENHANCEMENT: Add `TraceSecrets`-API to prevent FAKE from printing secrets
Expand Down
57 changes: 56 additions & 1 deletion build.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -411,13 +411,22 @@ Target.Create "DotNetCoreIntegrationTests" (fun _ ->
|> NUnit3.NUnit3 id
)

#if BOOTSTRAP
let withWorkDir wd (cliOpts: DotNet.Options) = { cliOpts with WorkingDirectory = wd }
#else
let withWorkDir wd (cliOpts:Cli.DotNetOptions) = { cliOpts with WorkingDirectory = wd }
#endif

Target.Create "DotNetCoreUnitTests" (fun _ ->
// dotnet run -p src/test/Fake.Core.UnitTests/Fake.Core.UnitTests.fsproj
#if BOOTSTRAP
let processResult =
DotNet.Exec (withWorkDir root) "src/test/Fake.Core.UnitTests/bin/Release/netcoreapp2.0/Fake.Core.UnitTests.dll" "--summary"
#else
let processResult =
Cli.DotNet (withWorkDir root) "src/test/Fake.Core.UnitTests/bin/Release/netcoreapp2.0/Fake.Core.UnitTests.dll" "--summary"
if processResult.ExitCode <> 0 then failwithf "Unit-Tests failed."
#endif
if processResult.ExitCode <> 0 then failwithf "Unit-Tests failed."
)

Target.Create "BootstrapTest" (fun _ ->
Expand Down Expand Up @@ -647,6 +656,16 @@ Target.Create "CreateNuGet" (fun _ ->


let LatestTooling options =
#if BOOTSTRAP
{ options with
DotNet.InstallerOptions = (fun io ->
{ io with
Branch = "release/2.1"
})
DotNet.Channel = None
DotNet.Version = DotNet.Version "2.1.4"
}
#else
{ options with
Cli.InstallerOptions = (fun io ->
{ io with
Expand All @@ -655,9 +674,18 @@ let LatestTooling options =
Cli.Channel = None
Cli.Version = Cli.Version "2.1.4"
}
#endif

#if BOOTSTRAP
Target.Create "InstallDotNetCore" (fun _ ->
DotNet.Install DotNet.Release_2_1_4
)
#else
Target.Create "InstallDotNetCore" (fun _ ->

Cli.DotNetCliInstall Cli.Release_2_1_4
)
#endif

let netCoreProjs =
!! (appDir </> "*/*.fsproj")
Expand Down Expand Up @@ -687,13 +715,23 @@ Target.Create "DotNetPackage_" (fun _ ->


// dotnet pack
#if BOOTSTRAP
DotNet.Pack (fun c ->
{ c with
Configuration = DotNet.Release
OutputPath = Some nugetDir
}) "Fake.sln"

let info = DotNet.Info id
#else
Cli.DotNetPack (fun c ->
{ c with
Configuration = Cli.Release
OutputPath = Some nugetDir
}) "Fake.sln"

let info = Cli.DotNetInfo id
#endif

// dotnet publish
runtimes
Expand All @@ -710,12 +748,21 @@ Target.Create "DotNetPackage_" (fun _ ->

//DotNetRestore (fun c -> {c with Runtime = Some runtime}) proj
let outDir = nugetDir @@ projName @@ runtimeName
#if BOOTSTRAP
DotNet.Publish (fun c ->
{ c with
Runtime = Some runtime
Configuration = DotNet.Release
OutputPath = Some outDir
}) proj
#else
Cli.DotNetPublish (fun c ->
{ c with
Runtime = Some runtime
Configuration = Cli.Release
OutputPath = Some outDir
}) proj
#endif
let source = outDir </> "dotnet"
if File.Exists source then
failwithf "Workaround no longer required?" //TODO: If this is not triggered delete this block
Expand All @@ -729,11 +776,19 @@ Target.Create "DotNetPackage_" (fun _ ->
// Publish portable as well (see https://docs.microsoft.com/en-us/dotnet/articles/core/app-types)
let netcoreFsproj = appDir </> "Fake.netcore/Fake.netcore.fsproj"
let outDir = nugetDir @@ "Fake.netcore" @@ "portable"
#if BOOTSTRAP
DotNet.Publish (fun c ->
{ c with
Framework = Some "netcoreapp2.0"
OutputPath = Some outDir
}) netcoreFsproj
#else
Cli.DotNetPublish (fun c ->
{ c with
Framework = Some "netcoreapp2.0"
OutputPath = Some outDir
}) netcoreFsproj
#endif

)

Expand Down
Loading

0 comments on commit 105fc9b

Please sign in to comment.