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

Release 5.9 #2137

Merged
merged 71 commits into from
Oct 13, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
f5ef276
Write the NUnit arguements to a temp file and pass that to NUnit console
BlythMeister Sep 27, 2018
da51bea
Reformat to be a try/finally
BlythMeister Sep 28, 2018
0c2bbf1
Merge branch 'nunitFileBasedAlways' of https:/BlythMeiste…
matthid Oct 8, 2018
fb8cc82
start
matthid Oct 8, 2018
b0b4e66
Add unit test for #2114
matthid Oct 8, 2018
7885e3a
Update SpecFlow for Version 2.4
magicmonty Oct 1, 2018
28c1048
Merge branch 'release/next' of github.com:fsharp/FAKE into process_ap…
matthid Oct 9, 2018
ec29430
fix test on unix
matthid Oct 9, 2018
2be0565
update pr template
matthid Oct 9, 2018
688a556
simplify a bit
matthid Oct 9, 2018
206f883
cleanup of the new api
matthid Oct 9, 2018
04e6664
move stuff around and mark a lot of APIs internal
matthid Oct 9, 2018
5ba591f
try to fix tests
matthid Oct 9, 2018
8e1c5e8
Fix existing tests.
matthid Oct 9, 2018
773b082
Merge branch 'release/next' of github.com:fsharp/FAKE into process_ap…
matthid Oct 9, 2018
0e84da6
Fix some tests & oversights
matthid Oct 9, 2018
0f26575
Merge branch 'release/next' of github.com:fsharp/FAKE into process_ap…
matthid Oct 9, 2018
e9b8834
Merge pull request #2131 from fsharp/process_api_hook
matthid Oct 10, 2018
5c2a6b1
5.9
matthid Oct 10, 2018
6bdd02b
Merge branch 'release/next' of github.com:fsharp/FAKE into release/next
matthid Oct 10, 2018
8ada7fc
Merge branch 'SpecFlow' of https:/magicmonty/FAKE into re…
matthid Oct 10, 2018
f912b37
add test for specflownext
matthid Oct 10, 2018
af6488e
paket update, fix test
matthid Oct 10, 2018
b36b39e
fix test
matthid Oct 10, 2018
40bf083
try multiple times
matthid Oct 10, 2018
0a4289d
update debugger settings for https:/fsharp/FAKE/issues/2136
matthid Oct 10, 2018
fa6e530
Correct TeamCity publish named artifact
BlythMeister Oct 10, 2018
1956a03
Add report build problem to TeamCity
BlythMeister Oct 10, 2018
031ccfa
Tidy TeamCity listener match statement
BlythMeister Oct 10, 2018
5538310
Refactor all messages sent to TeamCity into TeamCityInternal
BlythMeister Oct 10, 2018
a6384b2
Seperate runInternal & handle error
BlythMeister Oct 10, 2018
b5c1c1a
Add class and file filter parameters to Fake.Testing.ReportGenerator
magicmonty Oct 2, 2018
236af89
Fake.DotNet.Testing.SpecFlow: Added tests and optimized API
magicmonty Oct 11, 2018
e82712f
Move tracing to better reflect real command line
magicmonty Oct 11, 2018
6d8fc32
Move tracing down, to better reflect mono invocation
magicmonty Oct 11, 2018
921f4cc
fix helper for a variable number of args
matthid Oct 11, 2018
b2854dc
Merge pull request #2120 from magicmonty/ReportGenerator
matthid Oct 11, 2018
ce3a2c7
Merge pull request #2138 from BlythMeister/teamcity
matthid Oct 11, 2018
c935bca
Merge pull request #2143 from magicmonty/SpecFlowTests
matthid Oct 11, 2018
79894c4
Fix test
matthid Oct 12, 2018
b9409d4
Update Fake.Testing.ReportGenerator.fs
matthid Oct 12, 2018
97c9d9c
Update Fake.DotNet.Testing.SpecFlow.fs
matthid Oct 12, 2018
4ac310e
Update Fake.Testing.ReportGenerator.fs
matthid Oct 12, 2018
f73b02c
Update Fake.Tools.Pickles and added Unit tests
magicmonty Oct 9, 2018
ae86e1f
Fix Tests
magicmonty Oct 12, 2018
3f11bde
Fix ArgumentHelper.checkIfMono
magicmonty Oct 12, 2018
f55d67c
Made checkIfMono a bit more elegant
magicmonty Oct 12, 2018
a686bd4
Correct publish artifact
BlythMeister Oct 12, 2018
bd00131
Add message to the build state update
BlythMeister Oct 12, 2018
e3a539e
Merge branch 'TargetContext' into FailureContext
BlythMeister Oct 12, 2018
26c11e1
Add helpers for update build status
BlythMeister Oct 11, 2018
6514d38
Merge pull request #2133 from magicmonty/Pickles
matthid Oct 12, 2018
4e7a30d
Merge pull request #2147 from BlythMeister/patch-5
matthid Oct 12, 2018
47e325d
Correct documentation
BlythMeister Oct 12, 2018
0471b4b
Add `CreateProcess.disableTraceCommand` and use it to hide `appveyor.…
matthid Oct 12, 2018
deddb21
print all stack traces in verbose mode, references https:…
matthid Oct 12, 2018
6da9c67
next time we can fix https:/fsharp/FAKE/issues/2136
matthid Oct 12, 2018
c7705ce
add BlackFox.Fake.BuildTask to docs /cc @vbfox
matthid Oct 12, 2018
73812cb
Docs & cleanup
matthid Oct 12, 2018
e902645
more docs
matthid Oct 12, 2018
b1b37b9
documentation
matthid Oct 12, 2018
e5cdbaf
Fix code docs
matthid Oct 13, 2018
b498bdb
workaround azure devops bug again.
matthid Oct 13, 2018
cb11b6e
ups
matthid Oct 13, 2018
6b9e62e
BuildState with message (#2139)
BlythMeister Oct 13, 2018
fe979ba
Merge pull request #2140 from BlythMeister/TargetContext
matthid Oct 13, 2018
f2240e3
Merge branch 'FailureContext' into fix_conflics
matthid Oct 13, 2018
9b7db84
Merge pull request #2150 from fsharp/fix_conflics
matthid Oct 13, 2018
6ab9fa0
set FAKE_DETAILED_ERRORS to true
matthid Oct 13, 2018
d45470c
change API a bit
matthid Oct 13, 2018
c974031
release notes 5.9.0
matthid Oct 13, 2018
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
6 changes: 6 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,14 @@ If available, link to an existing issue this PR fixes. For example:

## TODO

Feel free to open the PR and ask for help

- [] New (API-)documentation for new features exist (Note: API-docs are enough, additional docs are in `help/markdown`)
- [] unit or integration test exists (or short reasoning why it doesn't make sense)

> Note: Consider using the `CreateProcess` API which can be tested more easily, see https:/fsharp/FAKE/pull/2131/files#diff-4fb4a77e110fbbe8210205dfe022389b for an example (the changes in the `DotNet.Testing.NUnit` module)

- [] boy scout rule: "leave the code behind in a better state than you found it" (fix warnings, obsolete members or code-style in the places you worked in)
- [] (if new module) the module has been linked from the "Modules" menu, edit `help/templates/template.cshtml`, linking to the API-reference is fine.
- [] (if new module) the module is in the correct namespace
- [] (if new module) the module is added to Fake.sln (`dotnet sln Fake.sln add src/app/Fake.*/Fake.*.fsproj`)
Expand Down
1 change: 1 addition & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ do_build:

variables:
TERM: "xterm-256color"
FAKE_DETAILED_ERRORS: "true"
MSBUILDDISABLENODEREUSE: "1"
BuildInParallel: "false"
LANG: "C"
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ sudo: required
dist: trusty # Ubuntu 14.04
dotnet : 2.1.402
env:
- HOME=/home/travis APPDATA=/home/travis LocalAppData=/home/travis
- FAKE_DETAILED_ERRORS=true HOME=/home/travis APPDATA=/home/travis LocalAppData=/home/travis


before_install:
Expand Down
9 changes: 6 additions & 3 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,20 @@
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [

{
"name": "Debug Build Script",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "dotnet:build:fake.sln",
"preLaunchTask": "dotnet:build:fake-netcore.fsproj",
"program": "${workspaceRoot}/src/app/Fake.netcore/bin/Debug/netcoreapp2.1/fake.dll",
"args": [
"run",
"build.fsx",
"--fsiargs",
"--debug:portable --optimize-"
"--debug:portable --optimize-",
"build.fsx",
"-st",
"DownloadPaket"
],
"cwd": "${workspaceRoot}",
"stopAtEntry": false,
Expand Down
23 changes: 23 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,29 @@
"dotnet:restore:fake.sln"
]
},
{
"label": "dotnet:restore:fake-netcore.fsproj",
"group": "build",
"command": "dotnet restore src/app/Fake.netcore/Fake.netcore.fsproj",
"type": "shell",
"presentation": {
"reveal": "always"
},
"problemMatcher": "$msCompile"
},
{
"label": "dotnet:build:fake-netcore.fsproj",
"group": "build",
"command": "dotnet build src/app/Fake.netcore/Fake.netcore.fsproj",
"type": "shell",
"presentation": {
"reveal": "always"
},
"problemMatcher": "$msCompile",
"dependsOn": [
"dotnet:restore:fake-netcore.fsproj"
]
},
{
"label": "dotnet:run:unitTests",
"group": "test",
Expand Down
16 changes: 16 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
# Release Notes

## 5.9.0 - 2018-10-13

* ENHANCEMENT: Write NUnit arguments to an arguments file, fixes problems with long command lines - https:/fsharp/FAKE/pull/2114
* ENHANCEMENT: Added `SpecFlowNext` module to `Fake.DotNet.Testing.SpecFlow` with improved API and missing arguments - https:/fsharp/FAKE/pull/2143
* ENHANCEMENT (BREAKING): Updated and finalized the new (and undocumented) process API which is more unit-testable - https:/fsharp/FAKE/pull/2131
* ENHANCEMENT: Updated `Fake.Testing.ReportGenerator` to include `ClassFilter` and `FileFilter` - https:/fsharp/FAKE/pull/2120
* ENHANCEMENT: Improve TeamCity integrations - https:/fsharp/FAKE/pull/2138
* ENHANCEMENT: Update `Fake.Tools.Pickles` to include latest CLI additions - https:/fsharp/FAKE/pull/2133
* ENHANCEMENT: The `Trace` module can now report build-state with a message - https:/fsharp/FAKE/pull/2139
* ENHANCEMENT: The target module not supports a `Trace.WithContext` mode to retrieve the context and handle potenial problems manually - https:/fsharp/FAKE/pull/2140
* ENHANCEMENT: The target module now allows to set the build-state by using the new `WithContext`-mode - https:/fsharp/FAKE/pull/2141
* BUGFIX: Fix TeamCity (named) Artifact upload - https:/fsharp/FAKE/pull/2147
* BUGFIX: AppVeyor module should not trace `appveyor.exe` calls - https:/fsharp/FAKE/pull/2137
* BUGFIX: Always print the stack-trace when in verbose mode - https:/fsharp/FAKE/issues/2136
* DOCUMENTATION: Some smaller fixes

## 5.8.5 - 2018-10-10

* BUGFIX: PATH Variable was overwritten when using the `DotNet.Cli` module - https:/fsharp/FAKE/issues/2134
Expand Down
6 changes: 5 additions & 1 deletion build.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,11 @@ let chocoVersion =
failwithf "%s" msg
result

Trace.setBuildNumber nugetVersion
match TeamFoundation.Environment.SystemPullRequestIsFork with
| None | Some false ->
Trace.setBuildNumber nugetVersion
| _ ->
Trace.traceFAKE "Not setting buildNumber to '%s', because of https://developercommunity.visualstudio.com/content/problem/350007/build-from-github-pr-fork-error-tf400813-the-user-1.html" nugetVersion

let dotnetSdk = lazy DotNet.install DotNet.Versions.FromGlobalJson
let inline dtntWorkDir wd =
Expand Down
166 changes: 150 additions & 16 deletions help/markdown/core-process.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,162 @@
<p>This documentation is for FAKE version 5.0 or later.</p>
</div>

[API-Reference](apidocs/v5/fake-core-process.html)
[API-Reference CreateProcess](apidocs/v5/fake-core-createprocess.html)
[API-Reference Proc](apidocs/v5/fake-core-proc.html)
[API-Reference Process](apidocs/v5/fake-core-process.html)

## Just start a process

You can either use a list of arguments:

```fsharp

