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

rombert pushed a commit to branch feature/SLING-7245
in repository https://gitbox.apache.org/repos/asf/sling-tooling-jenkins.git

commit 68aea3d1887c5f505b767410adde87eff0749206
Author: Robert Munteanu <[email protected]>
AuthorDate: Tue Dec 18 00:06:06 2018 +0100

    SLING-7245 - Validate pull requests using Jenkins
    
    Start parsing .sling-module.xml
---
 vars/slingOsgiBundleBuild.groovy | 25 +++++--------------------
 1 file changed, 5 insertions(+), 20 deletions(-)

diff --git a/vars/slingOsgiBundleBuild.groovy b/vars/slingOsgiBundleBuild.groovy
index 92ee5ec..27052ad 100644
--- a/vars/slingOsgiBundleBuild.groovy
+++ b/vars/slingOsgiBundleBuild.groovy
@@ -1,17 +1,8 @@
+import sling.SlingModuleParser;
+
 def call(Map params = [:]) {
     def availableJDKs = [ 8: 'JDK 1.8 (latest)', 9: 'JDK 1.9 (latest)']
     def mvnVersion = 'Maven 3.3.9'
-    // defaults for the build
-    def buildDesc = {
-        jdks: [8],
-        downstreamProjects: [],
-        archivePatterns: [],
-        mavenGoal: 'install',
-        additionalMavenParams: '',
-        rebuildFrequency: '@weekly',
-        enableXvfb: false,
-        enabled: true
-    }
 
     def moduleDir = params.containsKey('moduleDir') ? params.moduleDir : '.'
 
@@ -20,17 +11,11 @@ def call(Map params = [:]) {
         checkout scm
 
         stage('Init') {
+            def parser = new SlingModuleParser('.sling-module.xml')
             if ( fileExists('.sling-module.xml') ) {
-                def overrides = readFile('.sling-module.xml')
-                def slingMod = new XmlParser().parse(overrides)
-                if ( slingMod?.jenkins?.jdks ) {
-                    def jdks = []
-                    slingMod.jenkins.jdks.jdk.each { jdks.add it.text() }
-                    buildDesc.jdks = jdks
-
-                    echo "$Overriding JDKs list to be ${jdks}"
-                }
+                parser.parse()
             }
+            def buildDesc = parser.buildDesc;
         }
 
         buildDesc.jdks.each { jdkVersion -> 

Reply via email to