-
Notifications
You must be signed in to change notification settings - Fork 173
/
common.gradle
145 lines (120 loc) · 3.18 KB
/
common.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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
// include this file in subprojects:
// apply from: rootProject.file('libs/common.gradle')
apply plugin: 'groovy'
apply plugin: 'maven'
apply plugin: 'maven-publish'
apply plugin: 'com.jfrog.artifactory'
apply plugin: 'com.jfrog.bintray'
repositories {
maven {
url "file:$privateRepoDir"
}
jcenter()
}
group = rootProject.group
version = rootProject.version
configurations {
providedCompile
compile.extendsFrom providedCompile
}
afterEvaluate {
dependencies {
testCompile "org.codehaus.groovy:groovy-all:${groovy_version}"
testCompile "org.spockframework:spock-core:${spock_version}"
}
sourceCompatibility = '1.7'
targetCompatibility = '1.7'
task sourcesJar(type: Jar, dependsOn: classes, description: 'Creates sources jar') {
classifier = 'sources'
from sourceSets.main.allSource
}
task javadocJar(type: Jar, description: 'Creates javadoc jar') {
dependsOn javadoc
classifier = 'javadoc'
from javadoc.destinationDir
if(tasks.findByName('groovydoc')) {
dependsOn groovydoc
from groovydoc.destinationDir
}
}
artifacts {
archives sourcesJar, javadocJar
}
def thisProject = project
def configurePom = {
resolveStrategy = Closure.DELEGATE_FIRST
packaging 'jar'
description thisProject.description
url thisProject.project_website
scm {
url thisProject.project_scm
connection thisProject.project_scm
developerConnection thisProject.project_scm
}
licenses {
license {
name thisProject.license
url thisProject.license_url
distribution 'repo'
}
}
developers {
developer {
id thisProject.developerId
name thisProject.developerName
}
}
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
pom.withXml {
asNode().children().last() + configurePom
}
artifact tasks.sourcesJar
artifact tasks.javadocJar
}
}
repositories {
maven {
name 'private'
url "file:/${project.rootProject.ext.privateRepoDir}"
}
}
}
install.repositories.mavenInstaller.pom*.whenConfigured { pom ->
pom.project {
name thisProject.name
configurePom.rehydrate(delegate, owner, thisObject).call()
}
}
project.task('publishToPrivateRepository') {
dependsOn "publishMavenJavaPublicationToPrivateRepository"
}
project.tasks.build.dependsOn project.tasks.publishToPrivateRepository
rootProject.tasks.buildIntegrationTests.dependsOn project.tasks.publishToPrivateRepository
rootProject.tasks.testAllIntegrationTests.dependsOn project.tasks.publishToPrivateRepository
tasks.artifactoryPublish {
dependsOn { project.tasks.generatePomFileForMavenJavaPublication }
publications 'mavenJava'
}
bintray {
user = project.bintrayUser
key = project.bintrayKey
configurations = ['archives']
pkg {
repo = 'maven'
name = thisProject.projectId
desc = thisProject.description
licenses = [ thisProject.license ]
labels = thisProject.projectLabels.split(',')
}
dryRun = thisProject.bintrayDryRun
}
tasks.bintrayUpload.dependsOn assemble
if(!bintrayDryRun) {
tasks.bintrayUpload.finalizedBy rootProject.tasks.bintraySign
rootProject.tasks.bintraySign.onlyIf { !tasks.bintrayUpload.getState().getFailure() }
}
} // afterEvaluate