/*
 * This file was generated by the Gradle 'init' task.
 *
 * This generated file contains a sample Java Library project to get you started.
 * For more details take a look at the Java Libraries chapter in the Gradle
 * User Manual available at https://docs.gradle.org/5.6.2/userguide/java_library_plugin.html
 */

plugins {
  id 'io.github.gradle-nexus.publish-plugin' version '1.1.0'
  id "com.dorongold.task-tree" version "2.1.0"
}

ext {
  defaultVersion = '1.28.0'
}

def defaultGroupId      = 'com.appland'
def publishGroupId      = findProperty('publishGroupId') ?: defaultGroupId
group = publishGroupId
version = defaultVersion

nexusPublishing {
    repositories {
        sonatype {

            // this is evaluated even when task itself is not invoked
            // so we use fault-tolerant `findProperty` instead of strict `getProperty`
            // solely in order to allow building artifacts 
            // without runtime configuration (e.g. in context of Docker build)

            // see https://central.sonatype.org/pages/gradle.html
            def default_base        = "https://s01.oss.sonatype.org"
            def url_base            = findProperty("mavenRepoURL") ?: default_base

            nexusUrl                = uri(  url_base + "/service/local/")
            snapshotRepositoryUrl   = uri(  url_base + "/content/repositories/snapshots" )
            username                = project.findProperty('ossrhUsername')
            password                = project.findProperty('ossrhPassword')
        }
    }
}

subprojects {
  apply plugin: 'java-library'
  apply plugin: 'checkstyle'

  checkstyle {
    toolVersion = "9.3"
    configFile = rootProject.file("config/checkstyle/checkstyle.xml")
  }
}
