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,55 +24,72 @@ 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 = " orangy"
33
- val bintrayToken = " credentialsJSON:9a48193c-d16d-46c7-8751-2fb434b09e07"
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
40
31
params {
41
32
param(" teamcity.ui.settings.readOnly" , " true" )
42
33
}
43
34
44
- val buildAll = buildAll()
45
- val builds = platforms.map { build(it) }
35
+ val buildVersion = buildVersion()
36
+ val buildAll = buildAll(buildVersion)
37
+ val builds = platforms.map { build(it, buildVersion) }
46
38
builds.forEach { build ->
47
- buildAll.dependsOn(build) {
48
- snapshot {
49
- onDependencyFailure = FailureAction .ADD_PROBLEM
50
- onDependencyCancel = FailureAction .CANCEL
51
- }
52
- }
39
+ buildAll.dependsOnSnapshot(build, onFailure = FailureAction .ADD_PROBLEM )
53
40
buildAll.dependsOn(build) {
54
41
artifacts {
55
42
artifactRules = " +:maven=>maven\n +:api=>api"
56
43
}
57
44
}
58
45
}
59
46
60
- val deployConfigure = deployConfigure()
61
- val deploys = platforms.map { deploy(it, deployConfigure) }
62
- val deployPublish = deployPublish(deployConfigure).apply {
47
+ val deployVersion = deployVersion().apply {
48
+ dependsOnSnapshot(buildAll, onFailure = FailureAction .IGNORE )
49
+ }
50
+ val deploys = platforms.map { deploy(it, deployVersion) }
51
+ val deployPublish = deployPublish(deployVersion).apply {
52
+ dependsOnSnapshot(buildAll, onFailure = FailureAction .IGNORE )
63
53
deploys.forEach {
64
54
dependsOnSnapshot(it)
65
55
}
66
56
}
67
57
68
- buildTypesOrder = listOf (buildAll) + builds + deployPublish + deployConfigure + deploys
58
+ buildTypesOrder = listOf (buildAll, buildVersion, * builds.toTypedArray(), deployPublish, deployVersion, * deploys.toTypedArray())
59
+
60
+ additionalConfiguration()
69
61
}
70
62
71
- fun Project.buildAll () = BuildType {
72
- id(" Build_All" )
63
+ fun Project.buildVersion () = BuildType {
64
+ id(BUILD_CONFIGURE_VERSION_ID )
65
+ this .name = " Build (Configure Version)"
66
+ commonConfigure()
67
+
68
+ params {
69
+ param(versionSuffixParameter, " SNAPSHOT" )
70
+ param(teamcitySuffixParameter, " %build.counter%" )
71
+ }
72
+
73
+ steps {
74
+ gradle {
75
+ name = " Generate build chain version"
76
+ jdkHome = " %env.$jdk %"
77
+ tasks = " "
78
+ gradleParams = " --info --stacktrace -P$versionSuffixParameter =%$versionSuffixParameter % -P$teamcitySuffixParameter =%$teamcitySuffixParameter %"
79
+ buildFile = " "
80
+ gradleWrapperPath = " "
81
+ }
82
+ }
83
+ }.also { buildType(it) }
84
+
85
+ fun Project.buildAll (versionBuild : BuildType ) = BuildType {
86
+ id(BUILD_ALL_ID )
73
87
this .name = " Build (All)"
74
88
type = BuildTypeSettings .Type .COMPOSITE
75
-
89
+
90
+ dependsOnSnapshot(versionBuild)
91
+ buildNumberPattern = versionBuild.depParamRefs.buildNumber.ref
92
+
76
93
triggers {
77
94
vcs {
78
95
triggerRules = """
@@ -81,19 +98,27 @@ fun Project.buildAll() = BuildType {
81
98
""" .trimIndent()
82
99
}
83
100
}
84
-
101
+
85
102
commonConfigure()
86
103
}.also { buildType(it) }
87
104
88
- fun Project.build (platform : String ) = platform(platform, " Build" ) {
105
+ fun Project.build (platform : Platform , versionBuild : BuildType ) = buildType(" Build" , platform) {
106
+
107
+ dependsOnSnapshot(versionBuild)
108
+
109
+ params {
110
+ param(versionSuffixParameter, versionBuild.depParamRefs[versionSuffixParameter].ref)
111
+ param(teamcitySuffixParameter, versionBuild.depParamRefs[teamcitySuffixParameter].ref)
112
+ }
113
+
89
114
steps {
90
115
gradle {
91
- name = " Build and Test $platform Binaries"
116
+ name = " Build and Test ${ platform.buildTypeName()} Binaries"
92
117
jdkHome = " %env.$jdk %"
93
118
jvmArgs = " -Xmx1g"
94
- tasks = " clean publishToBuildLocal check ${fastBenchmarkTasks(platform).joinToString(separator = " " )} "
119
+ tasks = " clean publishToBuildLocal check"
95
120
// --continue is needed to run tests for all targets even if one target fails
96
- gradleParams = " --info --stacktrace -P$versionSuffixParameter =SNAPSHOT -P$teamcitySuffixParameter =%build.counter % --continue"
121
+ gradleParams = " --info --stacktrace -P$versionSuffixParameter =% $versionSuffixParameter % -P$teamcitySuffixParameter =%$teamcitySuffixParameter % --continue"
97
122
buildFile = " "
98
123
gradleWrapperPath = " "
99
124
}
@@ -103,34 +128,9 @@ fun Project.build(platform: String) = platform(platform, "Build") {
103
128
artifactRules = " +:build/maven=>maven\n +:build/api=>api"
104
129
}
105
130
106
- fun fastBenchmarkTasks (platform : String ): List <String > {
107
- val nativeFastBenchmark = when (platform) {
108
- " Mac OS X" -> " macosX64FastBenchmark"
109
- " Linux" -> " linuxX64FastBenchmark"
110
- " Windows" -> " mingwX64FastBenchmark"
111
- else -> throw IllegalArgumentException (" Unknown platform: $platform " )
112
- }
113
- return listOf (" jsFastBenchmark" , " jvmFastBenchmark" , nativeFastBenchmark)
114
- }
115
-
116
- fun BuildType.dependsOn (build : BuildType , configure : Dependency .() -> Unit ) =
117
- apply {
118
- dependencies.dependency(build, configure)
119
- }
120
-
121
- fun BuildType.dependsOnSnapshot (build : BuildType , configure : SnapshotDependency .() -> Unit = {}) = apply {
122
- dependencies.dependency(build) {
123
- snapshot {
124
- configure()
125
- onDependencyFailure = FailureAction .FAIL_TO_START
126
- onDependencyCancel = FailureAction .CANCEL
127
- }
128
- }
129
- }
130
-
131
- fun Project.deployConfigure () = BuildType {
132
- id(" Deploy_Configure" )
133
- this .name = " Deploy (Configure)"
131
+ fun Project.deployVersion () = BuildType {
132
+ id(DEPLOY_CONFIGURE_VERSION_ID )
133
+ this .name = " Deploy (Configure Version)"
134
134
commonConfigure()
135
135
136
136
params {
@@ -158,21 +158,21 @@ fun Project.deployConfigure() = BuildType {
158
158
}.also { buildType(it) }
159
159
160
160
fun Project.deployPublish (configureBuild : BuildType ) = BuildType {
161
- id(" Deploy_Publish " )
161
+ id(DEPLOY_PUBLISH_ID )
162
162
this .name = " Deploy (Publish)"
163
163
type = BuildTypeSettings .Type .COMPOSITE
164
+ dependsOnSnapshot(configureBuild)
165
+ buildNumberPattern = configureBuild.depParamRefs.buildNumber.ref
164
166
params {
165
- param(versionSuffixParameter, " ${configureBuild.depParamRefs[versionSuffixParameter]} " )
166
-
167
167
// Tell configuration build how to get release version parameter from this build
168
168
// "dev" is the default and means publishing is not releasing to public
169
- param (configureBuild.reverseDepParamRefs[releaseVersionParameter].name, " dev" )
169
+ text (configureBuild.reverseDepParamRefs[releaseVersionParameter].name, " dev" , display = ParameterDisplay . PROMPT , label = " Release Version " )
170
170
}
171
171
commonConfigure()
172
- }.also { buildType(it) }.dependsOnSnapshot(configureBuild)
172
+ }.also { buildType(it) }
173
173
174
174
175
- fun Project.deploy (platform : String , configureBuild : BuildType ) = platform(platform, " Deploy" ) {
175
+ fun Project.deploy (platform : Platform , configureBuild : BuildType ) = buildType( " Deploy" , platform ) {
176
176
type = BuildTypeSettings .Type .DEPLOYMENT
177
177
enablePersonalBuilds = false
178
178
maxRunningBuilds = 1
@@ -189,63 +189,13 @@ fun Project.deploy(platform: String, configureBuild: BuildType) = platform(platf
189
189
190
190
steps {
191
191
gradle {
192
- name = " Deploy $platform Binaries"
192
+ name = " Deploy ${ platform.buildTypeName()} Binaries"
193
193
jdkHome = " %env.$jdk %"
194
194
jvmArgs = " -Xmx1g"
195
195
gradleParams = " --info --stacktrace -P$versionSuffixParameter =%$versionSuffixParameter % -P$releaseVersionParameter =%$releaseVersionParameter % -PbintrayApiKey=%bintray-key% -PbintrayUser=%bintray-user%"
196
- tasks = " clean build publish"
196
+ tasks = " clean publish"
197
197
buildFile = " "
198
198
gradleWrapperPath = " "
199
199
}
200
200
}
201
201
}.dependsOnSnapshot(configureBuild)
202
-
203
- fun Project.platform (platform : String , name : String , configure : BuildType .() -> Unit ) = BuildType {
204
- // ID is prepended with Project ID, so don't repeat it here
205
- // ID should conform to identifier rules, so just letters, numbers and underscore
206
- id(" ${name} _${platform.substringBefore(" " )} " )
207
- // Display name of the build configuration
208
- this .name = " $name ($platform )"
209
-
210
- requirements {
211
- contains(" teamcity.agent.jvm.os.name" , platform)
212
- }
213
-
214
- params {
215
- // This parameter is needed for macOS agent to be compatible
216
- param(" env.JDK_17" , " " )
217
- }
218
-
219
- commonConfigure()
220
- configure()
221
- }.also { buildType(it) }
222
-
223
-
224
- fun BuildType.commonConfigure () {
225
- requirements {
226
- noLessThan(" teamcity.agent.hardware.memorySizeMb" , " 6144" )
227
- }
228
-
229
- // Allow to fetch build status through API for badges
230
- allowExternalStatus = true
231
-
232
- // Configure VCS, by default use the same and only VCS root from which this configuration is fetched
233
- vcs {
234
- root(DslContext .settingsRoot)
235
- showDependenciesChanges = true
236
- checkoutMode = CheckoutMode .ON_AGENT
237
- }
238
-
239
- failureConditions {
240
- errorMessage = true
241
- nonZeroExitCode = true
242
- executionTimeoutMin = 120
243
- }
244
-
245
- features {
246
- feature {
247
- id = " perfmon"
248
- type = " perfmon"
249
- }
250
- }
251
- }
0 commit comments