-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
67 lines (60 loc) · 2.39 KB
/
build.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
buildscript {
repositories {
mavenLocal()
jcenter()
maven {
url "https://plugins.gradle.org/m2/"
}
maven {
url artifactoryURL
credentials {
username = artifactoryUser
password = artifactoryPassword
}
}
}
dependencies {
classpath 'org.ajoberstar:gradle-git:1.7.2'
classpath 'net.ltgt.gradle:gradle-errorprone-plugin:0.0.13'
classpath 'com.github.jengelman.gradle.plugins:shadow:2.0.2'
}
}
// must be set prior to 'release-opinion' plugin getting applied
// as they are magically used behind the scenes.
if (!Boolean.valueOf(project.ciRelease)) {
rootProject.ext.setProperty('release.stage', releaseStage.trim())
rootProject.ext.setProperty('release.scope', releaseScope.trim())
}
apply plugin: 'org.ajoberstar.release-opinion'
// Task used for local kicking of CI/Production release
release {
def credentials = new org.ajoberstar.grgit.Credentials(releaseUsername, releasePassword)
grgit = org.ajoberstar.grgit.Grgit.open(dir: project.rootDir.absolutePath, creds: credentials)
versionStrategy org.ajoberstar.gradle.git.release.semver.RebuildVersionStrategy.INSTANCE
versionStrategy org.ajoberstar.gradle.git.release.opinion.Strategies.FINAL
defaultVersionStrategy = org.ajoberstar.gradle.git.release.opinion.Strategies.SNAPSHOT
tagStrategy {
generateMessage = { version -> "Version ${->project.version}" }
}
}
// only publish to Bintray and Github if done from CI environment.
if (Boolean.valueOf(project.ciRelease)) {
// 1.) The release process must first build the main/sub projects.
def buildTasks = ['build']
tasks.release.dependsOn(buildTasks.collect { task ->
allprojects.collect {
rootProject.name == it.name ? ":${task}" : ":${it.name}:${task}"
}.flatten()
}.flatten())
// 2.) The release process, when finished, can now upload artifacts.
def publishTasks = [uploadTask]
if (Boolean.valueOf(publishGithubPages).booleanValue() && releaseStage.trim().equals('final')) {
publishTasks << 'gitPublishPush'
}
tasks.release.finalizedBy(publishTasks.collect { task ->
allprojects.collect {
rootProject.name == it.name ? ":${task}" : ":${it.name}:${task}"
}.flatten()
}.flatten())
}
apply from: "$rootDir/gradle/projects.gradle"