Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #1808: Convert DotNet API to "module based" #1812

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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