wrapper {
    gradleVersion = "5.6.2"
    distributionUrl = "https://services.gradle.org/distributions/gradle-$gradleVersion-all.zip"
}

allprojects {
    apply plugin: 'eclipse'
    if (JavaVersion.current().isJava8Compatible()) {
        //Disable lint of javadoc until someone fixes all the html
        tasks.withType(Javadoc) {
          options.addStringOption('Xdoclint:none', '-quiet')
      }
    }
}

def gitCurBranch() {
    def branchName = System.getenv('TRAVIS_BRANCH')

    if (branchName) return branchName
    def process = "git rev-parse --abbrev-ref HEAD".execute()
    return process.text.trim()
}

subprojects {
    apply plugin: 'java'
    apply plugin: 'maven'

    def config = new ConfigSlurper().parse(new File("$projectDir/src/main/resources/version.properties").toURI().toURL())

    group = 'org.ethereum'

    version = config.versionNumber + ("master" == gitCurBranch() ? "-RELEASE" : "-SNAPSHOT")

    println("Building version: " + version + " (from branch " + gitCurBranch() + ")")

    compileJava.options.encoding = 'UTF-8'
    compileJava.options.compilerArgs << '-XDignore.symbol.file'

    compileTestJava.options.encoding = 'UTF-8'

    repositories {
        jcenter()
        maven { url "https://dl.bintray.com/ethereum/maven/" }
    }
}
