forked from gradle/common-custom-user-data-gradle-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
118 lines (98 loc) · 3.53 KB
/
build.gradle
File metadata and controls
118 lines (98 loc) · 3.53 KB
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
plugins {
id 'java-gradle-plugin'
id 'maven-publish'
id 'signing'
id 'com.gradle.plugin-publish' version '1.2.1'
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 = 'com.gradle'
version = releaseVersion.get()
description = 'A Gradle plugin to capture common custom user data used for Gradle Build Scans in Gradle Enterprise'
repositories {
gradlePluginPortal()
}
dependencies {
compileOnly 'com.gradle:gradle-enterprise-gradle-plugin:3.16'
testImplementation(platform('org.junit:junit-bom:5.10.1'))
testImplementation('org.junit.jupiter:junit-jupiter')
}
wrapperUpgrade {
gradle {
'common-custom-user-data-gradle-plugin' {
repo = 'gradle/common-custom-user-data-gradle-plugin'
}
}
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(8)
}
}
gradlePlugin {
website = 'https://github.com/gradle/common-custom-user-data-gradle-plugin'
vcsUrl = 'https://github.com/gradle/common-custom-user-data-gradle-plugin.git'
automatedPublishing = true
plugins {
commonCustomUserData {
id = 'com.gradle.common-custom-user-data-gradle-plugin'
displayName = 'Gradle Enterprise Common Custom User Data Gradle Plugin'
description = releaseNotes.get()
implementationClass = 'com.gradle.CommonCustomUserDataGradlePlugin'
tags.addAll('android', 'java', 'gradle enterprise')
}
}
}
tasks.withType(ValidatePlugins).configureEach {
failOnWarning = true
enableStricterValidation = true
}
test {
useJUnitPlatform()
}
/*
The rest of the build logic in this file is only required for publishing to the Gradle Plugin Portal.
When using this project as a template for your own plugin to publish internally, you should delete all code following this comment.
You may also remove `plugin-publish` and `signing` from the `plugins {}` block above.
*/
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('CCUD_GIT_TOKEN') ?: ''
owner = 'gradle'
repo = 'common-custom-user-data-gradle-plugin'
targetCommitish = 'main'
releaseName = releaseVersion
tagName = releaseVersion.map { "v$it" }
prerelease = false
overwrite = false
generateReleaseNotes = false
body = releaseNotes
}
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').configure {
dependsOn(createReleaseTag)
}
tasks.withType(com.gradle.publish.PublishTask) {
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() }
}