You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by rf...@apache.org on 2019/01/18 13:35:51 UTC

[maven-jmod-plugin] branch JMOD-20 updated (abed495 -> a146d2c)

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

rfscholte pushed a change to branch JMOD-20
in repository https://gitbox.apache.org/repos/asf/maven-jmod-plugin.git.


    from abed495  MJMOD-20: reorganize groovy script
     new b187590  MJMOD-20: Groovinize method
     new 5906895  MJMOD-20: replace target expression with actual command
     new a146d2c  MJMOD-20: rewrite groovy, Jenkins Pipeline fails to execute jmod command directly and catch output

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/it/mjmod-20-set-main-class/invoker.properties |  2 +-
 src/it/mjmod-20-set-main-class/verify.groovy      | 66 +++++++----------------
 2 files changed, 21 insertions(+), 47 deletions(-)


[maven-jmod-plugin] 03/03: MJMOD-20: rewrite groovy, Jenkins Pipeline fails to execute jmod command directly and catch output

Posted by rf...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rfscholte pushed a commit to branch JMOD-20
in repository https://gitbox.apache.org/repos/asf/maven-jmod-plugin.git

commit a146d2c3221d15ca2f53f4e24e410d97df918004
Author: rfscholte <rf...@apache.org>
AuthorDate: Fri Jan 18 14:35:43 2019 +0100

    MJMOD-20: rewrite groovy, Jenkins Pipeline fails to execute jmod command directly and catch output
---
 src/it/mjmod-20-set-main-class/invoker.properties |  2 +-
 src/it/mjmod-20-set-main-class/verify.groovy      | 58 +++++++----------------
 2 files changed, 17 insertions(+), 43 deletions(-)

diff --git a/src/it/mjmod-20-set-main-class/invoker.properties b/src/it/mjmod-20-set-main-class/invoker.properties
index eb94c3e..8cefaba 100644
--- a/src/it/mjmod-20-set-main-class/invoker.properties
+++ b/src/it/mjmod-20-set-main-class/invoker.properties
@@ -15,4 +15,4 @@
 # specific language governing permissions and limitations
 # under the License.
 invoker.java.version = 9+
-invoker.goals = package
+invoker.goals = verify
diff --git a/src/it/mjmod-20-set-main-class/verify.groovy b/src/it/mjmod-20-set-main-class/verify.groovy
index 340a7c9..1a1aec3 100644
--- a/src/it/mjmod-20-set-main-class/verify.groovy
+++ b/src/it/mjmod-20-set-main-class/verify.groovy
@@ -23,48 +23,22 @@ import java.util.jar.JarFile
 validateArtifact( "world", [ "classes/module-info.class", "classes/myproject/world/World.class" ] )
 validateArtifact( "greetings", [ "classes/module-info.class", "classes/myproject/greetings/Main.class" ] )
 
