All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.gosulang.gradle.tasks.compile.GosuCompileOptions Maven / Gradle / Ivy

Go to download

Gosu language compiler for Gradle. Built with Gradle 5.1.1. This has also been tested extensively with Gradle version(s): 5.1.1 ** Gradle versions below 2.12 are no longer supported ** Projects applying this plugin require a compile-time dependency on the gosu-core-api library. This version requires Gosu 1.13.9 or greater, or 1.14.2 or greater. Please include this in the depencencies closure: dependencies { compile group: 'org.gosu-lang.gosu', name: 'gosu-core-api', version: '1.14.12' }

There is a newer version: 6.0.1
Show newest version
package org.gosulang.gradle.tasks.compile;

import org.gradle.api.tasks.Console;
import org.gradle.api.tasks.Input;
import org.gradle.api.tasks.Nested;
import org.gradle.api.tasks.Optional;
import org.gradle.api.tasks.compile.AbstractOptions;
import org.gradle.api.tasks.compile.ForkOptions;

public class GosuCompileOptions extends AbstractOptions {

  //for some reason related to Java reflection, we need to name these private fields exactly like their getters/setters (no leading '_')
  private boolean checkedArithmetic = false;
  private boolean failOnError = true;
  private boolean fork = true;
  private ForkOptions forkOptions = new ForkOptions();
  private boolean verbose = false;
  private Integer maxwarns;
  private Integer maxerrs;

  /**
   * Tells whether the compilation task should fail if compile errors occurred. Defaults to {@code true}.
   * @return the failOnError property
   */
  @Input
  public boolean isFailOnError() {
    return failOnError;
  }

  /**
   * Sets whether the compilation task should fail if compile errors occurred. Defaults to {@code true}.
   * @param failOnError Fail the compilation task if compile errors occur
   */
  public void setFailOnError(boolean failOnError) {
    this.failOnError = failOnError;
  }

  /**
   * @return Whether to run the Gosu compiler in a separate process. Defaults to {@code true}.
   */
  @Input
  public boolean isFork() {
    return fork;
  }

  /**
   * @param fork Sets whether to run the Gosu compiler in a separate process. Defaults to {@code true}.
   */
  public void setFork(boolean fork) {
    this.fork = fork;
  }

  /**
   * @return options for running the Gosu compiler in a separate process. These options only take effect
   * if {@code fork} is set to {@code true}.
   */
  @Nested
  public ForkOptions getForkOptions() {
    return forkOptions;
  }

  /**
   * @param forkOptions Set these options for running the Gosu compiler in a separate process. These options only take effect
   * if {@code fork} is set to {@code true}.
   */
  public void setForkOptions(ForkOptions forkOptions) {
    this.forkOptions = forkOptions;
  }

  /**
   * @return Whether compilation with checked arithmetic operations is enabled or not. 
   */
  @Input
  public boolean isCheckedArithmetic() {
    return checkedArithmetic;
  }

  /**
   * If true, Gosu classes will be compiled with {@code -DcheckedArithmetic=true}.  Defaults to {@code false}.
   * @param checkedArithmetic Whether to compile with checked arithmetic
   */
  public void setCheckedArithmetic(boolean checkedArithmetic) {
    this.checkedArithmetic = checkedArithmetic;
  }
  
  /**
   * Sets whether the compilation task should use verbose logging. Defaults to {@code false}.
   * @param verbose Use verbose logging
   */
  public void setVerbose(boolean verbose) {
    this.verbose = verbose;
  }

  /**
   * @return Whether to use verbose logging. Defaults to {@code false}.
   */
  @Console
  public boolean isVerbose() {
    return verbose;
  }

  public void setMaxWarns(int maxwarns) {
    this.maxwarns = maxwarns;
  }

  /**
   * @return Max error threshold, if specified. May be null.
   */
  @Input
  @Optional
  public Integer getMaxWarns() {
    return maxwarns;
  }

  public void setMaxErrs(int maxerrs) {
    this.maxerrs = maxerrs;
  }

  /**
   * @return Max error threshold, if specified. May be null.
   */
  @Input
  @Optional
  public Integer getMaxErrs() {
    return maxerrs;
  }
  
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy