-
Notifications
You must be signed in to change notification settings - Fork 1
/
publishing.gradle
92 lines (75 loc) · 2.5 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
if (!gradle.startParameter.taskNames.contains('release')) {
println "Not a release build, setting version to ${project.version}-SNAPSHOT"
project.version += '-SNAPSHOT'
}
tasks.create('release') {
doLast {
println "Releasing $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
}