-def sout = new StringBuilder(), serr = new StringBuilder()
-def proc = "jmod describe ${basedir}/greetings/target/jmods/myproject.greetings.jmod".execute()
-proc.consumeProcessOutput( sout, serr )
-proc.waitForOrKill( 1000 )
-if ( ! sout.toString().trim().isEmpty() && serr.toString().trim().isEmpty() )
-{
-    Set<String> expectedLines = new HashSet(
-            Arrays.asList(
-                    "myproject.greetings@99.0",
-                    "requires java.base mandated",
-                    "requires myproject.world",
-                    "contains myproject.greetings",
-                    "main-class myproject.greetings.Main" ) )
-    String[] lines = sout.toString().split("\n")
-    for ( String line : lines )
-    {
-        if ( ! line.trim().isEmpty() && !expectedLines.contains(line) )
-        {
-            System.err.println( "This line was not returned from jmod: ${line}" )
-            return false
-        }
-        else
-        {
-            expectedLines.remove(line)
-        }
-    }
-    if (!expectedLines.isEmpty()) {
-        System.err.println( "This module does not the following items:" )
-        for ( String line : expectedLines )
-        {
-            System.err.println( line )
-        }
-        return false
-    }
-}
-else
-{
-    System.err.println( "Some error happened while trying to run 'jmod describe "
-            + "${basedir}/greetings/target/jmods/myproject.greetings.jmod'" )
-    System.err.println( serr )
-    return false
-}
+def buildLog = new File(basedir,'build.log')
+
+def describeLines = buildLog.readLines()
+                            .dropWhile{ it != '[INFO] myproject.greetings@99.0' } // start line, inclusive
+                            .takeWhile{ !it.startsWith('[INFO] ---') }            // end line, inclusive
+                            .grep()                                               // remove empty lines
+                            .collect{ it - '[INFO] ' } as Set                        // strip loglevel
+
+def expectedLines = [
+                "myproject.greetings@99.0",
+                "requires java.base mandated",
+                "requires myproject.world",
+                "contains myproject.greetings",
+                "main-class myproject.greetings.Main"] as Set
+
+assert describeLines == expectedLines
 
 def validateArtifact(module, artifactNames)
 {


[maven-jmod-plugin] 01/03: MJMOD-20: Groovinize method

Posted by rf...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rfscholte pushed a commit to branch JMOD-20
in repository https://gitbox.apache.org/repos/asf/maven-jmod-plugin.git

commit b1875903cf86b37576899c3121a30c15e0d75b34
Author: rfscholte <rf...@apache.org>
AuthorDate: Fri Jan 18 13:41:46 2019 +0100

    MJMOD-20: Groovinize method
---
 src/it/mjmod-20-set-main-class/verify.groovy | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/it/mjmod-20-set-main-class/verify.groovy b/src/it/mjmod-20-set-main-class/verify.groovy
index 83a0cc7..3db0c9d 100644
--- a/src/it/mjmod-20-set-main-class/verify.groovy
+++ b/src/it/mjmod-20-set-main-class/verify.groovy
@@ -66,10 +66,10 @@ else
     return false
 }
 
-def validateArtifact( String module, List<String> artifactNames )
+def validateArtifact(module, artifactNames)
 {
     println( "Checking if ${basedir}/${module}/target exists." )
-    File target = new File( basedir, "/${module}/target" )
+    def target = new File( basedir, "/${module}/target" )
     assert target.isDirectory()
 
     File artifact = new File( target, "/jmods/myproject.${module}.jmod" )


[maven-jmod-plugin] 02/03: MJMOD-20: replace target expression with actual command

Posted by rf...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rfscholte pushed a commit to branch JMOD-20
in repository https://gitbox.apache.org/repos/asf/maven-jmod-plugin.git

commit 59068958f6666518a4a6a7ccc167b07dba11d9e4
Author: rfscholte <rf...@apache.org>
AuthorDate: Fri Jan 18 13:46:53 2019 +0100

    MJMOD-20: replace target expression with actual command
---
 src/it/mjmod-20-set-main-class/verify.groovy | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/it/mjmod-20-set-main-class/verify.groovy b/src/it/mjmod-20-set-main-class/verify.groovy
index 3db0c9d..340a7c9 100644
--- a/src/it/mjmod-20-set-main-class/verify.groovy
+++ b/src/it/mjmod-20-set-main-class/verify.groovy
@@ -61,7 +61,7 @@ if ( ! sout.toString().trim().isEmpty() && serr.toString().trim().isEmpty() )
 else
 {
     System.err.println( "Some error happened while trying to run 'jmod describe "
-            + "${target}/jmods/myproject.greetings.jmod'" )
+            + "${basedir}/greetings/target/jmods/myproject.greetings.jmod'" )
     System.err.println( serr )
     return false
 }
@@ -69,10 +69,10 @@ else
 def validateArtifact(module, artifactNames)
 {
     println( "Checking if ${basedir}/${module}/target exists." )
-    def target = new File( basedir, "/${module}/target" )
-    assert target.isDirectory()
+    def targetDir = new File( basedir, "/${module}/target" )
+    assert targetDir.isDirectory()
 
-    File artifact = new File( target, "/jmods/myproject.${module}.jmod" )
+    File artifact = new File( targetDir, "/jmods/myproject.${module}.jmod" )
     assert artifact.isFile()
 
     Set contents = new HashSet()