CreateProcess.fromRawCommand "./folder/mytool.exe" ["arg1"; "arg2"]
|> Proc.run // start with the above configuration
|> ignore // ignore exit code

// Or

[ "arg1"; "arg2"
"arg3" ]
|> CreateProcess.fromRawCommand "./folder/mytool.exe"
|> CreateProcess.withWorkingDirectory "./folder"
|> Proc.run
|> ignore

```

Or a properly escaped command line:

```fsharp

CreateProcess.fromRawWindowsCommandLine "./folder/mytool.exe" "arg1 arg2 arg3"
|> Proc.run // start with the above configuration
|> ignore // ignore exit code

```

## Evaluate exit code

The most obvious way is:

```fsharp
let result =
[ "arg1"; "arg2"; "arg3" ]
|> CreateProcess.fromRawCommand "./folder/mytool.exe"
|> Proc.run

if result.ExitCode <> 0 then failwith "Command failed"

```

To simplify your life you can "embed" the return code check into the `CreateProcess` instance (which allows to pass the instance through your application and fail appropriately):

```fsharp

[ "arg1"; "arg2"; "arg3" ]
|> CreateProcess.fromRawCommand "./folder/mytool.exe"
|> CreateProcess.ensureExitCode // will make sure to throw on error
|> Proc.run
|> ignore

