|
| 1 | +plugins { |
| 2 | + id 'com.github.hierynomus.license' version '0.13.1' |
| 3 | + id 'net.researchgate.release' version '2.4.0' |
| 4 | + id 'org.sonarqube' version '2.2.1' |
| 5 | +} |
| 6 | + |
| 7 | +apply plugin: 'maven' |
| 8 | +apply plugin: 'osgi' |
| 9 | +apply plugin: 'java' |
| 10 | +apply plugin: 'maven-publish' |
| 11 | +apply plugin: 'signing' |
| 12 | +apply plugin: 'checkstyle' |
| 13 | +apply plugin: 'com.github.hierynomus.license' |
| 14 | +apply plugin: 'jacoco' |
| 15 | + |
| 16 | +sourceCompatibility = 1.8 |
| 17 | +targetCompatibility = 1.8 |
| 18 | + |
| 19 | + |
| 20 | +group = 'edu.amherst.acdc' |
| 21 | +description = 'Trellis Namespace Service' |
| 22 | + |
| 23 | +ext { |
| 24 | + vendor = 'Amherst College' |
| 25 | + homepage = 'https://www.amherst.edu' |
| 26 | + docURL = 'https://acdc.amherst.edu/wiki' |
| 27 | + license = 'Apache 2' |
| 28 | + |
| 29 | + /* Dependencies */ |
| 30 | + trellisSpiVersion = '0.1.0-SNAPSHOT' |
| 31 | + |
| 32 | + /* Testing */ |
| 33 | + junitVersion = '4.12' |
| 34 | + |
| 35 | + /* OSGi */ |
| 36 | + projectOsgiVersion = project.version.replaceAll("-SNAPSHOT", ".SNAPSHOT") |
| 37 | +} |
| 38 | + |
| 39 | +configurations { |
| 40 | + buildToolsConfig |
| 41 | +} |
| 42 | + |
| 43 | +dependencies { |
| 44 | + compile group: 'edu.amherst.acdc', name: 'trellis-spi', version: trellisSpiVersion |
| 45 | + |
| 46 | + testCompile group: 'junit', name: 'junit', version: junitVersion |
| 47 | + |
| 48 | + buildToolsConfig 'edu.amherst.acdc:acrepo-build-tools:0.2.0' |
| 49 | +} |
| 50 | + |
| 51 | +repositories { |
| 52 | + jcenter() |
| 53 | + mavenCentral() |
| 54 | + mavenLocal() |
| 55 | + // TODO -- remove this after the first release of the API |
| 56 | + maven { |
| 57 | + url "https://oss.sonatype.org/content/repositories/snapshots" |
| 58 | + } |
| 59 | +} |
| 60 | + |
| 61 | +gradle.projectsEvaluated { |
| 62 | + tasks.withType(JavaCompile) { |
| 63 | + options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation" |
| 64 | + } |
| 65 | +} |
| 66 | + |
| 67 | +release { |
| 68 | + tagTemplate = '$name-$version' |
| 69 | +} |
| 70 | + |
| 71 | +jar { |
| 72 | + manifest { |
| 73 | + description project.description |
| 74 | + docURL project.docURL |
| 75 | + vendor project.vendor |
| 76 | + license project.license |
| 77 | + |
| 78 | + instruction 'Import-Package', '*' |
| 79 | + instruction 'Export-Package', "edu.amherst.acdc.trellis.service.id;version=${projectOsgiVersion}" |
| 80 | + } |
| 81 | +} |
| 82 | + |
| 83 | +task sourceJar(type: Jar) { |
| 84 | + classifier 'sources' |
| 85 | + from sourceSets.main.allSource |
| 86 | +} |
| 87 | + |
| 88 | +task javadocJar(type: Jar) { |
| 89 | + classifier 'javadoc' |
| 90 | + from javadoc |
| 91 | +} |
| 92 | + |
| 93 | +artifacts { |
| 94 | + archives javadocJar |
| 95 | + archives sourceJar |
| 96 | + archives (file('build/resources/main/features.xml')) { |
| 97 | + classifier 'features' |
| 98 | + type 'xml' |
| 99 | + } |
| 100 | +} |
| 101 | + |
| 102 | +jacoco { |
| 103 | + toolVersion = "0.7.6.201602180812" |
| 104 | +} |
| 105 | + |
| 106 | +license { |
| 107 | + include "**/*.java" |
| 108 | + header rootProject.file('build/license/HEADER.txt') |
| 109 | + strictCheck true |
| 110 | + mapping { |
| 111 | + java = 'SLASHSTAR_STYLE' |
| 112 | + } |
| 113 | +} |
| 114 | + |
| 115 | +publishing { |
| 116 | + publications { |
| 117 | + maven(MavenPublication) { |
| 118 | + from components.java |
| 119 | + } |
| 120 | + } |
| 121 | +} |
| 122 | + |
| 123 | +processResources { |
| 124 | + outputs.upToDateWhen { false } |
| 125 | + expand project.properties |
| 126 | +} |
| 127 | + |
| 128 | +signing { |
| 129 | + required { !version.endsWith("SNAPSHOT") && gradle.taskGraph.hasTask("uploadArchives") } |
| 130 | + sign configurations.archives |
| 131 | +} |
| 132 | + |
| 133 | +uploadArchives { |
| 134 | + repositories.mavenDeployer { |
| 135 | + def sonatypeUsername = project.hasProperty('ossrhUsername') ? ossrhUsername : "" |
| 136 | + def sonatypePassword = project.hasProperty('ossrhPassword') ? ossrhPassword : "" |
| 137 | + beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) } |
| 138 | + |
| 139 | + repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") { |
| 140 | + authentication(userName: sonatypeUsername, password: sonatypePassword) |
| 141 | + } |
| 142 | + |
| 143 | + snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") { |
| 144 | + authentication(userName: sonatypeUsername, password: sonatypePassword) |
| 145 | + } |
| 146 | + |
| 147 | + pom.project { |
| 148 | + packaging 'jar' |
| 149 | + url 'https://acdc.amherst.edu/wiki' |
| 150 | + inceptionYear '2017' |
| 151 | + name 'Amherst College Trellis Repository namespace service' |
| 152 | + description 'The namespace service for a trellis repository' |
| 153 | + |
| 154 | + organization { |
| 155 | + name project.vendor |
| 156 | + url project.homepage |
| 157 | + } |
| 158 | + |
| 159 | + developers { |
| 160 | + developer { |
| 161 | + id 'acoburn' |
| 162 | + name 'Aaron Coburn' |
| 163 | + email 'acoburn @ (domain of organization url)' |
| 164 | + organization 'Amherst College' |
| 165 | + organizationUrl 'https://www.amherst.edu' |
| 166 | + roles { |
| 167 | + role 'developer' |
| 168 | + } |
| 169 | + timezone '-5' |
| 170 | + } |
| 171 | + developer { |
| 172 | + id 'bseeger' |
| 173 | + name 'Bethany Seeger' |
| 174 | + email 'bseeger @ (domain of organization url)' |
| 175 | + organization 'Amherst College' |
| 176 | + organizationUrl 'https://www.amherst.edu' |
| 177 | + roles { |
| 178 | + role 'developer' |
| 179 | + } |
| 180 | + timezone '-5' |
| 181 | + } |
| 182 | + } |
| 183 | + |
| 184 | + scm { |
| 185 | + connection 'scm:git:git://github.com/acoburn/trellis-service-namespaces-json.git' |
| 186 | + developerConnection 'scm:git:[email protected]/acoburn/trellis-service-namespaces-json.git' |
| 187 | + url 'https://github.com/acoburn/trellis-service-namespaces-json' |
| 188 | + tag 'HEAD' |
| 189 | + } |
| 190 | + |
| 191 | + licenses { |
| 192 | + license { |
| 193 | + name 'Apache License, Version 2.0' |
| 194 | + url 'http://www.apache.org/licenses/LICENSE-2.0' |
| 195 | + comments 'Copyright (c) 2017 Amherst College' |
| 196 | + } |
| 197 | + } |
| 198 | + } |
| 199 | + } |
| 200 | +} |
| 201 | + |
| 202 | +task processBuildTools(type: Copy) { |
| 203 | + from { |
| 204 | + configurations.buildToolsConfig.collect { |
| 205 | + zipTree(it).matching { |
| 206 | + include 'checkstyle/*.xml' |
| 207 | + include 'license/*.txt' |
| 208 | + } |
| 209 | + } |
| 210 | + } |
| 211 | + into 'build' |
| 212 | +} |
| 213 | + |
| 214 | +checkstyle { |
| 215 | + configFile = rootProject.file('build/checkstyle/checkstyle.xml') |
| 216 | + configProperties.checkstyleConfigDir = rootProject.file('build/checkstyle/') |
| 217 | +} |
| 218 | + |
| 219 | +sonarqube { |
| 220 | + properties { |
| 221 | + property "sonar.projectName", "Amherst College Trellis Repository Namespace Service" |
| 222 | + property "sonar.projectKey", "edu.amherst.acdc:trellis-service-namespaces-json" |
| 223 | + } |
| 224 | +} |
| 225 | + |
| 226 | +task docs(type: Javadoc) { |
| 227 | + source sourceSets.main.allJava |
| 228 | + classpath = files(sourceSets.main.compileClasspath) |
| 229 | + destinationDir = new File(projectDir, "docs/${version}") |
| 230 | +} |
| 231 | + |
| 232 | +checkstyleMain.dependsOn processBuildTools |
| 233 | +afterReleaseBuild.dependsOn docs |
| 234 | + |
0 commit comments