-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
allow jgiven-android to be published
- Loading branch information
Jan Schäfer
committed
Dec 24, 2016
1 parent
40b35f7
commit 41145fc
Showing
3 changed files
with
119 additions
and
113 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -73,28 +73,121 @@ subprojects{ | |
} | ||
} | ||
|
||
configure(subprojects.findAll {!it.name.contains("android")}) { | ||
apply plugin: 'checkstyle' | ||
configure(subprojects) { | ||
apply plugin: 'eclipse' | ||
apply plugin: 'idea' | ||
apply plugin: 'java' | ||
apply plugin: 'maven' | ||
apply plugin: 'signing' | ||
apply plugin: 'org.asciidoctor.convert' | ||
apply plugin: 'ru.vyarus.animalsniffer' | ||
apply plugin: 'maven-publish' | ||
|
||
description "${rootProject.description} - Module ${project.name}" | ||
sourceCompatibility = targetCompatibility = 1.6 | ||
|
||
publishing { | ||
publications { | ||
mavenJava(MavenPublication) { | ||
from components.java | ||
signing { | ||
// requires gradle.properties, see http://www.gradle.org/docs/current/userguide/signing_plugin.html | ||
required { | ||
isReleaseVersion && gradle.taskGraph.hasTask('uploadArchives') | ||
} | ||
sign configurations.archives | ||
} | ||
|
||
ext { | ||
sonatypeUsername = (rootProject.hasProperty('sonatypeUsername')) ? | ||
rootProject.sonatypeUsername : | ||
"$System.env.SONATYPE_USERNAME" | ||
|
||
sonatypePassword = (rootProject.hasProperty('sonatypePassword')) ? | ||
rootProject.sonatypePassword : | ||
"$System.env.SONATYPE_PASSWORD" | ||
} | ||
|
||
uploadArchives { | ||
repositories { | ||
mavenDeployer { | ||
beforeDeployment { deployment -> | ||
signing.signPom(deployment) | ||
} | ||
repository(url: 'https://oss.sonatype.org/service/local/staging/deploy/maven2/') { | ||
// username and password from gradle.properties | ||
authentication(userName: sonatypeUsername, password: sonatypePassword) | ||
} | ||
snapshotRepository(url: 'https://oss.sonatype.org/content/repositories/snapshots/') { | ||
authentication(userName: sonatypeUsername, password: sonatypePassword) | ||
} | ||
pom { | ||
project { | ||
name project.name | ||
url 'http://jgiven.org' | ||
|
||
scm { | ||
url 'scm:[email protected]:TNG/jgiven.git' | ||
connection 'scm:[email protected]:TNG/jgiven.git' | ||
developerConnection 'scm:[email protected]:TNG/jgiven.git' | ||
} | ||
|
||
licenses { | ||
license { | ||
name 'The Apache Software License, Version 2.0' | ||
url 'http://www.apache.org/licenses/LICENSE-2.0.txt' | ||
distribution 'repo' | ||
} | ||
} | ||
|
||
developers { | ||
developer { | ||
id 'janschaefer' | ||
name 'Jan Schäfer' | ||
} | ||
} | ||
} | ||
whenConfigured { pom -> | ||
def junitDep = pom.dependencies.find { dep -> dep.groupId == 'junit' && dep.artifactId == 'junit' } | ||
if (junitDep != null) { | ||
junitDep.with { | ||
version = '[4.9,4.12]' | ||
scope = 'provided' | ||
} | ||
} | ||
pom.dependencies.removeAll(pom.dependencies.findAll { dep -> dep.scope in ['test'] }) | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
// to be able use project.description which may be overridden in later executed build.gradle of subproject | ||
project.afterEvaluate { | ||
uploadArchives.repositories { | ||
mavenDeployer.pom.project { | ||
description = project.description | ||
} | ||
} | ||
} | ||
|
||
uploadArchives.onlyIf { | ||
!(isCI && isReleaseVersion) | ||
} | ||
|
||
uploadArchives.doFirst { | ||
if (!isCI && isReleaseVersion && !JavaVersion.current().isJava8Compatible()) { | ||
throw new GradleException("Releases have to be done with Java 8"); | ||
} | ||
} | ||
|
||
idea { | ||
module { | ||
downloadSources = true | ||
downloadJavadoc = true | ||
} | ||
} | ||
|
||
} | ||
|
||
configure(subprojects.findAll {!it.name.contains("android")}) { | ||
apply plugin: 'checkstyle' | ||
apply plugin: 'java' | ||
apply plugin: 'org.asciidoctor.convert' | ||
apply plugin: 'ru.vyarus.animalsniffer' | ||
|
||
dependencies { | ||
compile group: 'org.slf4j', name: 'slf4j-api', version: slf4jVersion | ||
|
||
|
@@ -107,8 +200,17 @@ configure(subprojects.findAll {!it.name.contains("android")}) { | |
signature 'org.codehaus.mojo.signature:java16:1.1@signature' | ||
} | ||
|
||
sourceCompatibility = targetCompatibility = 1.6 | ||
|
||
publishing { | ||
publications { | ||
mavenJava(MavenPublication) { | ||
from components.java | ||
} | ||
} | ||
} | ||
|
||
tasks.withType(JavaCompile) { | ||
// needed for DeSzenarioTest.java as it has Umlauts in the code | ||
options.encoding = 'UTF-8' | ||
} | ||
|
||
|
@@ -141,7 +243,6 @@ configure(subprojects.findAll {!it.name.contains("android")}) { | |
artifacts { | ||
archives jar | ||
archives javadocJar | ||
|
||
archives sourcesJar | ||
} | ||
|
||
|
@@ -174,6 +275,10 @@ configure(subprojects.findAll {!it.name.contains("android")}) { | |
exclude '**/impl/**' | ||
} | ||
|
||
javadoc.onlyIf { | ||
JavaVersion.current().isJava8Compatible() | ||
} | ||
|
||
checkstyle { | ||
configFile = file("${rootProject.projectDir}/develop/checkstyle-rules.xml") | ||
showViolations = false | ||
|
@@ -213,106 +318,6 @@ configure(subprojects.findAll {!it.name.contains("android")}) { | |
|
||
copyAsciiDoc.finalizedBy(asciidoctor) | ||
|
||
// -- build and publish artifacts ------------------------------------------------------------------------------------- | ||
|
||
signing { | ||
// requires gradle.properties, see http://www.gradle.org/docs/current/userguide/signing_plugin.html | ||
required { | ||
isReleaseVersion && gradle.taskGraph.hasTask('uploadArchives') | ||
} | ||
sign configurations.archives | ||
} | ||
|
||
ext { | ||
sonatypeUsername = (rootProject.hasProperty('sonatypeUsername')) ? | ||
rootProject.sonatypeUsername : | ||
"$System.env.SONATYPE_USERNAME" | ||
|
||
sonatypePassword = (rootProject.hasProperty('sonatypePassword')) ? | ||
rootProject.sonatypePassword : | ||
"$System.env.SONATYPE_PASSWORD" | ||
} | ||
|
||
uploadArchives { | ||
repositories { | ||
mavenDeployer { | ||
beforeDeployment { deployment -> | ||
signing.signPom(deployment) | ||
} | ||
repository(url: 'https://oss.sonatype.org/service/local/staging/deploy/maven2/') { | ||
// username and password from gradle.properties | ||
authentication(userName: sonatypeUsername, password: sonatypePassword) | ||
} | ||
snapshotRepository(url: 'https://oss.sonatype.org/content/repositories/snapshots/') { | ||
authentication(userName: sonatypeUsername, password: sonatypePassword) | ||
} | ||
pom { | ||
project { | ||
name project.name | ||
url 'http://jgiven.org' | ||
|
||
scm { | ||
url 'scm:[email protected]:TNG/jgiven.git' | ||
connection 'scm:[email protected]:TNG/jgiven.git' | ||
developerConnection 'scm:[email protected]:TNG/jgiven.git' | ||
} | ||
|
||
licenses { | ||
license { | ||
name 'The Apache Software License, Version 2.0' | ||
url 'http://www.apache.org/licenses/LICENSE-2.0.txt' | ||
distribution 'repo' | ||
} | ||
} | ||
|
||
developers { | ||
developer { | ||
id 'janschaefer' | ||
name 'Jan Schäfer' | ||
} | ||
} | ||
} | ||
whenConfigured { pom -> | ||
pom.dependencies.find { dep -> dep.groupId == 'junit' && dep.artifactId == 'junit' }.with { | ||
version = '[4.9,4.12]' | ||
scope = 'provided' | ||
} | ||
pom.dependencies.removeAll(pom.dependencies.findAll { dep -> dep.scope in ['test'] }) | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
// to be able use project.description which may be overridden in later executed build.gradle of subproject | ||
project.afterEvaluate { | ||
uploadArchives.repositories { | ||
mavenDeployer.pom.project { | ||
description = project.description | ||
} | ||
} | ||
} | ||
|
||
uploadArchives.onlyIf { | ||
!(isCI && isReleaseVersion) | ||
} | ||
|
||
uploadArchives.doFirst { | ||
if (!isCI && isReleaseVersion && !JavaVersion.current().isJava8Compatible()) { | ||
throw new GradleException("Releases have to be done with Java 8"); | ||
} | ||
} | ||
|
||
javadoc.onlyIf { | ||
JavaVersion.current().isJava8Compatible() | ||
} | ||
|
||
idea { | ||
module { | ||
downloadSources = true | ||
downloadJavadoc = true | ||
} | ||
} | ||
} | ||
|
||
task overallJacocoReport(type: JacocoReport) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters