@@ -37,15 +37,21 @@ const val BUILD_ALL_ID = "Build_All"
37
37
const val DEPLOY_CONFIGURE_VERSION_ID = " Deploy_Configure"
38
38
const val DEPLOY_PUBLISH_ID = " Deploy_Publish"
39
39
40
- private fun existingBuildId (suffix : String ): String = " RootProjectId_$suffix "
41
- private fun Project.existingBuildWithId (id : String ): BuildType = buildTypes.single { it.id.toString() == existingBuildId(id) }
42
-
43
- fun Project.existingBuildVersion (): BuildType = existingBuildWithId(BUILD_CONFIGURE_VERSION_ID )
44
- fun Project.existingBuildAll (): BuildType = existingBuildWithId(BUILD_ALL_ID )
45
- fun Project.existingBuild (platform : Platform ): BuildType = existingBuildWithId(" Build_${platform.buildTypeId()} " )
46
- fun Project.existingDeployVersion (): BuildType = existingBuildWithId(DEPLOY_CONFIGURE_VERSION_ID )
47
- fun Project.existingDeployPublish (): BuildType = existingBuildWithId(DEPLOY_PUBLISH_ID )
48
- fun Project.existingDeploy (platform : Platform ): BuildType = existingBuildWithId(" Deploy_${platform.buildTypeId()} " )
40
+ class KnownBuilds (private val project : Project ) {
41
+ private fun buildWithId (id : String ): BuildType {
42
+ val fullId = " RootProjectId_$id "
43
+ return project.buildTypes.single { it.id.toString() == fullId }
44
+ }
45
+
46
+ val buildVersion: BuildType get() = buildWithId(BUILD_CONFIGURE_VERSION_ID )
47
+ val buildAll: BuildType get() = buildWithId(BUILD_ALL_ID )
48
+ fun buildOn (platform : Platform ): BuildType = buildWithId(" Build_${platform.buildTypeId()} " )
49
+ val deployVersion: BuildType get() = buildWithId(DEPLOY_CONFIGURE_VERSION_ID )
50
+ val deployPublish: BuildType get() = buildWithId(DEPLOY_PUBLISH_ID )
51
+ fun deployOn (platform : Platform ): BuildType = buildWithId(" Deploy_${platform.buildTypeId()} " )
52
+ }
53
+
54
+ val Project .knownBuilds: KnownBuilds get() = KnownBuilds (this )
49
55
50
56
51
57
fun Project.buildType (name : String , platform : Platform , configure : BuildType .() -> Unit ) = BuildType {
0 commit comments