Skip to content

Commit 9872f12

Browse files
committed
Review Feedback Vol. 1
1 parent f495715 commit 9872f12

3 files changed

Lines changed: 31 additions & 4 deletions

File tree

.github/workflows/branches-and-prs.main.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ workflow(
8484
with(__FILE__.parentFile.resolve("../codecov.yml")) {
8585
readText()
8686
.replace("after_n_builds:.*+$".toRegex(), "after_n_builds: ${matrix.size}")
87-
.let(::writeText)
87+
.let { parentFile.resolve("../build/codecov_branches-and-prs.yaml").writeText(it) }
8888
}
8989
job(
9090
id = "build-and-verify",

.github/workflows/release.main.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ workflow(
5555
with(__FILE__.parentFile.resolve("../codecov.yml")) {
5656
readText()
5757
.replace("after_n_builds:.*+$".toRegex(), "after_n_builds: ${matrix.size}")
58-
.let(::writeText)
58+
.let { parentFile.resolve("../build/codecov_release.yaml").writeText(it) }
5959
}
6060
val buildAndVerify = job(
6161
id = "build-and-verify",

build.gradle

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -405,10 +405,37 @@ def configureGroovydoc(TaskProvider groovydoc) {
405405
}
406406
}
407407

408-
tasks.preprocessBranchesAndPrsWorkflow {
408+
def preprocessBranchesAndPrsWorkflowCodecovOutput = layout.buildDirectory.file('codecov_branches-and-prs.yaml')
409+
def preprocessReleaseWorkflowCodecovOutput = layout.buildDirectory.file('codecov_release.yaml')
410+
411+
def copyCodecovConfig = tasks.register('copyCodecovConfig') {
412+
inputs.files(preprocessBranchesAndPrsWorkflowCodecovOutput).withPropertyName('preprocessBranchesAndPrsWorkflowCodecovOutput')
413+
inputs.property('preprocessBranchesAndPrsWorkflowCodecovOutputLastModified', preprocessBranchesAndPrsWorkflowCodecovOutput.map { it.asFile.lastModified() })
414+
inputs.files(preprocessReleaseWorkflowCodecovOutput).withPropertyName('preprocessReleaseWorkflowCodecovOutput')
415+
inputs.property('preprocessReleaseWorkflowCodecovOutputLastModified', preprocessReleaseWorkflowCodecovOutput.map { it.asFile.lastModified() })
409416
outputs.file('.github/codecov.yml').withPropertyName('codecovConfig')
417+
418+
doLast {
419+
copy {
420+
from(
421+
[
422+
preprocessBranchesAndPrsWorkflowCodecovOutput,
423+
preprocessReleaseWorkflowCodecovOutput
424+
].max {it.get().asFile.lastModified() })
425+
into('.github')
426+
rename { 'codecov.yml' }
427+
}
428+
}
429+
}
430+
431+
tasks.preprocessBranchesAndPrsWorkflow {
432+
inputs.file('.github/codecov.yml').withPropertyName('codecovConfig')
433+
outputs.file(preprocessBranchesAndPrsWorkflowCodecovOutput).withPropertyName('codecovConfig')
434+
finalizedBy(copyCodecovConfig)
410435
}
411436

412437
tasks.preprocessReleaseWorkflow {
413-
outputs.file('.github/codecov.yml').withPropertyName('codecovConfig')
438+
inputs.file('.github/codecov.yml').withPropertyName('codecovConfig')
439+
outputs.file(preprocessReleaseWorkflowCodecovOutput).withPropertyName('codecovConfig')
440+
finalizedBy(copyCodecovConfig)
414441
}

0 commit comments

Comments
 (0)