Skip to content

Commit 1dea805

Browse files
author
Jan Schäfer
committed
fix publishing
1 parent 81358f6 commit 1dea805

File tree

1 file changed

+151
-155
lines changed

1 file changed

+151
-155
lines changed

build.gradle

+151-155
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ buildscript {
77
dependencies {
88
classpath 'org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.6.3'
99
classpath 'org.asciidoctor:asciidoctor-gradle-plugin:1.5.3'
10-
classpath "io.codearte.gradle.nexus:gradle-nexus-staging-plugin:0.5.3"
1110
}
1211
}
1312

@@ -21,7 +20,6 @@ plugins {
2120
apply plugin: 'com.github.kt3k.coveralls'
2221
apply plugin: 'org.asciidoctor.convert'
2322
apply plugin: 'project-report'
24-
apply plugin: 'io.codearte.nexus-staging'
2523

2624
description = 'JGiven - BDD in plain Java'
2725

@@ -54,10 +52,6 @@ asciidoctor {
5452
attributes 'version': version
5553
}
5654

57-
nexusStaging {
58-
stagingProfileId = stagingProfileId // stagingProfileId must be defined externally
59-
}
60-
6155
subprojects{
6256
ext {
6357
junitDataproviderVersion = '1.11.0'
@@ -79,7 +73,140 @@ subprojects{
7973
}
8074
}
8175

76+
configure(subprojects.findAll {!it.name.contains("android")}) {
77+
apply plugin: 'java'
78+
apply plugin: 'ru.vyarus.animalsniffer'
79+
apply plugin: 'org.asciidoctor.convert'
80+
apply plugin: 'maven'
81+
apply plugin: 'signing'
82+
apply plugin: 'maven-publish'
83+
84+
sourceCompatibility = targetCompatibility = 1.6
85+
86+
dependencies {
87+
compile group: 'org.slf4j', name: 'slf4j-api', version: slf4jVersion
88+
89+
testCompile group: 'org.slf4j', name: 'jcl-over-slf4j', version: slf4jVersion
90+
testCompile group: 'org.slf4j', name: 'slf4j-simple', version: slf4jVersion
91+
testCompile group: 'junit', name: 'junit', version: junitVersion
92+
testCompile group: 'org.assertj', name: 'assertj-core', version: assertjVersion
93+
testCompile group: 'com.tngtech.java', name: 'junit-dataprovider', version: junitDataproviderVersion
94+
testCompile group: 'net.java.quickcheck', name: 'quickcheck', version: quickcheckVersion
95+
signature 'org.codehaus.mojo.signature:java16:1.1@signature'
96+
}
97+
98+
publishing {
99+
publications {
100+
mavenJava(MavenPublication) {
101+
from components.java
102+
}
103+
}
104+
}
105+
106+
test {
107+
systemProperty 'jgiven.report.dir', 'build/reports/jgiven/json'
108+
systemProperty 'jgiven.report.text', 'false'
109+
systemProperty 'org.slf4j.simpleLogger.defaultLogLevel', 'warn'
110+
jacoco {
111+
destinationFile = file("${rootProject.projectDir}/build/jacoco/jacocoTest.exec")
112+
classDumpFile = file("${rootProject.projectDir}/build/jacoco/classpathdumps")
113+
}
114+
testLogging {
115+
showStandardStreams = true
116+
}
117+
}
118+
119+
tasks.withType(JavaCompile) {
120+
// needed for DeSzenarioTest.java as it has Umlauts in the code
121+
options.encoding = 'UTF-8'
122+
}
123+
124+
125+
tasks.withType(Jar) {
126+
def now = new Date()
127+
manifest = project.manifest().attributes(
128+
'Built-By': "Gradle ${gradle.gradleVersion}",
129+
'Build-Date': now.format('yyyy-MM-dd HH:mm:ss.S'), // TODO destroys incremental build feature, but maybe date without time is ok as well?
130+
'Copyright': "2013-" + now.format('yyyy') + " TNG Technology Consulting GmbH",
131+
'Implementation-Title': project.name,
132+
'Implementation-Version': project.version,
133+
'Implementation-Vendor': 'TNG Technology Consulting GmbH',
134+
'License': 'Apache License v2.0, January 2004',
135+
'Specification-Title': project.name,
136+
'Specification-Version': project.version,
137+
'Specification-Vendor': 'TNG Technology Consulting GmbH',
138+
)
139+
}
140+
141+
task sourcesJar(type: Jar) {
142+
classifier = 'sources'
143+
from sourceSets.main.allSource
144+
}
145+
146+
147+
javadoc {
148+
exclude '**/impl/**'
149+
}
150+
151+
javadoc.onlyIf {
152+
JavaVersion.current().isJava8Compatible()
153+
}
154+
155+
task javadocJar(type: Jar, dependsOn: javadoc) {
156+
classifier = 'javadoc'
157+
from javadoc.destinationDir
158+
}
159+
160+
artifacts {
161+
archives jar
162+
archives javadocJar
163+
164+
archives sourcesJar
165+
}
166+
167+
jacocoTestReport {
168+
reports {
169+
xml.enabled = true // coveralls plugin depends on xml format report
170+
}
171+
}
172+
173+
task jgivenHtml5Report(type: JavaExec) {
174+
main = 'com.tngtech.jgiven.report.ReportGenerator'
175+
args '--sourceDir=build/reports/jgiven/json',
176+
'--targetDir=build/reports/jgiven/html5',
177+
'--format=html5',
178+
'--exclude-empty-scenarios=true',
179+
'--customcss=build/resources/test/jgiven/custom.css'
180+
181+
classpath = configurations.testCompile
182+
}
183+
184+
task jgivenAsciiDocReport(type: JavaExec) {
185+
main = 'com.tngtech.jgiven.report.ReportGenerator'
186+
args '--sourceDir=build/reports/jgiven/json',
187+
'--targetDir=build/reports/jgiven/asciidoc',
188+
'--format=asciidoc'
189+
190+
classpath = configurations.testCompile
191+
}
192+
193+
asciidoctor {
194+
sourceDir = new File('build/reports/jgiven/asciidoc')
195+
outputDir = new File('build/reports/jgiven/htmladoc')
196+
attributes toc: ''
197+
}
198+
199+
task copyAsciiDoc(type: Copy, dependsOn: jgivenAsciiDocReport) {
200+
from 'src/asciidoc'
201+
into 'build/reports/jgiven/asciidoc'
202+
}
203+
204+
copyAsciiDoc.finalizedBy(asciidoctor)
205+
206+
}
207+
82208
configure(subprojects) {
209+
apply plugin: 'checkstyle'
83210
apply plugin: 'eclipse'
84211
apply plugin: 'idea'
85212
apply plugin: 'maven'
@@ -88,6 +215,20 @@ configure(subprojects) {
88215

89216
description "${rootProject.description} - Module ${project.name}"
90217

218+
sonarqube {
219+
properties {
220+
property "sonar.jacoco.reportPath", "${rootProject.projectDir}/build/jacoco/jacocoTest.exec"
221+
}
222+
}
223+
224+
checkstyle {
225+
configFile = file("${rootProject.projectDir}/develop/checkstyle-rules.xml")
226+
showViolations = false
227+
ignoreFailures = true
228+
}
229+
230+
// -- build and publish artifacts -------------------------------------------------------------------------------------
231+
91232
signing {
92233
// requires gradle.properties, see http://www.gradle.org/docs/current/userguide/signing_plugin.html
93234
required {
@@ -148,10 +289,10 @@ configure(subprojects) {
148289
whenConfigured { pom ->
149290
def junitDep = pom.dependencies.find { dep -> dep.groupId == 'junit' && dep.artifactId == 'junit' }
150291
if (junitDep != null) {
151-
junitDep.with {
152-
version = '[4.9,4.12]'
153-
scope = 'provided'
154-
}
292+
junitDep.with {
293+
version = '[4.9,4.12]'
294+
scope = 'provided'
295+
}
155296
}
156297
pom.dependencies.removeAll(pom.dependencies.findAll { dep -> dep.scope in ['test'] })
157298
}
@@ -185,151 +326,6 @@ configure(subprojects) {
185326
downloadJavadoc = true
186327
}
187328
}
188-
189-
}
190-
191-
configure(subprojects.findAll {!it.name.contains("jgiven-junit5")}) {
192-
apply plugin: 'ru.vyarus.animalsniffer'
193-
194-
dependencies {
195-
signature 'org.codehaus.mojo.signature:java16:1.1@signature'
196-
}
197-
}
198-
199-
configure(subprojects.findAll {!it.name.contains("android")}) {
200-
apply plugin: 'checkstyle'
201-
apply plugin: 'java'
202-
apply plugin: 'org.asciidoctor.convert'
203-
204-
dependencies {
205-
compile group: 'org.slf4j', name: 'slf4j-api', version: slf4jVersion
206-
207-
testCompile group: 'org.slf4j', name: 'jcl-over-slf4j', version: slf4jVersion
208-
testCompile group: 'org.slf4j', name: 'slf4j-simple', version: slf4jVersion
209-
testCompile group: 'junit', name: 'junit', version: junitVersion
210-
testCompile group: 'org.assertj', name: 'assertj-core', version: assertjVersion
211-
testCompile group: 'com.tngtech.java', name: 'junit-dataprovider', version: junitDataproviderVersion
212-
testCompile group: 'net.java.quickcheck', name: 'quickcheck', version: quickcheckVersion
213-
}
214-
215-
sourceCompatibility = targetCompatibility = 1.6
216-
217-
publishing {
218-
publications {
219-
mavenJava(MavenPublication) {
220-
from components.java
221-
}
222-
}
223-
}
224-
225-
tasks.withType(JavaCompile) {
226-
options.encoding = 'UTF-8'
227-
}
228-
229-
tasks.withType(Jar) {
230-
def now = new Date()
231-
manifest = project.manifest().attributes(
232-
'Built-By': "Gradle ${gradle.gradleVersion}",
233-
'Build-Date': now.format('yyyy-MM-dd HH:mm:ss.S'), // TODO destroys incremental build feature, but maybe date without time is ok as well?
234-
'Copyright': "2013-" + now.format('yyyy') + " TNG Technology Consulting GmbH",
235-
'Implementation-Title': project.name,
236-
'Implementation-Version': project.version,
237-
'Implementation-Vendor': 'TNG Technology Consulting GmbH',
238-
'License': 'Apache License v2.0, January 2004',
239-
'Specification-Title': project.name,
240-
'Specification-Version': project.version,
241-
'Specification-Vendor': 'TNG Technology Consulting GmbH',
242-
)
243-
}
244-
245-
task javadocJar(type: Jar, dependsOn: javadoc) {
246-
classifier = 'javadoc'
247-
from javadoc.destinationDir
248-
}
249-
250-
task sourcesJar(type: Jar) {
251-
classifier = 'sources'
252-
from sourceSets.main.allSource
253-
}
254-
255-
artifacts {
256-
archives jar
257-
archives javadocJar
258-
archives sourcesJar
259-
}
260-
261-
sonarqube {
262-
properties {
263-
property "sonar.jacoco.reportPath", "${rootProject.projectDir}/build/jacoco/jacocoTest.exec"
264-
}
265-
}
266-
267-
jacocoTestReport {
268-
reports {
269-
xml.enabled = true // coveralls plugin depends on xml format report
270-
}
271-
}
272-
273-
test {
274-
systemProperty 'jgiven.report.dir', 'build/reports/jgiven/json'
275-
systemProperty 'jgiven.report.text', 'false'
276-
systemProperty 'org.slf4j.simpleLogger.defaultLogLevel', 'warn'
277-
jacoco {
278-
destinationFile = file("${rootProject.projectDir}/build/jacoco/jacocoTest.exec")
279-
classDumpFile = file("${rootProject.projectDir}/build/jacoco/classpathdumps")
280-
}
281-
testLogging {
282-
showStandardStreams = true
283-
}
284-
}
285-
286-
javadoc {
287-
exclude '**/impl/**'
288-
}
289-
290-
javadoc.onlyIf {
291-
JavaVersion.current().isJava8Compatible()
292-
}
293-
294-
checkstyle {
295-
configFile = file("${rootProject.projectDir}/develop/checkstyle-rules.xml")
296-
showViolations = false
297-
ignoreFailures = true
298-
}
299-
300-
task jgivenHtml5Report(type: JavaExec) {
301-
main = 'com.tngtech.jgiven.report.ReportGenerator'
302-
args '--sourceDir=build/reports/jgiven/json',
303-
'--targetDir=build/reports/jgiven/html5',
304-
'--format=html5',
305-
'--exclude-empty-scenarios=true',
306-
'--customcss=build/resources/test/jgiven/custom.css'
307-
308-
classpath = configurations.testCompile
309-
}
310-
311-
task jgivenAsciiDocReport(type: JavaExec) {
312-
main = 'com.tngtech.jgiven.report.ReportGenerator'
313-
args '--sourceDir=build/reports/jgiven/json',
314-
'--targetDir=build/reports/jgiven/asciidoc',
315-
'--format=asciidoc'
316-
317-
classpath = configurations.testCompile
318-
}
319-
320-
asciidoctor {
321-
sourceDir = new File('build/reports/jgiven/asciidoc')
322-
outputDir = new File('build/reports/jgiven/htmladoc')
323-
attributes toc: ''
324-
}
325-
326-
task copyAsciiDoc(type: Copy, dependsOn: jgivenAsciiDocReport) {
327-
from 'src/asciidoc'
328-
into 'build/reports/jgiven/asciidoc'
329-
}
330-
331-
copyAsciiDoc.finalizedBy(asciidoctor)
332-
333329
}
334330

335331
task overallJacocoReport(type: JacocoReport) {

0 commit comments

Comments
 (0)