import java.text.SimpleDateFormat

apply plugin: 'signing'

Date buildTimeAndDate = new Date()
ext {
    buildTime = new SimpleDateFormat('yyyy-MM-dd').format(buildTimeAndDate)
    buildDate = new SimpleDateFormat('HH:mm:ss.SSSZ').format(buildTimeAndDate)
}

jar {
    manifest {
        attributes(
                'Built-By': System.properties['user.name'],
                'Created-By': System.properties['java.version'] + " (" + System.properties['java.vendor'] + " " + System.getProperty("java.vm.version") + ")",
                'Build-Date': project.buildTime,
                'Build-Time': project.buildDate,
                'Specification-Title': project.name,
                'Specification-Version': project.version,
        )
    }
}

javadoc {
    failOnError false
}

task javadocJar(type: Jar, dependsOn: javadoc) {
    classifier = 'javadoc'
    from 'build/docs/javadoc'
}

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

artifacts {
    archives jar
    archives javadocJar
    archives sourcesJar
}

buildscript {
    repositories {
        jcenter()

    }
    dependencies {
        //Check for the latest version here: http://plugins.gradle.org/plugin/com.jfrog.artifactory
        classpath "org.jfrog.buildinfo:build-info-extractor-gradle:3.0.3"
    }
}

apply from: 'gradle/publishing-maven.gradle'
apply from: 'gradle/publishing-jcenter.gradle'

