Setting options for Gosu command prompt compilation
The gwb compile command provides multiple options that modify the behavior of the Gosu compiler. These configuration options apply only to the gwb compile command. The compilation tools that Guidewire Studio provides do not use these options. For example, if you make changes to your Gosu code that might cause many compilation errors or warnings, you can set options to terminate the compilation after reaching a threshold.
To set Gosu command-prompt compilation
options, you edit the build.gradle
file in the PolicyCenter configuration folder. You add
the configuration options and values at the top of the file, similar
to the following lines:
// Add custom project specific configuration here if needed
tasks.compileGosu.gosuOptions.failOnError = false
The following table lists and describes the available configuration options for Gosu compilation.
Configuration option |
Default value |
Description |
|---|---|---|
|
|
Supports enabling checked arithmetic, which generates Gosu exceptions for nu.meric overflow errors |
|
|
Supports terminating a compilation task if the
number of errors exceeds the value that
|
|
|
Specifies the permitted number of
compilation errors after which the compilation
task fails if |
|
|
Specifies the permitted number of
compilation warnings after which the
compilation task fails if |
|
|
Specifies whether to print a message to the log for every file that the task compiles. |
|
|
Supports terminating a compilation task if the
number of warnings exceeds the value that
|
Examples
Each example stands alone. Remove the line or lines that you added for one example before you try the next example.
- Add the following line to the top of the
build.gradlefile.tasks.compileGosu.gosuOptions.checkedArithmetic = trueAt the command prompt run the gwb compile command. When you run a compiled class that causes a numeric overflow, the class throws an arithmetic exception and terminates.
- Add the following line to the top of the
build.gradlefile.tasks.compileGosu.gosuOptions.failOnError = falseAt the command prompt run the gwb compile command. Even if there are multiple compilation errors, the task ignores the
maxErrsoption and compiles all available Gosu classes. Output similar to the following lines appears.Error threshold of 10 exceeded; aborting compilation. gosuc completed with 12 errors. Warnings were disabled. :modules:configuration:compileGosu completed with errors, but ignoring as 'gosuO ptions.failOnError = false' was specified. - Add the following lines to the top of the
build.gradlefile.tasks.compileGosu.gosuOptions.failOnError = true tasks.compileGosu.gosuOptions.maxErrs = 10At the command prompt run the gwb compile command. If the number of compilation errors after completing compilation of any Gosu file is greater than
maxErrs, the compilation task terminates. Output similar to the following lines appears.Error threshold of 10 exceeded; aborting compilation. gosuc completed with 12 errors. Warnings were disabled. :modules:configuration:compileGosu FAILED FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':modules:configuration:compileGosu'. > Compilation failed with exit code 1; see the compiler error output for details. - Add the following line to the top of the
build.gradlefile.tasks.compileGosu.options.warnings = true tasks.compileGosu.gosuOptions.maxWarns = 100At the command prompt run the gwb compile command. If the number of compilation warnings after completing compilation of any Gosu file is greater than
maxWarns, the compilation task terminates. Output similar to the following lines appears.Warning threshold of 100 exceeded; aborting compilation. gosuc completed with 129 warnings and 0 errors. :modules:configuration:compileGosu FAILED FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':modules:configuration:compileGosu'. > Compilation failed with exit code 1; see the compiler error output for details. - Add the following line to the top of the
build.gradlefile.tasks.compileGosu.gosuOptions.verbose = trueAt the command prompt run the gwb compile command. Output similar to the following lines appears.
gosuc: about to compile file: C:\Guidewire\PolicyCenter\modules\configuration\gsrc\gw\policy \PolicyPeriodSearchCriteria.gs gosuc: about to compile file: C:\Guidewire\PolicyCenter\modules\configuration\gsrc\gw\policy \PolicyPeriodSideBySideEnhancement.gsx
See also
