From 94f317443b297707d5629d2861f718177cf3f263 Mon Sep 17 00:00:00 2001 From: Elena Lepilkina Date: Wed, 20 Mar 2019 14:08:53 +0300 Subject: [PATCH] Added gradle property to set branch which results save --- performance/build.gradle | 1 + performance/buildSrc/src/main/kotlin/BuildRegister.kt | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/performance/build.gradle b/performance/build.gradle index ec012d3a086..36d1824f7a4 100644 --- a/performance/build.gradle +++ b/performance/build.gradle @@ -82,6 +82,7 @@ private def uploadBenchmarkResultToBintray(String fileName) { } task registerBuild(type: BuildRegister) { + onlyBranch = project.findProperty('kotlin.register.only.branch') // Get bundle size. bundleSize = null if (project.findProperty('kotlin.bundleBuild') != null) { diff --git a/performance/buildSrc/src/main/kotlin/BuildRegister.kt b/performance/buildSrc/src/main/kotlin/BuildRegister.kt index 82585ffb577..b1408b4ad99 100644 --- a/performance/buildSrc/src/main/kotlin/BuildRegister.kt +++ b/performance/buildSrc/src/main/kotlin/BuildRegister.kt @@ -34,6 +34,7 @@ import java.util.Properties * @property currentBenchmarksReportFile path to file with becnhmarks result * @property analyzer path to analyzer tool * @property bundleSize size of build + * @property onlyBranch register only builds for branch */ open class BuildRegister : DefaultTask() { @Input @@ -41,6 +42,8 @@ open class BuildRegister : DefaultTask() { @Input lateinit var analyzer: String + var onlyBranch: String? = null + var bundleSize: Int? = null val buildInfoToken: Int = 4 @@ -88,6 +91,7 @@ open class BuildRegister : DefaultTask() { val teamCityUser = buildProperties.getProperty("teamcity.auth.userId") val teamCityPassword = buildProperties.getProperty("teamcity.auth.password") val buildNumber = buildProperties.getProperty("build.number") + val branch = buildProperties.getProperty("teamcity.build.branch") // Get summary information. val output = arrayOf("$analyzer", "summary", "-exec-samples", "all", "-compile", "samples", @@ -132,6 +136,11 @@ open class BuildRegister : DefaultTask() { append("\"codeSize\": \"$codeSizeInfo\",") append("\"bundleSize\": ${bundleSize?.let {"\"$bundleSize\""} ?: bundleSize}}") } - println(sendPostRequest("$performanceServer/register", requestBody)) + if (onlyBranch == null || onlyBranch == branch) { + println(sendPostRequest("$performanceServer/register", requestBody)) + } else { + println("Skipping registration. Current branch $branch, need registration for $onlyBranch!") + } + } } \ No newline at end of file