blob: 896b24a404083cdc9514d297cfb9acdcd290e1c1 [file] [log] [blame]
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
// This file contains common compiler configurations.
// JVM based compiler configuration
tasks.withType(AbstractCompile) {
sourceCompatibility = "1.$javaCompatibility"
targetCompatibility = "1.$javaCompatibility"
// --release is the recommended way to select the target release, but it's only supported in
// Java 9+ so we also set -source and -target via `sourceCompatibility` and `targetCompatibility`.
// If/when Gradle supports `--release` natively (,
// we should switch to that.
if (JavaVersion.current().isJava9Compatible()) {
options.compilerArgs << "--release" << "$javaCompatibility"
options.encoding = encoding // make sure the encoding is defined by the project and not the system default.
options.incremental = true // enable incremental compilation.
options.compilerArgs << '-proc:none' // Ignore leaked annotation processors on the compile classpath.
// Scala compiler configuration
tasks.withType(ScalaCompile) {
scalaCompileOptions.encoding = encoding // make sure the encoding is defined by the project and not the system default.
scalaCompileOptions.additionalParameters = [
// Emit warning and location for usages of features that should be imported explicitly.
// Emit various static analysis warnings.