|
| 1 | +import java.text.SimpleDateFormat |
| 2 | + |
| 3 | +buildscript { |
| 4 | + repositories { |
| 5 | + mavenCentral() |
| 6 | + } |
| 7 | +} |
| 8 | + |
| 9 | +plugins { |
| 10 | + id "com.jfrog.bintray" version "1.8.4" |
| 11 | +} |
| 12 | + |
| 13 | +apply plugin: 'java' |
| 14 | +apply plugin: 'groovy' |
| 15 | +apply plugin: 'maven-publish' |
| 16 | +apply plugin: 'com.jfrog.bintray' |
| 17 | + |
| 18 | +def getDevelopmentVersion() { |
| 19 | + def output = new StringBuilder() |
| 20 | + def error = new StringBuilder() |
| 21 | + def gitShortHash = "git -C ${projectDir} rev-parse --short HEAD".execute() |
| 22 | + gitShortHash.waitForProcessOutput(output, error) |
| 23 | + def gitHash = output.toString().trim() |
| 24 | + if (gitHash.isEmpty()) { |
| 25 | + println "git hash is empty: error: ${error.toString()}" |
| 26 | + throw new IllegalStateException("git hash could not be determined") |
| 27 | + } |
| 28 | + new SimpleDateFormat('yyyy-MM-dd\'T\'HH-mm-ss').format(new Date()) + "-" + gitHash |
| 29 | +} |
| 30 | + |
| 31 | + |
| 32 | +def releaseVersion = System.env.RELEASE_VERSION |
| 33 | +version = releaseVersion ? releaseVersion : getDevelopmentVersion() |
| 34 | +group = 'com.graphql-java' |
| 35 | + |
| 36 | +sourceCompatibility = 1.8 |
| 37 | +targetCompatibility = 1.8 |
| 38 | + |
| 39 | +repositories { |
| 40 | + mavenCentral() |
| 41 | + maven { url "http://dl.bintray.com/andimarek/graphql-java" } |
| 42 | +} |
| 43 | + |
| 44 | + |
| 45 | +dependencies { |
| 46 | + compile "com.graphql-java:graphql-java:12.0" |
| 47 | + |
| 48 | + testCompile 'org.spockframework:spock-core:1.1-groovy-2.4' |
| 49 | + testCompile 'org.codehaus.groovy:groovy-all:2.4.13' |
| 50 | +} |
| 51 | + |
| 52 | +task sourcesJar(type: Jar, dependsOn: classes) { |
| 53 | + classifier = 'sources' |
| 54 | + from sourceSets.main.allSource |
| 55 | +} |
| 56 | + |
| 57 | +task javadocJar(type: Jar, dependsOn: javadoc) { |
| 58 | + classifier = 'javadoc' |
| 59 | + from javadoc.destinationDir |
| 60 | +} |
| 61 | + |
| 62 | +artifacts { |
| 63 | + archives sourcesJar |
| 64 | + archives javadocJar |
| 65 | +} |
| 66 | + |
| 67 | +publishing { |
| 68 | + publications { |
| 69 | + maven(MavenPublication) { |
| 70 | + from components.java |
| 71 | + groupId group |
| 72 | + artifactId 'graphql-java-extended-validation' |
| 73 | + version version |
| 74 | + |
| 75 | + artifact sourcesJar |
| 76 | + artifact javadocJar |
| 77 | + |
| 78 | + pom.withXml { |
| 79 | + asNode().children().last() + { |
| 80 | + resolveStrategy = Closure.DELEGATE_FIRST |
| 81 | + name 'graphql-java-extended-validation' |
| 82 | + description 'A library fo extended validation for graphql-java' |
| 83 | + url 'https://github.com/graphql-java/graphql-java-extended-validation' |
| 84 | + inceptionYear '2019' |
| 85 | + |
| 86 | + scm { |
| 87 | + url 'https://github.com/graphql-java/graphql-java-extended-validation' |
| 88 | + connection 'scm:git@github.com:graphql-java/graphql-java-extended-validation.git' |
| 89 | + developerConnection 'scm:git@github.com:graphql-java/graphql-java-extended-validation.git' |
| 90 | + } |
| 91 | + |
| 92 | + licenses { |
| 93 | + license { |
| 94 | + name 'MIT' |
| 95 | + url 'https://github.com/graphql-java/graphql-java/blob/master/LICENSE.md' |
| 96 | + distribution 'repo' |
| 97 | + } |
| 98 | + } |
| 99 | + |
| 100 | + developers { |
| 101 | + developer { |
| 102 | + id 'bbakerman' |
| 103 | + name 'Brad Baker' |
| 104 | + email 'bbakerman@gmail.com' |
| 105 | + } |
| 106 | + } |
| 107 | + } |
| 108 | + } |
| 109 | + } |
| 110 | + } |
| 111 | +} |
| 112 | + |
| 113 | +bintray { |
| 114 | + user = System.getenv('BINTRAY_USER') |
| 115 | + key = System.getenv('BINTRAY_API_KEY') |
| 116 | + publications = ['maven'] |
| 117 | + publish = true |
| 118 | + pkg { |
| 119 | + userOrg = 'graphql-java' |
| 120 | + repo = 'graphql-java' |
| 121 | + name = "graphql-java-extended-validation" |
| 122 | + desc = 'A library fo extended validation for graphql-java' |
| 123 | + licenses = ['MIT'] |
| 124 | + vcsUrl = 'https://github.com/graphql-java/graphql-java-extended-validation.git' |
| 125 | + version { |
| 126 | + released = new Date() |
| 127 | + vcsTag = project.version |
| 128 | + gpg { |
| 129 | + sign = true |
| 130 | + } |
| 131 | + } |
| 132 | + } |
| 133 | +} |
0 commit comments