|
| 1 | +compileJava { |
| 2 | + sourceCompatibility = rootProject.ext.javaVersion |
| 3 | + targetCompatibility = rootProject.ext.javaVersion |
| 4 | + |
| 5 | + // Show all warnings except boot classpath |
| 6 | + configure(options) { |
| 7 | + compilerArgs << "-Xlint:all" // Turn on all warnings |
| 8 | + compilerArgs << "-Xlint:-options" // Turn off "missing" bootclasspath warning |
| 9 | + compilerArgs << "-Werror" // Turn warnings into errors |
| 10 | + compilerArgs << "-Xdiags:verbose" // Turn on verbose errors |
| 11 | + encoding = "utf-8" |
| 12 | + incremental = true |
| 13 | + fork = true |
| 14 | + } |
| 15 | +} |
| 16 | + |
| 17 | +compileGroovy { |
| 18 | + sourceCompatibility = rootProject.ext.javaVersion |
| 19 | + targetCompatibility = rootProject.ext.javaVersion |
| 20 | + |
| 21 | + // Show all warnings except boot classpath |
| 22 | + configure(options) { |
| 23 | + compilerArgs << "-Xlint:all" // Turn on all warnings |
| 24 | + compilerArgs << "-Xlint:-options" // Turn off "missing" bootclasspath warning |
| 25 | + compilerArgs << "-Werror" // Turn warnings into errors |
| 26 | + compilerArgs << "-Xdiags:verbose" // Turn on verbose errors |
| 27 | + encoding = "utf-8" |
| 28 | + incremental = true |
| 29 | + fork = true |
| 30 | + } |
| 31 | + |
| 32 | + configure(groovyOptions) { |
| 33 | + encoding = "utf-8" |
| 34 | + fork = true |
| 35 | + } |
| 36 | +} |
| 37 | + |
| 38 | +test { |
| 39 | + // Turn on logging for all tests, filter to show failures/skips only |
| 40 | + testLogging { |
| 41 | + exceptionFormat "full" |
| 42 | + showCauses true |
| 43 | + showExceptions true |
| 44 | + showStackTraces true |
| 45 | + events "failed", "skipped" |
| 46 | + } |
| 47 | + |
| 48 | + def maxWorkerCount = gradle.startParameter.maxWorkerCount |
| 49 | + maxParallelForks = (maxWorkerCount < 2) ? 1 : maxWorkerCount / 2 |
| 50 | +} |
| 51 | + |
| 52 | +javadoc { |
| 53 | + title = "${project.name} ${project.version}" |
| 54 | + configure(options) { |
| 55 | + header = project.name |
| 56 | + encoding "UTF-8" |
| 57 | + docEncoding "UTF-8" |
| 58 | + charSet "UTF-8" |
| 59 | + linkSource true |
| 60 | + author = true |
| 61 | + links("http://docs.oracle.com/javase/8/docs/api/", |
| 62 | + "http://docs.oracle.com/javaee/7/api/") |
| 63 | + exclude "**/*Test.java" |
| 64 | + if (JavaVersion.current().isJava8Compatible()) addStringOption("Xdoclint:none", "-quiet") |
| 65 | + } |
| 66 | +} |
| 67 | + |
| 68 | +groovydoc { |
| 69 | + docTitle = "${project.name} ${project.version}" |
| 70 | + header = project.name |
| 71 | + link("http://docs.oracle.com/javase/8/docs/api/", |
| 72 | + "http://docs.oracle.com/javaee/7/api/", |
| 73 | + "http://groovy.codehaus.org/gapi/") |
| 74 | + exclude "**/*Spec.java" |
| 75 | +} |
| 76 | + |
| 77 | +// Prevent forked processes from stealing focus (on MacOS at least) |
| 78 | +tasks.withType(JavaForkOptions) { |
| 79 | + // should improve memory on a 64bit JVM |
| 80 | + jvmArgs "-XX:+UseCompressedOops" |
| 81 | + // should avoid GradleWorkerMain to steal focus |
| 82 | + jvmArgs "-Djava.awt.headless=true" |
| 83 | + jvmArgs "-Dapple.awt.UIElement=true" |
| 84 | +} |
0 commit comments