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 Candidate 12 #1920

Merged
merged 126 commits into from
May 12, 2018
Merged
Changes from 1 commit
Commits
Show all changes
126 commits
Select commit Hold shift + click to select a range
5239f07
Ported RegistryHelper to Fake5 - Fake.WIndows.Registry module
vanceism7 May 3, 2018
24176c1
Fixed assembly info (even tho its generated -- for completeness)
vanceism7 May 3, 2018
d5d8261
Reversed path /'s in sln
vanceism7 May 3, 2018
594e3ca
Added PR requested changes
vanceism7 May 5, 2018
d4358ae
Revert format header for Fake.sln
vanceism7 May 5, 2018
0dfd0f7
update to rc11
matthid May 6, 2018
c9c6642
improve dependencies in build.fsx
matthid May 6, 2018
982054e
Fixed template link. Fixed registry code samples
vanceism7 May 6, 2018
9845eba
Merge branch 'rc_12' into RegistryModule
vanceism7 May 6, 2018
8e1dcf6
Fix #1915
sliepie May 8, 2018
4279fc1
Initial creation of Fsc module
vanceism7 May 4, 2018
bf94a37
Removed duplicate obsolete version of fsc wrapper
vanceism7 May 7, 2018
77fa303
Added reference to fake fs compile service
vanceism7 May 8, 2018
1063778
Added ability to call fsc.exe using CompileExternal function
vanceism7 May 9, 2018
4b195ee
Merge pull request #1918 from JarnoNijboer/rc_12
matthid May 9, 2018
d7b430b
Merge pull request #1909 from vanceism7/RegistryModule
matthid May 9, 2018
33eda94
move integration tests to expecto and netcore.
matthid May 10, 2018
3446ae2
fix intellisense not working as intended
matthid May 10, 2018
2aae4ed
improve cmd-line generation in msbuild
matthid May 10, 2018
f5d82ec
Merge branch 'rc_12' of github.com:fsharp/FAKE into rc_12
matthid May 10, 2018
ffe5e4f
Improve exception message and handling of DocoptException
matthid May 10, 2018
10452e0
fix fakelib
matthid May 10, 2018
8210150
fix solution
matthid May 10, 2018
797668f
ignore intellisense.fsx in fake 4
matthid May 10, 2018
fc08283
fix test
matthid May 10, 2018
3bafbd6
Renamed functions, fixed arg serialization and dependencies
vanceism7 May 10, 2018
efa2f87
create gitlab release pipeline
matthid May 10, 2018
a8fb2e2
push
matthid May 10, 2018
e1ecc8c
Added Fsc module to the various build processes. Deprecated FscHelper
vanceism7 May 10, 2018
3acfde4
add minimal build
matthid May 10, 2018
b078ef7
fix
matthid May 10, 2018
564d9cf
try to release with vsts.
matthid May 10, 2018
d41a8e6
Ensure docs dir (ie no clean)
matthid May 10, 2018
124d5d5
publish artifacts.
matthid May 10, 2018
95548f0
Change artifact name and create zip packages.
matthid May 10, 2018
d5df4d1
add artefact for publishing help
matthid May 10, 2018
365476e
Add tests.
matthid May 10, 2018
0506c8c
Initial creation of Fsc module
vanceism7 May 4, 2018
37da10f
Removed duplicate obsolete version of fsc wrapper
vanceism7 May 7, 2018
b269d95
Added reference to fake fs compile service
vanceism7 May 8, 2018
481f79d
Added ability to call fsc.exe using CompileExternal function
vanceism7 May 9, 2018
00e8025
Renamed functions, fixed arg serialization and dependencies
vanceism7 May 10, 2018
5aacb3f
Added Fsc module to the various build processes. Deprecated FscHelper
vanceism7 May 10, 2018
6665c79
missing close compile tag
vanceism7 May 10, 2018
46bfa24
Merge branch 'FscModule' of https://github.com/vanceism7/FAKE into Fs…
vanceism7 May 10, 2018
3b6e0c6
release pipeline.
matthid May 11, 2018
e7c27e5
fix
matthid May 11, 2018
79a3d81
add
matthid May 11, 2018
d507f7a
Renamed fsc functions for consistent api style. Fixed fsc website text
vanceism7 May 11, 2018
f9b4576
Added FscModule to Fake main solution
vanceism7 May 11, 2018
397e2d5
missed rename
vanceism7 May 11, 2018
386b890
fix gitlab
matthid May 11, 2018
35ddf76
fix gitlab
matthid May 11, 2018
2f43d56
gitlab-pipeline
matthid May 11, 2018
abc7f90
match branch with regex
matthid May 11, 2018
9edee67
upgrade fake
matthid May 11, 2018
00f41f1
cleanup and add Fake.BuildServer.GitLab
matthid May 11, 2018
4424076
Add GitLab support in-line (until released)
matthid May 11, 2018
1953440
Consolidate artifacts.
matthid May 11, 2018
994b576
fix perl warnings
matthid May 11, 2018
f7dbaff
fix BuildArtifacts.
matthid May 11, 2018
87b887f
install locales
matthid May 11, 2018
08b5640
install locales
matthid May 11, 2018
24abf41
Merge branch 'release/rc_12' into FscModule
matthid May 11, 2018
d928668
another fix
matthid May 11, 2018
eb746d1
fix directories not existing
matthid May 11, 2018
8632654
Merge pull request #1919 from vanceism7/FscModule
matthid May 11, 2018
934280d
fix sample in fake.windows.registry
matthid May 11, 2018
820c82e
fix gitlab
matthid May 11, 2018
996e33f
Fix fake.sln and update gitlab pipeline
matthid May 11, 2018
809e36a
use our own BuildException as we don't have the one defined in MSBuil…
matthid May 11, 2018
7132e23
rename BuildException to MSBuildException and mark existing exception…
matthid May 11, 2018
41f9142
Fix Fake.DotNet.Fsc net462 build.
matthid May 11, 2018
4704171
downgrade paket
matthid May 11, 2018
b438fed
detect gitlab ci
matthid May 11, 2018
223368b
try to fix docker support
matthid May 11, 2018
d45a799
fix gitlab artifacts
matthid May 11, 2018
2ac2674
try to fix gitlab
matthid May 11, 2018
c3c97f2
add build.fsx script to build-cache
matthid May 11, 2018
41e7628
I hate unzip
matthid May 11, 2018
1f472c9
build&test in vsts ci
matthid May 11, 2018
8de338b
add target descriptions
matthid May 11, 2018
b17ae0a
chmod + -y flag on apt-get install
matthid May 11, 2018
8737acb
add all targets into the context information, make sure CreateNuGet w…
matthid May 11, 2018
27d9a26
simplify gitlab
matthid May 11, 2018
64f7172
Consolidate choco and fix -x to +x
matthid May 11, 2018
49be7b8
force proper order via soft targets
matthid May 11, 2018
b72ea78
use corflags.exe on windows and checkin binary
matthid May 11, 2018
8c74c10
explicit nuget.exe
matthid May 11, 2018
8b698f8
add debug code and fix casing of NuGet.CommandLine package.
matthid May 11, 2018
b19fbed
+x and use full path (because we need to change working dir
matthid May 12, 2018
3f1ce43
workaround https://github.com/fsharp/FAKE/issues/1924
matthid May 12, 2018
0dde121
fixed xCorFlags
matthid May 12, 2018
ece9e5f
add release-notes
matthid May 12, 2018
34a95f5
try to fix artifact upload to vsts
matthid May 12, 2018
f94cf41
fix case of Fake.Deploy.Lib
matthid May 12, 2018
2c4be87
release notes
matthid May 12, 2018
f9b5ad4
try to fix vsts artifacts
matthid May 12, 2018
67890cc
make choco compatible with our docker wrapper.
matthid May 12, 2018
9d29f00
Allow trace module (=Buildservers) to detect and report failures in c…
matthid May 12, 2018
6f7eaac
update xcorflags
matthid May 12, 2018
f693095
make it compile again
matthid May 12, 2018
30fc267
boostrap
matthid May 12, 2018
68ad666
gitlab
matthid May 12, 2018
7226b22
generate version in build
matthid May 12, 2018
ec6d3bb
_ is invalid
matthid May 12, 2018
3f15694
change version number a bit
matthid May 12, 2018
dedd441
another fix to xcoreflags
matthid May 12, 2018
c654e89
chocolatey apparently cannot handle semver v2
matthid May 12, 2018
d88452b
fix coreflags again
matthid May 12, 2018
e137888
Update documentation
kblohm May 11, 2018
0b2641c
only push tag in vsts and shorten version string (chocolatey limits t…
matthid May 12, 2018
6a2bf25
make pr version smaller (chocolatey again)
matthid May 12, 2018
7952183
use build metadata
matthid May 12, 2018
31728f8
fail fast on invalid chocolatey version
matthid May 12, 2018
5bc02f4
**NO_CI** diable gitlab
matthid May 12, 2018
841784f
fix prepare artifacts
matthid May 12, 2018
4271279
Merge branch 'release/rc_12' into updateDocsTemplate
matthid May 12, 2018
01b3d13
debug unzip
matthid May 12, 2018
73f6f5e
Merge pull request #1923 from kblohm/updateDocsTemplate
matthid May 12, 2018
8e27412
release notes
matthid May 12, 2018
de265bc
update packages
matthid May 12, 2018
c611203
simplify script
matthid May 12, 2018
54245dc
Fix bugs and add workarounds
matthid May 12, 2018
2a8d08c
fix bootstrapping
matthid May 12, 2018
617e5c3
setup email/name on release
matthid May 12, 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
9 changes: 5 additions & 4 deletions src/app/Fake.DotNet.Fsc/Fake.DotNet.Fsc.fsproj
Original file line number Diff line number Diff line change
@@ -15,21 +15,22 @@
<Compile Include="Fsc.fs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Fake.Core.Process\Fake.Core.Process.fsproj" />
<ProjectReference Include="..\Fake.IO.FileSystem\Fake.IO.FileSystem.fsproj" />
<ProjectReference Include="..\Fake.Core.Trace\Fake.Core.Trace.fsproj" />
<ProjectReference Include="..\Fake.Core.String\Fake.Core.String.fsproj" />
<ProjectReference Include="..\Fake.DotNet.MSBuild\Fake.DotNet.MSBuild.fsproj" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net46'">
<Reference Include="FAKE.FSharp.Compiler.Service">
<HintPath>..\..\..\packages\FSharp.Compiler.Service\lib\net45\FAKE.FSharp.Compiler.Service.dll</HintPath>
<Reference Include="FSharp.Compiler.Service">
<HintPath>..\..\..\packages\FSharp.Compiler.Service\lib\net45\FSharp.Compiler.Service.dll</HintPath>
<Private>True</Private>
<Paket>False</Paket>
</Reference>
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
<Reference Include="FAKE.FSharp.Compiler.Service">
<HintPath>..\..\..\packages\FSharp.Compiler.Service\lib\netstandard2.0\FAKE.FSharp.Compiler.Service.dll</HintPath>
<Reference Include="FSharp.Compiler.Service">
<HintPath>..\..\..\packages\FSharp.Compiler.Service\lib\netstandard2.0\FSharp.Compiler.Service.dll</HintPath>
<Private>True</Private>
<Paket>False</Paket>
</Reference>
131 changes: 102 additions & 29 deletions src/app/Fake.DotNet.Fsc/Fsc.fs
Original file line number Diff line number Diff line change
@@ -297,35 +297,78 @@ type FscParam =
Debug false
]

/// Compiles the given source files with the given options. If no options
///Common Error Result type for tracing errors
type FscResultMessage =
| Warning of string
| Error of string

/// Type signature for a Compiler Function
type CompilerFunc = string [] -> ( FscResultMessage [] * int )


/// Computes output type and appends source files to argument list
let private makeArgsList (opts: string list) (srcFiles: string list) =
let outputArg arg = arg = "-o" || arg.StartsWith("--out:")
let libTarget arg = arg = "-a" || arg = "--target:library"
let hasOutputArg = Seq.exists outputArg
let hasLibTarget = Seq.exists libTarget

// If output file name is specified, pass it on to fsc.
if opts |> hasOutputArg
then opts @ srcFiles
// But if it's not, then figure out what it should be.
else
let outExt = if opts |> hasLibTarget then ".dll" else ".exe"
"-o" :: Path.changeExtension outExt (List.head srcFiles) :: opts @ srcFiles
|> Array.ofList

/// Reports Fsc compile errors to the console using Fake.Core.Trace
let private reportErrors (errors: FscResultMessage []) =
for e in errors do
match e with
| FscResultMessage.Warning errMsg -> Trace.traceImportant errMsg
| FscResultMessage.Error errMsg -> Trace.traceError errMsg

/// Compiles the given source files with the given options using either
/// the internal FCS or an external fsc.exe. If no options
/// given (i.e. the second argument is an empty list), by default tries
/// to behave the same way as would the command-line 'fsc.exe' tool.
let compileFiles (srcFiles : string list) (opts : string list) : int =
let scs = FSharpChecker.Create()

let optsArr =
// If output file name is specified, pass it on to fsc.
if Seq.exists (fun e -> e = "-o" || e.StartsWith("--out:")) opts then opts @ srcFiles
// But if it's not, then figure out what it should be.
else
let outExt =
if Seq.exists (fun e -> e = "-a" || e = "--target:library") opts then ".dll"
else ".exe"
"-o" :: Path.changeExtension outExt (List.head srcFiles) :: opts @ srcFiles
|> Array.ofList
let compileFiles (compiler: CompilerFunc) (srcFiles : string list) (opts : string list) : int =
let optsArr = makeArgsList opts srcFiles

Trace.trace <| sprintf "FSC with args:%A" optsArr
let errors, exitCode = compiler optsArr

reportErrors errors
exitCode

/// Common compiler arg prep code
let private doCompile (compiler: CompilerFunc) (fscParams : FscParam list) (inputFiles : string list) : int =
let inputFiles = inputFiles |> Seq.toList
let taskDesc = inputFiles |> FakeString.separated ", "
let fscParams = if fscParams = [] then FscParam.Defaults else fscParams
let argList = fscParams |> List.map string

use __ = Trace.traceTask "Fsc " taskDesc
let res = compileFiles compiler inputFiles argList
res


/// The internal FCS Compiler
let private scsCompile optsArr =
let scs = FSharpChecker.Create()
// Always prepend "fsc.exe" since fsc compiler skips the first argument
let optsArr = Array.append [|"fsc.exe"|] optsArr
let errors, exitCode = scs.Compile optsArr |> Async.RunSynchronously
// Better compile reporting thanks to:
// https://github.com/jbtule/ComposableExtensions/blob/5b961b30668bb7f4d17238770869b5a884bc591f/tools/CompilerHelper.fsx#L233
for e in errors do
let errMsg = e.ToString()
let errors, exitcode = scs.Compile optsArr |> Async.RunSynchronously

/// Better compile reporting thanks to:
/// https://github.com/jbtule/ComposableExtensions/blob/5b961b30668bb7f4d17238770869b5a884bc591f/tools/CompilerHelper.fsx#L233
let errors = errors |> Array.map (fun (e: FSharpErrorInfo) ->
match e.Severity with
| FSharpErrorSeverity.Warning -> Trace.traceImportant errMsg
| FSharpErrorSeverity.Error -> Trace.traceError errMsg
exitCode
| FSharpErrorSeverity.Error -> FscResultMessage.Error e.Message
| FSharpErrorSeverity.Warning -> FscResultMessage.Warning e.Message)

errors, exitcode

/// Compiles the given F# source files with the specified parameters.
///
@@ -348,13 +391,7 @@ let compileFiles (srcFiles : string list) (opts : string list) : int =
/// Debug false
/// ]
let compile (fscParams : FscParam list) (inputFiles : string list) : int =
let inputFiles = inputFiles |> Seq.toList
let taskDesc = inputFiles |> FakeString.separated ", "
let fscParams = if fscParams = [] then FscParam.Defaults else fscParams
let argList = fscParams |> List.map string
use __ = Trace.traceTask "Fsc " taskDesc
let res = compileFiles inputFiles argList
res
doCompile scsCompile fscParams inputFiles

/// Compiles one or more F# source files with the specified parameters.
/// ## Parameters
@@ -374,3 +411,39 @@ let compile (fscParams : FscParam list) (inputFiles : string list) : int =
let Compile (fscParams : FscParam list) (inputFiles : string list) : unit =
let res = compile fscParams inputFiles
if res <> 0 then raise <| BuildException("Fsc: compile failed with exit code", [ string res ])


/// An externally referenced compiler
let private externalCompile (fscTool: string) (optsArr: string []) =
let args = String.Join(" ", optsArr)
let r =
Process.execWithResult (fun info ->
{ info with
FileName = fscTool
Arguments = args
} ) TimeSpan.MaxValue

let errors = r.Errors |> List.map FscResultMessage.Warning |> List.toArray
errors, r.ExitCode

/// Compiles one or more F# source files with the specified parameters
/// using an existing fsc.exe installed on the system
/// ## Parameters
///
/// - `setParams` - Function used to overwrite the default Fsc parameters.
/// - `inputFiles` - The F# input files.
///
/// ## Sample
///
/// ["file1.fs"; "file2.fs"]
/// |> CompileExternal "path/to/fsc.exe"
/// [Out ""
/// Target Exe
/// Platform AnyCpu
/// References []
/// Debug false
/// ]
let CompileExternal (fscTool: string) (fscParams : FscParam list) (inputFiles : string list) : unit =
let compile = externalCompile fscTool
let res = doCompile compile fscParams inputFiles
if res <> 0 then raise <| BuildException("Fsc: compile failed with exit code", [ string res ])