project.ext.isReleaseVersion = !"${stubbyProjectVersion}".endsWith("SNAPSHOT")

buildscript {
    repositories {
        mavenLocal()
        repositories {
            maven {
                url "https://plugins.gradle.org/m2/"
            }
        }
    }
    dependencies {
        // From v6.14.0 (inc.) Java 8 support is dropped
        classpath("com.diffplug.spotless:spotless-plugin-gradle:6.13.0")
    }
}

apply plugin: "java-library"
apply plugin: "maven-publish"
apply plugin: "signing"
apply plugin: "idea"
apply plugin: "eclipse"
apply plugin: "jacoco"
apply plugin: "jvm-test-suite"

defaultTasks 'clean', 'test', 'integrationTest', 'functionalTest', 'build'
description = 'Gradle configuration for stubby4j'

compileJava {
    options.encoding = 'UTF-8'
    options.compilerArgs << '-parameters' << '-Xlint:deprecation'
}

compileTestJava {
    options.encoding = 'UTF-8'
}

javadoc {
    if (JavaVersion.current().isJava8Compatible()) {
        options.addStringOption('Xdoclint:none', '-quiet')
    }
}

repositories {
    mavenLocal()
    mavenCentral()
}

apply from: "$rootDir/conf/gradle/dependencies.gradle"
apply from: "$rootDir/conf/gradle/ide.gradle"
apply from: "$rootDir/conf/gradle/tests.gradle"
apply from: "$rootDir/conf/gradle/jacoco.gradle"
apply from: "$rootDir/conf/gradle/artifacts.gradle"
apply from: "$rootDir/conf/gradle/sonatype.gradle"

// Disabling the Spotless plugin on Ci due to its v6.13.0 incompatability with JDK 21 
if (!project.hasProperty("ciRun")) {
    apply from: "$rootDir/conf/gradle/spotless.gradle"
}

