diff options
| author | Menny Even Danan <menny@evendanan.net> | 2020-03-29 04:29:18 +0000 |
|---|---|---|
| committer | Menny Even Danan <menny@evendanan.net> | 2020-03-29 04:49:09 +0000 |
| commit | da7b89505de709cc79345a52ce7afb514ef320f2 (patch) | |
| tree | 2dceb240f218df94e4862a586ce88fe2e3ec2d95 /deployment | |
| parent | c051c44ca3d19dd7064a6ca9cd924f3fc6fcfae5 (diff) | |
| download | AnySoftKeyboard-da7b89505de709cc79345a52ce7afb514ef320f2.tar.gz AnySoftKeyboard-da7b89505de709cc79345a52ce7afb514ef320f2.tar.bz2 | |
Fix time-diff arg position
Diffstat (limited to 'deployment')
| -rw-r--r-- | deployment/build.gradle | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/deployment/build.gradle b/deployment/build.gradle index b3d58aba2..c62b77143 100644 --- a/deployment/build.gradle +++ b/deployment/build.gradle @@ -42,13 +42,13 @@ long getDaysFromLastCommitFromGit() { Instant now = Instant.now() Instant timeOfLastCommit = Instant.ofEpochMilli(epochOfLastCommit) println("now: ${now}, timeOfLastCommit: ${timeOfLastCommit}") - Duration diff = Duration.between(now, timeOfLastCommit) - println("diff is ${diff}") + Duration diff = Duration.between(timeOfLastCommit, now) + println("diff is ${diff}, days ${diff.toDays()}") return diff.toDays() } -String getTaskNameByStepFor(String processName, long step) { - def processSteps = deployments.named(processName).get().environmentSteps +static String getTaskNameByStepFor(Project project, String processName, long step) { + def processSteps = project.deployments.named(processName).get().environmentSteps if (step >= processSteps.size()) { step = processSteps.size() - 1 } @@ -60,7 +60,7 @@ String getTaskNameByStepFor(String processName, long step) { def imeOnMasterPush = tasks.register("imeOnMasterPush") { it.group "Publishing" it.description "Deployment request on master push for IME" - it.dependsOn tasks.named(getTaskNameByStepFor("imeMaster", 0)) + it.dependsOn tasks.named(getTaskNameByStepFor(it.project, "imeMaster", 0)) } def imePromoteMaster = tasks.register("imePromoteMaster") { @@ -70,7 +70,7 @@ def imePromoteMaster = tasks.register("imePromoteMaster") { def shouldPromote = Instant.now().toCalendar().toDayOfWeek() == DayOfWeek.WEDNESDAY it.onlyIf { shouldPromote } if (shouldPromote) { - it.dependsOn tasks.named(getTaskNameByStepFor("imeMaster", 1)) + it.dependsOn tasks.named(getTaskNameByStepFor(it.project, "imeMaster", 1)) } } @@ -78,7 +78,7 @@ def imePromoteMaster = tasks.register("imePromoteMaster") { def imeOnReleasePush = tasks.register("imeOnReleasePush") { it.group "Publishing" it.description "Deployment request on release-branch push for IME" - it.dependsOn tasks.named(getTaskNameByStepFor("imeProduction", 0)) + it.dependsOn tasks.named(getTaskNameByStepFor(it.project, "imeProduction", 0)) } def imePromoteRelease = tasks.register("imePromoteRelease") { @@ -88,7 +88,7 @@ def imePromoteRelease = tasks.register("imePromoteRelease") { def days = getDaysFromLastCommitFromGit() it.onlyIf { days > 0 } if (days > 0) { - it.dependsOn tasks.named(getTaskNameByStepFor("imeProduction", days)) + it.dependsOn tasks.named(getTaskNameByStepFor(it.project, "imeProduction", days)) } } //////// end - IME @@ -99,7 +99,7 @@ def noOpTask = tasks.register("noOpDeployTask") def addOnsOnMasterPush = tasks.register("addOnsOnMasterPush") { it.group "Publishing" it.description "Deployment request on master push for all addons" - it.dependsOn tasks.named(getTaskNameByStepFor("addOnsMaster", 0)) + it.dependsOn tasks.named(getTaskNameByStepFor(it.project, "addOnsMaster", 0)) } def addOnsPromoteMaster = tasks.register("addOnsPromoteMaster") { @@ -112,7 +112,7 @@ def addOnsPromoteMaster = tasks.register("addOnsPromoteMaster") { def addOnsOnReleasePush = tasks.register("addOnsOnReleasePush") { it.group "Publishing" it.description "Deployment request on release-branch push for addons" - it.dependsOn tasks.named(getTaskNameByStepFor("addOnsProduction", 0)) + it.dependsOn tasks.named(getTaskNameByStepFor(it.project, "addOnsProduction", 0)) } def addOnsPromoteRelease = tasks.register("addOnsPromoteRelease") { @@ -122,7 +122,7 @@ def addOnsPromoteRelease = tasks.register("addOnsPromoteRelease") { def days = getDaysFromLastCommitFromGit() it.onlyIf { days > 0 } if (days > 0) { - it.dependsOn tasks.named(getTaskNameByStepFor("addOnsProduction", days)) + it.dependsOn tasks.named(getTaskNameByStepFor(it.project, "addOnsProduction", days)) } } //////// end - addons |
