@@ -7,9 +7,6 @@ import jetbrains.buildServer.configs.kotlin.v2018_2.*
7
7
import jetbrains.buildServer.configs.kotlin.v2018_2.buildSteps.gradle
8
8
import java.lang.IllegalArgumentException
9
9
10
- val platforms = listOf (" Windows" , " Linux" , " Mac OS X" )
11
- val jdk = " JDK_18_x64"
12
-
13
10
fun Project.additionalConfiguration () {
14
11
subProject(benchmarksProject())
15
12
}
@@ -18,10 +15,14 @@ fun benchmarksProject() = Project {
18
15
this .id(" Benchmarks" )
19
16
this .name = " Benchmarks"
20
17
18
+ params {
19
+ param(" teamcity.ui.settings.readOnly" , " true" )
20
+ }
21
+
21
22
val benchmarkAll = benchmarkAll()
22
23
val benchmarks = listOf (
23
- benchmark(" js" , " Linux" ),
24
- benchmark(" jvm" , " Linux" ),
24
+ benchmark(" js" , Platform . Linux ),
25
+ benchmark(" jvm" , Platform . Linux ),
25
26
* platforms.map { benchmark(" native" , it) }.toTypedArray()
26
27
)
27
28
@@ -45,7 +46,7 @@ fun Project.benchmarkAll() = BuildType {
45
46
commonConfigure()
46
47
}.also { buildType(it) }
47
48
48
- fun Project.benchmark (target : String , platform : String ) = platform(platform, " ${target} Benchmark" ) {
49
+ fun Project.benchmark (target : String , platform : Platform ) = buildType( " ${target} Benchmark" , platform ) {
49
50
steps {
50
51
gradle {
51
52
name = " Benchmark"
@@ -68,83 +69,13 @@ fun Project.benchmark(target: String, platform: String) = platform(platform, "${
68
69
}
69
70
}
70
71
71
- fun benchmarkTask (target : String , platform : String ): String = when (target) {
72
+ fun benchmarkTask (target : String , platform : Platform ): String = when (target) {
72
73
" 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"
79
75
else -> throw IllegalArgumentException (" Unknown target: $target " )
80
76
}
81
77
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" )
150
81
}
0 commit comments