-
Notifications
You must be signed in to change notification settings - Fork 328
/
Copy pathbuild.gradle
48 lines (43 loc) · 1.8 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
import java.time.format.DateTimeFormatter
plugins {
id "io.github.gradle-nexus.publish-plugin" version "$nexusPublishPluginVersion"
id 'com.github.ben-manes.versions' version "$versionsPluginVersion"
id 'org.ajoberstar.grgit' version "$grgitVersion"
id 'org.jreleaser' version "$jreleaserVersion" apply false
id "eclipse"
id "idea"
}
def buildTimeAndDate = grgit.head().dateTime
// common variables
ext {
isTravis = (System.getenv("TRAVIS") == "true")
isTravisPullRequest = (System.getenv("TRAVIS_PULL_REQUEST")) != "false"
pullRequestId = System.getenv("TRAVIS_PULL_REQUEST")
pullRequestBranch = System.getenv("TRAVIS_PULL_REQUEST_BRANCH")
hasGithub = System.getenv("GITHUBTOKEN") && System.getenv("GITHUBREPO")
hasSonar = System.getenv("SONARORG") && System.getenv("SONARLOGIN")
sonarDefaultURL = "https://sonarcloud.io"
sonarDefaultProjectKey = "org.jbake:jbake-base:jbake-core"
sonarURL = System.getenv("SONARHOST") ?: sonarDefaultURL
sonarProjectKey = System.getenv("SONARPROJECTKEY") ?: sonarDefaultProjectKey
buildDate = buildTimeAndDate.format(DateTimeFormatter.ofPattern('yyyy-MM-dd'))
buildTime = buildTimeAndDate.format(DateTimeFormatter.ofPattern('HH:mm:ss.SSSZ'))
isReleaseVersion = !version.endsWith("SNAPSHOT")
}
nexusPublishing {
repositories {
sonatype()
}
}
dependencyUpdates.resolutionStrategy {
componentSelection { rules ->
rules.all { ComponentSelection selection ->
boolean rejected = ['alpha', 'beta', 'rc', 'cr', 'm'].any { qualifier ->
selection.candidate.version ==~ /(?i).*[.-]?${qualifier}[.\d-]*/
}
if (rejected) {
selection.reject('Release candidate')
}
}
}
}