where does the log is created by default in FAKE F#Make? - f#

I am trying to build a csproj file with FAKE, following the "Getting started with FAKE - F# Make" tutorial from the FAKE website. I am trying to understand what this line is doing:
|> Log "AppBuild-Output: "
I understand that it is creating the log of the respective build. But where is this log file being created?
This is the code:
Target "BuildApp" (fun _ ->
!! "src/app/**/*.csproj"
|> MSBuildRelease buildDir "Build"
|> Log "AppBuild-Output: "
)
When I delete the last line, i.e. if i write:
Target "BuildApp" (fun _ ->
!! "src/app/**/*.csproj"
|> MSBuildRelease buildDir "Build"
)
I am getting an error, type 'unit' doesn't match the type 'string list'.

Related

How to read file content to variable in Tupfile (windows)

I am experimenting with the tup build system and now try to make the tup-over-maven build file.
I want to extract the project version from the POM file and use it to specify output files like this:
: pom.xml |> $(mvn) help:evaluate -Dexpression=project.version -q -DforceStdout > .version |> .version
set project_version = **???? must be content of .version file ????**
: |> $(mvn) package |> target/global-config-$(project_version).jar target/global-config-$(project_version)-sources.jar | $(temp_outputs)
Is this possible?
The environment is Windows, so backtick is not an option.

'Unknown logical symbol map.Map.const' message in Why3

I'm experimenting with why3 by following their tutorial, but I get the message Unknown logical symbol map.Map.const for multiple provers. Here are the contents of the theory I'm trying to prove:
theory List
type list 'a = Nil | Cons 'a (list 'a)
predicate mem(x: 'a) (l: list 'a) = match l with
| Nil -> false
| Cons y r -> x = y || mem x r
end
goal G1: mem 2 (Cons 1 (Cons 2 (Cons 3 Nil)))
end
Here are the results of a variety of provers:
z3:
▶ why3 prove -P z3 demo_logic.why
File "/usr/local/share/why3/drivers/z3_bare.drv", line 172, characters 36-41:
Unknown logical symbol map.Map.const
cvc4:
▶ why3 prove -P cvc4 demo_logic.why
File "/usr/local/share/why3/drivers/cvc4_bare.drv", line 180, characters 36-41:
Unknown logical symbol map.Map.const
pvs:
▶ why3 prove -P pvs demo_logic.why
File "/usr/local/share/why3/drivers/pvs-common.gen", line 41, characters 18-23:
Unknown logical symbol map.Map.const
This is my why3 version information:
▶ why3 --version
Why3 platform, version -n 0.85+git (build date: Tue Mar 10 08:27:47 EDT 2015)
The timestamps on the .drv files mentioned in the error messages match the timestamp on my why3 executable.
Is there something wrong with my theory or my installation?
Edit to add: In the tutorial itself it says to use why3 demo_logic.why to prove the theory, but when I try that I get this result:
▶ why3 demo_logic.why
'demo_logic.why' is not a Why3 command.
If instead I just do why3 prove demo_logic.why, the result is just (approximately) an echo of the theory:
▶ why3 prove demo_logic.why
theory List
(* use why3.BuiltIn.BuiltIn *)
type list 'a =
| Nil
| Cons 'a (list 'a)
predicate mem (x:'a) (l:list 'a) =
match l with
| Nil -> false
| Cons y r -> x = y || mem x r
end
goal G1 : mem 2 (Cons 1 (Cons 2 (Cons 3 (Nil:list int))))
end
Do you installed a previous version of why3? Problems in the execution of provers are often due to a new why3 using a configuration file of an old why3. And I have seen your particular instance fixed by this:
rm ~/.why3.conf
why3 config --detect

How to launch an F# console app from VS Code

Given a simple F# console app:
[<EntryPoint>]
let main argv =
printfn "Hello world"
Console.ReadLine() |> ignore
0
What do I need to do to start the console app up in the same manner that ctrl F5 would do in Visual Studio.
I have tried running it form a FAKE build script using the Fake.ProcessHelper:
Target "Run" (fun _ ->
let exe = #"C:\Source\code\fs_console_app\build\fs_console_app.exe"
let errorCode = Shell.AsyncExec(exe, "", buildDir)
()
)
Hitting Ctrl F5 I receive the following build report:
Target Duration
------ --------
Build 00:00:00.3916039
Run 00:00:00.0743197
Total: 00:00:00.5605493
Status: Ok
But no sign of the console application starting up and waiting for input.
I would have preferred to comment but it would be too long, I consider this more of a workaround answer, as I'm not that familiar with Fake. My guess is that your Run Target is actually being executed but is probably being swallowed by AsyncExec or it just shows in the Fake output window (try Exec) but doesn't start a new window.
You can just create a runcmd.bat (assuming you're on windows), and put the following into it, make sure the file is NOT in your build directory as it might get cleaned up:
start C:\Source\code\fs_console_app\build\fs_console_app.exe
You need start to kick off a new cmd window. This could be something else of course, bash or powershell, etc.
Then inside your build.fsx:
Target "Run" (fun _ ->
let exe = "path/to/runcmd.bat"
printfn "%A" "Hello World"
Shell.Exec(exe) |> ignore
)
// Build order
"Clean"
==> "Build"
==> "Run"
==> "Deploy"
Now if I run (via Ctrl+Shift+P) Fake, and pick Run, it compiles, starts a new command line and waits for the ReadLine. It also works via Ctrl+F5.

docgen: Merge/Append libraries

How can I create a docgen solution with multiple library packages? Similar to Dart's, where the left vertical menu contains links to each library.
Example: I have dart editor workspace with 5 projects
mowbotnavrc_server (server)
mowbotnavrc_web (client)
mowbotnavrc (library)
mowbotnavrc_protocol (library)
osswebwidgets (library)
I'd like the 3 library packages above listed on the left menu from index.html. As I add more libraries, they each get a link in the left menu. Currently, I can only generate each library separately with no problem.
cd %project-folder%
:: <<< Run pub get to get the dependencies >>>
cmd /c %dart-sdk-bin%\pub get
cmd /c docgen.bat --verbose %OPTIONS% --out %ENV-PROJECT-DOCS% --no-include-sdk --no-include-dependent-packages --package-root=%project-folder%\packages %project-folder%\lib
The --append option according to the documentation sounds like what I need but I never get it to work.
--append
Use the same format used the last time the docs were generated,
as stated in library_list.json. Add the newly generated documentation
to the docs directory, library_list.json, and index.txt.
I'm using Dart SDK version 1.4.0-dev.2.2. I think --append deprecated as of 1.4. Any suggestions appreciated.
Based on Günter's answer, I was able to get a Windows command version working. Maybe others will find helpful as well.
:: ===========================================================================
:: DOCGEN: MOWBOT Dart Project
:: ===========================================================================
mode con:cols=135 lines=50
:: --------------------------------------------
:: Initialize environment variables
:: --------------------------------------------
setlocal
set PATH-DARTSDKBIN=F:\Public\Downloads\Darteditor-windows-x64\dart\dart-sdk\bin
set PATH=%PATH%;%PATH-DARTSDKBIN%
set PATH-DARTPROJECTS=C:\Users\OSSDevYorgi\DartProjects
set PATH-DARTDOCS=C:\Users\OSSDevYorgi\DartDocs
set ERRORMSG=
:: --------------------------------------------
:: Initialize PATH-DARTDOCS & PATH-DARTDOCS-MOWBOT folders
:: --------------------------------------------
IF NOT EXIST %PATH-DARTDOCS% mkdir %PATH-DARTDOCS%
set PATH-DARTDOCS-MOWBOT=%PATH-DARTDOCS%\mowbot
IF NOT EXIST %PATH-DARTDOCS-MOWBOT% (
mkdir %PATH-DARTDOCS-MOWBOT% 1> nul
) ELSE (
del %PATH-DARTDOCS-MOWBOT% /s /q 1> nul
)
:: --------------------------------------------
:: MAIN DOC PROJECT:mowbotnavrc
:: --------------------------------------------
set PROJECT-NAME=mowbotnavrc
set PATH-PROJECT=%PATH-DARTPROJECTS%\libraries\%PROJECT-NAME%
set PROJECTLIBS=lib\mowbotnavrc.dart
set PROJECTLIBS=%PROJECTLIBS% %PATH-DARTPROJECTS%\libraries\mowbotnavrc_protocol\lib\protobufs\mowbot.pb.dart
set PROJECTLIBS=%PROJECTLIBS% %PATH-DARTPROJECTS%\webcomponents\osswebwidgets\lib\instruments.dart
::set PROJECTLIBS=%PROJECTLIBS% %PATH-DARTPROJECTS%\webcomponents\osswebwidgets\lib\guages.dart
::set STARTPAGE=%PROJECT-NAME%
:: --------------------------------------------
:: VERIFY FOLDERS EXIST
:: --------------------------------------------
#IF EXIST %PATH-PROJECT% goto :BUILDDOCS
#set ERRORMSG="PATH NOT FOUND "%PATH-PROJECT%
#goto :ERRORHANDLER
:: --------------------------------------------
:: SUBROUTINE:BUILDDOCS
:: --------------------------------------------
:BUILDDOCS
:: --------------------------------------------
:: Hack:Temporary workaround for pre-existing dartdoc-viewer causes "docgen --serve" to fail
:: --------------------------------------------
set ENV-PROJECT-DOCS=%PATH-PROJECT%\dartdoc-viewer
IF EXIST %ENV-PROJECT-DOCS% (
rmdir %ENV-PROJECT-DOCS% /s /q 1> nul
)
set ENV-PROJECT-DOCS=%PATH-PROJECT%\nobackup\docs
IF NOT EXIST %ENV-PROJECT-DOCS% (
mkdir %ENV-PROJECT-DOCS% 1> nul
) ELSE (
del %ENV-PROJECT-DOCS% /s /q 1> nul
)
cd %PATH-PROJECT%
:: <<< Run pub get to get the dependencies >>>
::cmd /c %PATH-DARTSDKBIN%\pub get
cmd /c docgen.bat --serve --verbose --no-include-sdk ^
--include-dependent-packages ^
--out %ENV-PROJECT-DOCS% ^
--package-root=%PATH-PROJECT%\packages ^
--introduction=README.md ^
%PROJECTLIBS%
goto :exit
:: --------------------------------------------
:: SUBROUTINE:ERRORHANDLER
:: --------------------------------------------
:ERRORHANDLER
#echo.
#echo --------------------------------------------
#echo ERROR:%ERRORMSG%
#echo --------------------------------------------
#echo.
:: --------------------------------------------
:: END OF JOB
:: --------------------------------------------
:exit
pause
Just add each library file you want to add as an additional argument at the end of the command line.
See generate-documentation.sh (AngularDart) for an example.

Build error running FAKE MSBUild on project files with parenthesis

When I execute my Fake build script I run into a problem where the parenthesis in my project file seem to be converted to %28 and %29 respectively. This results in a failed build.
Here is my FAKE script below:
// include Fake lib
#I #"../tools/FAKE/tools/"
#r #"FakeLib.dll"
open Fake
let buildDir = "./.build"
let dotNet40ProjectsIncludeStr = "**/*(NET40).*proj"
let dotNet40Projects =
!! dotNet40ProjectsIncludeStr
let dotNet45Projects =
!! "**/*.*proj"
-- dotNet40ProjectsIncludeStr
// Default target
Target "Default" (fun _ ->
trace "Executed Default target"
)
Target "Build NET45" (fun _ ->
dotNet45Projects |> Seq.iter (log << sprintf "%s%s" "Net45Projects:")
MSBuildRelease (buildDir ## "net45") "Build" dotNet45Projects
|> Log "BuildNet45: "
)
Target "Build NET40" (fun _ ->
//let projects = dotNet40Projects |> Seq.map (sprintf "%s")
//projects |> Seq.iter (log << sprintf "%s%s" "Net40Projects:")
dotNet40Projects |> Seq.iter (log << sprintf "%s%s" "Net40Projects:")
MSBuildRelease (buildDir ## "net40") "Build" dotNet40Projects
|> Log "BuildNet40: "
)
"Build NET40"
==> "Build NET45"
==> "Default"
// start build
RunTargetOrDefault "Default"
The output I get contains the following:
Starting Target: Build NET40 Net40Projects:C:\dev\work\My- Company\dev\MyProject\Data\MyProject\MyProject.Data(NET40).csproj
Net40Projects:C:\dev\work\My-Company\dev\MyProject\Data\MyProject.Data.Tests\MyProject.Data.Tests(NET40).cspr oj
Running build failed.
Error:
System.IO.FileNotFoundException: Could not find file 'C:\dev\work\MyCompany\dev\MyProject\Data\MyProject.Data\MyProject.Data%28NET40%29.csproj'.
I consider this as a bug. Please open an issue in fake's github issue tracker.

Resources