Skip to content
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
14 changes: 13 additions & 1 deletion appveyor-build.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ echo Build and run a subset of test suites
echo.
echo Usage:
echo.
echo appveyor-build.cmd ^<all^|net40^|portable47^|portable7^|portable78^|portable259^|vs^|cambridge_suite^|qa_suite^|smoke^|smoke_only^>
echo appveyor-build.cmd ^<all^|net40^|portable47^|portable7^|portable78^|portable259^|vs^|cambridge_suite^|qa_suite^|smoke^|smoke_only^|build_only^>
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this add build_only argument to appveyor, to build without tests ( compile only ).
can be combined with others arguments, for example net40,portable7,build_only compile only net40 and portable7 instead of compile+tests

echo.
echo No arguments default to 'smoke' ( build all profiles, run all unit tests, cambridge Smoke, fsharpqa Smoke)
echo.
Expand Down Expand Up @@ -146,6 +146,18 @@ if /i '%BUILD_PROFILE%' == 'smoke_only' (
set CONF_CAMBRIDGE_SUITE=Smoke
set CONF_QA_SUITE=Smoke
)

if /i '%BUILD_PROFILE%' == 'build_only' (
set TEST_NET40=0
set TEST_PORTABLE47=0
set TEST_PORTABLE7=0
set TEST_PORTABLE78=0
set TEST_PORTABLE259=0
set TEST_VS=0
set TEST_CAMBRIDGE_SUITE=0
set TEST_QA_SUITE=0
)

goto :EOF

:MAIN
Expand Down
58 changes: 57 additions & 1 deletion src/fsharp/CompileOptions.fs
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,32 @@ let DumpCompilerOptionBlocks blocks = List.iter dumpCompilerOptionBlock blocks
let isSlashOpt (opt:string) =
opt.[0] = '/' && (opt.Length = 1 || not (opt.[1..].Contains "/"))

module ResponseFile =

type ResponseFileData = ResponseFileLine list
and ResponseFileLine =
| CompilerOptionSpec of string
| Comment of string

let parseFile path : Choice<ResponseFileData,Exception> =
let parseLine (l: string) =
match l with
| s when String.IsNullOrWhiteSpace(s) -> None
| s when l.StartsWith("#") -> Some (ResponseFileLine.Comment (s.TrimStart('#')))
| s -> Some (ResponseFileLine.CompilerOptionSpec (s.Trim()))

try
use stream = FileSystem.FileStreamReadShim path
use reader = new System.IO.StreamReader(stream, true)
let data =
seq { while not reader.EndOfStream do yield reader.ReadLine () }
|> Seq.choose parseLine
|> List.ofSeq
Choice1Of2 data
with e ->
Choice2Of2 e


let ParseCompilerOptions (collectOtherArgument : string -> unit, blocks: CompilerOptionBlock list, args) =
use unwindBuildPhase = PushThreadBuildPhaseUntilUnwind (BuildPhase.Parameter)

