-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathpublishing.gradle
117 lines (94 loc) · 3.11 KB
/
publishing.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
if (gradle.startParameter.taskNames.contains('release')) {
logger.lifecycle 'Starting release build {}', version
check.dependsOn integrationTest
} else {
logger.lifecycle 'Not a release build, setting version to {}', "${project.version}-SNAPSHOT"
project.version += '-SNAPSHOT'
}
task release {
dependsOn build
doLast {
logger.lifecycle 'Release {} successful', version
}
}
project.plugins.withId('maven-publish') {
model {
def publication = publishing.publications.mavenJava
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
pom.withXml {
configurations.compile.resolvedConfiguration.firstLevelModuleDependencies.each { dep ->
asNode().dependencies.dependency.find {
it.artifactId.text() == dep.moduleName && it.groupId.text() == dep.moduleGroup
}?.scope[0]?.value = 'compile'
}
}
}
}
}
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.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.split ','
plugins {
gitVersionPlugin {
id = 'org.unbroken-dome.gitversion'
displayName = 'Gradle Git Version Plugin'
}
}
}
tasks['release'].dependsOn tasks.publishPlugins
}