// The above is roughly equivalent to the following (which you can copy and edit to customize):

[ "arg1"; "arg2"; "arg3" ]
|> CreateProcess.fromRawCommand "./folder/mytool.exe"
|> CreateProcess.addOnExited (fun data exitCode ->
if exitCode <> 0 then
// TODO: throw your own exception here
failwithf "Process exit code '%d' <> 0. Command Line: %s" exitCode r.CommandLine
else
data)
|> Proc.run
|> ignore

```

## Different ways to "run" or "start"

The basic difference between "start" and "run" is:

- "start" starts the process and returns after the process is started. This usually means the process is still running.
- "run" waits for the started process to exit and returns the result.

The different ways to start or run a process are documented [here](/apidocs/v5/fake-core-proc.html).

## Running a command and analyse results

Whatever processing option you choose in all cases you need to start process redirection:

```fsharp
let result =
CreateProcess.fromRawCommand "./folder/mytool.exe" ["arg1"; "arg2"]
|> CreateProcess.redirectOutput
|> Proc.run
```

let fakeToolPath = "known/path/to/fake.exe"
let directFakeInPath command workingDir target =
let result =
Process.execWithResult (fun (info:ProcStartInfo) ->
{ info with
FileName = fakeToolPath
WorkingDirectory = workingDir
Arguments = command }
|> Process.setEnvironmentVariable "target" target) (System.TimeSpan.FromMinutes 15.)
if result.ExitCode <> 0 then
let errors = String.Join(Environment.NewLine,result.Errors)
printfn "%s" <| String.Join(Environment.NewLine,result.Messages)
failwithf "FAKE Process exited with %d: %s" result.ExitCode errors
String.Join(Environment.NewLine,result.Messages)
This immediately changes the type of `result`, now you can access the output:

let output = directFakeInPath "--version" "." "All"
```fsharp
if result.ExitCode <> 0 then
printfn "%s" result.Result.Output
failwithf "FAKE Process exited with %d: %s" result.ExitCode result.Result.Error
let output = result.Result.Output
// Parse output?
```

But even better you can make the 'process-call' type safe for others, by parsing the output:

```fsharp

type MySafeOutput = // ...
let parseOutput (r:ProcessResult<ProcessOutput>) : MySafeOutput =
// use r.Result.Output, r.ExitCode and create MySafeOutput
let startProcess () (*args*)=
CreateProcess.fromRawCommand "./folder/mytool.exe" ["arg1"; "arg2"]
|> CreateProcess.redirectOutput
|> CreateProcess.ensureExitCode // optional, if your parse function can handle output from failures as well
|> CreateProcess.map parseOutput

// Usage:
let myOutput : MySafeOutput =
startProcess()
|> Proc.run

```

Additionally sometimes you need/want asynchronous results to have intermediate results.
For example if you want that the user continuously "sees" the output as the process generates it:

```fsharp

let output =
CreateProcess.fromRawCommand "./folder/mytool.exe" ["arg1"; "arg2"]
|> CreateProcess.redirectOutput
|> CreateProcess.withOutputEventsNotNull Trace.trace Trace.traceError
|> Proc.run

// "process" output
```

## Advanced usage scenarios


Redirect output from one process `outgen.exe` to `processIn.exe`:


```fsharp

let input = StreamRef.Empty
let p1 =
CreateProcess.fromRawCommand "processIn.exe" []
|> CreateProcess.withStandardInput (CreatePipe input)
|> Proc.start

