@@ -143,67 +143,43 @@ fun Project.build(platform: String, versionBuild: BuildType) = platform(platform
143143 artifactRules = " +:build/maven=>maven\n +:build/api=>api"
144144}
145145
146- fun Project.benchmark (target : String , platform : String ) = BuildType {
147- // ID is prepended with Project ID, so don't repeat it here
148- // ID should conform to identifier rules, so just letters, numbers and underscore
149- id(" ${target} Benchmark_${platform.substringBefore(" " )} " )
150- // Display name of the build configuration
151- this .name = " ${target} Benchmark ($platform )"
152-
146+ fun Project.benchmark (target : String , platform : String ) = platform(platform, " ${target} Benchmark" ) {
153147 steps {
154148 gradle {
155149 name = " Benchmark"
156- tasks = " ${ if (target == " native " ) nativeTarget( platform) else target} Benchmark "
150+ tasks = benchmarkTask (target, platform)
157151 jdkHome = " %env.$jdk %"
158152 param(" org.jfrog.artifactory.selectedDeployableServer.defaultModuleVersionConfiguration" , " GLOBAL" )
159153 buildFile = " "
160154 gradleWrapperPath = " "
161155 }
162156 }
163157
164- // What files to publish as build artifacts
165158 artifactRules = " benchmarks/build/reports/**=> reports"
166159
167160 requirements {
168- equals(" system.ec2.instance-type" , " m5d.xlarge" )
169- contains(" teamcity.agent.jvm.os.name" , platform)
170- noLessThan(" teamcity.agent.hardware.memorySizeMb" , " 6144" )
171- }
172-
173- params {
174- // This parameter is needed for macOS agent to be compatible
175- if (platform.startsWith(" Mac" )) param(" env.JDK_17" , " " )
176- }
177-
178- // Allow to fetch build status through API for badges
179- allowExternalStatus = true
180-
181- // Configure VCS, by default use the same and only VCS root from which this configuration is fetched
182- vcs {
183- root(DslContext .settingsRoot)
184- showDependenciesChanges = true
185- checkoutMode = CheckoutMode .ON_AGENT
161+ benchmarkAgentInstanceTypeRequirement(platform)
186162 }
187163
188164 failureConditions {
189- errorMessage = true
190- nonZeroExitCode = true
191165 executionTimeoutMin = 1440
192166 }
167+ }
193168
194- features {
195- feature {
196- id = " perfmon"
197- type = " perfmon"
198- }
169+ fun benchmarkTask (target : String , platform : String ): String = when (target) {
170+ " js" , " jvm" -> " ${target} Benchmark"
171+ " native" -> when (platform) {
172+ " Mac OS X" -> " macosX64Benchmark"
173+ " Linux" -> " linuxX64Benchmark"
174+ " Windows" -> " mingwX64Benchmark"
175+ else -> throw IllegalArgumentException (" Unknown platform: $platform " )
199176 }
200- }.also { buildType(it) }
177+ else -> throw IllegalArgumentException (" Unknown target: $target " )
178+ }
201179
202- fun nativeTarget (platform : String ): String = when (platform) {
203- " Mac OS X" -> " macosX64"
204- " Linux" -> " linuxX64"
205- " Windows" -> " mingwX64"
206- else -> throw IllegalArgumentException (" Unknown platform: $platform " )
180+ fun Requirements.benchmarkAgentInstanceTypeRequirement (platform : String ) {
181+ if (platform == " Linux" ) equals(" system.ec2.instance-type" , " m5d.xlarge" )
182+ else if (platform == " Windows" ) equals(" system.ec2.instance-type" , " m5.xlarge" )
207183}
208184
209185fun BuildType.dependsOn (build : BuildType , configure : Dependency .() -> Unit ) =
0 commit comments