buildscript {
    repositories {
        mavenLocal()
        jcenter()
       maven {
         url "https://plugins.gradle.org/m2/"
        }
    }
    dependencies {
        classpath 'com.google.cloud.tools:appengine-gradle-plugin:1.3.5'
        classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
        classpath "org.jfrog.buildinfo:build-info-extractor-gradle:4.6.2"
    }
}

subprojects{

apply plugin: 'java'
apply plugin: 'com.jfrog.artifactory'
apply plugin: 'com.jfrog.bintray'
apply plugin: 'maven-publish'
apply plugin: 'com.google.cloud.tools.appengine'

repositories {
    mavenLocal()
    mavenCentral()
    jcenter()
    maven { url 'https://oss.jfrog.org/artifactory/oss-snapshot-local' }
}

processResources {
       from 'src/main/java'
       from 'src/main/resources'
}
    
dependencies {
    compile 'com.google.appengine:appengine-api-1.0-sdk:1.9.53'

    //vintage module is needed because of WicketTester
    testCompile group: 'org.junit.vintage', name: 'junit-vintage-engine', version: junit_version

    testCompile group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: junit_version
    testRuntimeOnly group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: junit_version
}

test {
    useJUnitPlatform()
}

// run gradle with "-Dsnapshot=true" to automatically append "-SNAPSHOT" to the version
version = '3.2.0' + (Boolean.valueOf(System.getProperty("snapshot")) ? "-SNAPSHOT" : "")
sourceCompatibility = 1.8

ext {
    bintrayUser = System.getProperty("bintray.user")
    bintrayKey = System.getProperty("bintray.key")
    buildNumber = System.getProperty("build.number")
}

task sourcesJar(type: Jar, dependsOn: classes) {
    classifier = 'sources'
    from sourceSets.main.output
    from sourceSets.main.allSource
}

javadoc.failOnError = false
task javadocJar(type: Jar, dependsOn: javadoc) {
    classifier = 'javadoc'
    from javadoc.destinationDir
}

artifacts {
    archives sourcesJar
    archives javadocJar
}

def pomConfig = {
    licenses {
        license {
            name "The Apache Software License, Version 2.0"
            url "http://www.apache.org/licenses/LICENSE-2.0.txt"
            distribution "repo"
        }
    }
    developers {
        developer {
            id "thombergs"
            name "Tom Hombergs"
            email "tom.hombergs@gmail.com"
        }
    }

    scm {
        url "https://github.com/adessoag/wicked-charts"
    }
}

publishing {
    publications {
        mavenPublication(MavenPublication) {
            from components.java
            artifact sourcesJar {
                classifier "sources"
            }
            artifact javadocJar {
                classifier "javadoc"
            }
            groupId 'de.adesso.wicked-charts'
            artifactId 'wicked-charts-showcase-options'
            version '3.2.0-SNAPSHOT'
            pom.withXml {
                def root = asNode()
                root.appendNode('description', 'Beautiful Charts for Java-based Web Applications')
                root.appendNode('name', 'Wicked Charts')
                root.appendNode('url', 'https://github.com/adessoag/wicked-charts')
                root.children().last() + pomConfig
            }
        }
    }
}

artifactory {
    contextUrl = 'http://oss.jfrog.org'
    publish {
        repository {
            repoKey = 'oss-snapshot-local'
            username = bintrayUser
            password = bintrayKey
        }
        defaults {
            publications('mavenPublication')
            publishArtifacts = true
            publishPom = true
            properties = [
                    'build.number': buildNumber,
                    'build.name'  : 'wicked-charts'
            ]
        }
    }
    resolve {
        repoKey = 'jcenter'
    }
    clientConfig.info.setBuildNumber(buildNumber)
    clientConfig.info.setBuildName('wicked-charts')
}

bintray {
    user = bintrayUser
    key = bintrayKey
    publications = ['mavenPublication']

    pkg {
        repo = 'wicked-charts'
        name = 'wicked-charts'
        userOrg = 'adessoag'
        licenses = ['Apache-2.0']
        vcsUrl = 'https://github.com/adessoag/wicked-charts'
        version {
            name = project.version
            desc = "build ${buildNumber}"
            released = new Date()
        }
    }

    publish = true
}
}






