1- import jetbrains.buildServer.configs.kotlin.v2018_2.*
2- import jetbrains.buildServer.configs.kotlin.v2018_2.buildFeatures.commitStatusPublisher
3- import jetbrains.buildServer.configs.kotlin.v2018_2.buildSteps.*
4- 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.*
54
65/*
76The settings script is an entry point for defining a TeamCity
@@ -25,16 +24,7 @@ To debug in IntelliJ Idea, open the 'Maven Projects' tool window (View
2524'Debug' option is available in the context menu for the task.
2625*/
2726
28- version = " 2018.2"
29- val versionSuffixParameter = " versionSuffix"
30- val teamcitySuffixParameter = " teamcitySuffix"
31- val releaseVersionParameter = " releaseVersion"
32-
33- val bintrayUserName = " %env.BINTRAY_USER%"
34- val bintrayToken = " %env.BINTRAY_API_KEY%"
35-
36- val platforms = listOf (" Windows" , " Linux" , " Mac OS X" )
37- val jdk = " JDK_18_x64"
27+ version = " 2020.1"
3828
3929project {
4030 // Disable editing of project and build settings from the UI to avoid issues with TeamCity
@@ -54,22 +44,30 @@ project {
5444 }
5545 }
5646
57- val deployConfigure = deployConfigure ().apply {
47+ val deployVersion = deployVersion ().apply {
5848 dependsOnSnapshot(buildAll, onFailure = FailureAction .IGNORE )
49+ dependsOnSnapshot(BUILD_CREATE_STAGING_REPO_ABSOLUTE_ID ) {
50+ reuseBuilds = ReuseBuilds .NO
51+ }
5952 }
60- val deploys = platforms.map { deploy(it, deployConfigure ) }
61- val deployPublish = deployPublish(deployConfigure ).apply {
53+ val deploys = platforms.map { deploy(it, deployVersion ) }
54+ val deployPublish = deployPublish(deployVersion ).apply {
6255 dependsOnSnapshot(buildAll, onFailure = FailureAction .IGNORE )
56+ dependsOnSnapshot(BUILD_CREATE_STAGING_REPO_ABSOLUTE_ID ) {
57+ reuseBuilds = ReuseBuilds .NO
58+ }
6359 deploys.forEach {
6460 dependsOnSnapshot(it)
6561 }
6662 }
6763
68- buildTypesOrder = listOf (buildAll, buildVersion, * builds.toTypedArray(), deployPublish, deployConfigure, * deploys.toTypedArray())
64+ buildTypesOrder = listOf (buildAll, buildVersion, * builds.toTypedArray(), deployPublish, deployVersion, * deploys.toTypedArray())
65+
66+ additionalConfiguration()
6967}
7068
7169fun Project.buildVersion () = BuildType {
72- id(" Build_Version " )
70+ id(BUILD_CONFIGURE_VERSION_ID )
7371 this .name = " Build (Configure Version)"
7472 commonConfigure()
7573
@@ -91,7 +89,7 @@ fun Project.buildVersion() = BuildType {
9189}.also { buildType(it) }
9290
9391fun Project.buildAll (versionBuild : BuildType ) = BuildType {
94- id(" Build_All " )
92+ id(BUILD_ALL_ID )
9593 this .name = " Build (All)"
9694 type = BuildTypeSettings .Type .COMPOSITE
9795
@@ -107,22 +105,10 @@ fun Project.buildAll(versionBuild: BuildType) = BuildType {
107105 }
108106 }
109107
110- features {
111- commitStatusPublisher {
112- publisher = github {
113- githubUrl = " https://api.github.com"
114- authType = personalToken {
115- token = " credentialsJSON:af36802a-ccd4-401b-86b9-0b08d2dfad17"
116- }
117- }
118- param(" github_oauth_user" , " ilya-g" )
119- }
120- }
121-
122108 commonConfigure()
123109}.also { buildType(it) }
124110
125- fun Project.build (platform : String , versionBuild : BuildType ) = platform(platform, " Build" ) {
111+ fun Project.build (platform : Platform , versionBuild : BuildType ) = buildType( " Build" , platform ) {
126112
127113 dependsOnSnapshot(versionBuild)
128114
@@ -133,7 +119,7 @@ fun Project.build(platform: String, versionBuild: BuildType) = platform(platform
133119
134120 steps {
135121 gradle {
136- name = " Build and Test $platform Binaries"
122+ name = " Build and Test ${ platform.buildTypeName()} Binaries"
137123 jdkHome = " %env.$jdk %"
138124 jvmArgs = " -Xmx1g"
139125 tasks = " clean publishToBuildLocal check"
@@ -148,23 +134,8 @@ fun Project.build(platform: String, versionBuild: BuildType) = platform(platform
148134 artifactRules = " +:build/maven=>maven\n +:build/api=>api"
149135}
150136
151- fun BuildType.dependsOn (build : BuildType , configure : Dependency .() -> Unit ) =
152- apply {
153- dependencies.dependency(build, configure)
154- }
155-
156- fun BuildType.dependsOnSnapshot (build : BuildType , onFailure : FailureAction = FailureAction .FAIL_TO_START , configure : SnapshotDependency .() -> Unit = {}) = apply {
157- dependencies.dependency(build) {
158- snapshot {
159- configure()
160- onDependencyFailure = onFailure
161- onDependencyCancel = FailureAction .CANCEL
162- }
163- }
164- }
165-
166- fun Project.deployConfigure () = BuildType {
167- id(" Deploy_Configure" )
137+ fun Project.deployVersion () = BuildType {
138+ id(DEPLOY_CONFIGURE_VERSION_ID )
168139 this .name = " Deploy (Configure Version)"
169140 commonConfigure()
170141
@@ -174,6 +145,8 @@ fun Project.deployConfigure() = BuildType {
174145 param(" bintray-user" , bintrayUserName)
175146 password(" bintray-key" , bintrayToken)
176147 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%" )
177150 }
178151
179152 requirements {
@@ -184,7 +157,7 @@ fun Project.deployConfigure() = BuildType {
184157 steps {
185158 gradle {
186159 name = " Verify Gradle Configuration"
187- tasks = " clean publishBintrayCreateVersion "
160+ tasks = " clean publishPrepareVersion "
188161 gradleParams = " --info --stacktrace -P$versionSuffixParameter =%$versionSuffixParameter % -P$releaseVersionParameter =%$releaseVersionParameter % -PbintrayApiKey=%bintray-key% -PbintrayUser=%bintray-user%"
189162 buildFile = " "
190163 jdkHome = " %env.$jdk %"
@@ -193,7 +166,7 @@ fun Project.deployConfigure() = BuildType {
193166}.also { buildType(it) }
194167
195168fun Project.deployPublish (configureBuild : BuildType ) = BuildType {
196- id(" Deploy_Publish " )
169+ id(DEPLOY_PUBLISH_ID )
197170 this .name = " Deploy (Publish)"
198171 type = BuildTypeSettings .Type .COMPOSITE
199172 dependsOnSnapshot(configureBuild)
@@ -202,12 +175,13 @@ fun Project.deployPublish(configureBuild: BuildType) = BuildType {
202175 // Tell configuration build how to get release version parameter from this build
203176 // "dev" is the default and means publishing is not releasing to public
204177 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%" )
205179 }
206180 commonConfigure()
207181}.also { buildType(it) }
208182
209183
210- fun Project.deploy (platform : String , configureBuild : BuildType ) = platform(platform, " Deploy" ) {
184+ fun Project.deploy (platform : Platform , configureBuild : BuildType ) = buildType( " Deploy" , platform ) {
211185 type = BuildTypeSettings .Type .DEPLOYMENT
212186 enablePersonalBuilds = false
213187 maxRunningBuilds = 1
@@ -216,6 +190,7 @@ fun Project.deploy(platform: String, configureBuild: BuildType) = platform(platf
216190 param(releaseVersionParameter, " ${configureBuild.depParamRefs[releaseVersionParameter]} " )
217191 param(" bintray-user" , bintrayUserName)
218192 password(" bintray-key" , bintrayToken)
193+ param(" env.libs.repository.id" , " %dep.$BUILD_CREATE_STAGING_REPO_ABSOLUTE_ID .env.libs.repository.id%" )
219194 }
220195
221196 vcs {
@@ -224,7 +199,7 @@ fun Project.deploy(platform: String, configureBuild: BuildType) = platform(platf
224199
225200 steps {
226201 gradle {
227- name = " Deploy $platform Binaries"
202+ name = " Deploy ${ platform.buildTypeName()} Binaries"
228203 jdkHome = " %env.$jdk %"
229204 jvmArgs = " -Xmx1g"
230205 gradleParams = " --info --stacktrace -P$versionSuffixParameter =%$versionSuffixParameter % -P$releaseVersionParameter =%$releaseVersionParameter % -PbintrayApiKey=%bintray-key% -PbintrayUser=%bintray-user%"
@@ -234,53 +209,3 @@ fun Project.deploy(platform: String, configureBuild: BuildType) = platform(platf
234209 }
235210 }
236211}.dependsOnSnapshot(configureBuild)
237-
238- fun Project.platform (platform : String , name : String , configure : BuildType .() -> Unit ) = BuildType {
239- // ID is prepended with Project ID, so don't repeat it here
240- // ID should conform to identifier rules, so just letters, numbers and underscore
241- id(" ${name} _${platform.substringBefore(" " )} " )
242- // Display name of the build configuration
243- this .name = " $name ($platform )"
244-
245- requirements {
246- contains(" teamcity.agent.jvm.os.name" , platform)
247- }
248-
249- params {
250- // This parameter is needed for macOS agent to be compatible
251- if (platform.startsWith(" Mac" )) param(" env.JDK_17" , " " )
252- }
253-
254- commonConfigure()
255- configure()
256- }.also { buildType(it) }
257-
258-
259- fun BuildType.commonConfigure () {
260- requirements {
261- noLessThan(" teamcity.agent.hardware.memorySizeMb" , " 6144" )
262- }
263-
264- // Allow to fetch build status through API for badges
265- allowExternalStatus = true
266-
267- // Configure VCS, by default use the same and only VCS root from which this configuration is fetched
268- vcs {
269- root(DslContext .settingsRoot)
270- showDependenciesChanges = true
271- checkoutMode = CheckoutMode .ON_AGENT
272- }
273-
274- failureConditions {
275- errorMessage = true
276- nonZeroExitCode = true
277- executionTimeoutMin = 120
278- }
279-
280- features {
281- feature {
282- id = " perfmon"
283- type = " perfmon"
284- }
285- }
286- }
0 commit comments