/*
 *  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
 *
 *    https://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing,
 *  software distributed under the License is distributed on an
 *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 *  KIND, either express or implied.  See the License for the
 *  specific language governing permissions and limitations
 *  under the License.
 */

compileJava.options.release = javaVersion.toInteger()

extensions.configure(JavaPluginExtension)  {
    it.withJavadocJar()
    it.withSourcesJar()
}

tasks.withType(Javadoc).configureEach { Javadoc it ->
    it.options.noTimestamp true // prevent the file header with the date
    it.options.bottom "Generated ${formattedBuildDate} (UTC)"
}

// JavaCompile is not configured because we put java files inside of the groovy source sets

tasks.withType(GroovyCompile).configureEach {
    groovyOptions.encoding = 'UTF-8' // encoding needs to be the same since it's different across platforms
    // Preserve method parameter names in Groovy classes for IDE parameter hints.
    groovyOptions.parameters = true
    options.encoding = 'UTF-8' // encoding needs to be the same since it's different across platforms
    options.fork = true
    options.forkOptions.jvmArgs = ['-Xms128M', '-Xmx2G']
}