This is an automated email from the ASF dual-hosted git repository.

paulk pushed a commit to branch asf-site
in repository https://gitbox.apache.org/repos/asf/groovy-website.git


The following commit(s) were added to refs/heads/asf-site by this push:
     new fbdba69  minor refactor: gradle improvements
fbdba69 is described below

commit fbdba693dbc78489b387a1b6571f19fc9897e0d3
Author: Paul King <[email protected]>
AuthorDate: Wed Jan 22 21:34:55 2025 +1000

    minor refactor: gradle improvements
---
 settings.gradle       | 16 +++++++++++-----
 site-dev/build.gradle | 46 ++++++++++++++++++++++++++--------------------
 2 files changed, 37 insertions(+), 25 deletions(-)

diff --git a/settings.gradle b/settings.gradle
index aa78d1d..b07649b 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -18,15 +18,21 @@
  */
 
 plugins {
-    id "com.gradle.enterprise" version "3.5.2"
+    id "com.gradle.develocity" version "3.18.2"
 }
 
 rootProject.name = 'groovy-website'
-include 'generator','site-dev','site-user'
+include 'generator', 'site-dev', 'site-user'
+
+develocity {
+    server = "https://develocity.apache.org";
+    projectId = "groovy-website"
+    allowUntrustedServer = false
 
-gradleEnterprise {
     buildScan {
-        termsOfServiceUrl = 'https://gradle.com/terms-of-service'
-        termsOfServiceAgree = 'yes'
+        publishing.onlyIf { it.authenticated }
+        obfuscation {
+            ipAddresses { addresses -> addresses.collect { address -> 
"0.0.0.0" } }
+        }
     }
 }
diff --git a/site-dev/build.gradle b/site-dev/build.gradle
index 4a445a0..aab75fb 100644
--- a/site-dev/build.gradle
+++ b/site-dev/build.gradle
@@ -24,23 +24,24 @@ import util.CssFilter
 import util.JsFilter
 import util.CheckLinks
 
+import javax.inject.Inject
+
 plugins {
     id 'base'                  // common lifecycle tasks and artifact types
     id 'org.ajoberstar.grgit' version '5.3.0' // to publish website to asf-git 
branch
 }
 
-ext {
-    grgitClass = org.ajoberstar.grgit.Grgit
-}
-ext.watchmode = 
project.hasProperty('watchmode')?project.getProperty('watchmode'):'false'
+ext.watchmode = project.hasProperty('watchmode') ? 
project.getProperty('watchmode') : 'false'
+
+def grgitClass = org.ajoberstar.grgit.Grgit
 // a collection of links which have either been validated or are dummy links
-ext.excludeFromChecks = [
-        'http://issues.apache.org/jira',
-        'https://issues.apache.org/jira',
-        'target.html',
-        'foo.html',
-        'http://www.acme.com/cars',
-        'http://localhost:8080/groovy/hello.groovy'
+def excludeFromChecks = [
+    'http://issues.apache.org/jira',
+    'https://issues.apache.org/jira',
+    'target.html',
+    'foo.html',
+    'http://www.acme.com/cars',
+    'http://localhost:8080/groovy/hello.groovy'
 ]
 
 def commitedChanges = false
@@ -95,14 +96,14 @@ tasks.register('checkDeadLinks') {
     dependsOn generateSite
     description = 'Checks for dead links in the generated Groovy website'
 
-    ext.outputDir = project.layout.buildDirectory.dir('reports')
-    ext.reportFile = file("$outputDir/deadlinks.html")
+    ext.outputDir = project.layout.buildDirectory.dir('reports').get().asFile
+    def reportFile = file("$outputDir/deadlinks.html")
 
     inputs.files fileTree(generateSite.outputDir)
     outputs.file reportFile
 
     doLast {
-        def baseDir = generateSite.outputDir
+        def baseDir = generateSite.outputDir.get().asFile
         def checkLinks = new CheckLinks(baseDir: baseDir,
                 excludeFromChecks: excludeFromChecks,
                 logger: logger)
@@ -189,6 +190,11 @@ tasks.register('commitWebsite') {
     }
 }
 
+interface InjectedExecOps {
+    @Inject //@javax.inject.Inject
+    ExecOperations getExecOps()
+}
+
 /*
  * Pushes the asf-site branch commits.
  *
@@ -207,6 +213,7 @@ tasks.register('commitWebsite') {
  */
 tasks.register('publishWebsite') {
     dependsOn commitWebsite
+    def injected = project.objects.newInstance(InjectedExecOps)
     doLast {
         assert grgit : "git repository not found?"
 
@@ -219,14 +226,13 @@ tasks.register('publishWebsite') {
 
         // Because git.push() fails to authenticate, run git push directly.
         def cmd = 'git push origin asf-site'
-        exec {
+        def isWindows = 
System.getProperty('os.name').toLowerCase(Locale.ROOT).contains('windows')
+        injected.execOps.exec {
             workingDir stagingDevSite
-            if 
(System.getProperty('os.name').toLowerCase(Locale.ROOT).contains('windows')) {
-                executable 'cmd.exe'
-                args '/c', cmd
+            if (isWindows) {
+                commandLine 'cmd.exe', '/c', cmd
             } else {
-                executable 'sh'
-                args '-c', cmd
+                commandLine 'sh', '-c', cmd
             }
         }
     }

Reply via email to