@@ -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
412443tasks. 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