@@ -7,9 +7,6 @@ import jetbrains.buildServer.configs.kotlin.v2018_2.*
77import jetbrains.buildServer.configs.kotlin.v2018_2.buildSteps.gradle
88import java.lang.IllegalArgumentException
99
10- val platforms = listOf (" Windows" , " Linux" , " Mac OS X" )
11- val jdk = " JDK_18_x64"
12-
1310fun Project.additionalConfiguration () {
1411 subProject(benchmarksProject())
1512}
@@ -18,10 +15,14 @@ fun benchmarksProject() = Project {
1815 this .id(" Benchmarks" )
1916 this .name = " Benchmarks"
2017
18+ params {
19+ param(" teamcity.ui.settings.readOnly" , " true" )
20+ }
21+
2122 val benchmarkAll = benchmarkAll()
2223 val benchmarks = listOf (
23- benchmark(" js" , " Linux" ),
24- benchmark(" jvm" , " Linux" ),
24+ benchmark(" js" , Platform . Linux ),
25+ benchmark(" jvm" , Platform . Linux ),
2526 * platforms.map { benchmark(" native" , it) }.toTypedArray()
2627 )
2728
@@ -45,7 +46,7 @@ fun Project.benchmarkAll() = BuildType {
4546 commonConfigure()
4647}.also { buildType(it) }
4748
48- fun Project.benchmark (target : String , platform : String ) = platform(platform, " ${target} Benchmark" ) {
49+ fun Project.benchmark (target : String , platform : Platform ) = buildType( " ${target} Benchmark" , platform ) {
4950 steps {
5051 gradle {
5152 name = " Benchmark"
@@ -68,83 +69,13 @@ fun Project.benchmark(target: String, platform: String) = platform(platform, "${
6869 }
6970}
7071
71- fun benchmarkTask (target : String , platform : String ): String = when (target) {
72+ fun benchmarkTask (target : String , platform : Platform ): String = when (target) {
7273 " js" , " jvm" -> " ${target} FastBenchmark"
73- " native" -> when (platform) {
74- " Mac OS X" -> " macosX64FastBenchmark"
75- " Linux" -> " linuxX64FastBenchmark"
76- " Windows" -> " mingwX64FastBenchmark"
77- else -> throw IllegalArgumentException (" Unknown platform: $platform " )
78- }
74+ " native" -> " ${platform.nativeTaskPrefix()} FastBenchmark"
7975 else -> throw IllegalArgumentException (" Unknown target: $target " )
8076}
8177
82- fun Requirements.benchmarkAgentInstanceTypeRequirement (platform : String ) {
83- if (platform == " Linux" ) equals(" system.ec2.instance-type" , " m5d.xlarge" )
84- else if (platform == " Windows" ) equals(" system.ec2.instance-type" , " m5.xlarge" )
85- }
86-
87- fun BuildType.dependsOn (build : BuildType , configure : Dependency .() -> Unit ) =
88- apply {
89- dependencies.dependency(build, configure)
90- }
91-
92- fun BuildType.dependsOnSnapshot (build : BuildType , onFailure : FailureAction = FailureAction .FAIL_TO_START , configure : SnapshotDependency .() -> Unit = {}) = apply {
93- dependencies.dependency(build) {
94- snapshot {
95- configure()
96- onDependencyFailure = onFailure
97- onDependencyCancel = FailureAction .CANCEL
98- }
99- }
100- }
101-
102- fun Project.platform (platform : String , name : String , configure : BuildType .() -> Unit ) = BuildType {
103- // ID is prepended with Project ID, so don't repeat it here
104- // ID should conform to identifier rules, so just letters, numbers and underscore
105- id(" ${name} _${platform.substringBefore(" " )} " )
106- // Display name of the build configuration
107- this .name = " $name ($platform )"
108-
109- requirements {
110- contains(" teamcity.agent.jvm.os.name" , platform)
111- }
112-
113- params {
114- // This parameter is needed for macOS agent to be compatible
115- if (platform.startsWith(" Mac" )) param(" env.JDK_17" , " " )
116- }
117-
118- commonConfigure()
119- configure()
120- }.also { buildType(it) }
121-
122-
123- fun BuildType.commonConfigure () {
124- requirements {
125- noLessThan(" teamcity.agent.hardware.memorySizeMb" , " 6144" )
126- }
127-
128- // Allow to fetch build status through API for badges
129- allowExternalStatus = true
130-
131- // Configure VCS, by default use the same and only VCS root from which this configuration is fetched
132- vcs {
133- root(DslContext .settingsRoot)
134- showDependenciesChanges = true
135- checkoutMode = CheckoutMode .ON_AGENT
136- }
137-
138- failureConditions {
139- errorMessage = true
140- nonZeroExitCode = true
141- executionTimeoutMin = 120
142- }
143-
144- features {
145- feature {
146- id = " perfmon"
147- type = " perfmon"
148- }
149- }
78+ fun Requirements.benchmarkAgentInstanceTypeRequirement (platform : Platform ) {
79+ if (platform == Platform .Linux ) equals(" system.ec2.instance-type" , " m5d.xlarge" )
80+ else if (platform == Platform .Windows ) equals(" system.ec2.instance-type" , " m5.xlarge" )
15081}
0 commit comments