-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1a28472
commit ec87d20
Showing
3 changed files
with
112 additions
and
126 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 |
---|---|---|
@@ -1,137 +1,19 @@ | ||
plugins { | ||
id 'java' | ||
id 'groovy' | ||
id 'maven' | ||
id 'signing' | ||
id 'com.jfrog.bintray' version '1.0' | ||
id 'java-gradle-plugin' | ||
id 'maven-publish' | ||
id 'com.jfrog.bintray' version '1.7' | ||
id 'com.gradle.plugin-publish' version '0.9.6' | ||
} | ||
|
||
if (!gradle.startParameter.taskNames.contains('release')) { | ||
println "Not a release build, setting version to ${version}-SNAPSHOT" | ||
version += '-SNAPSHOT' | ||
} | ||
|
||
repositories { | ||
jcenter() | ||
} | ||
|
||
|
||
dependencies { | ||
compile gradleApi() | ||
|
||
testCompile ('org.spockframework:spock-core:0.7-groovy-2.0') { | ||
exclude group: 'org.codehaus.groovy' | ||
} | ||
testCompile 'org.hamcrest:hamcrest-all:1.3' | ||
} | ||
|
||
|
||
def pomDefinition = pom { | ||
project { | ||
name project.friendly_name | ||
packaging 'jar' | ||
description project.description | ||
url project.home_url | ||
|
||
scm { | ||
connection "scm:git:${project.scm_url}" | ||
developerConnection "scm:git:${project.scm_url}" | ||
url project.scm_url | ||
} | ||
|
||
licenses { | ||
license { | ||
name = project.license_name | ||
url project.license_url | ||
} | ||
} | ||
|
||
developers { | ||
developer { | ||
name 'Till Krullmann' | ||
email '[email protected]' | ||
} | ||
} | ||
} | ||
} | ||
|
||
|
||
task generatePom { | ||
outputs.file "$buildDir/poms/pom.xml" | ||
doLast { | ||
pomDefinition.writeTo "$buildDir/poms/pom.xml" | ||
} | ||
} | ||
|
||
|
||
jar { | ||
into("META-INF/maven/$project.group/$project.name") { | ||
from generatePom | ||
} | ||
} | ||
|
||
|
||
task javadocJar(type: Jar) { | ||
description = 'Assembles a jar archive containing the javadocs.' | ||
classifier = 'javadoc' | ||
from javadoc | ||
} | ||
|
||
|
||
task sourcesJar(type: Jar) { | ||
description = 'Assembles a jar archive containing the sources.' | ||
classifier = 'sources' | ||
from sourceSets.main.allSource | ||
} | ||
|
||
|
||
artifacts { | ||
archives javadocJar, sourcesJar | ||
} | ||
|
||
|
||
signing { | ||
sign configurations.archives | ||
} | ||
|
||
|
||
install { | ||
repositories.mavenInstaller { | ||
beforeDeployment { deployment -> signing.signPom(deployment) } | ||
pom = pomDefinition | ||
testCompile('org.spockframework:spock-core:1.0-groovy-2.4') { | ||
exclude group: 'org.codehaus.groovy', module: 'groovy-all' | ||
} | ||
testCompile 'org.hamcrest:java-hamcrest:2.0.0.0' | ||
} | ||
|
||
|
||
bintray { | ||
user = bintray_user | ||
key = bintray_key | ||
configurations = ['archives'] | ||
|
||
pkg { | ||
repo = project.bintray_repo | ||
name = project.name | ||
desc = project.description | ||
websiteUrl = project.home_url | ||
licenses = ['MIT'] | ||
labels = ['gradle', 'plugin', 'test', 'testset'] | ||
|
||
vcsUrl = project.scm_url | ||
issueTrackerUrl = project.issues_url | ||
publicDownloadNumbers = true | ||
|
||
version { | ||
vcsTag = project.version | ||
attributes = [ | ||
'gradle-plugin': "org.unbroken-dome.test-sets:${project.group}:${project.name}" | ||
] | ||
} | ||
} | ||
} | ||
|
||
|
||
task release(dependsOn: ['bintrayUpload']) { | ||
group = 'publishing' | ||
} << { | ||
println "Releasing $version" | ||
} | ||
apply from: "$rootDir/publishing.gradle" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
if (!gradle.startParameter.taskNames.contains('release')) { | ||
println "Not a release build, setting version to ${project.version}-SNAPSHOT" | ||
project.version += '-SNAPSHOT' | ||
} | ||
|
||
|
||
tasks.create('release') << { | ||
println "Releasing $version" | ||
} | ||
|
||
|
||
project.plugins.withId('maven-publish') { | ||
|
||
/* Add the generated pom.xml file into the JAR */ | ||
model { | ||
tasks.jar { | ||
into("META-INF/maven/${project.group}/${project.name}") { | ||
from generatePomFileForMavenJavaPublication | ||
rename 'pom-default.xml', 'pom.xml' | ||
} | ||
} | ||
} | ||
|
||
tasks.create('sourcesJar', Jar) { | ||
description = 'Assembles a jar archive containing the sources.' | ||
classifier = 'sources' | ||
group = 'build' | ||
from sourceSets.main.allSource | ||
} | ||
|
||
tasks.create('javadocJar', Jar) { | ||
description = 'Assembles a jar archive containing the javadocs.' | ||
classifier = 'javadoc' | ||
group = 'build' | ||
from tasks.javadoc | ||
} | ||
|
||
project.publishing { | ||
publications { | ||
mavenJava(MavenPublication) { | ||
from components.java | ||
artifact tasks.sourcesJar | ||
artifact tasks.javadocJar | ||
} | ||
} | ||
} | ||
|
||
plugins.withId('com.jfrog.bintray') { | ||
bintray.publications = ['mavenJava'] | ||
} | ||
} | ||
|
||
|
||
project.plugins.withId('com.jfrog.bintray') { | ||
bintray { | ||
user = project.bintray_user | ||
key = project.bintray_key | ||
|
||
dryRun = Boolean.valueOf(project.bintray_dryrun as String) | ||
|
||
pkg { | ||
repo = project.bintray_repo | ||
name = project.name | ||
desc = project.description | ||
websiteUrl = project.home_url | ||
licenses = ['MIT'] | ||
labels = (project.bintray_labels as String).split ',' | ||
|
||
vcsUrl = project.scm_url | ||
issueTrackerUrl = project.issues_url | ||
publicDownloadNumbers = true | ||
} | ||
|
||
pkg.version { | ||
name = project.version | ||
released = new Date() | ||
vcsTag = project.version | ||
} | ||
} | ||
|
||
tasks['release'].dependsOn tasks.bintrayUpload | ||
} | ||
|
||
|
||
project.plugins.withId('com.gradle.plugin-publish') { | ||
pluginBundle { | ||
website = project.home_url | ||
vcsUrl = project.scm_url | ||
description = project.description | ||
tags = (project.bintray_labels as String).split ',' | ||
|
||
plugins { | ||
testSetsPlugin { | ||
id = project.plugin_id | ||
displayName = project.friendly_name | ||
} | ||
} | ||
} | ||
|
||
tasks['release'].dependsOn tasks.publishPlugins | ||
} |