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