-
Notifications
You must be signed in to change notification settings - Fork 14
/
build.gradle
158 lines (134 loc) · 4.85 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
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
146
147
148
149
150
151
152
153
154
155
156
157
158
import org.gradle.util.GradleVersion
plugins {
id 'groovy'
id 'java-gradle-plugin'
id 'maven-publish'
id 'signing'
id 'com.gradle.plugin-publish' version '1.3.0'
id 'com.github.breadmoirai.github-release' version '2.5.2'
id 'org.gradle.wrapper-upgrade' version '0.11.4'
}
def releaseVersion = releaseVersion()
def releaseNotes = releaseNotes()
group = 'org.gradle'
version = releaseVersion.get()
description = 'A Gradle plugin that detects and updates Gradle and Maven wrappers to the latest Gradle and Maven version.'
repositories {
mavenCentral()
}
dependencies {
implementation 'org.kohsuke:github-api:1.322'
implementation 'com.fasterxml.jackson.core:jackson-core:2.16.0'
implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.16.0'
testImplementation gradleTestKit()
testImplementation 'org.spockframework:spock-core:2.3-groovy-3.0'
}
wrapperUpgrade {
gradle {
'wrapper-upgrade-gradle-plugin' {
repo = 'gradle/wrapper-upgrade-gradle-plugin'
}
}
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(8)
}
}
tasks.withType(Test).configureEach {
useJUnitPlatform()
def testGradleVersion = findProperty('testGradleVersion') ?: GradleVersion.current().version
systemProperty 'testContext.gradleVersion', testGradleVersion
buildScan.value(identityPath.path + "#gradleVersion", testGradleVersion)
}
tasks.withType(Jar).configureEach {
into(".") {
from(layout.projectDirectory.file("LICENSE"))
from(layout.projectDirectory.dir("release/distribution"))
}
}
gradlePlugin {
website = "https://github.com/gradle/wrapper-upgrade-gradle-plugin/"
vcsUrl = "https://github.com/gradle/wrapper-upgrade-gradle-plugin.git"
automatedPublishing = true
plugins {
wrapperUpgrade {
id = 'org.gradle.wrapper-upgrade'
displayName = 'Wrapper Upgrade Gradle Plugin'
description = releaseNotes.get()
implementationClass = 'org.gradle.wrapperupgrade.WrapperUpgradePlugin'
tags.addAll("gradle", "maven", "wrapper")
}
}
}
tasks.withType(ValidatePlugins).configureEach {
failOnWarning = true
enableStricterValidation = true
}
signing {
// Require publications to be signed on CI. Otherwise, publication will be signed only if keys are provided.
required providers.environmentVariable('CI').isPresent()
useInMemoryPgpKeys(
providers.environmentVariable('PGP_SIGNING_KEY').orNull,
providers.environmentVariable('PGP_SIGNING_KEY_PASSPHRASE').orNull
)
}
githubRelease {
token = System.getenv('WRAPPER_UPGRADE_GRADLE_PLUGIN_GIT_TOKEN') ?: ''
owner = 'gradle'
repo = 'wrapper-upgrade-gradle-plugin'
targetCommitish = 'main'
releaseName = releaseVersion
tagName = releaseVersion.map { "v$it" }
prerelease = false
overwrite = false
generateReleaseNotes = false
body = releaseNotes
}
publishing {
publications {
mavenJava(MavenPublication) {
pom {
name = 'Wrapper Upgrade Gradle Plugin'
description = 'A Gradle plugin that detects and updates Gradle and Maven wrappers to the latest Gradle and Maven version.'
url = 'https://github.com/gradle/wrapper-upgrade-gradle-plugin'
licenses {
license {
name = "Apache-2.0"
url = "https://www.apache.org/licenses/LICENSE-2.0.txt"
}
}
developers {
developer {
name = "The Gradle team"
organization = "Gradle Inc."
organizationUrl = "https://gradle.com"
}
}
scm {
developerConnection = "scm:git:https://github.com/gradle/wrapper-upgrade-gradle-plugin.git"
url = "https://github.com/gradle/wrapper-upgrade-gradle-plugin"
}
}
}
}
}
def createReleaseTag = tasks.register('createReleaseTag', CreateGitTag) {
// Ensure tag is created only after a successful publishing
mustRunAfter('publishPlugins')
tagName = githubRelease.tagName.map { it.toString() }
}
tasks.named('githubRelease') {
dependsOn(createReleaseTag)
}
tasks.withType(com.gradle.publish.PublishTask).configureEach {
notCompatibleWithConfigurationCache("$name task does not support configuration caching")
}
def releaseVersion() {
def releaseVersionFile = layout.projectDirectory.file('release/version.txt')
return providers.fileContents(releaseVersionFile).asText.map { it -> it.trim() }
}
def releaseNotes() {
def releaseNotesFile = layout.projectDirectory.file('release/changes.md')
return providers.fileContents(releaseNotesFile).asText.map { it -> it.trim() }
}