Fsc Task

Description

This task compiles F# source into executables or modules. The task requires fsc.exe on the execute path, unless it or an equivalent program is specified in the executable parameter

All parameters are optional: <fsc/> should suffice to produce a debug build of all *.fs files.

The task is a directory based task, so attributes like includes="**\/*.fs" and excludes="broken.fs" can be used to control the files pulled in. By default, all *.fs files from the project folder down are included in the command. When this happens the destFile -if not specified- is taken as the first file in the list, which may be somewhat hard to control. Specifying the output file with destfile is prudent.

Also, dependency checking only works if destfile is set. As with <csc> nested src filesets of source, reference filesets, definitions and resources can be provided.

Parameters

Attribute Description Type Requirement
additionalmodules Semicolon separated list of modules to refer to. String Optional
debug set the debug flag on or off. boolean
destdir Set the destination directory of files to be compiled. File
destfile Set the name of exe/library to create. File
executable set the name of the program, overriding the defaults. Can be used to set the full path to a program, or to switch to an alternate implementation of the command -provided they use the same command line arguments as the .NET framework edition String
extraoptions Any extra options which are not explicitly supported by this task. String
failonerror If true, fail on compilation errors. boolean
optimize If true, enables optimization flag. boolean
tailcalls Whether to enable tailcalls boolean, defaults to true
crossoptimize Whether to enable cross-module optimizations. boolean, defaults to false
standalone Whether to statically link the F# library and all referenced DLLs into the assembly. boolean, defaults to false
references Semicolon separated list of DLLs to refer to. String
srcdir Set the source directory of the files to be compiled. File
targettype set the target type to one of exe|library|module|winexe "exe", "library", "module", "winexe"
utf8output If true, require all compiler output to be in UTF8 format. boolean
warnlevel Level of warning currently between 1 and 4 with 4 being the strictest. int
win32icon Set the filename of icon to include. File
win32res Sets the filename of a win32 resource (.RES) file to include. This is not a .NET resource, but what Windows is used to. File
useresponsefile Sets whether a response file instead of a command line only invocation should be used. Defaults to false but Ant will still use a response file if more than 64 command line arguments would be used. boolean

Parameters as nested elements

define (org.apache.ant.dotnet.compile..DotnetDefine)

add a define to the list of definitions

reference (org.apache.tools.ant.types.FileSet)

add a new reference fileset to the compilation

resource (org.apache.ant.dotnet.compile.DotnetResource)

link or embed a resource

src (org.apache.tools.ant.types.FileSet)

add a new source directory to the compile

Examples

<fsc optimize="true" debug="false"
  warnLevel="4" targetType="exe" definitions="RELEASE"
  excludes="src/unicode_class.fs"
  destFile="NetApp.exe" tailcalls="true" >
    <reference file="${testCSC.dll}"/>
    <define name="RELEASE"/>
    <define name="DEBUG" if="debug.property"/>
    <define name="def3" unless="def2.property"/>
</fsc>