plugins {
    id 'com.github.johnrengelman.shadow' version '2.0.1'
    id 'java'
}

group 'com.mollin.yapi'
version '1.0'

sourceCompatibility = 1.8

repositories {
    mavenCentral()
}

ext {
    GSON_V = '2.8.2'
    JUNIT_V = '4.12'
    JUNIT_PARAMS_V = '1.1.0'
    ASSERTJ_V = '3.8.0'
    TINYLOG_V = '1.2'
    POWERMOCK_V = '1.7.3'
}

dependencies {
    compile "com.google.code.gson:gson:$GSON_V"
    compile "org.tinylog:tinylog:$TINYLOG_V"
    testCompile "junit:junit:$JUNIT_V"
    testCompile "pl.pragmatists:JUnitParams:$JUNIT_PARAMS_V"
    testCompile "org.assertj:assertj-core:$ASSERTJ_V"
    testCompile "org.powermock:powermock-module-junit4:$POWERMOCK_V"
    testCompile "org.powermock:powermock-api-mockito2:$POWERMOCK_V"
}

sourceSets {
    main {
        java {
            exclude 'com/mollin/yapi/_*.java'
        }
    }
}

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

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

task generateJars() {
    dependsOn 'check'
    dependsOn 'jar'
    dependsOn 'sourcesJar'
    dependsOn 'javadocJar'
    dependsOn 'shadowJar'
}
