1
- import jetbrains.buildServer.configs.kotlin.v2018_2 .*
2
- import jetbrains.buildServer.configs.kotlin.v2018_2 .buildSteps.*
3
- import jetbrains.buildServer.configs.kotlin.v2018_2 .triggers.*
1
+ import jetbrains.buildServer.configs.kotlin.v2019_2 .*
2
+ import jetbrains.buildServer.configs.kotlin.v2019_2 .buildSteps.*
3
+ import jetbrains.buildServer.configs.kotlin.v2019_2 .triggers.*
4
4
5
5
/*
6
6
The settings script is an entry point for defining a TeamCity
@@ -24,16 +24,7 @@ To debug in IntelliJ Idea, open the 'Maven Projects' tool window (View
24
24
'Debug' option is available in the context menu for the task.
25
25
*/
26
26
27
- version = " 2018.2"
28
- val versionSuffixParameter = " versionSuffix"
29
- val teamcitySuffixParameter = " teamcitySuffix"
30
- val releaseVersionParameter = " releaseVersion"
31
-
32
- val bintrayUserName = " %env.BINTRAY_USER%"
33
- val bintrayToken = " %env.BINTRAY_API_KEY%"
34
-
35
- val platforms = listOf (" Windows" , " Linux" , " Mac OS X" )
36
- val jdk = " JDK_18_x64"
27
+ version = " 2020.1"
37
28
38
29
project {
39
30
// Disable editing of project and build settings from the UI to avoid issues with TeamCity
@@ -53,22 +44,30 @@ project {
53
44
}
54
45
}
55
46
56
- val deployConfigure = deployConfigure ().apply {
47
+ val deployVersion = deployVersion ().apply {
57
48
dependsOnSnapshot(buildAll, onFailure = FailureAction .IGNORE )
49
+ dependsOnSnapshot(BUILD_CREATE_STAGING_REPO_ABSOLUTE_ID ) {
50
+ reuseBuilds = ReuseBuilds .NO
51
+ }
58
52
}
59
- val deploys = platforms.map { deploy(it, deployConfigure ) }
60
- val deployPublish = deployPublish(deployConfigure ).apply {
53
+ val deploys = platforms.map { deploy(it, deployVersion ) }
54
+ val deployPublish = deployPublish(deployVersion ).apply {
61
55
dependsOnSnapshot(buildAll, onFailure = FailureAction .IGNORE )
56
+ dependsOnSnapshot(BUILD_CREATE_STAGING_REPO_ABSOLUTE_ID ) {
57
+ reuseBuilds = ReuseBuilds .NO
58
+ }
62
59
deploys.forEach {
63
60
dependsOnSnapshot(it)
64
61
}
65
62
}
66
63
67
- buildTypesOrder = listOf (buildAll, buildVersion, * builds.toTypedArray(), deployPublish, deployConfigure, * deploys.toTypedArray())
64
+ buildTypesOrder = listOf (buildAll, buildVersion, * builds.toTypedArray(), deployPublish, deployVersion, * deploys.toTypedArray())
65
+
66
+ additionalConfiguration()
68
67
}
69
68
70
69
fun Project.buildVersion () = BuildType {
71
- id(" Build_Version " )
70
+ id(BUILD_CONFIGURE_VERSION_ID )
72
71
this .name = " Build (Configure Version)"
73
72
commonConfigure()
74
73
@@ -90,7 +89,7 @@ fun Project.buildVersion() = BuildType {
90
89
}.also { buildType(it) }
91
90
92
91
fun Project.buildAll (versionBuild : BuildType ) = BuildType {
93
- id(" Build_All " )
92
+ id(BUILD_ALL_ID )
94
93
this .name = " Build (All)"
95
94
type = BuildTypeSettings .Type .COMPOSITE
96
95
@@ -109,7 +108,7 @@ fun Project.buildAll(versionBuild: BuildType) = BuildType {
109
108
commonConfigure()
110
109
}.also { buildType(it) }
111
110
112
- fun Project.build (platform : String , versionBuild : BuildType ) = platform(platform, " Build" ) {
111
+ fun Project.build (platform : Platform , versionBuild : BuildType ) = buildType( " Build" , platform ) {
113
112
114
113
dependsOnSnapshot(versionBuild)
115
114
@@ -120,7 +119,7 @@ fun Project.build(platform: String, versionBuild: BuildType) = platform(platform
120
119
121
120
steps {
122
121
gradle {
123
- name = " Build and Test $platform Binaries"
122
+ name = " Build and Test ${ platform.buildTypeName()} Binaries"
124
123
jdkHome = " %env.$jdk %"
125
124
jvmArgs = " -Xmx1g"
126
125
tasks = " clean publishToBuildLocal check"
@@ -135,23 +134,8 @@ fun Project.build(platform: String, versionBuild: BuildType) = platform(platform
135
134
artifactRules = " +:build/maven=>maven\n +:build/api=>api"
136
135
}
137
136
138
- fun BuildType.dependsOn (build : BuildType , configure : Dependency .() -> Unit ) =
139
- apply {
140
- dependencies.dependency(build, configure)
141
- }
142
-
143
- fun BuildType.dependsOnSnapshot (build : BuildType , onFailure : FailureAction = FailureAction .FAIL_TO_START , configure : SnapshotDependency .() -> Unit = {}) = apply {
144
- dependencies.dependency(build) {
145
- snapshot {
146
- configure()
147
- onDependencyFailure = onFailure
148
- onDependencyCancel = FailureAction .CANCEL
149
- }
150
- }
151
- }
152
-
153
- fun Project.deployConfigure () = BuildType {
154
- id(" Deploy_Configure" )
137
+ fun Project.deployVersion () = BuildType {
138
+ id(DEPLOY_CONFIGURE_VERSION_ID )
155
139
this .name = " Deploy (Configure Version)"
156
140
commonConfigure()
157
141
@@ -161,6 +145,8 @@ fun Project.deployConfigure() = BuildType {
161
145
param(" bintray-user" , bintrayUserName)
162
146
password(" bintray-key" , bintrayToken)
163
147
param(versionSuffixParameter, " dev-%build.counter%" )
148
+ param(" reverse.dep.$BUILD_CREATE_STAGING_REPO_ABSOLUTE_ID .system.libs.repo.description" , libraryStagingRepoDescription)
149
+ param(" env.libs.repository.id" , " %dep.$BUILD_CREATE_STAGING_REPO_ABSOLUTE_ID .env.libs.repository.id%" )
164
150
}
165
151
166
152
requirements {
@@ -171,7 +157,7 @@ fun Project.deployConfigure() = BuildType {
171
157
steps {
172
158
gradle {
173
159
name = " Verify Gradle Configuration"
174
- tasks = " clean publishBintrayCreateVersion "
160
+ tasks = " clean publishPrepareVersion "
175
161
gradleParams = " --info --stacktrace -P$versionSuffixParameter =%$versionSuffixParameter % -P$releaseVersionParameter =%$releaseVersionParameter % -PbintrayApiKey=%bintray-key% -PbintrayUser=%bintray-user%"
176
162
buildFile = " "
177
163
jdkHome = " %env.$jdk %"
@@ -180,7 +166,7 @@ fun Project.deployConfigure() = BuildType {
180
166
}.also { buildType(it) }
181
167
182
168
fun Project.deployPublish (configureBuild : BuildType ) = BuildType {
183
- id(" Deploy_Publish " )
169
+ id(DEPLOY_PUBLISH_ID )
184
170
this .name = " Deploy (Publish)"
185
171
type = BuildTypeSettings .Type .COMPOSITE
186
172
dependsOnSnapshot(configureBuild)
@@ -189,12 +175,13 @@ fun Project.deployPublish(configureBuild: BuildType) = BuildType {
189
175
// Tell configuration build how to get release version parameter from this build
190
176
// "dev" is the default and means publishing is not releasing to public
191
177
text(configureBuild.reverseDepParamRefs[releaseVersionParameter].name, " dev" , display = ParameterDisplay .PROMPT , label = " Release Version" )
178
+ param(" env.libs.repository.id" , " %dep.$BUILD_CREATE_STAGING_REPO_ABSOLUTE_ID .env.libs.repository.id%" )
192
179
}
193
180
commonConfigure()
194
181
}.also { buildType(it) }
195
182
196
183
197
- fun Project.deploy (platform : String , configureBuild : BuildType ) = platform(platform, " Deploy" ) {
184
+ fun Project.deploy (platform : Platform , configureBuild : BuildType ) = buildType( " Deploy" , platform ) {
198
185
type = BuildTypeSettings .Type .DEPLOYMENT
199
186
enablePersonalBuilds = false
200
187
maxRunningBuilds = 1
@@ -203,6 +190,7 @@ fun Project.deploy(platform: String, configureBuild: BuildType) = platform(platf
203
190
param(releaseVersionParameter, " ${configureBuild.depParamRefs[releaseVersionParameter]} " )
204
191
param(" bintray-user" , bintrayUserName)
205
192
password(" bintray-key" , bintrayToken)
193
+ param(" env.libs.repository.id" , " %dep.$BUILD_CREATE_STAGING_REPO_ABSOLUTE_ID .env.libs.repository.id%" )
206
194
}
207
195
208
196
vcs {
@@ -211,7 +199,7 @@ fun Project.deploy(platform: String, configureBuild: BuildType) = platform(platf
211
199
212
200
steps {
213
201
gradle {
214
- name = " Deploy $platform Binaries"
202
+ name = " Deploy ${ platform.buildTypeName()} Binaries"
215
203
jdkHome = " %env.$jdk %"
216
204
jvmArgs = " -Xmx1g"
217
205
gradleParams = " --info --stacktrace -P$versionSuffixParameter =%$versionSuffixParameter % -P$releaseVersionParameter =%$releaseVersionParameter % -PbintrayApiKey=%bintray-key% -PbintrayUser=%bintray-user%"
@@ -221,53 +209,3 @@ fun Project.deploy(platform: String, configureBuild: BuildType) = platform(platf
221
209
}
222
210
}
223
211
}.dependsOnSnapshot(configureBuild)
224
-
225
- fun Project.platform (platform : String , name : String , configure : BuildType .() -> Unit ) = BuildType {
226
- // ID is prepended with Project ID, so don't repeat it here
227
- // ID should conform to identifier rules, so just letters, numbers and underscore
228
- id(" ${name} _${platform.substringBefore(" " )} " )
229
- // Display name of the build configuration
230
- this .name = " $name ($platform )"
231
-
232
- requirements {
233
- contains(" teamcity.agent.jvm.os.name" , platform)
234
- }
235
-
236
- params {
237
- // This parameter is needed for macOS agent to be compatible
238
- if (platform.startsWith(" Mac" )) param(" env.JDK_17" , " " )
239
- }
240
-
241
- commonConfigure()
242
- configure()
243
- }.also { buildType(it) }
244
-
245
-
246
- fun BuildType.commonConfigure () {
247
- requirements {
248
- noLessThan(" teamcity.agent.hardware.memorySizeMb" , " 6144" )
249
- }
250
-
251
- // Allow to fetch build status through API for badges
252
- allowExternalStatus = true
253
-
254
- // Configure VCS, by default use the same and only VCS root from which this configuration is fetched
255
- vcs {
256
- root(DslContext .settingsRoot)
257
- showDependenciesChanges = true
258
- checkoutMode = CheckoutMode .ON_AGENT
259
- }
260
-
261
- failureConditions {
262
- errorMessage = true
263
- nonZeroExitCode = true
264
- executionTimeoutMin = 120
265
- }
266
-
267
- features {
268
- feature {
269
- id = " perfmon"
270
- type = " perfmon"
271
- }
272
- }
273
- }
0 commit comments