Details about advanced configuration options
The Eta compiler takes many command line options that you may want to use for your Gradle build. We provide an Options DSL to allow you to configure compiler options easily.
The following table lists the properties that are available for the options property of the compile[SourceSet]Eta task:
Property | Type |
language | String |
extensions | NamedDomainObjectContainer<LanguageExtension> |
args | List<String> |
cpp | List<String> |
installIncludes | List<String> |
includeDirs | List<String> |
This specifies the language to use for the build. A language consists of a set of predefined language extensions are are defined by the compiler. Currently, there are only two values you can put for this field:
Default: 'Haskell2010'
Sets the language to Haskell98 for all the Eta source files in the main sourceSet.
1 2 3 | compileEta {
options.language = 'Haskell98'
}
|
The set of language extensions to enable or disable for the build.
Enables the DataKinds language extension by default for all the Eta source files in the main sourceSet.
1 2 3 4 5 6 7 | compileEta {
options {
extensions {
DataKinds
}
}
}
|
Disables the DataKinds language extension by default for all the Eta source files in the test sourceSet.
1 2 3 4 5 6 7 | compileTestEta {
options {
extensions {
NoDataKinds
}
}
}
|
The flags to send to the preprocessor used by the Eta compiler to preprocess files that enable the CPP extension.
Enables the CPP language extension for all the Eta source files in the test sourceSet and sends some flags to the preprocessor that define the MY_VERSION constant to be 1200.
1 2 3 4 5 6 7 8 9 | compileTestEta {
options {
extensions {
CPP
}
cpp = ['-DMY_VERSION=1200']
}
}
|
Paths to directories which contain include files that can later be referenced with #include directives.
Locates header files in /path/to/includes so that the files in the main sourceSet can access the include files they need.
1 2 3 4 5 | compileEta {
options {
includeDirs = ['/path/to/includes']
}
}
|
Names of include files to install along with the package being built.
Configures the CTypes.h header file to be installed along with the package defined by the main sourceSet.
1 2 3 | compileEta {
options.installIncludes = ['CTypes.h']
}
|
Sometimes we want to share configuration across multiple tasks. Here's a quick example of how to use Groovy's language features to configure multiple tasks at a time.
1 2 3 4 5 6 7 8 | [compileEta, compileTestEta].each {
options {
args = ['-Werror','-Wall']
extensions {
DataKinds
}
}
}
|