jamesfredley commented on code in PR #15557:
URL: https://github.com/apache/grails-core/pull/15557#discussion_r3142542781


##########
.github/workflows/groovy-joint-workflow.yml:
##########
@@ -109,16 +128,50 @@ jobs:
           echo "" >> $GITHUB_OUTPUT
           echo "EOF" >> $GITHUB_OUTPUT
       - name: "🐘 Configure Gradle Plugins (step 3/3)"
+        # Pattern-based (not line-number-based) so upstream Groovy 
restructuring
+        # does not silently break this workflow - see GROOVY_4_0_X vs 
GROOVY_5_0_X.
         run: |
           cd groovy
-          # Delete existing plugins from settings.gradle file
-          sed -i '32,37d' settings.gradle
-          # Add Develocity setup related configuration after line no 31 in 
settings.gradle
-          echo "${{ steps.develocity-conf-1.outputs.value }}" | sed -i -e "31r 
/dev/stdin" settings.gradle
-          # Delete existing buildCache configuration from 
gradle/build-scans.gradle file
-          sed -i '23,46d' gradle/build-scans.gradle
-          # Add Develocity setup related configuration after line no 22 in 
gradle/build-scans.gradle
-          echo "${{ steps.develocity-conf-2.outputs.value }}" | sed -i -e "22r 
/dev/stdin" gradle/build-scans.gradle
+
+          cat > /tmp/grails-plugins-block.gradle <<'EOF_PLUGINS'
+          ${{ steps.develocity-conf-1.outputs.value }}
+          EOF_PLUGINS
+
+          cat > /tmp/grails-build-scans.gradle <<'EOF_SCANS'
+          ${{ steps.develocity-conf-2.outputs.value }}
+          EOF_SCANS
+
+          # `^plugins \{$` deliberately excludes `pluginManagement {`.

Review Comment:
   Done in commit 558e132737. Replaced the awk content-mutation with 
.github/scripts/groovy-joint-build.init.gradle, applied to the Groovy build via 
`--init-script`. The init-script uses `settingsEvaluated` + 
`pluginManager.withPlugin('com.gradle.develocity')` (defensive guard - no-op if 
Groovy ever drops the plugin) to override develocity.server, the buildScan tags 
/ publishing.onlyIf / uploadInBackground, and buildCache local/remote. Five 
workflow steps disappear. Drive-by: fixed the `'GRAILS_DEVELOCITY_ACCESS_KEY '` 
(trailing space) typo from the deleted develocity-conf-2 step that made 
isAuthenticated always false. Verified locally with `./gradlew help 
--init-script .github/scripts/groovy-joint-build.init.gradle` - BUILD 
SUCCESSFUL with a build scan published to develocity.apache.org.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to