@@ -42,38 +42,62 @@ project {
42
42
param(" env.JDK_6" , " %env.JDK_16%" )
43
43
}
44
44
45
- val buildAll = buildAll()
46
- val builds = platforms.map { build(it) }
45
+ val buildVersion = buildVersion()
46
+ val buildAll = buildAll(buildVersion)
47
+ val builds = platforms.map { build(it, buildVersion) }
47
48
builds.forEach { build ->
48
- buildAll.dependsOn(build) {
49
- snapshot {
50
- onDependencyFailure = FailureAction .ADD_PROBLEM
51
- onDependencyCancel = FailureAction .CANCEL
52
- }
53
- }
49
+ buildAll.dependsOnSnapshot(build, onFailure = FailureAction .ADD_PROBLEM )
54
50
buildAll.dependsOn(build) {
55
51
artifacts {
56
52
artifactRules = " +:maven=>maven\n +:api=>api"
57
53
}
58
54
}
59
55
}
60
56
61
- val deployConfigure = deployConfigure()
57
+ val deployConfigure = deployConfigure().apply {
58
+ dependsOnSnapshot(buildAll, onFailure = FailureAction .IGNORE )
59
+ }
62
60
val deploys = platforms.map { deploy(it, deployConfigure) }
63
61
val deployPublish = deployPublish(deployConfigure).apply {
62
+ dependsOnSnapshot(buildAll, onFailure = FailureAction .IGNORE )
64
63
deploys.forEach {
65
64
dependsOnSnapshot(it)
66
65
}
67
66
}
68
67
69
- buildTypesOrder = listOf (buildAll) + builds + deployPublish + deployConfigure + deploys
68
+ buildTypesOrder = listOf (buildAll, buildVersion, * builds.toTypedArray(), deployPublish, deployConfigure, * deploys.toTypedArray())
70
69
}
71
70
72
- fun Project.buildAll () = BuildType {
71
+ fun Project.buildVersion () = BuildType {
72
+ id(" Build_Version" )
73
+ this .name = " Build (Configure Version)"
74
+ commonConfigure()
75
+
76
+ params {
77
+ param(versionSuffixParameter, " SNAPSHOT" )
78
+ param(teamcitySuffixParameter, " %build.counter%" )
79
+ }
80
+
81
+ steps {
82
+ gradle {
83
+ name = " Generate build chain version"
84
+ jdkHome = " %env.$jdk %"
85
+ tasks = " "
86
+ gradleParams = " --info --stacktrace -P$versionSuffixParameter =%$versionSuffixParameter % -P$teamcitySuffixParameter =%$teamcitySuffixParameter %"
87
+ buildFile = " "
88
+ gradleWrapperPath = " "
89
+ }
90
+ }
91
+ }.also { buildType(it) }
92
+
93
+ fun Project.buildAll (versionBuild : BuildType ) = BuildType {
73
94
id(" Build_All" )
74
95
this .name = " Build (All)"
75
96
type = BuildTypeSettings .Type .COMPOSITE
76
-
97
+
98
+ dependsOnSnapshot(versionBuild)
99
+ buildNumberPattern = versionBuild.depParamRefs.buildNumber.ref
100
+
77
101
triggers {
78
102
vcs {
79
103
triggerRules = """
@@ -82,19 +106,27 @@ fun Project.buildAll() = BuildType {
82
106
""" .trimIndent()
83
107
}
84
108
}
85
-
109
+
86
110
commonConfigure()
87
111
}.also { buildType(it) }
88
112
89
- fun Project.build (platform : String ) = platform(platform, " Build" ) {
113
+ fun Project.build (platform : String , versionBuild : BuildType ) = platform(platform, " Build" ) {
114
+
115
+ dependsOnSnapshot(versionBuild)
116
+
117
+ params {
118
+ param(versionSuffixParameter, versionBuild.depParamRefs[versionSuffixParameter].ref)
119
+ param(teamcitySuffixParameter, versionBuild.depParamRefs[teamcitySuffixParameter].ref)
120
+ }
121
+
90
122
steps {
91
123
gradle {
92
124
name = " Build and Test $platform Binaries"
93
125
jdkHome = " %env.$jdk %"
94
126
jvmArgs = " -Xmx1g"
95
127
tasks = " clean publishToBuildLocal check"
96
128
// --continue is needed to run tests for all targets even if one target fails
97
- gradleParams = " --info --stacktrace -P$versionSuffixParameter =SNAPSHOT -P$teamcitySuffixParameter =%build.counter % --continue"
129
+ gradleParams = " --info --stacktrace -P$versionSuffixParameter =% $versionSuffixParameter % -P$teamcitySuffixParameter =%$teamcitySuffixParameter % --continue"
98
130
buildFile = " "
99
131
gradleWrapperPath = " "
100
132
}
@@ -109,19 +141,19 @@ fun BuildType.dependsOn(build: BuildType, configure: Dependency.() -> Unit) =
109
141
dependencies.dependency(build, configure)
110
142
}
111
143
112
- fun BuildType.dependsOnSnapshot (build : BuildType , configure : SnapshotDependency .() -> Unit = {}) = apply {
144
+ fun BuildType.dependsOnSnapshot (build : BuildType , onFailure : FailureAction = FailureAction . FAIL_TO_START , configure : SnapshotDependency .() -> Unit = {}) = apply {
113
145
dependencies.dependency(build) {
114
146
snapshot {
115
147
configure()
116
- onDependencyFailure = FailureAction . FAIL_TO_START
148
+ onDependencyFailure = onFailure
117
149
onDependencyCancel = FailureAction .CANCEL
118
150
}
119
151
}
120
152
}
121
153
122
154
fun Project.deployConfigure () = BuildType {
123
155
id(" Deploy_Configure" )
124
- this .name = " Deploy (Configure)"
156
+ this .name = " Deploy (Configure Version )"
125
157
commonConfigure()
126
158
127
159
params {
@@ -152,15 +184,15 @@ fun Project.deployPublish(configureBuild: BuildType) = BuildType {
152
184
id(" Deploy_Publish" )
153
185
this .name = " Deploy (Publish)"
154
186
type = BuildTypeSettings .Type .COMPOSITE
187
+ dependsOnSnapshot(configureBuild)
188
+ buildNumberPattern = configureBuild.depParamRefs.buildNumber.ref
155
189
params {
156
- param(versionSuffixParameter, " ${configureBuild.depParamRefs[versionSuffixParameter]} " )
157
-
158
190
// Tell configuration build how to get release version parameter from this build
159
191
// "dev" is the default and means publishing is not releasing to public
160
- param (configureBuild.reverseDepParamRefs[releaseVersionParameter].name, " dev" )
192
+ text (configureBuild.reverseDepParamRefs[releaseVersionParameter].name, " dev" , display = ParameterDisplay . PROMPT , label = " Release Version " )
161
193
}
162
194
commonConfigure()
163
- }.also { buildType(it) }.dependsOnSnapshot(configureBuild)
195
+ }.also { buildType(it) }
164
196
165
197
166
198
fun Project.deploy (platform : String , configureBuild : BuildType ) = platform(platform, " Deploy" ) {
0 commit comments