Skip to content

Commit 447f8cb

Browse files
committed
Review Feedback Vol. 1
1 parent f495715 commit 447f8cb

3 files changed

Lines changed: 49 additions & 4 deletions

File tree

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,13 @@ 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 {
88+
parentFile
89+
.resolve("../build/")
90+
.apply { mkdirs() }
91+
.resolve("codecov_branches-and-prs.yml")
92+
.writeText(it)
93+
}
8894
}
8995
job(
9096
id = "build-and-verify",

.github/workflows/release.main.kts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,13 @@ 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 {
59+
parentFile
60+
.resolve("../build/")
61+
.apply { mkdirs() }
62+
.resolve("codecov_release.yml")
63+
.writeText(it)
64+
}
5965
}
6066
val buildAndVerify = job(
6167
id = "build-and-verify",

build.gradle

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

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

412443
tasks.preprocessReleaseWorkflow {
413-
outputs.file('.github/codecov.yml').withPropertyName('codecovConfig')
444+
inputs.file('.github/codecov.yml').withPropertyName('codecovConfig')
445+
outputs.file(preprocessReleaseWorkflowCodecovOutput).withPropertyName('codecovConfig')
446+
finalizedBy(copyCodecovConfig)
414447
}

0 commit comments

Comments
 (0)