forked from etiennestuder/teamcity-build-scan-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
126 lines (102 loc) · 3.56 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
import java.text.SimpleDateFormat
plugins {
id 'java'
id 'groovy'
id 'io.github.rodm.teamcity-server' version '1.5' // see https://github.com/rodm/gradle-teamcity-plugin
id 'io.github.rodm.teamcity-environments' version '1.5'
id 'com.github.breadmoirai.github-release' version '2.4.1'
id 'org.nosphere.gradle.github.actions' version '1.3.2'
}
ext {
CI = System.getenv().containsKey('CI') || project.properties.containsKey('CI')
RELEASE = project.properties.containsKey('RELEASE')
baseVersion = '0.34'
buildTime = new Date()
}
def buildTimestamp = CI ? timestamp(buildTime) : 'prerelease'
def snapshotVersion = RELEASE ? '' : buildTimestamp
group = 'nu.studer'
version = baseVersion + (snapshotVersion ? "-$snapshotVersion" : '')
def teamCityApiVersion = '2020.1'
dependencies {
implementation 'com.google.code.gson:gson:2.10.1'
implementation 'com.google.guava:guava:31.1-jre'
provided "org.jetbrains.teamcity:oauth:$teamCityApiVersion"
agent project(path: ':agent', configuration: 'plugin')
testImplementation 'org.spockframework:spock-core:2.3-groovy-3.0'
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(8)
vendor = JvmVendorSpec.BELLSOFT
}
}
test {
useJUnitPlatform()
}
teamcity {
version = teamCityApiVersion
server {
descriptor {
name = 'GradleBuildScanIntegration'
displayName = 'Integration for Gradle and Maven build scans'
description = 'Provides easy navigation from TeamCity builds to Gradle and Maven build scans'
version = project.version
vendorName = 'Etienne Studer'
vendorUrl = 'https://github.com/etiennestuder'
// optional properties
email = '[email protected]'
downloadUrl = 'https://github.com/etiennestuder/teamcity-build-scan-plugin'
useSeparateClassloader = true
}
publish {
channels = ['Stable']
token = System.getenv('TEAMCITY_PLUGIN_PUBLISH_TOKEN')
notes = layout.projectDirectory.file('release/changes.md').asFile.text.trim()
}
}
environments {
downloadsDir = mkdir('.teamcity/dists')
baseHomeDir = mkdir('.teamcity/servers')
baseDataDir = mkdir('.teamcity/data')
teamcity2022_4 {
version = '2022.04'
serverOptions '-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005'
agentOptions '-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5006'
}
}
}
githubRelease {
token = System.getenv('TEAMCITY_PLUGIN_GIT_TOKEN') ?: ''
owner = 'etiennestuder'
repo = 'teamcity-build-scan-plugin'
targetCommitish = 'main'
releaseName = gitHubReleaseName()
tagName = gitReleaseTag()
prerelease = !RELEASE
overwrite = !RELEASE
generateReleaseNotes = false
body = layout.projectDirectory.file('release/changes.md').asFile.text.trim()
releaseAssets(tasks.named('serverPlugin'))
}
repositories {
mavenCentral()
}
tasks.register('createReleaseTag', CreateGitTag) {
tagName = gitReleaseTag()
overwriteExisting = !RELEASE
}
tasks.named('githubRelease') {
dependsOn('createReleaseTag')
}
def gitHubReleaseName() {
return RELEASE ? version.toString() : 'Development Build'
}
def gitReleaseTag() {
return RELEASE ? "v${version}" : 'development-latest'
}
static timestamp(Date date) {
def timestampFormat = new SimpleDateFormat('yyyyMMddHHmmss')
timestampFormat.timeZone = TimeZone.getTimeZone('UTC')
timestampFormat.format(date)
}