Expand Down Expand Up @@ -228,6 +254,35 @@ let ParseCompilerOptions (collectOtherArgument : string -> unit, blocks: Compile
let rec processArg args =
match args with
| [] -> ()
| ((rsp: string) :: t) when rsp.StartsWith("@") ->
let responseFileOptions =
let fullpath =
try
Some (rsp.TrimStart('@') |> FileSystem.GetFullPathShim)
with _ ->
None

match fullpath with
| None ->
errorR(Error(FSComp.SR.optsResponseFileNameInvalid(rsp),rangeCmdArgs))
[]
| Some(path) when not (FileSystem.SafeExists path) ->
errorR(Error(FSComp.SR.optsResponseFileNotFound(rsp, path),rangeCmdArgs))
[]
| Some path ->
match ResponseFile.parseFile path with
| Choice2Of2 _ ->
errorR(Error(FSComp.SR.optsInvalidResponseFile(rsp, path),rangeCmdArgs))
[]
| Choice1Of2 rspData ->
let onlyOptions l =
match l with
| ResponseFile.ResponseFileLine.Comment _ -> None
| ResponseFile.ResponseFileLine.CompilerOptionSpec opt -> Some opt
rspData |> List.choose onlyOptions

processArg (responseFileOptions @ t)

| opt :: t ->

let optToken, argString = parseOption opt
Expand Down Expand Up @@ -873,7 +928,8 @@ let miscFlagsBoth tcConfigB =

let miscFlagsFsc tcConfigB =
miscFlagsBoth tcConfigB @
[ CompilerOption("help", tagNone, OptionHelp (fun blocks -> displayHelpFsc tcConfigB blocks), None, Some (FSComp.SR.optsHelp()))
[ CompilerOption("help", tagNone, OptionHelp (fun blocks -> displayHelpFsc tcConfigB blocks), None, Some (FSComp.SR.optsHelp()));
CompilerOption("@<file>", tagNone, OptionUnit ignore, None, Some (FSComp.SR.optsResponseFile()))
]
let miscFlagsFsi tcConfigB = miscFlagsBoth tcConfigB

Expand Down
92 changes: 7 additions & 85 deletions src/fsharp/FSComp.txt

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// #NoMT #CompilerOptions
//<Expects id="FS3192" status="error"></Expects>
exit 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// #NoMT #CompilerOptions
//<Expects id="FS3193" status="error"></Expects>
exit 1
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
SOURCE="responsefile01.fs" SCFLAGS="--define:FROM_RESPONSE_FILE_1" # responsefile01.fs define
SOURCE="responsefile01.fs" SCFLAGS="\@rs1.rsp" # responsefile01.fs define inside response file
SOURCE="responsefile01.fs" SCFLAGS="\@rs1_multiline_and_comments.rsp" # responsefile01.fs comments/newline inside response file
SOURCE="responsefile01.fs \@rs2.rsp" # responsefile01.fs nested response file, different position
SOURCE="responsefile01.fs \@empty_rs.rsp \@rs2.rsp \@empty_rs.rsp " # responsefile01.fs nested response file
SOURCE="responsefile02.fs" SCFLAGS="\@rs1_multiline_and_comments.rsp" # responsefile02.fs response file multiline
SOURCE="E_responsefile_not_found.fs" COMPILE_ONLY=1 SCFLAGS="\@not_exists" # E_responsefile_not_found.fs error if response file does not exists
SOURCE="E_responsefile_path_invalid.fs" COMPILE_ONLY=1 SCFLAGS="\@" # E_responsefile_path_invalid.fs error if response file name is empty or invalid
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// #NoMT #CompilerOptions
//<Expected status=success></Expects>

[<EntryPoint>]
let main args =
let expected =
#if FROM_RESPONSE_FILE_1
"ok"
#else
"fail"
#endif

exit(if(expected = "ok") then 0 else 1)
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// #NoMT #CompilerOptions
//<Expected status=success></Expects>

[<EntryPoint>]
let main args =
let expected1 =
#if FROM_RESPONSE_FILE_1
"ok"
#else
"fail"
#endif

let expected2 =
#if FROM_RESPONSE_FILE_2
"ok"
#else
"fail"
#endif

exit(if(expected1 = "ok" && expected2 = "ok") then 0 else 1)
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--define:FROM_RESPONSE_FILE_1
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

# some comments

--define:FROM_RESPONSE_FILE_1

#other comments

--define:FROM_RESPONSE_FILE_2

# end of comments
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@rs1.rsp
1 change: 1 addition & 0 deletions tests/fsharpqa/Source/test.lst
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ CompilerOptions01,NoMT CompilerOptions\fsc\times
CompilerOptions01,NoMT CompilerOptions\fsc\warn
CompilerOptions01,NoMT CompilerOptions\fsc\warnaserror
CompilerOptions01,NoMT CompilerOptions\fsc\warnon
CompilerOptions01,NoMT CompilerOptions\fsc\responsefile
CompilerOptions01,NoMT CompilerOptions\fsi\help
CompilerOptions01,NoMT CompilerOptions\fsi\highentropyva
CompilerOptions01,NoMT CompilerOptions\fsi\nologo
Expand Down