let p2 =
CreateProcess.fromRawCommand "outgen.exe" []
|> CreateProcess.withStandardOutput (UseStream(false, input.Value))
|> Proc.run


```
38 changes: 38 additions & 0 deletions help/markdown/core-targets.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,44 @@ Everything after the target will be interpreted as argument for the target:

You can access the arguments from every target executed along the way.

## Setting build status

You can set the build status automatically using `Target.updateBuildStatus`. To do this you need to use the `Target.WithContext` functions to run a target and retrieve the context information:

Example:

```fsharp
#r "paket:
nuget Fake.Core.Target //"

open Fake.Core

// *** Define Targets ***
Target.create "Clean" (fun p ->
Trace.trace " --- Cleaning stuff --- "
)

Target.create "Build" (fun _ ->
Trace.trace " --- Building the app --- "
)

Target.create "Deploy" (fun _ ->
Trace.trace " --- Deploying app --- "
)

open Fake.Core.TargetOperators

// *** Define Dependencies ***
"Clean"
==> "Build"
==> "Deploy"

// *** Start Build ***
let ctx = Target.WithContext.runOrDefault "Deploy"
Target.updateBuildStatus ctx
Target.raiseIfError ctx // important to have proper exit code on build failures.
```

## Final targets

Final targets can be used for TearDown functionality.
Expand Down
41 changes: 40 additions & 1 deletion help/markdown/fake-dotnet-testing-specflow.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,48 @@ SpecFlow is open source and provided under a BSD license. As part of the Cucumbe

The package Fake.DotNet.Testing.SpecFlow is a bridge to the [SpecFlow] CLI (specflow.exe).

**If you use SpecFlow in a version >= 2.4, then please use the SpecFlowNext module**

[API-Reference](https://fake.build/apidocs/v5/fake-dotnet-testing-specflow.html)

## Minimal working example
## Minimal working example (v2.4+)

```fsharp
#r "paket:
nuget Fake.Core.Target
nuget Fake.DotNet.Testing.SpecFlow //"

open Fake.Core
open Fake.DotNet.Testing

let specsProject = "IntegrationTests.csproj"

Target.create "Regenerate Test Classes" (fun _ ->
specsProject |> SpecFlowNext.run id
)

Target.create "Create StepDefinition Report" (fun _ ->
specsProject
|> SpecFlowNext.run (fun p ->
{ p with
SubCommand = StepDefinitionReport
BinFolder = Some "bin/Debug"
OutputFile = Some "StepDefinitionReport.html" })
)

Target.create "Default" Target.DoNothing

"Clean"
==> "Regenerate Test Classes"
==> "Build"
==> "Run Integration Tests"
==> "Create StepDefinition Report"
==> "Default"

Target.runOrDefault "Default"
```

## Minimal working example (pre v2.4)

```fsharp
#r "paket:
Expand Down
Loading