public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/java-ebuilder:master commit in: src/main/java/org/gentoo/java/ebuilder/maven/
@ 2019-10-30 17:35 Michał Górny
  0 siblings, 0 replies; 48+ messages in thread
From: Michał Górny @ 2019-10-30 17:35 UTC (permalink / raw
  To: gentoo-commits

commit:     5efa2cb1e7912a64fca08378ba6426eb88c36766
Author:     Miroslav Šulc <fordfrog <AT> fordfrog <DOT> com>
AuthorDate: Fri Sep  9 07:10:40 2016 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Fri Sep  9 07:10:40 2016 +0000
URL:        https://gitweb.gentoo.org/proj/java-ebuilder.git/commit/?id=5efa2cb1

added some comments useful for generation of ebuild from multiple projects

 .../org/gentoo/java/ebuilder/maven/MavenEbuilder.java    | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java b/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java
index f717d9b..c6e18bd 100644
--- a/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java
+++ b/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java
@@ -489,6 +489,22 @@ public class MavenEbuilder {
             final List<MavenProject> mavenProjects, final PrintWriter writer) {
         // TODO: implement multiple-project script
         throw new UnsupportedOperationException("Not implemented yet.");
+
+        // Global:
+        // JAVA_GENTOO_CLASSPATH
+        // JAVA_CLASSPATH_EXTRA
+        // JAVA_GENTOO_TEST_CLASSPATH
+        // JAVA_ENCODING (unless it differs in projects)
+        // Compile (jars, doc):
+        // JAVA_SRC_DIR
+        // JAVA_RESOURCE_DIRS
+        // JAVA_ENCODING (in case project encodings are different)
+        // Test:
+        // JAVA_TESTING_FRAMEWORK
+        // JAVA_TEST_SRC_DIR
+        // JAVA_TEST_RESOURCE_DIRS
+        // Install (jars, doc, sources):
+        // JAVA_MAIN_CLASS
     }
 
     /**


^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [gentoo-commits] proj/java-ebuilder:master commit in: src/main/java/org/gentoo/java/ebuilder/maven/
@ 2019-10-30 17:35 Michał Górny
  0 siblings, 0 replies; 48+ messages in thread
From: Michał Górny @ 2019-10-30 17:35 UTC (permalink / raw
  To: gentoo-commits

commit:     84942a498822697f13a6a34e9e0ee46d79310004
Author:     heroxbd <heroxbd <AT> gmail <DOT> com>
AuthorDate: Fri Sep  9 06:40:22 2016 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Fri Sep  9 06:40:22 2016 +0000
URL:        https://gitweb.gentoo.org/proj/java-ebuilder.git/commit/?id=84942a49

org/gentoo/java/ebuilder/maven/MavenParser.java: fix result list

1. Parsed objects should be added the returning result ArrayList.
2. Some pom.xml has 'projects' tag enclosing 'project', ignore it if found.

 src/main/java/org/gentoo/java/ebuilder/maven/MavenParser.java | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/main/java/org/gentoo/java/ebuilder/maven/MavenParser.java b/src/main/java/org/gentoo/java/ebuilder/maven/MavenParser.java
index d8e4b48..52449dc 100644
--- a/src/main/java/org/gentoo/java/ebuilder/maven/MavenParser.java
+++ b/src/main/java/org/gentoo/java/ebuilder/maven/MavenParser.java
@@ -49,6 +49,8 @@ public class MavenParser {
                         "junit", "junit", "4.11", "test",
                         mavenCache.getDependency("junit", "junit", "4.11")));
             }
+
+	    result.add(mavenProject);
         });
 
         return result;
@@ -347,6 +349,9 @@ public class MavenParser {
 
                 if (reader.isStartElement()) {
                     switch (reader.getLocalName()) {
+                        case "projects":
+                            /* no-op */
+                            break;
                         case "project":
                             parseProject(mavenProject, mavenCache, reader);
                             break;


^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [gentoo-commits] proj/java-ebuilder:master commit in: src/main/java/org/gentoo/java/ebuilder/maven/
@ 2019-10-30 17:35 Michał Górny
  0 siblings, 0 replies; 48+ messages in thread
From: Michał Górny @ 2019-10-30 17:35 UTC (permalink / raw
  To: gentoo-commits

commit:     f5b6cd58d567592d8b919b1d1b10b173c23276b0
Author:     William L. Thomson Jr <wlt <AT> o-sinc <DOT> com>
AuthorDate: Wed Oct  5 15:38:48 2016 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Wed Oct  5 15:38:48 2016 +0000
URL:        https://gitweb.gentoo.org/proj/java-ebuilder.git/commit/?id=f5b6cd58

src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java: Minor change

1. Relocated doc source, and though not used test IUSE variables from
   IUSE with rest of ebuild variables to above inherit using
   JAVA_PKG_IUSE. Left test there in case default test case is added to
   java eclasses, but at this time has no usage in JAVA_PKG_IUSE.

 .../gentoo/java/ebuilder/maven/MavenEbuilder.java   | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java b/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java
index 067ea80..50c5992 100644
--- a/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java
+++ b/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java
@@ -38,11 +38,11 @@ public class MavenEbuilder {
             writeHeader(writer);
             writeCommand(config, writer);
             writeEAPI(writer);
-            writeInherit(writer);
+            MavenProject mp = mavenProjects.get(mavenProjects.size() - 1);
+            writeInherit(mp, writer);
             // write the info from the last project as it is probably the one
             // that depends on the rest
-            writePackageInfo(config,
-                    mavenProjects.get(mavenProjects.size() - 1), writer);
+            writePackageInfo(config, mp, writer);
 
             writeDependencies(config, mavenProjects, writer);
             writeSourceDir(writer);
@@ -481,7 +481,14 @@ public class MavenEbuilder {
      *
      * @param writer ebuild writer
      */
-    private void writeInherit(final PrintWriter writer) {
+    private void writeInherit(final MavenProject mavenProject,
+                              final PrintWriter writer) {
+        writer.println();
+        writer.print("IUSE=\"doc source");
+        if (mavenProject.hasTests()) {
+            writer.print(" test");
+        }
+        writer.println('"');
         writer.println();
         writer.println("inherit java-pkg-2 java-pkg-simple");
     }
@@ -562,11 +569,7 @@ public class MavenEbuilder {
         writer.print(config.getKeywords());
         writer.println('"');
 
-        writer.print("IUSE=\"doc source");
-
-        if (mavenProject.hasTests()) {
-            writer.print(" test");
-        }
+        writer.print("IUSE=\"");
 
         writer.println('"');
 


^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [gentoo-commits] proj/java-ebuilder:master commit in: src/main/java/org/gentoo/java/ebuilder/maven/
@ 2019-10-30 17:35 Michał Górny
  0 siblings, 0 replies; 48+ messages in thread
From: Michał Górny @ 2019-10-30 17:35 UTC (permalink / raw
  To: gentoo-commits

commit:     304e54ebfcd4e20ca3e54aaf6add7e02a9f15210
Author:     Benda Xu <heroxbd <AT> gentoo <DOT> org>
AuthorDate: Mon Jan  9 11:48:48 2017 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Mon Jan  9 12:43:30 2017 +0000
URL:        https://gitweb.gentoo.org/proj/java-ebuilder.git/commit/?id=304e54eb

MavenVersion.java: _rc3 should not be stripped.

  >=cat/pkg-1.0 does not match cat/pkg-1.0_rc3

 src/main/java/org/gentoo/java/ebuilder/maven/MavenCache.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/gentoo/java/ebuilder/maven/MavenCache.java b/src/main/java/org/gentoo/java/ebuilder/maven/MavenCache.java
index 1295856..9d91528 100644
--- a/src/main/java/org/gentoo/java/ebuilder/maven/MavenCache.java
+++ b/src/main/java/org/gentoo/java/ebuilder/maven/MavenCache.java
@@ -163,13 +163,13 @@ public class MavenCache {
     }
 
     /**
-     * Strips all -r* and _* segments from the version string.
+     * Strips all -r* from the version string.
      *
      * @param version version string
      *
      * @return stripped version string
      */
     private String stripExtraFromVersion(final String version) {
-        return version.replaceAll("-r\\d+", "").replaceAll("_.*", "");
+        return version.replaceAll("-r\\d+", "");
     }
 }


^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [gentoo-commits] proj/java-ebuilder:master commit in: src/main/java/org/gentoo/java/ebuilder/maven/
@ 2019-10-30 17:43 Miroslav Šulc
  0 siblings, 0 replies; 48+ messages in thread
From: Miroslav Šulc @ 2019-10-30 17:43 UTC (permalink / raw
  To: gentoo-commits

commit:     fbe55dc306855e8743631402df4fc58bdc19a956
Author:     Miroslav Šulc <fordfrog <AT> gentoo <DOT> org>
AuthorDate: Wed Oct 30 17:41:47 2019 +0000
Commit:     Miroslav Šulc <fordfrog <AT> gentoo <DOT> org>
CommitDate: Wed Oct 30 17:43:16 2019 +0000
URL:        https://gitweb.gentoo.org/proj/java-ebuilder.git/commit/?id=fbe55dc3

added todos

Signed-off-by: Miroslav Šulc <fordfrog <AT> gentoo.org>

 src/main/java/org/gentoo/java/ebuilder/maven/MavenParser.java | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/main/java/org/gentoo/java/ebuilder/maven/MavenParser.java b/src/main/java/org/gentoo/java/ebuilder/maven/MavenParser.java
index 6e6435e..4ab15e9 100644
--- a/src/main/java/org/gentoo/java/ebuilder/maven/MavenParser.java
+++ b/src/main/java/org/gentoo/java/ebuilder/maven/MavenParser.java
@@ -515,8 +515,12 @@ public class MavenParser {
                 switch (reader.getLocalName()) {
                     case "artifactId":
                         artifactId = reader.getElementText();
+
 			/* jsch.agentproxy is an empty artifact. */
-			if (artifactId.equals("jsch.agentproxy")) return;
+                        // TODO: this should go to a config file to ignore some artifacts
+			if (artifactId.equals("jsch.agentproxy")) {
+                            return;
+                        }
                         break;
                     case "groupId":
                         groupId = reader.getElementText();
@@ -529,6 +533,7 @@ public class MavenParser {
                                 "");
 			/* crazy version from
 			 * org.khronos:opengl-api:gl1.1-android-2.1_r1 */
+                        // TODO: this should go to a file mapping crazy versions
 			if (version.equals("gl1.1-android-2.1_r1")) {
 			    version = "2.1.1";
 			}


^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [gentoo-commits] proj/java-ebuilder:master commit in: src/main/java/org/gentoo/java/ebuilder/maven/
@ 2019-11-01 18:43 Miroslav Šulc
  0 siblings, 0 replies; 48+ messages in thread
From: Miroslav Šulc @ 2019-11-01 18:43 UTC (permalink / raw
  To: gentoo-commits

commit:     7b10390839585c4bf129814380bb2f099678b7d0
Author:     Miroslav Šulc <fordfrog <AT> gentoo <DOT> org>
AuthorDate: Fri Nov  1 18:40:28 2019 +0000
Commit:     Miroslav Šulc <fordfrog <AT> gentoo <DOT> org>
CommitDate: Fri Nov  1 18:42:45 2019 +0000
URL:        https://gitweb.gentoo.org/proj/java-ebuilder.git/commit/?id=7b103908

updated eapi to 7

Signed-off-by: Miroslav Šulc <fordfrog <AT> gentoo.org>

 src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java b/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java
index 50c5992..796bd9c 100644
--- a/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java
+++ b/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java
@@ -19,7 +19,7 @@ public class MavenEbuilder {
     /**
      * EAPI version.
      */
-    private static final String EAPI = "5";
+    private static final String EAPI = "7";
 
     /**
      * Generates ebuild from the collected information at the specified path.


^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [gentoo-commits] proj/java-ebuilder:master commit in: src/main/java/org/gentoo/java/ebuilder/maven/
@ 2019-11-01 18:43 Miroslav Šulc
  0 siblings, 0 replies; 48+ messages in thread
From: Miroslav Šulc @ 2019-11-01 18:43 UTC (permalink / raw
  To: gentoo-commits

commit:     e7cc54b0e4a218d494333ab027d6c35aa49301de
Author:     Miroslav Šulc <fordfrog <AT> gentoo <DOT> org>
AuthorDate: Fri Nov  1 18:41:29 2019 +0000
Commit:     Miroslav Šulc <fordfrog <AT> gentoo <DOT> org>
CommitDate: Fri Nov  1 18:43:03 2019 +0000
URL:        https://gitweb.gentoo.org/proj/java-ebuilder.git/commit/?id=e7cc54b0

updated default ebuild jdk version to 1.8

Signed-off-by: Miroslav Šulc <fordfrog <AT> gentoo.org>

 src/main/java/org/gentoo/java/ebuilder/maven/MavenProject.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/gentoo/java/ebuilder/maven/MavenProject.java b/src/main/java/org/gentoo/java/ebuilder/maven/MavenProject.java
index af05c7c..ba575b1 100644
--- a/src/main/java/org/gentoo/java/ebuilder/maven/MavenProject.java
+++ b/src/main/java/org/gentoo/java/ebuilder/maven/MavenProject.java
@@ -67,11 +67,11 @@ public class MavenProject {
     /**
      * Source compile version.
      */
-    private String sourceVersion = "1.7";
+    private String sourceVersion = "1.8";
     /**
      * Target compile version.
      */
-    private String targetVersion = "1.7";
+    private String targetVersion = "1.8";
     /**
      * Test resource directories.
      */


^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [gentoo-commits] proj/java-ebuilder:master commit in: src/main/java/org/gentoo/java/ebuilder/maven/
@ 2019-11-01 18:43 Miroslav Šulc
  0 siblings, 0 replies; 48+ messages in thread
From: Miroslav Šulc @ 2019-11-01 18:43 UTC (permalink / raw
  To: gentoo-commits

commit:     fa9dcf8c73d4e65f11fb0b1caf130b85f6493fc7
Author:     Miroslav Šulc <fordfrog <AT> gentoo <DOT> org>
AuthorDate: Fri Nov  1 18:40:45 2019 +0000
Commit:     Miroslav Šulc <fordfrog <AT> gentoo <DOT> org>
CommitDate: Fri Nov  1 18:42:52 2019 +0000
URL:        https://gitweb.gentoo.org/proj/java-ebuilder.git/commit/?id=fa9dcf8c

updated ebuild header

Signed-off-by: Miroslav Šulc <fordfrog <AT> gentoo.org>

 src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java | 1 -
 1 file changed, 1 deletion(-)

diff --git a/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java b/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java
index 796bd9c..8e0780d 100644
--- a/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java
+++ b/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java
@@ -473,7 +473,6 @@ public class MavenEbuilder {
                 LocalDate.now().getYear());
         writer.println("# Distributed under the terms of the GNU General "
                 + "Public License v2");
-        writer.println("# $Id$");
     }
 
     /**


^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [gentoo-commits] proj/java-ebuilder:master commit in: src/main/java/org/gentoo/java/ebuilder/maven/
@ 2019-11-01 18:43 Miroslav Šulc
  0 siblings, 0 replies; 48+ messages in thread
From: Miroslav Šulc @ 2019-11-01 18:43 UTC (permalink / raw
  To: gentoo-commits

commit:     3d0f19ba3367571b88ab40332b3d8245bcbc0209
Author:     Miroslav Šulc <fordfrog <AT> gentoo <DOT> org>
AuthorDate: Fri Nov  1 18:41:12 2019 +0000
Commit:     Miroslav Šulc <fordfrog <AT> gentoo <DOT> org>
CommitDate: Fri Nov  1 18:42:58 2019 +0000
URL:        https://gitweb.gentoo.org/proj/java-ebuilder.git/commit/?id=3d0f19ba

removed redundant IUSE

Signed-off-by: Miroslav Šulc <fordfrog <AT> gentoo.org>

 src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java b/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java
index 8e0780d..f4f380a 100644
--- a/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java
+++ b/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java
@@ -568,10 +568,6 @@ public class MavenEbuilder {
         writer.print(config.getKeywords());
         writer.println('"');
 
-        writer.print("IUSE=\"");
-
-        writer.println('"');
-
         writer.print("MAVEN_ID=\"");
         writer.print(mavenProject.getGroupId());
         writer.print(':');


^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [gentoo-commits] proj/java-ebuilder:master commit in: src/main/java/org/gentoo/java/ebuilder/maven/
@ 2019-11-01 18:43 Miroslav Šulc
  0 siblings, 0 replies; 48+ messages in thread
From: Miroslav Šulc @ 2019-11-01 18:43 UTC (permalink / raw
  To: gentoo-commits

commit:     ea70051f2d5c72b2712f2a12942c8f0346b15019
Author:     Miroslav Šulc <fordfrog <AT> gentoo <DOT> org>
AuthorDate: Fri Nov  1 18:41:40 2019 +0000
Commit:     Miroslav Šulc <fordfrog <AT> gentoo <DOT> org>
CommitDate: Fri Nov  1 18:43:08 2019 +0000
URL:        https://gitweb.gentoo.org/proj/java-ebuilder.git/commit/?id=ea70051f

reformatted

Signed-off-by: Miroslav Šulc <fordfrog <AT> gentoo.org>

 src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java b/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java
index f4f380a..ffb6e66 100644
--- a/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java
+++ b/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java
@@ -484,9 +484,11 @@ public class MavenEbuilder {
                               final PrintWriter writer) {
         writer.println();
         writer.print("IUSE=\"doc source");
+
         if (mavenProject.hasTests()) {
             writer.print(" test");
         }
+
         writer.println('"');
         writer.println();
         writer.println("inherit java-pkg-2 java-pkg-simple");


^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [gentoo-commits] proj/java-ebuilder:master commit in: src/main/java/org/gentoo/java/ebuilder/maven/
@ 2019-11-02 21:42 Miroslav Šulc
  0 siblings, 0 replies; 48+ messages in thread
From: Miroslav Šulc @ 2019-11-02 21:42 UTC (permalink / raw
  To: gentoo-commits

commit:     54202dcc53c082b4b62bd82510e79ab3f9e53825
Author:     Miroslav Šulc <fordfrog <AT> gentoo <DOT> org>
AuthorDate: Sat Nov  2 21:41:30 2019 +0000
Commit:     Miroslav Šulc <fordfrog <AT> gentoo <DOT> org>
CommitDate: Sat Nov  2 21:41:30 2019 +0000
URL:        https://gitweb.gentoo.org/proj/java-ebuilder.git/commit/?id=54202dcc

fixed parsing of project build tree

Signed-off-by: Miroslav Šulc <fordfrog <AT> gentoo.org>

 src/main/java/org/gentoo/java/ebuilder/maven/MavenParser.java | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/main/java/org/gentoo/java/ebuilder/maven/MavenParser.java b/src/main/java/org/gentoo/java/ebuilder/maven/MavenParser.java
index 2e81541..942ee27 100644
--- a/src/main/java/org/gentoo/java/ebuilder/maven/MavenParser.java
+++ b/src/main/java/org/gentoo/java/ebuilder/maven/MavenParser.java
@@ -389,6 +389,9 @@ public class MavenParser {
                     case "artifactId":
                         mavenProject.setArtifactId(reader.getElementText());
                         break;
+                    case "build":
+                        parseProjectBuild(mavenProject, reader);
+                        break;
                     case "dependencies":
                         parseProjectDependencies(mavenProject, mavenCache,
                                 reader);


^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [gentoo-commits] proj/java-ebuilder:master commit in: src/main/java/org/gentoo/java/ebuilder/maven/
@ 2019-11-02 21:42 Miroslav Šulc
  0 siblings, 0 replies; 48+ messages in thread
From: Miroslav Šulc @ 2019-11-02 21:42 UTC (permalink / raw
  To: gentoo-commits

commit:     6ffda4c5bb983ee60afe8cdbdd8cac800d2dda4e
Author:     Miroslav Šulc <fordfrog <AT> gentoo <DOT> org>
AuthorDate: Sat Nov  2 21:41:55 2019 +0000
Commit:     Miroslav Šulc <fordfrog <AT> gentoo <DOT> org>
CommitDate: Sat Nov  2 21:41:55 2019 +0000
URL:        https://gitweb.gentoo.org/proj/java-ebuilder.git/commit/?id=6ffda4c5

fixed projects dump issues

Signed-off-by: Miroslav Šulc <fordfrog <AT> gentoo.org>

 src/main/java/org/gentoo/java/ebuilder/maven/MavenProject.java | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/main/java/org/gentoo/java/ebuilder/maven/MavenProject.java b/src/main/java/org/gentoo/java/ebuilder/maven/MavenProject.java
index 6d0d8ec..eb379e0 100644
--- a/src/main/java/org/gentoo/java/ebuilder/maven/MavenProject.java
+++ b/src/main/java/org/gentoo/java/ebuilder/maven/MavenProject.java
@@ -151,9 +151,9 @@ public class MavenProject {
         writer.print("sourceDirectory: ");
         writer.println(sourceDirectory);
         writer.print("hasResources: ");
-        writer.println(hasResources);
+        writer.println(hasResources());
 
-        writer.print("resourceDirectories:");
+        writer.println("resourceDirectories:");
 
         if (resourceDirectories != null) {
             resourceDirectories.forEach((resourceDirectory) -> {
@@ -163,11 +163,11 @@ public class MavenProject {
         }
 
         writer.print("hasTests: ");
-        writer.println(hasTests);
+        writer.println(hasTests());
         writer.print("testSourceDirectory: ");
         writer.println(testSourceDirectory);
         writer.print("hasTestResources: ");
-        writer.println(hasTestResources);
+        writer.println(hasTestResources());
 
         writer.println("testResourceDirectories:");
 


^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [gentoo-commits] proj/java-ebuilder:master commit in: src/main/java/org/gentoo/java/ebuilder/maven/
@ 2019-11-02 21:54 Miroslav Šulc
  0 siblings, 0 replies; 48+ messages in thread
From: Miroslav Šulc @ 2019-11-02 21:54 UTC (permalink / raw
  To: gentoo-commits

commit:     9982eb3cbf850fe6985fb29017f2161489cae07a
Author:     Miroslav Šulc <fordfrog <AT> gentoo <DOT> org>
AuthorDate: Sat Nov  2 21:53:49 2019 +0000
Commit:     Miroslav Šulc <fordfrog <AT> gentoo <DOT> org>
CommitDate: Sat Nov  2 21:53:49 2019 +0000
URL:        https://gitweb.gentoo.org/proj/java-ebuilder.git/commit/?id=9982eb3c

replacing ebuild name and version with variables

Signed-off-by: Miroslav Šulc <fordfrog <AT> gentoo.org>

 .../gentoo/java/ebuilder/maven/MavenEbuilder.java  | 24 +++++++++++++++++-----
 1 file changed, 19 insertions(+), 5 deletions(-)

diff --git a/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java b/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java
index ffb6e66..2194b80 100644
--- a/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java
+++ b/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java
@@ -226,6 +226,16 @@ public class MavenEbuilder {
         return result;
     }
 
+    private String replaceWithVars(final String string, final Config config) {
+        final String pString
+                = config.getEbuildName() + '-' + config.getEbuildVersion();
+
+        return string.
+                replace(pString, "${P}").
+                replace(config.getEbuildName(), "${PN}").
+                replace(config.getEbuildVersion(), "${PV}");
+    }
+
     /**
      * Writes command that was used to create skeleton of the ebuild.
      *
@@ -551,7 +561,8 @@ public class MavenEbuilder {
         writer.println('"');
 
         writer.print("SRC_URI=\"");
-        writer.print(config.getDownloadUri());
+        writer.print(
+                replaceWithVars(config.getDownloadUri().toString(), config));
         writer.println('"');
 
         writer.print("LICENSE=\"");
@@ -653,7 +664,9 @@ public class MavenEbuilder {
                     writer.print(':');
                 }
 
-                writer.print(config.getWorkdir().relativize(resources));
+                writer.print(replaceWithVars(
+                        config.getWorkdir().relativize(resources).toString(),
+                        config));
             }
 
             writer.println('"');
@@ -661,8 +674,8 @@ public class MavenEbuilder {
 
         if (mavenProject.hasTests()) {
             writer.print("JAVA_TEST_SRC_DIR=\"");
-            writer.print(config.getWorkdir().relativize(
-                    mavenProject.getTestSourceDirectory()));
+            writer.print(replaceWithVars(config.getWorkdir().relativize(
+                    mavenProject.getTestSourceDirectory()).toString(), config));
             writer.println('"');
 
             if (mavenProject.hasTestResources()) {
@@ -678,7 +691,8 @@ public class MavenEbuilder {
                         writer.print(':');
                     }
 
-                    writer.print(config.getWorkdir().relativize(resources));
+                    writer.print(replaceWithVars(config.getWorkdir().
+                            relativize(resources).toString(), config));
                 }
 
                 writer.println('"');


^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [gentoo-commits] proj/java-ebuilder:master commit in: src/main/java/org/gentoo/java/ebuilder/maven/
@ 2019-11-02 22:27 Miroslav Šulc
  0 siblings, 0 replies; 48+ messages in thread
From: Miroslav Šulc @ 2019-11-02 22:27 UTC (permalink / raw
  To: gentoo-commits

commit:     2cfc1a85a6306b51d9ce5771f7645cad74206eaf
Author:     Miroslav Šulc <fordfrog <AT> gentoo <DOT> org>
AuthorDate: Sat Nov  2 22:27:15 2019 +0000
Commit:     Miroslav Šulc <fordfrog <AT> gentoo <DOT> org>
CommitDate: Sat Nov  2 22:27:15 2019 +0000
URL:        https://gitweb.gentoo.org/proj/java-ebuilder.git/commit/?id=2cfc1a85

switched from IUSE to JAVA_PKG_IUSE

Signed-off-by: Miroslav Šulc <fordfrog <AT> gentoo.org>

 src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java b/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java
index 2194b80..1be72cb 100644
--- a/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java
+++ b/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java
@@ -493,7 +493,7 @@ public class MavenEbuilder {
     private void writeInherit(final MavenProject mavenProject,
                               final PrintWriter writer) {
         writer.println();
-        writer.print("IUSE=\"doc source");
+        writer.print("JAVA_PKG_IUSE=\"doc source");
 
         if (mavenProject.hasTests()) {
             writer.print(" test");


^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [gentoo-commits] proj/java-ebuilder:master commit in: src/main/java/org/gentoo/java/ebuilder/maven/
@ 2019-11-03 10:12 Miroslav Šulc
  0 siblings, 0 replies; 48+ messages in thread
From: Miroslav Šulc @ 2019-11-03 10:12 UTC (permalink / raw
  To: gentoo-commits

commit:     d5c08b1662e06096f8bd0ce9ee1407250a842119
Author:     Miroslav Šulc <fordfrog <AT> gentoo <DOT> org>
AuthorDate: Sun Nov  3 10:11:48 2019 +0000
Commit:     Miroslav Šulc <fordfrog <AT> gentoo <DOT> org>
CommitDate: Sun Nov  3 10:11:48 2019 +0000
URL:        https://gitweb.gentoo.org/proj/java-ebuilder.git/commit/?id=d5c08b16

improved project dump layout

Signed-off-by: Miroslav Šulc <fordfrog <AT> gentoo.org>

 src/main/java/org/gentoo/java/ebuilder/maven/MavenProject.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/main/java/org/gentoo/java/ebuilder/maven/MavenProject.java b/src/main/java/org/gentoo/java/ebuilder/maven/MavenProject.java
index eb379e0..c3f45f8 100644
--- a/src/main/java/org/gentoo/java/ebuilder/maven/MavenProject.java
+++ b/src/main/java/org/gentoo/java/ebuilder/maven/MavenProject.java
@@ -180,7 +180,7 @@ public class MavenProject {
 
         if (dependencies != null) {
             dependencies.forEach((dependency) -> {
-                writer.print("\n  groupId: ");
+                writer.print("- groupId: ");
                 writer.println(dependency.getGroupId());
                 writer.print("  artifactId: ");
                 writer.println(dependency.getArtifactId());


^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [gentoo-commits] proj/java-ebuilder:master commit in: src/main/java/org/gentoo/java/ebuilder/maven/
@ 2019-11-03 10:12 Miroslav Šulc
  0 siblings, 0 replies; 48+ messages in thread
From: Miroslav Šulc @ 2019-11-03 10:12 UTC (permalink / raw
  To: gentoo-commits

commit:     7f0292efdc6698bd28dc6137660c6145cd357690
Author:     Miroslav Šulc <fordfrog <AT> gentoo <DOT> org>
AuthorDate: Sun Nov  3 10:11:14 2019 +0000
Commit:     Miroslav Šulc <fordfrog <AT> gentoo <DOT> org>
CommitDate: Sun Nov  3 10:11:14 2019 +0000
URL:        https://gitweb.gentoo.org/proj/java-ebuilder.git/commit/?id=7f0292ef

fixed and reformatted ebuild variables

Signed-off-by: Miroslav Šulc <fordfrog <AT> gentoo.org>

 .../gentoo/java/ebuilder/maven/MavenEbuilder.java  | 96 ++++++++++++----------
 1 file changed, 52 insertions(+), 44 deletions(-)

diff --git a/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java b/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java
index 1be72cb..5953815 100644
--- a/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java
+++ b/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java
@@ -618,6 +618,12 @@ public class MavenEbuilder {
             final MavenProject mavenProject, final PrintWriter writer) {
         writer.println();
 
+        if (!"UTF-8".equals(mavenProject.getSourceEncoding())) {
+            writer.print("JAVA_ENCODING=\"");
+            writer.print(mavenProject.getSourceEncoding());
+            writer.println("\"\n");
+        }
+
         if (!mavenProject.getCommonDependencies().isEmpty()
                 || !mavenProject.getRuntimeDependencies().isEmpty()) {
             final List<MavenDependency> dependencies
@@ -638,78 +644,80 @@ public class MavenEbuilder {
             writer.println('"');
         }
 
-        if (!mavenProject.getTestDependencies().isEmpty()) {
-            writer.print("JAVA_GENTOO_TEST_CLASSPATH=\"");
-            writer.print(createClassPath(mavenProject.getTestDependencies()));
+        writer.print("JAVA_SRC_DIR=\"");
+        writer.print(replaceWithVars(config.getWorkdir().relativize(
+                mavenProject.getSourceDirectory()).toString(), config));
+        writer.println('"');
+
+        if (mavenProject.getMainClass() != null) {
+            writer.print("JAVA_MAIN_CLASS=\"");
+            writer.print(mavenProject.getMainClass());
             writer.println('"');
         }
 
+        if (mavenProject.hasResources()) {
+            writer.println("JAVA_RESOURCE_DIRS=(");
+
+            mavenProject.getResourceDirectories().forEach((directory) -> {
+                writer.print("\t\"");
+                writer.print(replaceWithVars(
+                        config.getWorkdir().relativize(directory).toString(),
+                        config));
+                writer.println('"');
+            });
+
+            writer.println(')');
+        }
+
         final String testingFramework = determineTestingFramework(mavenProject);
+        boolean firstTestVar = true;
 
         if (testingFramework != null) {
+            if (firstTestVar) {
+                writer.println();
+                firstTestVar = false;
+            }
+
             writer.print("JAVA_TESTING_FRAMEWORK=\"");
             writer.print(testingFramework);
             writer.println('"');
         }
 
-        if (mavenProject.hasResources()) {
-            writer.print("JAVA_RESOURCE_DIRS=\"");
-
-            boolean first = true;
-
-            for (final Path resources : mavenProject.getResourceDirectories()) {
-                if (first) {
-                    first = false;
-                } else {
-                    writer.print(':');
-                }
-
-                writer.print(replaceWithVars(
-                        config.getWorkdir().relativize(resources).toString(),
-                        config));
+        if (!mavenProject.getTestDependencies().isEmpty()) {
+            if (firstTestVar) {
+                writer.println();
+                firstTestVar = false;
             }
 
+            writer.print("JAVA_GENTOO_TEST_CLASSPATH=\"");
+            writer.print(createClassPath(mavenProject.getTestDependencies()));
             writer.println('"');
         }
 
         if (mavenProject.hasTests()) {
+            if (firstTestVar) {
+                writer.println();
+            }
+
             writer.print("JAVA_TEST_SRC_DIR=\"");
             writer.print(replaceWithVars(config.getWorkdir().relativize(
                     mavenProject.getTestSourceDirectory()).toString(), config));
             writer.println('"');
 
             if (mavenProject.hasTestResources()) {
-                writer.print("JAVA_TEST_RESOURCE_DIRS=\"");
-
-                boolean first = true;
-
-                for (final Path resources : mavenProject.
-                        getTestResourceDirectories()) {
-                    if (first) {
-                        first = false;
-                    } else {
-                        writer.print(':');
-                    }
+                writer.println("JAVA_TEST_RESOURCE_DIRS=(");
 
+                mavenProject.getTestResourceDirectories().
+                        forEach((directory) -> {
+                    writer.print("\t\"");
                     writer.print(replaceWithVars(config.getWorkdir().
-                            relativize(resources).toString(), config));
-                }
+                            relativize(directory).toString(), config));
+                    writer.println('"');
+                });
 
-                writer.println('"');
+                writer.println(')');
             }
         }
-
-        if (!"UTF-8".equals(mavenProject.getSourceEncoding())) {
-            writer.print("JAVA_ENCODING=\"");
-            writer.print(mavenProject.getSourceEncoding());
-            writer.println('"');
-        }
-
-        if (mavenProject.getMainClass() != null) {
-            writer.print("JAVA_MAIN_CLASS=\"");
-            writer.print(mavenProject.getMainClass());
-            writer.println('"');
-        }
     }
 
     /**


^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [gentoo-commits] proj/java-ebuilder:master commit in: src/main/java/org/gentoo/java/ebuilder/maven/
@ 2019-11-03 10:14 Miroslav Šulc
  0 siblings, 0 replies; 48+ messages in thread
From: Miroslav Šulc @ 2019-11-03 10:14 UTC (permalink / raw
  To: gentoo-commits

commit:     08c9231f4893571a89387035c4e63e09f08dfa9e
Author:     Miroslav Šulc <fordfrog <AT> gentoo <DOT> org>
AuthorDate: Sun Nov  3 10:14:44 2019 +0000
Commit:     Miroslav Šulc <fordfrog <AT> gentoo <DOT> org>
CommitDate: Sun Nov  3 10:14:44 2019 +0000
URL:        https://gitweb.gentoo.org/proj/java-ebuilder.git/commit/?id=08c9231f

reformatted

Signed-off-by: Miroslav Šulc <fordfrog <AT> gentoo.org>

 .../java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java b/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java
index 5953815..b7192d6 100644
--- a/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java
+++ b/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java
@@ -38,11 +38,15 @@ public class MavenEbuilder {
             writeHeader(writer);
             writeCommand(config, writer);
             writeEAPI(writer);
-            MavenProject mp = mavenProjects.get(mavenProjects.size() - 1);
-            writeInherit(mp, writer);
-            // write the info from the last project as it is probably the one
-            // that depends on the rest
-            writePackageInfo(config, mp, writer);
+
+            /**
+             * Write the info from the last project as it is probably the one
+             * that depends on the rest.
+             */
+            final MavenProject mavenProject
+                    = mavenProjects.get(mavenProjects.size() - 1);
+            writeInherit(mavenProject, writer);
+            writePackageInfo(config, mavenProject, writer);
 
             writeDependencies(config, mavenProjects, writer);
             writeSourceDir(writer);


^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [gentoo-commits] proj/java-ebuilder:master commit in: src/main/java/org/gentoo/java/ebuilder/maven/
@ 2019-11-03 10:37 Miroslav Šulc
  0 siblings, 0 replies; 48+ messages in thread
From: Miroslav Šulc @ 2019-11-03 10:37 UTC (permalink / raw
  To: gentoo-commits

commit:     590141ced5bc7cc8e28f4aae854d5e0f9ad2857e
Author:     Miroslav Šulc <fordfrog <AT> gentoo <DOT> org>
AuthorDate: Sun Nov  3 10:37:40 2019 +0000
Commit:     Miroslav Šulc <fordfrog <AT> gentoo <DOT> org>
CommitDate: Sun Nov  3 10:37:40 2019 +0000
URL:        https://gitweb.gentoo.org/proj/java-ebuilder.git/commit/?id=590141ce

reformatted dependencies output

Signed-off-by: Miroslav Šulc <fordfrog <AT> gentoo.org>

 .../gentoo/java/ebuilder/maven/MavenEbuilder.java  | 74 +++++++++++-----------
 1 file changed, 36 insertions(+), 38 deletions(-)

diff --git a/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java b/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java
index b7192d6..53708e9 100644
--- a/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java
+++ b/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java
@@ -319,41 +319,38 @@ public class MavenEbuilder {
                 }
 
                 if (!mavenProject.getCommonDependencies().isEmpty()) {
-                    writeDependenciesInfo(writer, mavenProject.getPomFile(),
+                    writeDependenciesInfo(config, writer,
+                            mavenProject.getPomFile(),
                             mavenProject.getCommonDependencies(), null);
                 }
 
-                if (mavenProject.getTargetVersion()!=null) {
-                    writeDependenciesInfo(writer, mavenProject.getPomFile(),
+                if (mavenProject.getTargetVersion() != null) {
+                    writeDependenciesInfo(config, writer,
+                            mavenProject.getPomFile(),
                             mavenProject.getTestDependencies(), "test?");
                 }
 
                 hasCDepend = true;
             }
 
-            writer.print("CDEPEND=\"");
+            writer.println("\nCDEPEND=\"");
 
             if (!commonDependencies.isEmpty()) {
-                commonDependencies.stream().
-                        forEach((dependency) -> {
-                            writer.println();
-                            writer.print('\t');
-                            writer.print(dependency);
-                        });
+                commonDependencies.stream().forEach((dependency) -> {
+                    writer.print('\t');
+                    writer.println(dependency);
+                });
             }
 
             if (!testDependencies.isEmpty()) {
-                writer.println();
                 writer.println("\ttest? (");
 
-                testDependencies.stream().
-                        forEach((dependency) -> {
-                            writer.println();
-                            writer.print("\t\t");
-                            writer.print(dependency);
-                        });
+                testDependencies.stream().forEach((dependency) -> {
+                    writer.print("\t\t");
+                    writer.println(dependency);
+                });
 
-                writer.print("\t)");
+                writer.println("\t)");
             }
 
             writer.println('"');
@@ -362,10 +359,11 @@ public class MavenEbuilder {
         if (!compileDependencies.isEmpty()) {
             writer.println("# Compile dependencies");
 
-            mavenProjects.stream().filter((mavenProject) -> (!mavenProject.
-                    getCompileDependencies().isEmpty()))
+            mavenProjects.stream().filter((mavenProject) ->
+                    (!mavenProject.getCompileDependencies().isEmpty()))
                     .forEach((mavenProject) -> {
-                        writeDependenciesInfo(writer, mavenProject.getPomFile(),
+                        writeDependenciesInfo(config, writer,
+                                mavenProject.getPomFile(),
                                 mavenProject.getCompileDependencies(), null);
                     });
         } else {
@@ -389,12 +387,11 @@ public class MavenEbuilder {
         }
 
         if (!compileDependencies.isEmpty()) {
-            compileDependencies.stream().
-                    forEach((dependency) -> {
-                        writer.println();
-                        writer.print('\t');
-                        writer.print(dependency);
-                    });
+            compileDependencies.stream().forEach((dependency) -> {
+                writer.println();
+                writer.print('\t');
+                writer.println(dependency);
+            });
         }
 
         writer.println('"');
@@ -405,7 +402,8 @@ public class MavenEbuilder {
             mavenProjects.stream().filter((mavenProject) -> (!mavenProject.
                     getRuntimeDependencies().isEmpty()))
                     .forEach((mavenProject) -> {
-                        writeDependenciesInfo(writer, mavenProject.getPomFile(),
+                        writeDependenciesInfo(config, writer,
+                                mavenProject.getPomFile(),
                                 mavenProject.getRuntimeDependencies(), null);
                     });
         } else {
@@ -423,12 +421,11 @@ public class MavenEbuilder {
         writer.print(getMinTargetVersion(mavenProjects));
 
         if (!runtimeDependencies.isEmpty()) {
-            runtimeDependencies.stream().
-                    forEach((dependency) -> {
-                        writer.println();
-                        writer.print('\t');
-                        writer.print(dependency);
-                    });
+            runtimeDependencies.stream().forEach((dependency) -> {
+                writer.println();
+                writer.print('\t');
+                writer.println(dependency);
+            });
         }
 
         writer.println('"');
@@ -437,16 +434,17 @@ public class MavenEbuilder {
     /**
      * Writes dependencies information to the ebuild.
      *
+     * @param config       application configuration
      * @param writer       ebuild writer
      * @param pomFile      path to pom file
      * @param dependencies list of dependencies
      * @param useFlag      optional USE flag including question mark
      */
-    private void writeDependenciesInfo(final PrintWriter writer,
-            final Path pomFile, final List<MavenDependency> dependencies,
-            final String useFlag) {
+    private void writeDependenciesInfo(final Config config,
+            final PrintWriter writer, final Path pomFile,
+            final List<MavenDependency> dependencies, final String useFlag) {
         writer.print("# POM: ");
-        writer.println(pomFile);
+        writer.println(replaceWithVars(pomFile.toString(), config));
 
         dependencies.stream().forEach((dependency) -> {
             writer.print("# ");


^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [gentoo-commits] proj/java-ebuilder:master commit in: src/main/java/org/gentoo/java/ebuilder/maven/
@ 2019-11-03 11:26 Miroslav Šulc
  0 siblings, 0 replies; 48+ messages in thread
From: Miroslav Šulc @ 2019-11-03 11:26 UTC (permalink / raw
  To: gentoo-commits

commit:     af344112881d635949535ba6a5fc9e11ad284dc5
Author:     Miroslav Šulc <fordfrog <AT> gentoo <DOT> org>
AuthorDate: Sun Nov  3 11:26:07 2019 +0000
Commit:     Miroslav Šulc <fordfrog <AT> gentoo <DOT> org>
CommitDate: Sun Nov  3 11:26:07 2019 +0000
URL:        https://gitweb.gentoo.org/proj/java-ebuilder.git/commit/?id=af344112

encapsulated java version in new container

Signed-off-by: Miroslav Šulc <fordfrog <AT> gentoo.org>

 .../gentoo/java/ebuilder/maven/JavaVersion.java    | 87 ++++++++++++++++++++++
 .../gentoo/java/ebuilder/maven/MavenParser.java    | 10 ++-
 .../gentoo/java/ebuilder/maven/MavenProject.java   | 12 +--
 3 files changed, 99 insertions(+), 10 deletions(-)

diff --git a/src/main/java/org/gentoo/java/ebuilder/maven/JavaVersion.java b/src/main/java/org/gentoo/java/ebuilder/maven/JavaVersion.java
new file mode 100644
index 0000000..5aa600d
--- /dev/null
+++ b/src/main/java/org/gentoo/java/ebuilder/maven/JavaVersion.java
@@ -0,0 +1,87 @@
+package org.gentoo.java.ebuilder.maven;
+
+import java.text.MessageFormat;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * Java versionNumber container.
+ *
+ * @author fordfrog
+ */
+public class JavaVersion {
+
+    /**
+     * Pattern for parsing Java versionNumber.
+     */
+    private static final Pattern PATTERN_VERSION
+            = Pattern.compile("^(?:1\\.)(\\d+)$");
+    /**
+     * Java versionNumber number.
+     */
+    private final int versionNumber;
+    /**
+     * Java version string.
+     */
+    private final String versionString;
+
+    /**
+     * Creates new instance of JavaVersion. Parses the version string and uses
+     * the main Java version. Terminates if the version is not valid.
+     *
+     * @param versionString version string
+     */
+    public JavaVersion(final String versionString) {
+        this.versionString = versionString;
+
+        final Matcher matcher = PATTERN_VERSION.matcher(versionString);
+
+        if (!matcher.matches()) {
+            throw new IllegalArgumentException(MessageFormat.format(
+                    "Java version \"{0}\" is not valid!", versionString));
+        }
+
+        versionNumber = Integer.parseInt(matcher.group(1), 10);
+    }
+
+    /**
+     * Compares this JavaVersion to the passed JavaVersion.
+     *
+     * @param javaVersion JavaVersion to compare to.
+     *
+     * @return -1 if this versionNumber is lower, 1 if this versionNumber is
+     * higher and 0 if both are equal
+     */
+    public int compareTo(final JavaVersion javaVersion) {
+        if (javaVersion.getVersionNumber() > versionNumber) {
+            return -1;
+        } else if (javaVersion.getVersionNumber() < versionNumber) {
+            return 1;
+        } else {
+            return 0;
+        }
+    }
+
+    /**
+     * Getter for {@link #versionNumber}.
+     *
+     * @return {@link #versionNumber}
+     */
+    public int getVersionNumber() {
+        return versionNumber;
+    }
+
+    /**
+     * Getter for {@link #versionString}.
+     *
+     * @return {@link #versionString}
+     */
+    public String getVersionString() {
+        return versionString;
+    }
+
+    @Override
+    public String toString() {
+        return versionString;
+    }
+}

diff --git a/src/main/java/org/gentoo/java/ebuilder/maven/MavenParser.java b/src/main/java/org/gentoo/java/ebuilder/maven/MavenParser.java
index 942ee27..7c9d162 100644
--- a/src/main/java/org/gentoo/java/ebuilder/maven/MavenParser.java
+++ b/src/main/java/org/gentoo/java/ebuilder/maven/MavenParser.java
@@ -208,7 +208,7 @@ public class MavenParser {
                     case "source":
                         if ("maven-compiler-plugin".equals(artifactId)) {
                             mavenProject.setSourceVersion(
-                                    reader.getElementText());
+                                    new JavaVersion(reader.getElementText()));
                         } else {
                             consumeElement(reader);
                         }
@@ -217,7 +217,7 @@ public class MavenParser {
                     case "target":
                         if ("maven-compiler-plugin".equals(artifactId)) {
                             mavenProject.setTargetVersion(
-                                    reader.getElementText());
+                                    new JavaVersion(reader.getElementText()));
                         } else {
                             consumeElement(reader);
                         }
@@ -572,10 +572,12 @@ public class MavenParser {
             if (reader.isStartElement()) {
                 switch (reader.getLocalName()) {
                     case "maven.compiler.source":
-                        mavenProject.setSourceVersion(reader.getElementText());
+                        mavenProject.setSourceVersion(
+                                new JavaVersion(reader.getElementText()));
                         break;
                     case "maven.compiler.target":
-                        mavenProject.setTargetVersion(reader.getElementText());
+                        mavenProject.setTargetVersion(
+                                new JavaVersion(reader.getElementText()));
                         break;
                     case "project.build.sourceEncoding":
                         mavenProject.setSourceEncoding(reader.getElementText());

diff --git a/src/main/java/org/gentoo/java/ebuilder/maven/MavenProject.java b/src/main/java/org/gentoo/java/ebuilder/maven/MavenProject.java
index 6cead37..07fa60e 100644
--- a/src/main/java/org/gentoo/java/ebuilder/maven/MavenProject.java
+++ b/src/main/java/org/gentoo/java/ebuilder/maven/MavenProject.java
@@ -68,11 +68,11 @@ public class MavenProject {
     /**
      * Source compile version.
      */
-    private String sourceVersion = "1.8";
+    private JavaVersion sourceVersion = new JavaVersion("1.8");
     /**
      * Target compile version.
      */
-    private String targetVersion = "1.8";
+    private JavaVersion targetVersion = new JavaVersion("1.8");
     /**
      * Test resource directories.
      */
@@ -382,7 +382,7 @@ public class MavenProject {
      *
      * @return {@link #sourceVersion}
      */
-    public String getSourceVersion() {
+    public JavaVersion getSourceVersion() {
         return sourceVersion;
     }
 
@@ -391,7 +391,7 @@ public class MavenProject {
      *
      * @param sourceVersion {@link #sourceVersion}
      */
-    public void setSourceVersion(final String sourceVersion) {
+    public void setSourceVersion(final JavaVersion sourceVersion) {
         this.sourceVersion = sourceVersion;
     }
 
@@ -400,7 +400,7 @@ public class MavenProject {
      *
      * @return {@link #targetVersion}
      */
-    public String getTargetVersion() {
+    public JavaVersion getTargetVersion() {
         return targetVersion;
     }
 
@@ -409,7 +409,7 @@ public class MavenProject {
      *
      * @param targetVersion {@link #targetVersion}
      */
-    public void setTargetVersion(final String targetVersion) {
+    public void setTargetVersion(final JavaVersion targetVersion) {
         this.targetVersion = targetVersion;
     }
 


^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [gentoo-commits] proj/java-ebuilder:master commit in: src/main/java/org/gentoo/java/ebuilder/maven/
@ 2019-11-03 12:17 Miroslav Šulc
  0 siblings, 0 replies; 48+ messages in thread
From: Miroslav Šulc @ 2019-11-03 12:17 UTC (permalink / raw
  To: gentoo-commits

commit:     88779df1d44e081fab5d3602f0b7baf4a6802fbe
Author:     Miroslav Šulc <fordfrog <AT> gentoo <DOT> org>
AuthorDate: Sun Nov  3 12:15:16 2019 +0000
Commit:     Miroslav Šulc <fordfrog <AT> gentoo <DOT> org>
CommitDate: Sun Nov  3 12:15:16 2019 +0000
URL:        https://gitweb.gentoo.org/proj/java-ebuilder.git/commit/?id=88779df1

fixed parsing of java version

Signed-off-by: Miroslav Šulc <fordfrog <AT> gentoo.org>

 src/main/java/org/gentoo/java/ebuilder/maven/JavaVersion.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/main/java/org/gentoo/java/ebuilder/maven/JavaVersion.java b/src/main/java/org/gentoo/java/ebuilder/maven/JavaVersion.java
index 5aa600d..7402cd2 100644
--- a/src/main/java/org/gentoo/java/ebuilder/maven/JavaVersion.java
+++ b/src/main/java/org/gentoo/java/ebuilder/maven/JavaVersion.java
@@ -15,7 +15,7 @@ public class JavaVersion {
      * Pattern for parsing Java versionNumber.
      */
     private static final Pattern PATTERN_VERSION
-            = Pattern.compile("^(?:1\\.)(\\d+)$");
+            = Pattern.compile("^(?:1\\.)?(\\d+)$");
     /**
      * Java versionNumber number.
      */


^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [gentoo-commits] proj/java-ebuilder:master commit in: src/main/java/org/gentoo/java/ebuilder/maven/
@ 2019-11-03 12:17 Miroslav Šulc
  0 siblings, 0 replies; 48+ messages in thread
From: Miroslav Šulc @ 2019-11-03 12:17 UTC (permalink / raw
  To: gentoo-commits

commit:     7d91defe12e3ddda4746a1d5e37655536f6e2d32
Author:     Miroslav Šulc <fordfrog <AT> gentoo <DOT> org>
AuthorDate: Sun Nov  3 12:17:29 2019 +0000
Commit:     Miroslav Šulc <fordfrog <AT> gentoo <DOT> org>
CommitDate: Sun Nov  3 12:17:29 2019 +0000
URL:        https://gitweb.gentoo.org/proj/java-ebuilder.git/commit/?id=7d91defe

added slot information to virtual/{jdk,jre} dependencies

Signed-off-by: Miroslav Šulc <fordfrog <AT> gentoo.org>

 src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java b/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java
index d6e3f1a..61f97f2 100644
--- a/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java
+++ b/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java
@@ -399,6 +399,7 @@ public class MavenEbuilder {
         writer.print("\t>=virtual/jdk-");
         writer.print(getMinSourceVersion(
                 mavenProjects, config.getForceMinJavaVersion()));
+        writer.print(":*");
 
         if (config.getDownloadUri() != null && config.getDownloadUri().
                 toString().matches("^.*?\\.(jar|zip)$")) {
@@ -440,6 +441,7 @@ public class MavenEbuilder {
         writer.print("\t>=virtual/jre-");
         writer.print(getMinTargetVersion(
                 mavenProjects, config.getForceMinJavaVersion()));
+        writer.print(":*");
 
         if (!runtimeDependencies.isEmpty()) {
             runtimeDependencies.stream().forEach((dependency) -> {


^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [gentoo-commits] proj/java-ebuilder:master commit in: src/main/java/org/gentoo/java/ebuilder/maven/
@ 2019-11-03 15:14 Miroslav Šulc
  0 siblings, 0 replies; 48+ messages in thread
From: Miroslav Šulc @ 2019-11-03 15:14 UTC (permalink / raw
  To: gentoo-commits

commit:     1d76ee8e7d73653f56e228fb3cc30742bfa0abd4
Author:     Miroslav Šulc <fordfrog <AT> gentoo <DOT> org>
AuthorDate: Sun Nov  3 15:14:27 2019 +0000
Commit:     Miroslav Šulc <fordfrog <AT> gentoo <DOT> org>
CommitDate: Sun Nov  3 15:14:27 2019 +0000
URL:        https://gitweb.gentoo.org/proj/java-ebuilder.git/commit/?id=1d76ee8e

fixed test dependencies and reformatted dependencies

Signed-off-by: Miroslav Šulc <fordfrog <AT> gentoo.org>

 .../gentoo/java/ebuilder/maven/MavenEbuilder.java  | 132 ++++++++++-----------
 1 file changed, 62 insertions(+), 70 deletions(-)

diff --git a/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java b/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java
index 61f97f2..5ddfd9b 100644
--- a/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java
+++ b/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java
@@ -324,125 +324,117 @@ public class MavenEbuilder {
                 mavenProjects, "compile");
         final List<String> runtimeDependencies = mergeSystemDependencies(
                 mavenProjects, "runtime");
-        boolean hasCDepend = !commonDependencies.isEmpty()
-                || !testDependencies.isEmpty();
+        final boolean hasCDepend = !commonDependencies.isEmpty();
+
+        writer.println();
 
         if (hasCDepend) {
-            writer.println();
             writer.println("# Common dependencies");
 
-            for (final MavenProject mavenProject : mavenProjects) {
-                if (mavenProject.getCommonDependencies().isEmpty()
-                        && mavenProject.getTestDependencies().isEmpty()) {
-                    continue;
-                }
-
-                if (!mavenProject.getCommonDependencies().isEmpty()) {
-                    writeDependenciesInfo(config, writer,
-                            mavenProject.getPomFile(),
-                            mavenProject.getCommonDependencies(), null);
-                }
-
-                if (mavenProject.getTargetVersion() != null) {
-                    writeDependenciesInfo(config, writer,
-                            mavenProject.getPomFile(),
-                            mavenProject.getTestDependencies(), "test?");
-                }
-
-                hasCDepend = true;
-            }
+            mavenProjects.stream().
+                    filter((mavenProject)
+                    -> !mavenProject.getCommonDependencies().isEmpty()).
+                    forEach((mavenProject) -> {
+                        writeDependenciesInfo(config, writer,
+                                mavenProject.getPomFile(),
+                                mavenProject.getCommonDependencies(), null);
+                    });
 
             writer.println("\nCDEPEND=\"");
 
-            if (!commonDependencies.isEmpty()) {
-                commonDependencies.stream().forEach((dependency) -> {
-                    writer.print('\t');
-                    writer.println(dependency);
-                });
-            }
-
-            if (!testDependencies.isEmpty()) {
-                writer.println("\ttest? (");
-
-                testDependencies.stream().forEach((dependency) -> {
-                    writer.print("\t\t");
-                    writer.println(dependency);
-                });
-
-                writer.println("\t)");
-            }
+            commonDependencies.stream().forEach((dependency) -> {
+                writer.print('\t');
+                writer.println(dependency);
+            });
 
             writer.println('"');
         }
 
-        if (!compileDependencies.isEmpty()) {
+        writer.println();
+
+        if (!compileDependencies.isEmpty()
+                || !testDependencies.isEmpty()) {
             writer.println("# Compile dependencies");
 
-            mavenProjects.stream().filter((mavenProject) ->
-                    (!mavenProject.getCompileDependencies().isEmpty()))
+            mavenProjects.stream().
+                    filter((mavenProject) ->
+                    !mavenProject.getCompileDependencies().isEmpty()
+                    || !mavenProject.getTestDependencies().isEmpty())
                     .forEach((mavenProject) -> {
-                        writeDependenciesInfo(config, writer,
-                                mavenProject.getPomFile(),
-                                mavenProject.getCompileDependencies(), null);
+                        if (!mavenProject.getCompileDependencies().isEmpty()) {
+                            writeDependenciesInfo(config, writer,
+                                    mavenProject.getPomFile(),
+                                    mavenProject.getCompileDependencies(),
+                                    null);
+                        }
+
+                        if (!mavenProject.getTestDependencies().isEmpty()) {
+                            writeDependenciesInfo(config, writer,
+                                    mavenProject.getPomFile(),
+                                    mavenProject.getTestDependencies(),
+                                    "test?");
+                        }
                     });
-        } else {
-            writer.println();
         }
 
-        writer.print("DEPEND=\"");
+        writer.print("\nDEPEND=\"\n\t=virtual/jdk-");
+        writer.print(getMinSourceVersion(
+                mavenProjects, config.getForceMinJavaVersion()));
+        writer.println(":*");
 
         if (hasCDepend) {
-            writer.print("${CDEPEND}");
+            writer.println("\t${CDEPEND}");
         }
 
-        writer.println();
-        writer.print("\t>=virtual/jdk-");
-        writer.print(getMinSourceVersion(
-                mavenProjects, config.getForceMinJavaVersion()));
-        writer.print(":*");
-
         if (config.getDownloadUri() != null && config.getDownloadUri().
                 toString().matches("^.*?\\.(jar|zip)$")) {
-            writer.println();
-            writer.print("\tapp-arch/unzip");
+            writer.println("\tapp-arch/unzip");
         }
 
         if (!compileDependencies.isEmpty()) {
             compileDependencies.stream().forEach((dependency) -> {
-                writer.println();
                 writer.print('\t');
                 writer.println(dependency);
             });
         }
 
+        if (!testDependencies.isEmpty()) {
+            writer.println("\ttest? (");
+
+            testDependencies.stream().forEach((dependency) -> {
+                writer.print("\t\t");
+                writer.println(dependency);
+            });
+
+            writer.println("\t)");
+        }
+
         writer.println('"');
 
+        writer.println();
+
         if (!runtimeDependencies.isEmpty()) {
             writer.println("# Runtime dependencies");
 
-            mavenProjects.stream().filter((mavenProject) -> (!mavenProject.
-                    getRuntimeDependencies().isEmpty()))
+            mavenProjects.stream().
+                    filter((mavenProject)
+                            -> !mavenProject.getRuntimeDependencies().isEmpty())
                     .forEach((mavenProject) -> {
                         writeDependenciesInfo(config, writer,
                                 mavenProject.getPomFile(),
                                 mavenProject.getRuntimeDependencies(), null);
                     });
-        } else {
-            writer.println();
         }
 
-        writer.print("RDEPEND=\"");
+        writer.print("RDEPEND=\"\n\t>=virtual/jre-");
+        writer.print(getMinTargetVersion(
+                mavenProjects, config.getForceMinJavaVersion()));
+        writer.println(":*");
 
         if (hasCDepend) {
             writer.print("${CDEPEND}");
         }
 
-        writer.println();
-        writer.print("\t>=virtual/jre-");
-        writer.print(getMinTargetVersion(
-                mavenProjects, config.getForceMinJavaVersion()));
-        writer.print(":*");
-
         if (!runtimeDependencies.isEmpty()) {
             runtimeDependencies.stream().forEach((dependency) -> {
                 writer.println();


^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [gentoo-commits] proj/java-ebuilder:master commit in: src/main/java/org/gentoo/java/ebuilder/maven/
@ 2019-11-27  9:50 Miroslav Šulc
  0 siblings, 0 replies; 48+ messages in thread
From: Miroslav Šulc @ 2019-11-27  9:50 UTC (permalink / raw
  To: gentoo-commits

commit:     ca925dfbe04523d44329cd4f9233f763bf8974da
Author:     Miroslav Šulc <fordfrog <AT> gentoo <DOT> org>
AuthorDate: Wed Nov 27 09:46:30 2019 +0000
Commit:     Miroslav Šulc <fordfrog <AT> gentoo <DOT> org>
CommitDate: Wed Nov 27 09:49:25 2019 +0000
URL:        https://gitweb.gentoo.org/proj/java-ebuilder.git/commit/?id=ca925dfb

reformatted

Signed-off-by: Miroslav Šulc <fordfrog <AT> gentoo.org>

 .../gentoo/java/ebuilder/maven/MavenEbuilder.java  | 49 ++++++++++++----------
 1 file changed, 26 insertions(+), 23 deletions(-)

diff --git a/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java b/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java
index c9ec5b9..4becd69 100644
--- a/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java
+++ b/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java
@@ -88,18 +88,21 @@ public class MavenEbuilder {
                         sbCP.append(',');
                     }
 
-		    String[] parts = dependency.getSystemDependency().
-			replaceAll(".*/", "").
-			replaceAll("\\[.*\\]", "").
-			split(":");
-		    String PN = parts[0].replaceAll("-r\\d+$", "");
-		    if (parts.length == 2) {
-			PN = PN.substring(0, PN.lastIndexOf('-'));
-			if (!parts[1].equals("0")) {
-			    PN += "-" + parts[1];
-			}
-		    }
-                    sbCP.append(PN);
+                    final String[] parts = dependency.getSystemDependency().
+                            replaceAll(".*/", "").
+                            replaceAll("\\[.*\\]", "").
+                            split(":");
+                    String pn = parts[0].replaceAll("-r\\d+$", "");
+
+                    if (parts.length == 2) {
+                        pn = pn.substring(0, pn.lastIndexOf('-'));
+
+                        if (!parts[1].equals("0")) {
+                            pn += "-" + parts[1];
+                        }
+                    }
+
+                    sbCP.append(pn);
                 });
 
         return sbCP.toString();
@@ -155,7 +158,7 @@ public class MavenEbuilder {
     /**
      * Retrieves minimum source version from the maven projects.
      *
-     * @param mavenProjects list of maven projects
+     * @param mavenProjects   list of maven projects
      * @param forceMinVersion optional minimum version to force
      *
      * @return minimum source version
@@ -182,7 +185,7 @@ public class MavenEbuilder {
     /**
      * Retrieves minimum target version from the maven projects.
      *
-     * @param mavenProjects list of maven projects
+     * @param mavenProjects   list of maven projects
      * @param forceMinVersion optional minimum version to force
      *
      * @return minimum target version
@@ -371,7 +374,7 @@ public class MavenEbuilder {
 
             mavenProjects.stream().
                     filter((mavenProject)
-                    -> !mavenProject.getCommonDependencies().isEmpty()).
+                            -> !mavenProject.getCommonDependencies().isEmpty()).
                     forEach((mavenProject) -> {
                         writeDependenciesInfo(config, writer,
                                 mavenProject.getPomFile(),
@@ -395,8 +398,8 @@ public class MavenEbuilder {
             writer.println("# Compile dependencies");
 
             mavenProjects.stream().
-                    filter((mavenProject) ->
-                    !mavenProject.getCompileDependencies().isEmpty()
+                    filter((mavenProject)
+                            -> !mavenProject.getCompileDependencies().isEmpty()
                     || !mavenProject.getTestDependencies().isEmpty())
                     .forEach((mavenProject) -> {
                         if (!mavenProject.getCompileDependencies().isEmpty()) {
@@ -546,7 +549,7 @@ public class MavenEbuilder {
      * @param writer ebuild writer
      */
     private void writeInherit(final MavenProject mavenProject,
-                              final PrintWriter writer) {
+            final PrintWriter writer) {
         writer.println();
         writer.print("JAVA_PKG_IUSE=\"doc source");
 
@@ -764,11 +767,11 @@ public class MavenEbuilder {
 
                 mavenProject.getTestResourceDirectories().
                         forEach((directory) -> {
-                    writer.print("\t\"");
-                    writer.print(replaceWithVars(config.getWorkdir().
-                            relativize(directory).toString(), config));
-                    writer.println('"');
-                });
+                            writer.print("\t\"");
+                            writer.print(replaceWithVars(config.getWorkdir().
+                                    relativize(directory).toString(), config));
+                            writer.println('"');
+                        });
 
                 writer.println(')');
             }


^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [gentoo-commits] proj/java-ebuilder:master commit in: src/main/java/org/gentoo/java/ebuilder/maven/
@ 2019-11-27  9:50 Miroslav Šulc
  0 siblings, 0 replies; 48+ messages in thread
From: Miroslav Šulc @ 2019-11-27  9:50 UTC (permalink / raw
  To: gentoo-commits

commit:     46bbaf55e2d6924a324fbff3dc0755e4ad8280eb
Author:     Miroslav Šulc <fordfrog <AT> gentoo <DOT> org>
AuthorDate: Wed Nov 27 09:44:05 2019 +0000
Commit:     Miroslav Šulc <fordfrog <AT> gentoo <DOT> org>
CommitDate: Wed Nov 27 09:49:19 2019 +0000
URL:        https://gitweb.gentoo.org/proj/java-ebuilder.git/commit/?id=46bbaf55

fixing download tarball name

Signed-off-by: Miroslav Šulc <fordfrog <AT> gentoo.org>

 .../gentoo/java/ebuilder/maven/MavenEbuilder.java  | 42 ++++++++++++++++++++--
 1 file changed, 40 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java b/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java
index 5ddfd9b..c9ec5b9 100644
--- a/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java
+++ b/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java
@@ -7,6 +7,8 @@ import java.nio.file.Path;
 import java.time.LocalDate;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 import org.gentoo.java.ebuilder.Config;
 
 /**
@@ -20,6 +22,16 @@ public class MavenEbuilder {
      * EAPI version.
      */
     private static final String EAPI = "7";
+    /**
+     * Pattern for retrieval of tarball extension.
+     */
+    private static final Pattern PATTERN_TARBALL_EXTENSION = Pattern.compile(
+            "^.*((?:\\.tar)\\.\\S+)$");
+    /**
+     * Pattern for checking whether download tarball name matches expected name.
+     */
+    private static final Pattern PATTERN_TARBALL_NAME
+            = Pattern.compile("^.*/\\$\\{P\\}(?:\\.tar)\\.\\S+$");
 
     /**
      * Generates ebuild from the collected information at the specified path.
@@ -194,6 +206,32 @@ public class MavenEbuilder {
         return result;
     }
 
+    /**
+     * If the tarball name does not match pattern ${P}.ext then we will update
+     * it to store the tarball as ${P}.ext.
+     *
+     * @param srcUri source URI
+     *
+     * @return either original source URI or updated source URI
+     */
+    private String improveSrcUri(final String srcUri) {
+        if (PATTERN_TARBALL_NAME.matcher(srcUri).matches()) {
+            return srcUri;
+        }
+
+        final Matcher matcher = PATTERN_TARBALL_EXTENSION.matcher(srcUri);
+
+        /**
+         * We do not know how to get the extension so we will leave the tarball
+         * name as it is.
+         */
+        if (!matcher.matches()) {
+            return srcUri;
+        }
+
+        return srcUri + " -> " + "${P}" + matcher.group(1);
+    }
+
     /**
      * Merges maven project system dependencies of specified type and removed
      * duplicates.
@@ -578,8 +616,8 @@ public class MavenEbuilder {
         writer.println('"');
 
         writer.print("SRC_URI=\"");
-        writer.print(
-                replaceWithVars(config.getDownloadUri().toString(), config));
+        writer.print(improveSrcUri(
+                replaceWithVars(config.getDownloadUri().toString(), config)));
         writer.println('"');
 
         writer.print("LICENSE=\"");


^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [gentoo-commits] proj/java-ebuilder:master commit in: src/main/java/org/gentoo/java/ebuilder/maven/
@ 2020-07-06 10:56 Miroslav Šulc
  0 siblings, 0 replies; 48+ messages in thread
From: Miroslav Šulc @ 2020-07-06 10:56 UTC (permalink / raw
  To: gentoo-commits

commit:     78af8f695010209d0aa09acace7532eecd305020
Author:     zongyu <zzy2529420793 <AT> gmail <DOT> com>
AuthorDate: Mon Jun 15 01:44:16 2020 +0000
Commit:     Miroslav Šulc <fordfrog <AT> gentoo <DOT> org>
CommitDate: Mon Jul  6 09:48:27 2020 +0000
URL:        https://gitweb.gentoo.org/proj/java-ebuilder.git/commit/?id=78af8f69

prevent java-ebuilder from writing "JAVA_SRC_DIR"

Signed-off-by: zongyu <zzy2529420793 <AT> gmail.com>

 src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java b/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java
index 4becd69..f17f860 100644
--- a/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java
+++ b/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java
@@ -418,7 +418,7 @@ public class MavenEbuilder {
                     });
         }
 
-        writer.print("\nDEPEND=\"\n\t=virtual/jdk-");
+        writer.print("\nDEPEND=\"\n\t>=virtual/jdk-");
         writer.print(getMinSourceVersion(
                 mavenProjects, config.getForceMinJavaVersion()));
         writer.println(":*");
@@ -702,10 +702,12 @@ public class MavenEbuilder {
             writer.println('"');
         }
 
+        /*
         writer.print("JAVA_SRC_DIR=\"");
         writer.print(replaceWithVars(config.getWorkdir().relativize(
                 mavenProject.getSourceDirectory()).toString(), config));
         writer.println('"');
+	*/
 
         if (mavenProject.getMainClass() != null) {
             writer.print("JAVA_MAIN_CLASS=\"");


^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [gentoo-commits] proj/java-ebuilder:master commit in: src/main/java/org/gentoo/java/ebuilder/maven/
@ 2020-07-06 10:56 Miroslav Šulc
  0 siblings, 0 replies; 48+ messages in thread
From: Miroslav Šulc @ 2020-07-06 10:56 UTC (permalink / raw
  To: gentoo-commits

commit:     ddca794355fa2f062a5c6c711e91ec80f18ef936
Author:     zongyu <zzy2529420793 <AT> gmail <DOT> com>
AuthorDate: Mon Jun 15 01:39:41 2020 +0000
Commit:     Miroslav Šulc <fordfrog <AT> gentoo <DOT> org>
CommitDate: Mon Jul  6 09:48:27 2020 +0000
URL:        https://gitweb.gentoo.org/proj/java-ebuilder.git/commit/?id=ddca7943

run simple_formatter after mvn -f, which enables us to re-format the irregular xml file produced by mvn

Signed-off-by: zongyu <zzy2529420793 <AT> gmail.com>

 .../java/org/gentoo/java/ebuilder/maven/MavenCache.java |  4 ++--
 .../org/gentoo/java/ebuilder/maven/MavenParser.java     | 17 +++++++++++++++++
 2 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/gentoo/java/ebuilder/maven/MavenCache.java b/src/main/java/org/gentoo/java/ebuilder/maven/MavenCache.java
index 4e8767e..19e40f9 100644
--- a/src/main/java/org/gentoo/java/ebuilder/maven/MavenCache.java
+++ b/src/main/java/org/gentoo/java/ebuilder/maven/MavenCache.java
@@ -24,7 +24,7 @@ public class MavenCache {
      * items.
      */
     private final Map<String, Map<String, List<CacheItem>>> cache
-            = new HashMap<>(200);
+            = new HashMap<>();
 
     /**
      * Searches for system dependency using maven group id, artifact id and
@@ -151,7 +151,7 @@ public class MavenCache {
                 = cache.get(cacheItem.getGroupId());
 
         if (artifactIds == null) {
-            artifactIds = new HashMap<>(100);
+            artifactIds = new HashMap<>();
             cache.put(cacheItem.getGroupId(), artifactIds);
         }
 

diff --git a/src/main/java/org/gentoo/java/ebuilder/maven/MavenParser.java b/src/main/java/org/gentoo/java/ebuilder/maven/MavenParser.java
index 7c9d162..63ba043 100644
--- a/src/main/java/org/gentoo/java/ebuilder/maven/MavenParser.java
+++ b/src/main/java/org/gentoo/java/ebuilder/maven/MavenParser.java
@@ -102,6 +102,9 @@ public class MavenParser {
                 pomFile.toString(), "help:effective-pom",
                 "-Doutput=" + outputPath);
         processBuilder.directory(config.getWorkdir().toFile());
+        final ProcessBuilder xmlBuilder = new ProcessBuilder("/usr/lib/java-ebuilder/simple_formatter",
+                "" + outputPath);
+        xmlBuilder.directory(config.getWorkdir().toFile());
 
         final Process process;
 
@@ -119,6 +122,20 @@ public class MavenParser {
             Runtime.getRuntime().exit(1);
         }
 
+        final Process xmlProcess;
+        try {
+            xmlProcess = xmlBuilder.start();
+        } catch (final IOException ex) {
+            throw new RuntimeException("Failed to format xml", ex);
+        }
+        try {
+            xmlProcess.waitFor(10, TimeUnit.MINUTES);
+        } catch (final InterruptedException ex) {
+            config.getErrorWriter().println("ERROR: xml formatter run 10 minutes??");
+            Runtime.getRuntime().exit(1);
+        }
+
+
         if (process.exitValue() != 0) {
             config.getErrorWriter().println(
                     "ERROR: Failed to run mvn command:");


^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [gentoo-commits] proj/java-ebuilder:master commit in: src/main/java/org/gentoo/java/ebuilder/maven/
@ 2020-07-06 10:56 Miroslav Šulc
  0 siblings, 0 replies; 48+ messages in thread
From: Miroslav Šulc @ 2020-07-06 10:56 UTC (permalink / raw
  To: gentoo-commits

commit:     22dd78f39f031a7c5a410ffacabae75e1ff04f91
Author:     zongyu <zzy2529420793 <AT> gmail <DOT> com>
AuthorDate: Thu Jun 18 07:10:50 2020 +0000
Commit:     Miroslav Šulc <fordfrog <AT> gentoo <DOT> org>
CommitDate: Mon Jul  6 09:48:27 2020 +0000
URL:        https://gitweb.gentoo.org/proj/java-ebuilder.git/commit/?id=22dd78f3

compare maven version and required maven version correctly

Signed-off-by: zongyu <zzy2529420793 <AT> gmail.com>

 src/main/java/org/gentoo/java/ebuilder/maven/MavenCache.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/gentoo/java/ebuilder/maven/MavenCache.java b/src/main/java/org/gentoo/java/ebuilder/maven/MavenCache.java
index 19e40f9..45ff1d9 100644
--- a/src/main/java/org/gentoo/java/ebuilder/maven/MavenCache.java
+++ b/src/main/java/org/gentoo/java/ebuilder/maven/MavenCache.java
@@ -57,7 +57,7 @@ public class MavenCache {
 
         for (final CacheItem curCacheItem : versions) {
             if (curCacheItem.getParsedMavenVersion().compareTo(mavenVersion)
-                    <= 0) {
+                    >= 0) {
                 cacheItem = curCacheItem;
 
                 break;
@@ -65,7 +65,7 @@ public class MavenCache {
         }
 
         if (cacheItem == null) {
-            cacheItem = versions.get(versions.size() - 1);
+            return "!!!suitble-avenVersion-not-found!!!";
         }
 
         final StringBuilder sbDependency = new StringBuilder(50);


^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [gentoo-commits] proj/java-ebuilder:master commit in: src/main/java/org/gentoo/java/ebuilder/maven/
@ 2020-07-06 10:56 Miroslav Šulc
  0 siblings, 0 replies; 48+ messages in thread
From: Miroslav Šulc @ 2020-07-06 10:56 UTC (permalink / raw
  To: gentoo-commits

commit:     446eb983de84a4240b387bfd6c080a3d90281363
Author:     zongyu <zzy2529420793 <AT> gmail <DOT> com>
AuthorDate: Mon Jun 22 07:18:19 2020 +0000
Commit:     Miroslav Šulc <fordfrog <AT> gentoo <DOT> org>
CommitDate: Mon Jul  6 09:48:27 2020 +0000
URL:        https://gitweb.gentoo.org/proj/java-ebuilder.git/commit/?id=446eb983

jdk-8 -> jdk-1.8

Signed-off-by: zongyu <zzy2529420793 <AT> gmail.com>

 src/main/java/org/gentoo/java/ebuilder/maven/JavaVersion.java | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/gentoo/java/ebuilder/maven/JavaVersion.java b/src/main/java/org/gentoo/java/ebuilder/maven/JavaVersion.java
index 7402cd2..b1918b0 100644
--- a/src/main/java/org/gentoo/java/ebuilder/maven/JavaVersion.java
+++ b/src/main/java/org/gentoo/java/ebuilder/maven/JavaVersion.java
@@ -32,8 +32,6 @@ public class JavaVersion {
      * @param versionString version string
      */
     public JavaVersion(final String versionString) {
-        this.versionString = versionString;
-
         final Matcher matcher = PATTERN_VERSION.matcher(versionString);
 
         if (!matcher.matches()) {
@@ -42,6 +40,13 @@ public class JavaVersion {
         }
 
         versionNumber = Integer.parseInt(matcher.group(1), 10);
+        if (versionNumber <= 8) {
+            this.versionString = "1." + Integer.toString(versionNumber);
+        }
+        else {
+            this.versionString = versionString;
+        }
+
     }
 
     /**


^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [gentoo-commits] proj/java-ebuilder:master commit in: src/main/java/org/gentoo/java/ebuilder/maven/
@ 2020-07-06 10:56 Miroslav Šulc
  0 siblings, 0 replies; 48+ messages in thread
From: Miroslav Šulc @ 2020-07-06 10:56 UTC (permalink / raw
  To: gentoo-commits

commit:     55d4da9bfad9e4773edc1aded22bb154571e9e56
Author:     zongyu <zzy2529420793 <AT> gmail <DOT> com>
AuthorDate: Mon Jul  6 04:19:49 2020 +0000
Commit:     Miroslav Šulc <fordfrog <AT> gentoo <DOT> org>
CommitDate: Mon Jul  6 09:48:27 2020 +0000
URL:        https://gitweb.gentoo.org/proj/java-ebuilder.git/commit/?id=55d4da9b

fix some typos

Signed-off-by: zongyu <zzy2529420793 <AT> gmail.com>

 src/main/java/org/gentoo/java/ebuilder/maven/MavenCache.java    | 2 +-
 src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/main/java/org/gentoo/java/ebuilder/maven/MavenCache.java b/src/main/java/org/gentoo/java/ebuilder/maven/MavenCache.java
index 45ff1d9..0443dd4 100644
--- a/src/main/java/org/gentoo/java/ebuilder/maven/MavenCache.java
+++ b/src/main/java/org/gentoo/java/ebuilder/maven/MavenCache.java
@@ -65,7 +65,7 @@ public class MavenCache {
         }
 
         if (cacheItem == null) {
-            return "!!!suitble-avenVersion-not-found!!!";
+            return "!!!suitble-mavenVersion-not-found!!!";
         }
 
         final StringBuilder sbDependency = new StringBuilder(50);

diff --git a/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java b/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java
index 0387120..48920e5 100644
--- a/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java
+++ b/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java
@@ -838,10 +838,10 @@ public class MavenEbuilder {
         writer.println();
         writer.println("src_unpack() {");
         writer.println("\tmkdir -p ${S}/${JAVA_SRC_DIR}");
-        writer.println("\tunzip ${DISTDIR}/${P}.jar -d ${S}/${JAVA_SRC_DIR}");
+        writer.println("\tunzip ${DISTDIR}/${P}.jar -d ${S}/${JAVA_SRC_DIR} || die");
         if (mavenProject.hasTests()) {
             writer.println("\tmkdir -p ${JAVA_TEST_SRC_DIR}");
-            writer.println("\tunzip ${DISTDIR}/${P}-test.jar -d ${S}/${JAVA_TEST_SRC_DIR}");
+            writer.println("\tunzip ${DISTDIR}/${P}-test.jar -d ${S}/${JAVA_TEST_SRC_DIR} || die");
         }
         writer.println("}");
     }


^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [gentoo-commits] proj/java-ebuilder:master commit in: src/main/java/org/gentoo/java/ebuilder/maven/
@ 2020-07-24  6:41 Miroslav Šulc
  0 siblings, 0 replies; 48+ messages in thread
From: Miroslav Šulc @ 2020-07-24  6:41 UTC (permalink / raw
  To: gentoo-commits

commit:     6d3d209a35ee2102d633061b3f0a2d5ad671608f
Author:     zongyu <zzy2529420793 <AT> gmail <DOT> com>
AuthorDate: Sat Jul 18 07:37:44 2020 +0000
Commit:     Miroslav Šulc <fordfrog <AT> gentoo <DOT> org>
CommitDate: Sat Jul 18 14:50:03 2020 +0000
URL:        https://gitweb.gentoo.org/proj/java-ebuilder.git/commit/?id=6d3d209a

format a right string for java-virtuals/*

Signed-off-by: zongyu <zzy2529420793 <AT> gmail.com>

 .../org/gentoo/java/ebuilder/maven/MavenCache.java | 10 ++--
 .../gentoo/java/ebuilder/maven/MavenEbuilder.java  | 54 ++++++++++------------
 2 files changed, 32 insertions(+), 32 deletions(-)

diff --git a/src/main/java/org/gentoo/java/ebuilder/maven/MavenCache.java b/src/main/java/org/gentoo/java/ebuilder/maven/MavenCache.java
index 0443dd4..d6345bf 100644
--- a/src/main/java/org/gentoo/java/ebuilder/maven/MavenCache.java
+++ b/src/main/java/org/gentoo/java/ebuilder/maven/MavenCache.java
@@ -69,12 +69,16 @@ public class MavenCache {
         }
 
         final StringBuilder sbDependency = new StringBuilder(50);
-        sbDependency.append(">=");
+	if (cacheItem.getCategory().compareTo("java-virtuals") != 0) {
+            sbDependency.append(">=");
+	}
         sbDependency.append(cacheItem.getCategory());
         sbDependency.append('/');
         sbDependency.append(cacheItem.getPkg());
-        sbDependency.append('-');
-        sbDependency.append(stripExtraFromVersion(cacheItem.getVersion()));
+	if (cacheItem.getCategory().compareTo("java-virtuals") != 0) {
+            sbDependency.append('-');
+            sbDependency.append(stripExtraFromVersion(cacheItem.getVersion()));
+	}
 
         if (cacheItem.getUseFlag() != null) {
             sbDependency.append('[');

diff --git a/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java b/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java
index 08a5f99..da3a01b 100644
--- a/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java
+++ b/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java
@@ -57,7 +57,7 @@ public class MavenEbuilder {
              */
             final MavenProject mavenProject
                     = mavenProjects.get(mavenProjects.size() - 1);
-            writeInherit(mavenProject, writer);
+            writeInherit(config, mavenProject, writer);
             writePackageInfo(config, mavenProject, writer);
 
             writeDependencies(config, mavenProjects, writer);
@@ -244,16 +244,11 @@ public class MavenEbuilder {
      */
     private String improveBinjarUri(final String binjarUri) {
 
-        final Matcher matcher = PATTERN_TARBALL_EXTENSION.matcher(binjarUri);
-
         /**
-         * We do not know how to get the extension so assume it will be jar
+         * Binary file should be jars
          */
-        if (!matcher.matches()) {
-            return binjarUri + " -> " + "${P}-bin.jar";
-        }
+        return binjarUri + " -> " + "${P}-bin.jar";
 
-        return binjarUri + " -> " + "${P}-bin" + matcher.group(1);
     }
 
     /**
@@ -479,15 +474,19 @@ public class MavenEbuilder {
                 mavenProjects, config.getForceMinJavaVersion()));
         writer.println(":*");
 
-        if (hasCDepend) {
-            writer.println("\t${CDEPEND}");
-        }
-
         if (config.getDownloadUri() != null && config.getDownloadUri().
                 toString().matches("^.*?\\.(jar|zip)$")) {
             writer.println("\tapp-arch/unzip");
         }
 
+        if (config.hasBinjarUri() && (hasCDepend || !compileDependencies.isEmpty())) {
+            writer.println("\t!binary? (");
+        }
+
+        if (hasCDepend) {
+            writer.println("\t${CDEPEND}");
+        }
+
         if (!compileDependencies.isEmpty()) {
             compileDependencies.stream().forEach((dependency) -> {
                 writer.print('\t');
@@ -495,6 +494,10 @@ public class MavenEbuilder {
             });
         }
 
+        if (config.hasBinjarUri() && (hasCDepend || !compileDependencies.isEmpty())) {
+            writer.println("\t)");
+        }
+
         if (!testDependencies.isEmpty()) {
             writer.println("\ttest? (");
 
@@ -528,10 +531,6 @@ public class MavenEbuilder {
                 mavenProjects, config.getForceMinJavaVersion()));
         writer.println(":*");
 
-        if (config.hasBinjarUri()) {
-            writer.println("\t!binary? (");
-        }
-
         if (hasCDepend) {
             writer.print("${CDEPEND}");
         }
@@ -544,9 +543,6 @@ public class MavenEbuilder {
             });
         }
 
-        if (config.hasBinjarUri()) {
-            writer.println("\t)");
-        }
 
 
         writer.println('"');
@@ -613,8 +609,8 @@ public class MavenEbuilder {
      *
      * @param writer ebuild writer
      */
-    private void writeInherit(final MavenProject mavenProject,
-            final PrintWriter writer) {
+    private void writeInherit(final Config config,
+            final MavenProject mavenProject, final PrintWriter writer) {
         writer.println();
         writer.print("JAVA_PKG_IUSE=\"doc source");
 
@@ -622,7 +618,7 @@ public class MavenEbuilder {
             writer.print(" test");
         }
 
-        if (mavenProject.hasBinjarUri()) {
+        if (config.hasBinjarUri()) {
             writer.print(" binary");
         }
 
@@ -800,6 +796,10 @@ public class MavenEbuilder {
             writer.println(')');
         }
 
+	if (config.hasBinjarUri()) {
+            writer.println("JAVA_BINJAR_FILENAME=\"${P}-bin.jar\"");
+	}
+
         final String testingFramework = determineTestingFramework(mavenProject);
         boolean firstTestVar = true;
 
@@ -851,7 +851,7 @@ public class MavenEbuilder {
         }
 
         if (config.isFromMavenCentral()) {
-            writeMavenUnpack(config, mavenProject, writer);
+            writeMavenUnpack(mavenProject, writer);
         }
 
     }
@@ -871,8 +871,8 @@ public class MavenEbuilder {
      *
      * @param writer ebuild writer
      */
-    private void writeMavenUnpack(final Config config,
-            final MavenProject mavenProject, final PrintWriter writer) {
+    private void writeMavenUnpack(final MavenProject mavenProject,
+            final PrintWriter writer) {
         writer.println();
         writer.println("src_unpack() {");
         writer.println("\tmkdir -p ${S}/${JAVA_SRC_DIR}");
@@ -883,10 +883,6 @@ public class MavenEbuilder {
             writer.println("\tunzip ${DISTDIR}/${P}-test.jar -d ${S}/${JAVA_TEST_SRC_DIR} || die");
         }
 
-	if (config.hasBinjarUri()) {
-            writer.println("use binary && cp ${DISTDIR}/${P}-bin.jar ${S}/${PN}.jar || die \"failed to copy binary jar\"");
-        }
-
         writer.println("}");
     }
 }


^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [gentoo-commits] proj/java-ebuilder:master commit in: src/main/java/org/gentoo/java/ebuilder/maven/
@ 2020-07-24  6:41 Miroslav Šulc
  0 siblings, 0 replies; 48+ messages in thread
From: Miroslav Šulc @ 2020-07-24  6:41 UTC (permalink / raw
  To: gentoo-commits

commit:     2079ef593386ada75e3afc6750e11a2165896569
Author:     zongyu <zzy2529420793 <AT> gmail <DOT> com>
AuthorDate: Sun Jul 19 12:12:25 2020 +0000
Commit:     Miroslav Šulc <fordfrog <AT> gentoo <DOT> org>
CommitDate: Sun Jul 19 12:12:25 2020 +0000
URL:        https://gitweb.gentoo.org/proj/java-ebuilder.git/commit/?id=2079ef59

rename source code file to ${P}-sources.[extension]

Signed-off-by: zongyu <zzy2529420793 <AT> gmail.com>

 src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java b/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java
index da3a01b..38a8bf8 100644
--- a/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java
+++ b/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java
@@ -31,7 +31,7 @@ public class MavenEbuilder {
      * Pattern for checking whether download tarball name matches expected name.
      */
     private static final Pattern PATTERN_TARBALL_NAME
-            = Pattern.compile("^.*/\\$\\{P\\}((?:\\.tar)\\.\\S+|(?:\\.jar))$");
+            = Pattern.compile("^.*/\\$\\{P\\}-sources.((?:\\.tar)\\.\\S+|(?:\\.jar))$");
 
     /**
      * Generates ebuild from the collected information at the specified path.
@@ -232,7 +232,7 @@ public class MavenEbuilder {
             return srcUri;
         }
 
-        return srcUri + " -> " + "${P}" + matcher.group(1);
+        return srcUri + " -> " + "${P}-sources" + matcher.group(1);
     }
 
     /**
@@ -876,7 +876,7 @@ public class MavenEbuilder {
         writer.println();
         writer.println("src_unpack() {");
         writer.println("\tmkdir -p ${S}/${JAVA_SRC_DIR}");
-        writer.println("\tunzip ${DISTDIR}/${P}.jar -d ${S}/${JAVA_SRC_DIR} || die");
+        writer.println("\tunzip ${DISTDIR}/${P}-sources.jar -d ${S}/${JAVA_SRC_DIR} || die");
 
         if (mavenProject.hasTests()) {
             writer.println("\tmkdir -p ${JAVA_TEST_SRC_DIR}");


^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [gentoo-commits] proj/java-ebuilder:master commit in: src/main/java/org/gentoo/java/ebuilder/maven/
@ 2020-08-05 14:31 Miroslav Šulc
  0 siblings, 0 replies; 48+ messages in thread
From: Miroslav Šulc @ 2020-08-05 14:31 UTC (permalink / raw
  To: gentoo-commits

commit:     84b4ee711e35b9b53a443cd92d31a108e2aaa569
Author:     zongyu <zzy2529420793 <AT> gmail <DOT> com>
AuthorDate: Sat Aug  1 15:21:31 2020 +0000
Commit:     Miroslav Šulc <fordfrog <AT> gentoo <DOT> org>
CommitDate: Sat Aug  1 15:26:41 2020 +0000
URL:        https://gitweb.gentoo.org/proj/java-ebuilder.git/commit/?id=84b4ee71

update the recorded skeleton cmd

Signed-off-by: zongyu <zzy2529420793 <AT> gmail.com>

 src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java b/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java
index 8fceec6..810358c 100644
--- a/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java
+++ b/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java
@@ -364,11 +364,20 @@ public class MavenEbuilder {
             });
         }
 
+        if (config.isFromMavenCentral()) {
+            writer.print(" --from-maven-central");
+        }
+
         if (config.getDownloadUri() != null) {
             writer.print(" --download-uri ");
             writer.print(config.getDownloadUri());
         }
 
+        if (config.hasBinjarUri()) {
+            writer.print(" --binjar-uri ");
+            writer.print(config.getBinjarUri());
+        }
+
         if (config.getLicense() != null) {
             writer.print(" --license ");
             writer.print(config.getLicense());


^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [gentoo-commits] proj/java-ebuilder:master commit in: src/main/java/org/gentoo/java/ebuilder/maven/
@ 2020-08-05 14:31 Miroslav Šulc
  0 siblings, 0 replies; 48+ messages in thread
From: Miroslav Šulc @ 2020-08-05 14:31 UTC (permalink / raw
  To: gentoo-commits

commit:     d87268c1674caf498a8cb65033a6a1b763112e35
Author:     zongyu <zzy2529420793 <AT> gmail <DOT> com>
AuthorDate: Tue Aug  4 07:08:00 2020 +0000
Commit:     Miroslav Šulc <fordfrog <AT> gentoo <DOT> org>
CommitDate: Tue Aug  4 07:08:00 2020 +0000
URL:        https://gitweb.gentoo.org/proj/java-ebuilder.git/commit/?id=d87268c1

sort licenses

Signed-off-by: zongyu <zzy2529420793 <AT> gmail.com>

 src/main/java/org/gentoo/java/ebuilder/maven/MavenProject.java | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/main/java/org/gentoo/java/ebuilder/maven/MavenProject.java b/src/main/java/org/gentoo/java/ebuilder/maven/MavenProject.java
index 4ce11b8..e1016a8 100644
--- a/src/main/java/org/gentoo/java/ebuilder/maven/MavenProject.java
+++ b/src/main/java/org/gentoo/java/ebuilder/maven/MavenProject.java
@@ -4,9 +4,9 @@ import java.io.PrintWriter;
 import java.nio.file.Path;
 import java.util.ArrayList;
 import java.util.Collections;
-import java.util.HashSet;
 import java.util.List;
-import java.util.Set;
+import java.util.SortedSet;
+import java.util.TreeSet;
 
 /**
  * Contains information about maven project collected from pom.xml.
@@ -46,7 +46,7 @@ public class MavenProject {
     /**
      * Lisences.
      */
-    private Set<String> licenses = new HashSet<>(10);
+    private SortedSet<String> licenses = new TreeSet<>(10);
     /**
      * Homepage URL.
      */


^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [gentoo-commits] proj/java-ebuilder:master commit in: src/main/java/org/gentoo/java/ebuilder/maven/
@ 2020-08-05 14:31 Miroslav Šulc
  0 siblings, 0 replies; 48+ messages in thread
From: Miroslav Šulc @ 2020-08-05 14:31 UTC (permalink / raw
  To: gentoo-commits

commit:     6f952b0dfa64958ddd6f391703995c6c97f75bce
Author:     zongyu <zzy2529420793 <AT> gmail <DOT> com>
AuthorDate: Sun Aug  2 02:48:45 2020 +0000
Commit:     Miroslav Šulc <fordfrog <AT> gentoo <DOT> org>
CommitDate: Sun Aug  2 03:21:21 2020 +0000
URL:        https://gitweb.gentoo.org/proj/java-ebuilder.git/commit/?id=6f952b0d

create proper GENTOO_CLASSPATH for java-virtuals/*.

Signed-off-by: zongyu <zzy2529420793 <AT> gmail.com>

 .../org/gentoo/java/ebuilder/maven/MavenEbuilder.java    | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java b/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java
index 810358c..646fc13 100644
--- a/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java
+++ b/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java
@@ -33,6 +33,12 @@ public class MavenEbuilder {
     private static final Pattern PATTERN_TARBALL_NAME
             = Pattern.compile("^.*/\\$\\{P\\}-sources.((?:\\.tar)\\.\\S+|(?:\\.jar))$");
 
+    /**
+     * Pattern for checking whether the dependency is specifying versions.
+     */
+    private static final Pattern PATTERN_EBUILD_VERSIONING
+            = Pattern.compile("^[~=<>].*$");
+
     /**
      * Generates ebuild from the collected information at the specified path.
      *
@@ -88,14 +94,20 @@ public class MavenEbuilder {
                         sbCP.append(',');
                     }
 
-                    final String[] parts = dependency.getSystemDependency().
+                    final String ebuildDependency =
+                            dependency.getSystemDependency();
+
+                    final String[] parts = ebuildDependency.
                             replaceAll(".*/", "").
                             replaceAll("\\[.*\\]", "").
                             split(":");
                     String pn = parts[0].replaceAll("-r\\d+$", "");
 
                     if (parts.length == 2) {
-                        pn = pn.substring(0, pn.lastIndexOf('-'));
+                        if (PATTERN_EBUILD_VERSIONING.
+                                matcher(ebuildDependency).matches()) {
+                            pn = pn.substring(0, pn.lastIndexOf('-'));
+                        }
 
                         if (!parts[1].equals("0")) {
                             pn += "-" + parts[1];


^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [gentoo-commits] proj/java-ebuilder:master commit in: src/main/java/org/gentoo/java/ebuilder/maven/
@ 2020-08-05 14:31 Miroslav Šulc
  0 siblings, 0 replies; 48+ messages in thread
From: Miroslav Šulc @ 2020-08-05 14:31 UTC (permalink / raw
  To: gentoo-commits

commit:     1a3f3a54a35473811acf16057529703199a3df76
Author:     zongyu <zzy2529420793 <AT> gmail <DOT> com>
AuthorDate: Wed Aug  5 04:20:07 2020 +0000
Commit:     Miroslav Šulc <fordfrog <AT> gentoo <DOT> org>
CommitDate: Wed Aug  5 07:49:29 2020 +0000
URL:        https://gitweb.gentoo.org/proj/java-ebuilder.git/commit/?id=1a3f3a54

make java-ebuilder able to recogize junit-5 and cucumber testing frameworks

Signed-off-by: zongyu <zzy2529420793 <AT> gmail.com>

 .../org/gentoo/java/ebuilder/maven/MavenEbuilder.java  | 18 ++++++++++++------
 .../org/gentoo/java/ebuilder/maven/MavenProject.java   |  2 +-
 2 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java b/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java
index b9778ef..e73a1fd 100644
--- a/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java
+++ b/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java
@@ -211,11 +211,9 @@ public class MavenEbuilder {
      */
     private String determineTestingFrameworkByDependency(
             final MavenDependency dependency) {
-        /** TODO: missing support for
-         *    "org.junit.vintage:junit-vintage-engine" tests
+        /** TODO: missing determination for
          *    "POJO" tests
          *    "spock" tests
-         *    "cucumber" tests
          */
         if ("junit".equals(dependency.getGroupId())
                 && "junit".equals(dependency.getArtifactId())) {
@@ -224,9 +222,17 @@ public class MavenEbuilder {
                 && "testng".equals(dependency.getArtifactId())) {
             return "testng";
         } else if ("org.junit.jupiter".equals(dependency.getGroupId())
-                && "junit-jupiter-engine".
-                    equals(dependency.getArtifactId())) {
-            return "junit-5";
+                && "junit-jupiter-engine".equals(dependency.getArtifactId())) {
+            // java-pkg-simple do not support now
+            return "junit-juniper";
+        } else if ("org.junit.vintage".equals(dependency.getGroupId())
+                && "junit-vintage-engine".equals(dependency.getArtifactId())) {
+            // java-pkg-simple do not support now
+            return "junit-vintage";
+        } else if ("io.cucumber".equals(dependency.getGroupId())
+                && "cucumber-junit".equals(dependency.getArtifactId())) {
+            // java-pkg-simple do not support now
+            return "cucumber";
         } else {
             return null;
         }

diff --git a/src/main/java/org/gentoo/java/ebuilder/maven/MavenProject.java b/src/main/java/org/gentoo/java/ebuilder/maven/MavenProject.java
index 51ec844..794f992 100644
--- a/src/main/java/org/gentoo/java/ebuilder/maven/MavenProject.java
+++ b/src/main/java/org/gentoo/java/ebuilder/maven/MavenProject.java
@@ -276,7 +276,7 @@ public class MavenProject {
      * @param description {@link #description}
      */
     public void setDescription(final String description) {
-        this.description = description;
+        this.description = description.replaceAll("[\n ]+", " ");
     }
 
     /**


^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [gentoo-commits] proj/java-ebuilder:master commit in: src/main/java/org/gentoo/java/ebuilder/maven/
@ 2020-08-05 14:31 Miroslav Šulc
  0 siblings, 0 replies; 48+ messages in thread
From: Miroslav Šulc @ 2020-08-05 14:31 UTC (permalink / raw
  To: gentoo-commits

commit:     774340875eb0e929b0db193cd4e84887e52339d8
Author:     zongyu <zzy2529420793 <AT> gmail <DOT> com>
AuthorDate: Mon Aug  3 08:38:58 2020 +0000
Commit:     Miroslav Šulc <fordfrog <AT> gentoo <DOT> org>
CommitDate: Mon Aug  3 10:56:22 2020 +0000
URL:        https://gitweb.gentoo.org/proj/java-ebuilder.git/commit/?id=77434087

make MavenEbuilder not print unnecessary lines

Signed-off-by: zongyu <zzy2529420793 <AT> gmail.com>

 .../gentoo/java/ebuilder/maven/MavenEbuilder.java  | 24 ++++++++--------------
 1 file changed, 8 insertions(+), 16 deletions(-)

diff --git a/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java b/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java
index 1fde760..857d6c1 100644
--- a/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java
+++ b/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java
@@ -450,10 +450,8 @@ public class MavenEbuilder {
                 mavenProjects, "runtime");
         final boolean hasCDepend = !commonDependencies.isEmpty();
 
-        writer.println();
-
         if (hasCDepend) {
-            writer.println("# Common dependencies");
+            writer.println("\n# Common dependencies");
 
             mavenProjects.stream().
                     filter((mavenProject)
@@ -474,11 +472,9 @@ public class MavenEbuilder {
             writer.println('"');
         }
 
-        writer.println();
-
         if (!compileDependencies.isEmpty()
                 || !testDependencies.isEmpty()) {
-            writer.println("# Compile dependencies");
+            writer.println("\n# Compile dependencies");
 
             mavenProjects.stream().
                     filter((mavenProject)
@@ -543,10 +539,8 @@ public class MavenEbuilder {
 
         writer.println('"');
 
-        writer.println();
-
         if (!runtimeDependencies.isEmpty()) {
-            writer.println("# Runtime dependencies");
+            writer.println("\n# Runtime dependencies");
 
             mavenProjects.stream().
                     filter((mavenProject)
@@ -558,7 +552,7 @@ public class MavenEbuilder {
                     });
         }
 
-        writer.print("RDEPEND=\"\n\t>=virtual/jre-");
+        writer.print("\nRDEPEND=\"\n\t>=virtual/jre-");
         writer.print(getMinTargetVersion(
                 mavenProjects, config.getForceMinJavaVersion()));
         writer.println(":*");
@@ -575,8 +569,6 @@ public class MavenEbuilder {
             });
         }
 
-
-
         writer.println('"');
     }
 
@@ -680,14 +672,14 @@ public class MavenEbuilder {
         // Global:
         // JAVA_GENTOO_CLASSPATH
         // JAVA_CLASSPATH_EXTRA
-        // JAVA_GENTOO_TEST_CLASSPATH
+        // JAVA_TEST_GENTOO_CLASSPATH
         // JAVA_ENCODING (unless it differs in projects)
         // Compile (jars, doc):
         // JAVA_SRC_DIR
         // JAVA_RESOURCE_DIRS
         // JAVA_ENCODING (in case project encodings are different)
         // Test:
-        // JAVA_TESTING_FRAMEWORK
+        // JAVA_TESTING_FRAMEWORKS
         // JAVA_TEST_SRC_DIR
         // JAVA_TEST_RESOURCE_DIRS
         // Install (jars, doc, sources):
@@ -855,7 +847,7 @@ public class MavenEbuilder {
                 firstTestVar = false;
             }
 
-            writer.print("JAVA_TESTING_FRAMEWORK=\"");
+            writer.print("JAVA_TESTING_FRAMEWORKS=\"");
             writer.print(testingFramework);
             writer.println('"');
         }
@@ -866,7 +858,7 @@ public class MavenEbuilder {
                 firstTestVar = false;
             }
 
-            writer.print("JAVA_GENTOO_TEST_CLASSPATH=\"");
+            writer.print("JAVA_TEST_GENTOO_CLASSPATH=\"");
             writer.print(createClassPath(mavenProject.getTestDependencies()));
             writer.println('"');
         }


^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [gentoo-commits] proj/java-ebuilder:master commit in: src/main/java/org/gentoo/java/ebuilder/maven/
@ 2020-08-05 14:31 Miroslav Šulc
  0 siblings, 0 replies; 48+ messages in thread
From: Miroslav Šulc @ 2020-08-05 14:31 UTC (permalink / raw
  To: gentoo-commits

commit:     22348c9c8ef160aab32ed4231cd45279ec56cdd2
Author:     zongyu <zzy2529420793 <AT> gmail <DOT> com>
AuthorDate: Mon Aug  3 02:37:54 2020 +0000
Commit:     Miroslav Šulc <fordfrog <AT> gentoo <DOT> org>
CommitDate: Mon Aug  3 02:40:52 2020 +0000
URL:        https://gitweb.gentoo.org/proj/java-ebuilder.git/commit/?id=22348c9c

add default{Desciption,Homepage}

Signed-off-by: zongyu <zzy2529420793 <AT> gmail.com>

 .../gentoo/java/ebuilder/maven/MavenEbuilder.java  | 33 ++++++++++++++++------
 1 file changed, 25 insertions(+), 8 deletions(-)

diff --git a/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java b/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java
index 646fc13..1fde760 100644
--- a/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java
+++ b/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java
@@ -18,6 +18,17 @@ import org.gentoo.java.ebuilder.Config;
  */
 public class MavenEbuilder {
 
+    /**
+     * The fallback description if no description is found in pom.xml.
+     */
+    private static final String defaultDescription = "${MAVEN_ID}";
+
+    /**
+     * The fallback homepage if no homepage is found in pom.xml.
+     */
+    private static final String defaultHomepage
+            = "https://wiki.gentoo.org/wiki/No_homepage";
+
     /**
      * EAPI version.
      */
@@ -694,10 +705,22 @@ public class MavenEbuilder {
             final MavenProject mavenProject, final PrintWriter writer) {
         writer.println();
 
+        // write MAVEN_ID ahead of DESCRIPTION,
+        //   becase defaultDescription need ${MAVEN_ID}
+        writer.print("MAVEN_ID=\"");
+        writer.print(mavenProject.getGroupId());
+        writer.print(':');
+        writer.print(mavenProject.getArtifactId());
+        writer.print(':');
+        writer.print(mavenProject.getVersion());
+        writer.println('"');
+
         writer.print("DESCRIPTION=\"");
 
         if (mavenProject.getDescription() != null) {
             writer.print(mavenProject.getDescription().replace("\"", "\\\""));
+        } else {
+            writer.print(defaultDescription);
         }
 
         writer.println('"');
@@ -706,6 +729,8 @@ public class MavenEbuilder {
 
         if (mavenProject.getHomepage() != null) {
             writer.print(mavenProject.getHomepage());
+        } else {
+            writer.print(defaultHomepage);
         }
 
         writer.println('"');
@@ -736,14 +761,6 @@ public class MavenEbuilder {
         writer.print("KEYWORDS=\"");
         writer.print(config.getKeywords());
         writer.println('"');
-
-        writer.print("MAVEN_ID=\"");
-        writer.print(mavenProject.getGroupId());
-        writer.print(':');
-        writer.print(mavenProject.getArtifactId());
-        writer.print(':');
-        writer.print(mavenProject.getVersion());
-        writer.println('"');
     }
 
     /**


^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [gentoo-commits] proj/java-ebuilder:master commit in: src/main/java/org/gentoo/java/ebuilder/maven/
@ 2020-08-18  8:11 Miroslav Šulc
  0 siblings, 0 replies; 48+ messages in thread
From: Miroslav Šulc @ 2020-08-18  8:11 UTC (permalink / raw
  To: gentoo-commits

commit:     0d8dcd56027708943ffd97869f268e9d17be6723
Author:     zongyu <zzy2529420793 <AT> gmail <DOT> com>
AuthorDate: Thu Aug 13 07:49:21 2020 +0000
Commit:     Miroslav Šulc <fordfrog <AT> gentoo <DOT> org>
CommitDate: Tue Aug 18 08:05:21 2020 +0000
URL:        https://gitweb.gentoo.org/proj/java-ebuilder.git/commit/?id=0d8dcd56

the minimum version of jdk should be 1.8 to make it compatible with jdk-11

Signed-off-by: zongyu <zzy2529420793 <AT> gmail.com>

 src/main/java/org/gentoo/java/ebuilder/maven/JavaVersion.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/main/java/org/gentoo/java/ebuilder/maven/JavaVersion.java b/src/main/java/org/gentoo/java/ebuilder/maven/JavaVersion.java
index b1918b0..6df982a 100644
--- a/src/main/java/org/gentoo/java/ebuilder/maven/JavaVersion.java
+++ b/src/main/java/org/gentoo/java/ebuilder/maven/JavaVersion.java
@@ -41,7 +41,7 @@ public class JavaVersion {
 
         versionNumber = Integer.parseInt(matcher.group(1), 10);
         if (versionNumber <= 8) {
-            this.versionString = "1." + Integer.toString(versionNumber);
+            this.versionString = "1.8";
         }
         else {
             this.versionString = versionString;


^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [gentoo-commits] proj/java-ebuilder:master commit in: src/main/java/org/gentoo/java/ebuilder/maven/
@ 2020-08-18  8:11 Miroslav Šulc
  0 siblings, 0 replies; 48+ messages in thread
From: Miroslav Šulc @ 2020-08-18  8:11 UTC (permalink / raw
  To: gentoo-commits

commit:     ab6630af6804d8e79e3a3f6ab31b5abb8a6f6d9c
Author:     zongyu <zzy2529420793 <AT> gmail <DOT> com>
AuthorDate: Tue Aug 18 03:20:45 2020 +0000
Commit:     Miroslav Šulc <fordfrog <AT> gentoo <DOT> org>
CommitDate: Tue Aug 18 08:05:21 2020 +0000
URL:        https://gitweb.gentoo.org/proj/java-ebuilder.git/commit/?id=ab6630af

improve the coding style of ebuild

Signed-off-by: zongyu <zzy2529420793 <AT> gmail.com>

 .../gentoo/java/ebuilder/maven/MavenEbuilder.java  | 107 ++++++++++-----------
 1 file changed, 53 insertions(+), 54 deletions(-)

diff --git a/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java b/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java
index bfedb68..b16a64e 100644
--- a/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java
+++ b/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java
@@ -31,14 +31,6 @@ public class MavenEbuilder {
     private static final String defaultHomepage
             = "https://wiki.gentoo.org/wiki/No_homepage";
 
-    /**
-     * The extra dependency for framework "pkgdiff"
-     */
-    private static final String dependencyForPkgdiff
-            = "\n\t\tamd64? (\n\t\t\tdev-util/pkgdiff"
-              + "\n\t\t\tdev-util/japi-compliance-checker"
-              + "\n\t\t)";
-
     /**
      * EAPI version.
      */
@@ -389,7 +381,9 @@ public class MavenEbuilder {
 
             dependencies.stream().filter((dependency)
                     -> (dependency.getSystemDependency() != null
-                    && !result.contains(dependency.getSystemDependency()))).
+                    && !result.contains(dependency.getSystemDependency())
+                    && (determineTestingFrameworkByDependency(dependency) == null
+                        || type != "test"))).
                     forEach((dependency) -> {
                         result.add(dependency.getSystemDependency());
                     });
@@ -555,26 +549,39 @@ public class MavenEbuilder {
             writer.println("\tapp-arch/unzip");
         }
 
-        if (config.hasBinjarUri() && (hasCDepend || !compileDependencies.isEmpty())) {
-            writer.println("\t!binary? (");
-        }
-
-        if (hasCDepend) {
-            writer.println("\t${CDEPEND}");
-        }
+        if (config.hasBinjarUri()) {
+            if (hasCDepend && compileDependencies.isEmpty()) {
+                writer.println("\t!binary? ( ${CDEPEND} )");
+            } else if (!compileDependencies.isEmpty()) {
+                writer.println("\t!binary? (");
+
+                if (hasCDepend) {
+                    writer.println("\t\t${CDEPEND}");
+                }
+
+                if (!compileDependencies.isEmpty()) {
+                    compileDependencies.stream().forEach((dependency) -> {
+                        writer.print("\t\t");
+                        writer.println(dependency);
+                    });
+                }
 
-        if (!compileDependencies.isEmpty()) {
-            compileDependencies.stream().forEach((dependency) -> {
-                writer.print('\t');
-                writer.println(dependency);
-            });
-        }
+                writer.println("\t)");
+            }
+        } else {
+            if (hasCDepend) {
+                writer.println("\t${CDEPEND}");
+            }
 
-        if (config.hasBinjarUri() && (hasCDepend || !compileDependencies.isEmpty())) {
-            writer.println("\t)");
+            if (!compileDependencies.isEmpty()) {
+                compileDependencies.stream().forEach((dependency) -> {
+                    writer.print('\t');
+                    writer.println(dependency);
+                });
+            }
         }
 
-        if (!testDependencies.isEmpty() || config.hasBinjarUri()) {
+        if (!testDependencies.isEmpty()) {
             writer.println("\ttest? (");
 
             testDependencies.stream().forEach((dependency) -> {
@@ -582,11 +589,6 @@ public class MavenEbuilder {
                 writer.println(dependency);
             });
 
-            // TODO: is it necessary to check whether amd64 is inside KEYWORDS?
-            if (config.hasBinjarUri()) {
-                writer.println(dependencyForPkgdiff);
-            }
-
             writer.println("\t)");
         }
 
@@ -611,7 +613,7 @@ public class MavenEbuilder {
         writer.println(":*");
 
         if (hasCDepend) {
-            writer.print("${CDEPEND}");
+            writer.print("\t${CDEPEND}");
         }
 
         if (!runtimeDependencies.isEmpty()) {
@@ -700,6 +702,26 @@ public class MavenEbuilder {
         }
 
         writer.println('"');
+
+        // write MAVEN_ID ahead of DESCRIPTION
+        writer.print("MAVEN_ID=\"");
+        writer.print(mavenProject.getGroupId());
+        writer.print(':');
+        writer.print(mavenProject.getArtifactId());
+        writer.print(':');
+        writer.print(mavenProject.getVersion());
+        writer.println('"');
+
+        // write testing framworks, so java-pkg-simple.eclass can deal with it
+        final String testingFramework
+                = determineTestingFramework(mavenProject, config);
+
+        if (testingFramework != null) {
+            writer.print("JAVA_TESTING_FRAMEWORKS=\"");
+            writer.print(testingFramework);
+            writer.println('"');
+        }
+
         writer.println();
         writer.print("inherit java-pkg-2 java-pkg-simple");
 
@@ -750,16 +772,6 @@ public class MavenEbuilder {
             final MavenProject mavenProject, final PrintWriter writer) {
         writer.println();
 
-        // write MAVEN_ID ahead of DESCRIPTION,
-        //   becase defaultDescription need ${MAVEN_ID}
-        writer.print("MAVEN_ID=\"");
-        writer.print(mavenProject.getGroupId());
-        writer.print(':');
-        writer.print(mavenProject.getArtifactId());
-        writer.print(':');
-        writer.print(mavenProject.getVersion());
-        writer.println('"');
-
         writer.print("DESCRIPTION=\"");
 
         if (mavenProject.getDescription() != null) {
@@ -895,21 +907,8 @@ public class MavenEbuilder {
             writer.println("JAVA_BINJAR_FILENAME=\"${P}-bin.jar\"");
         }
 
-        final String testingFramework
-                = determineTestingFramework(mavenProject, config);
         boolean firstTestVar = true;
 
-        if (testingFramework != null) {
-            if (firstTestVar) {
-                writer.println();
-                firstTestVar = false;
-            }
-
-            writer.print("JAVA_TESTING_FRAMEWORKS=\"");
-            writer.print(testingFramework);
-            writer.println('"');
-        }
-
         if (!mavenProject.getTestDependencies().isEmpty()) {
             if (firstTestVar) {
                 writer.println();


^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [gentoo-commits] proj/java-ebuilder:master commit in: src/main/java/org/gentoo/java/ebuilder/maven/
@ 2020-08-27 17:24 Miroslav Šulc
  0 siblings, 0 replies; 48+ messages in thread
From: Miroslav Šulc @ 2020-08-27 17:24 UTC (permalink / raw
  To: gentoo-commits

commit:     e024794b5f61201fc1db11fdfc40fa05b03125ed
Author:     zongyu <zzy2529420793 <AT> gmail <DOT> com>
AuthorDate: Wed Aug 19 08:02:07 2020 +0000
Commit:     Miroslav Šulc <fordfrog <AT> gentoo <DOT> org>
CommitDate: Wed Aug 19 08:07:40 2020 +0000
URL:        https://gitweb.gentoo.org/proj/java-ebuilder.git/commit/?id=e024794b

recognize and write JAVA_NEEDS_TOOLS automatically

Signed-off-by: zongyu <zzy2529420793 <AT> gmail.com>

 .../gentoo/java/ebuilder/maven/MavenEbuilder.java  |  3 +++
 .../gentoo/java/ebuilder/maven/MavenProject.java   | 31 ++++++++++++++++++++++
 2 files changed, 34 insertions(+)

diff --git a/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java b/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java
index b16a64e..c1e84d1 100644
--- a/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java
+++ b/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java
@@ -749,6 +749,7 @@ public class MavenEbuilder {
         // JAVA_CLASSPATH_EXTRA
         // JAVA_TEST_GENTOO_CLASSPATH
         // JAVA_ENCODING (unless it differs in projects)
+        // JAVA_NEED_TOOLS
         // Compile (jars, doc):
         // JAVA_SRC_DIR
         // JAVA_RESOURCE_DIRS
@@ -878,6 +879,8 @@ public class MavenEbuilder {
             writer.println('"');
         }
 
+        writer.print(mavenProject.getExtraJars(config.getStdoutWriter()));
+
         writer.print("JAVA_SRC_DIR=\"");
         writer.print(replaceWithVars(config.getWorkdir().relativize(
                 mavenProject.getSourceDirectory()).toString(), config));

diff --git a/src/main/java/org/gentoo/java/ebuilder/maven/MavenProject.java b/src/main/java/org/gentoo/java/ebuilder/maven/MavenProject.java
index 794f992..b7553b0 100644
--- a/src/main/java/org/gentoo/java/ebuilder/maven/MavenProject.java
+++ b/src/main/java/org/gentoo/java/ebuilder/maven/MavenProject.java
@@ -423,6 +423,37 @@ public class MavenProject {
         this.sourceVersion = sourceVersion;
     }
 
+    /**
+     * deal with scope == "system" dependencies
+     *
+     * @return lines of ebuild variables
+     */
+    @SuppressWarnings("unchecked")
+    public String getExtraJars(final PrintWriter writer) {
+        String ret = "";
+        List<MavenDependency> systemDependencies = getDependencies(new String[]{"system"});
+
+        for (final MavenDependency dependency : systemDependencies) {
+            switch (dependency.getGroupId()) {
+                case "com.sun":
+                    switch (dependency.getArtifactId()) {
+                        case "tools":
+                            ret += "JAVA_NEEDS_TOOLS=1\n";
+                            break;
+                        default:
+                            writer.println("Equivalent variable for " +
+                                dependency.getArtifactId() + " not found.");
+                    }
+                    break;
+                default:
+                    writer.println("Equivalent variable for " +
+                            dependency.getGroupId() + " not found.");
+            }
+        }
+
+        return ret;
+    }
+
     /**
      * Getter for {@link #targetVersion}.
      *


^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [gentoo-commits] proj/java-ebuilder:master commit in: src/main/java/org/gentoo/java/ebuilder/maven/
@ 2020-08-27 17:24 Miroslav Šulc
  0 siblings, 0 replies; 48+ messages in thread
From: Miroslav Šulc @ 2020-08-27 17:24 UTC (permalink / raw
  To: gentoo-commits

commit:     ab9e52a462aa9107adf7fbe6940c8ce01eddde60
Author:     zongyu <zzy2529420793 <AT> gmail <DOT> com>
AuthorDate: Wed Aug 19 08:33:23 2020 +0000
Commit:     Miroslav Šulc <fordfrog <AT> gentoo <DOT> org>
CommitDate: Wed Aug 19 08:55:39 2020 +0000
URL:        https://gitweb.gentoo.org/proj/java-ebuilder.git/commit/?id=ab9e52a4

Distinguish "dev-java/junit:0" and "dev-java/junit-4"

Signed-off-by: zongyu <zzy2529420793 <AT> gmail.com>

 src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java b/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java
index c1e84d1..19fc43c 100644
--- a/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java
+++ b/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java
@@ -12,6 +12,7 @@ import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 import java.util.Set;
 import org.gentoo.java.ebuilder.Config;
+import org.gentoo.java.ebuilder.portage.MavenVersion;
 
 /**
  * Generates ebuild from maven project.
@@ -209,7 +210,12 @@ public class MavenEbuilder {
          */
         if ("junit".equals(dependency.getGroupId())
                 && "junit".equals(dependency.getArtifactId())) {
-            return "junit";
+            if (dependency.getMavenVersion().
+                    compareTo(new MavenVersion("3.9.9")) < 1) {
+                return "junit";
+            } else {
+                return "junit-4";
+            }
         } else if ("org.testng".equals(dependency.getGroupId())
                 && "testng".equals(dependency.getArtifactId())) {
             return "testng";


^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [gentoo-commits] proj/java-ebuilder:master commit in: src/main/java/org/gentoo/java/ebuilder/maven/
@ 2020-08-30 18:22 Miroslav Šulc
  0 siblings, 0 replies; 48+ messages in thread
From: Miroslav Šulc @ 2020-08-30 18:22 UTC (permalink / raw
  To: gentoo-commits

commit:     a34a975a19e5c9a963cb96c1c0496d55a1430f3c
Author:     Miroslav Šulc <fordfrog <AT> gentoo <DOT> org>
AuthorDate: Sun Aug 30 18:21:47 2020 +0000
Commit:     Miroslav Šulc <fordfrog <AT> gentoo <DOT> org>
CommitDate: Sun Aug 30 18:21:47 2020 +0000
URL:        https://gitweb.gentoo.org/proj/java-ebuilder.git/commit/?id=a34a975a

filtering out resource directories that are not valid

Signed-off-by: Miroslav Šulc <fordfrog <AT> gentoo.org>

 .../gentoo/java/ebuilder/maven/MavenProject.java   | 77 +++++++++++-----------
 1 file changed, 38 insertions(+), 39 deletions(-)

diff --git a/src/main/java/org/gentoo/java/ebuilder/maven/MavenProject.java b/src/main/java/org/gentoo/java/ebuilder/maven/MavenProject.java
index e91bb80..48c6506 100644
--- a/src/main/java/org/gentoo/java/ebuilder/maven/MavenProject.java
+++ b/src/main/java/org/gentoo/java/ebuilder/maven/MavenProject.java
@@ -32,14 +32,6 @@ public class MavenProject {
      * Maven group id.
      */
     private String groupId;
-    /**
-     * Whether the package has resources.
-     */
-    private Boolean hasResources;
-    /**
-     * Whether the package has test resources.
-     */
-    private Boolean hasTestResources;
     /**
      * Whether the package has test classes.
      */
@@ -126,18 +118,38 @@ public class MavenProject {
      * Adds path to {@link #resourceDirectories}.
      *
      * @param path resource path
+     *
+     * @return true if the path was added, otherwise false
+     *
+     * @see #isValidResourcesDir(java.nio.file.Path)
      */
-    public void addResourceDirectory(final Path path) {
+    public boolean addResourceDirectory(final Path path) {
+        if (!isValidResourcesDir(path)) {
+            return false;
+        }
+
         resourceDirectories.add(path);
+
+        return true;
     }
 
     /**
-     * Adds path to {@link #testResourceDirectories}.
+     * Adds path to {@link #testResourceDirectories}. The path must be valid.
      *
      * @param path resource path
+     *
+     * @return true if the path was added, otherwise false
+     *
+     * @see #isValidResourcesDir(java.nio.file.Path)
      */
-    public void addTestResourceDirectory(final Path path) {
+    public boolean addTestResourceDirectory(final Path path) {
+        if (!isValidResourcesDir(path)) {
+            return false;
+        }
+
         testResourceDirectories.add(path);
+
+        return true;
     }
 
     /**
@@ -549,20 +561,7 @@ public class MavenProject {
      * @return {@link #hasResources}
      */
     public boolean hasResources() {
-        if (hasResources == null) {
-            hasResources = false;
-
-            for (final Path resources : resourceDirectories) {
-                if (resources.toFile().exists()
-                        && resources.toFile().list().length != 0) {
-                    hasResources = true;
-
-                    break;
-                }
-            }
-        }
-
-        return hasResources;
+        return !resourceDirectories.isEmpty();
     }
 
     /**
@@ -571,20 +570,7 @@ public class MavenProject {
      * @return {@link #hasTestResources}
      */
     public boolean hasTestResources() {
-        if (hasTestResources == null) {
-            hasTestResources = false;
-
-            for (final Path resources : testResourceDirectories) {
-                if (resources.toFile().exists()
-                        && resources.toFile().list().length != 0) {
-                    hasTestResources = true;
-
-                    break;
-                }
-            }
-        }
-
-        return hasTestResources;
+        return !testResourceDirectories.isEmpty();
     }
 
     /**
@@ -633,4 +619,17 @@ public class MavenProject {
 
         return result;
     }
+
+    /**
+     * Checks whether the provided path is a valid directory for resources. It
+     * must exist and contain at least one file.
+     *
+     * @param resources path to resources
+     *
+     * @return true if the resources directory is valid, otherwise false
+     */
+    private boolean isValidResourcesDir(final Path resources) {
+        return resources.toFile().exists()
+                && resources.toFile().list().length != 0;
+    }
 }


^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [gentoo-commits] proj/java-ebuilder:master commit in: src/main/java/org/gentoo/java/ebuilder/maven/
@ 2020-08-30 18:22 Miroslav Šulc
  0 siblings, 0 replies; 48+ messages in thread
From: Miroslav Šulc @ 2020-08-30 18:22 UTC (permalink / raw
  To: gentoo-commits

commit:     766ecd34d054a963c7b7149d8e53676b289b8ea8
Author:     Miroslav Šulc <fordfrog <AT> gentoo <DOT> org>
AuthorDate: Sun Aug 30 18:20:44 2020 +0000
Commit:     Miroslav Šulc <fordfrog <AT> gentoo <DOT> org>
CommitDate: Sun Aug 30 18:20:44 2020 +0000
URL:        https://gitweb.gentoo.org/proj/java-ebuilder.git/commit/?id=766ecd34

minor style fixes and sorted methods in MavenProject

Signed-off-by: Miroslav Šulc <fordfrog <AT> gentoo.org>

 .../gentoo/java/ebuilder/maven/MavenProject.java   | 98 +++++++++++-----------
 1 file changed, 50 insertions(+), 48 deletions(-)

diff --git a/src/main/java/org/gentoo/java/ebuilder/maven/MavenProject.java b/src/main/java/org/gentoo/java/ebuilder/maven/MavenProject.java
index b7553b0..e91bb80 100644
--- a/src/main/java/org/gentoo/java/ebuilder/maven/MavenProject.java
+++ b/src/main/java/org/gentoo/java/ebuilder/maven/MavenProject.java
@@ -3,6 +3,7 @@ package org.gentoo.java.ebuilder.maven;
 import java.io.PrintWriter;
 import java.nio.file.Path;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
 import java.util.SortedSet;
@@ -43,14 +44,14 @@ public class MavenProject {
      * Whether the package has test classes.
      */
     private Boolean hasTests;
-    /**
-     * Lisences.
-     */
-    private SortedSet<String> licenses = new TreeSet<>();
     /**
      * Homepage URL.
      */
     private String homepage;
+    /**
+     * Lisences.
+     */
+    private final SortedSet<String> licenses = new TreeSet<>();
     /**
      * Application main class.
      */
@@ -113,14 +114,12 @@ public class MavenProject {
     /**
      * Adds license to {@link #licenses}.
      *
-     * @param license {@link #licenses}
+     * @param portageLicenses {@link #licenses}
      */
     public void addLicense(final String portageLicenses) {
         final String[] parts = portageLicenses.split(":");
 
-        for (String eachLicense: parts) {
-            licenses.add(eachLicense);
-        }
+        licenses.addAll(Arrays.asList(parts));
     }
 
     /**
@@ -279,6 +278,40 @@ public class MavenProject {
         this.description = description.replaceAll("[\n ]+", " ");
     }
 
+    /**
+     * deal with scope == "system" dependencies
+     *
+     * @param writer writer
+     *
+     * @return lines of ebuild variables
+     */
+    @SuppressWarnings("unchecked")
+    public String getExtraJars(final PrintWriter writer) {
+        String ret = "";
+        List<MavenDependency> systemDependencies = getDependencies(new String[]{
+            "system"});
+
+        for (final MavenDependency dependency : systemDependencies) {
+            switch (dependency.getGroupId()) {
+                case "com.sun":
+                    switch (dependency.getArtifactId()) {
+                        case "tools":
+                            ret += "JAVA_NEEDS_TOOLS=1\n";
+                            break;
+                        default:
+                            writer.println("Equivalent variable for "
+                                    + dependency.getArtifactId() + " not found.");
+                    }
+                    break;
+                default:
+                    writer.println("Equivalent variable for " + dependency.
+                            getGroupId() + " not found.");
+            }
+        }
+
+        return ret;
+    }
+
     /**
      * Getter for {@link #groupId}.
      *
@@ -297,6 +330,15 @@ public class MavenProject {
         this.groupId = groupId;
     }
 
+    /**
+     * Setter for {@link #hasTests}
+     *
+     * @param hasTests {@link #hasTests}
+     */
+    public void setHasTests(boolean hasTests) {
+        this.hasTests = hasTests;
+    }
+
     /**
      * Getter for {@link #homepage}.
      *
@@ -423,37 +465,6 @@ public class MavenProject {
         this.sourceVersion = sourceVersion;
     }
 
-    /**
-     * deal with scope == "system" dependencies
-     *
-     * @return lines of ebuild variables
-     */
-    @SuppressWarnings("unchecked")
-    public String getExtraJars(final PrintWriter writer) {
-        String ret = "";
-        List<MavenDependency> systemDependencies = getDependencies(new String[]{"system"});
-
-        for (final MavenDependency dependency : systemDependencies) {
-            switch (dependency.getGroupId()) {
-                case "com.sun":
-                    switch (dependency.getArtifactId()) {
-                        case "tools":
-                            ret += "JAVA_NEEDS_TOOLS=1\n";
-                            break;
-                        default:
-                            writer.println("Equivalent variable for " +
-                                dependency.getArtifactId() + " not found.");
-                    }
-                    break;
-                default:
-                    writer.println("Equivalent variable for " +
-                            dependency.getGroupId() + " not found.");
-            }
-        }
-
-        return ret;
-    }
-
     /**
      * Getter for {@link #targetVersion}.
      *
@@ -591,15 +602,6 @@ public class MavenProject {
         return hasTests;
     }
 
-    /**
-     * Setter for {@link #hasTests}
-     *
-     * @param hasTests {@link #hasTests}
-     */
-    public void setHasTests(boolean hasTests) {
-        this.hasTests = hasTests;
-    }
-
     /**
      * Returns dependencies based on the specified scopes.
      *


^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [gentoo-commits] proj/java-ebuilder:master commit in: src/main/java/org/gentoo/java/ebuilder/maven/
@ 2020-10-02  7:43 Miroslav Šulc
  0 siblings, 0 replies; 48+ messages in thread
From: Miroslav Šulc @ 2020-10-02  7:43 UTC (permalink / raw
  To: gentoo-commits

commit:     744e9bdcbf51b80f4595f77ad88c435ec67a7e5e
Author:     Zhang Zongyu <zzy2529420793 <AT> gmail <DOT> com>
AuthorDate: Fri Sep  4 12:09:36 2020 +0000
Commit:     Miroslav Šulc <fordfrog <AT> gentoo <DOT> org>
CommitDate: Fri Sep  4 12:15:58 2020 +0000
URL:        https://gitweb.gentoo.org/proj/java-ebuilder.git/commit/?id=744e9bdc

only detect frameworks when the project has tests.

Signed-off-by: Zhang Zongyu <zzy2529420793 <AT> gmail.com>

 .../org/gentoo/java/ebuilder/maven/MavenEbuilder.java    | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java b/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java
index 19fc43c..4a63494 100644
--- a/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java
+++ b/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java
@@ -172,14 +172,16 @@ public class MavenEbuilder {
             final MavenProject mavenProject, final Config config) {
         Set<String> frameworks = new HashSet<>(10);
 
-        for (final MavenDependency dependency : mavenProject.
-                getTestDependencies()) {
-            frameworks.add(determineTestingFrameworkByDependency(dependency));
-        }
+        if (mavenProject.hasTests()) {
+            for (final MavenDependency dependency : mavenProject.
+                    getTestDependencies()) {
+                frameworks.add(determineTestingFrameworkByDependency(dependency));
+            }
 
-        for (final MavenDependency dependency : mavenProject.
-                getCommonDependencies()) {
-            frameworks.add(determineTestingFrameworkByDependency(dependency));
+            for (final MavenDependency dependency : mavenProject.
+                    getCommonDependencies()) {
+                frameworks.add(determineTestingFrameworkByDependency(dependency));
+            }
         }
 
         if (config.hasBinjarUri()) {


^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [gentoo-commits] proj/java-ebuilder:master commit in: src/main/java/org/gentoo/java/ebuilder/maven/
@ 2021-06-03  8:38 Miroslav Šulc
  0 siblings, 0 replies; 48+ messages in thread
From: Miroslav Šulc @ 2021-06-03  8:38 UTC (permalink / raw
  To: gentoo-commits

commit:     ad01a8f58da50aa36582fbd0b84b54f7db9c44b6
Author:     Miroslav Šulc <fordfrog <AT> gentoo <DOT> org>
AuthorDate: Thu Jun  3 08:37:40 2021 +0000
Commit:     Miroslav Šulc <fordfrog <AT> gentoo <DOT> org>
CommitDate: Thu Jun  3 08:37:40 2021 +0000
URL:        https://gitweb.gentoo.org/proj/java-ebuilder.git/commit/?id=ad01a8f5

put unzip in BDEPEND

Closes: https://bugs.gentoo.org/793863
Signed-off-by: Miroslav Šulc <fordfrog <AT> gentoo.org>

 .../java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java     | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java b/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java
index 4a63494..1543b5c 100644
--- a/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java
+++ b/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java
@@ -552,11 +552,6 @@ public class MavenEbuilder {
                 mavenProjects, config.getForceMinJavaVersion()));
         writer.println(":*");
 
-        if (config.getDownloadUri() != null && config.getDownloadUri().
-                toString().matches("^.*?\\.(jar|zip)$")) {
-            writer.println("\tapp-arch/unzip");
-        }
-
         if (config.hasBinjarUri()) {
             if (hasCDepend && compileDependencies.isEmpty()) {
                 writer.println("\t!binary? ( ${CDEPEND} )");
@@ -633,6 +628,11 @@ public class MavenEbuilder {
         }
 
         writer.println('"');
+
+        if (config.getDownloadUri() != null && config.getDownloadUri().
+                toString().matches("^.*?\\.(jar|zip)$")) {
+            writer.println("\nBDEPEND=\"app-arch/unzip\"");
+        }
     }
 
     /**


^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [gentoo-commits] proj/java-ebuilder:master commit in: src/main/java/org/gentoo/java/ebuilder/maven/
@ 2021-06-15  7:40 Miroslav Šulc
  0 siblings, 0 replies; 48+ messages in thread
From: Miroslav Šulc @ 2021-06-15  7:40 UTC (permalink / raw
  To: gentoo-commits

commit:     61ac9154ef648de0dacbc8f1977d093c1374cca4
Author:     Yuan Liao <liaoyuan <AT> gmail <DOT> com>
AuthorDate: Mon Jun 14 16:09:15 2021 +0000
Commit:     Miroslav Šulc <fordfrog <AT> gentoo <DOT> org>
CommitDate: Tue Jun 15 07:40:21 2021 +0000
URL:        https://gitweb.gentoo.org/proj/java-ebuilder.git/commit/?id=61ac9154

Fix hanging Maven process when lots of artifacts are being downloaded

The MavenParser class uses Java's ProcessBuilder to start a Maven
process without consuming the process's output.  This might cause the
Maven process to hang indefinitely after the output stream buffer is
full, because the process is blocked to wait for the contents in the
buffer to be cleared, but no other program is going to clear them.

When java-ebuilder is asked to create an ebuild for a Maven artifact
whose dependencies are mostly not cached in the local Maven repository
(stored in ~/.m2 by default), it will call Maven, which in turn will
download artifacts for all those dependencies, flooding lots of contents
into the output stream.  The size of output stream buffers Java uses for
the processes created from ProcessBuilder is just 8192 bytes, so with
lots of output, the buffer can become full fairly easily.

This explains why a hanging process is often observed when java-ebuilder
is requested to generate ebuilds for some new Maven artifacts, but
interrupting the process and restarting java-ebuilder can resolve the
issue.  When java-ebuilder is restarted, as long as MAVEN_ARTS is
unchanged, it can skip downloading the dependencies that have already
been cached in the previous execution before the buffer is full, so the
number of artifacts it still needs to download is reduced, and it might
be able to complete before the buffer is full again.

The solution to this issue is simple: either suppress Maven's output, or
consume the output stream buffer's contents to prevent blocking.  The
former solution is probably more preferable because it only requires
minimal change to both the source code and the program's behavior, and
it avoids output redirection, which is not easily portable between
different operating systems.

Reference: https://stackoverflow.com/questions/3285408/java-processbuilder-resultant-process-hangs

Signed-off-by: Yuan Liao <liaoyuan <AT> gmail.com>
Closes: https://github.com/gentoo/java-ebuilder/pull/10
Signed-off-by: Miroslav Šulc <fordfrog <AT> gentoo.org>

 src/main/java/org/gentoo/java/ebuilder/maven/MavenParser.java | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/main/java/org/gentoo/java/ebuilder/maven/MavenParser.java b/src/main/java/org/gentoo/java/ebuilder/maven/MavenParser.java
index 07ae96e..1411307 100644
--- a/src/main/java/org/gentoo/java/ebuilder/maven/MavenParser.java
+++ b/src/main/java/org/gentoo/java/ebuilder/maven/MavenParser.java
@@ -110,6 +110,10 @@ public class MavenParser {
 
         final ProcessBuilder processBuilder = new ProcessBuilder("mvn", "-f",
                 pomFile.toString(), "help:effective-pom",
+                // If output was not suppressed, mvn would hang indefinitely
+                // if new artifact should be downloaded, probably because of
+                // limited output stream buffer size
+                "-q",
                 "-Doutput=" + outputPath);
         processBuilder.directory(config.getWorkdir().toFile());
         final ProcessBuilder xmlBuilder = new ProcessBuilder("simple-xml-formatter",


^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [gentoo-commits] proj/java-ebuilder:master commit in: src/main/java/org/gentoo/java/ebuilder/maven/
@ 2021-07-01 13:13 Miroslav Šulc
  0 siblings, 0 replies; 48+ messages in thread
From: Miroslav Šulc @ 2021-07-01 13:13 UTC (permalink / raw
  To: gentoo-commits

commit:     e7b4d104d20a6b1faac3c3e67463d49294fb79b4
Author:     Miroslav Šulc <fordfrog <AT> gentoo <DOT> org>
AuthorDate: Thu Jul  1 13:12:45 2021 +0000
Commit:     Miroslav Šulc <fordfrog <AT> gentoo <DOT> org>
CommitDate: Thu Jul  1 13:12:45 2021 +0000
URL:        https://gitweb.gentoo.org/proj/java-ebuilder.git/commit/?id=e7b4d104

fixed a typo

Signed-off-by: Miroslav Šulc <fordfrog <AT> gentoo.org>

 src/main/java/org/gentoo/java/ebuilder/maven/MavenCache.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/main/java/org/gentoo/java/ebuilder/maven/MavenCache.java b/src/main/java/org/gentoo/java/ebuilder/maven/MavenCache.java
index 98864f8..60ef9d1 100644
--- a/src/main/java/org/gentoo/java/ebuilder/maven/MavenCache.java
+++ b/src/main/java/org/gentoo/java/ebuilder/maven/MavenCache.java
@@ -65,7 +65,7 @@ public class MavenCache {
         }
 
         if (cacheItem == null) {
-            return "!!!suitble-mavenVersion-not-found!!!";
+            return "!!!suitable-mavenVersion-not-found!!!";
         }
 
         final StringBuilder sbDependency = new StringBuilder(50);


^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [gentoo-commits] proj/java-ebuilder:master commit in: src/main/java/org/gentoo/java/ebuilder/maven/
@ 2021-12-02 16:38 Miroslav Šulc
  0 siblings, 0 replies; 48+ messages in thread
From: Miroslav Šulc @ 2021-12-02 16:38 UTC (permalink / raw
  To: gentoo-commits

commit:     4f68c6d6cc05acc40c2b7f4d29a5ba3807d987b3
Author:     Miroslav Šulc <fordfrog <AT> gentoo <DOT> org>
AuthorDate: Thu Dec  2 16:38:41 2021 +0000
Commit:     Miroslav Šulc <fordfrog <AT> gentoo <DOT> org>
CommitDate: Thu Dec  2 16:38:41 2021 +0000
URL:        https://gitweb.gentoo.org/proj/java-ebuilder.git/commit/?id=4f68c6d6

changed eapi to 8

Signed-off-by: Miroslav Šulc <fordfrog <AT> gentoo.org>

 src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java b/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java
index 1543b5c..ce1b852 100644
--- a/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java
+++ b/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java
@@ -35,7 +35,7 @@ public class MavenEbuilder {
     /**
      * EAPI version.
      */
-    private static final String EAPI = "7";
+    private static final String EAPI = "8";
     /**
      * Pattern for retrieval of tarball extension.
      */


^ permalink raw reply related	[flat|nested] 48+ messages in thread

end of thread, other threads:[~2021-12-02 16:38 UTC | newest]

Thread overview: 48+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-07-06 10:56 [gentoo-commits] proj/java-ebuilder:master commit in: src/main/java/org/gentoo/java/ebuilder/maven/ Miroslav Šulc
  -- strict thread matches above, loose matches on Subject: below --
2021-12-02 16:38 Miroslav Šulc
2021-07-01 13:13 Miroslav Šulc
2021-06-15  7:40 Miroslav Šulc
2021-06-03  8:38 Miroslav Šulc
2020-10-02  7:43 Miroslav Šulc
2020-08-30 18:22 Miroslav Šulc
2020-08-30 18:22 Miroslav Šulc
2020-08-27 17:24 Miroslav Šulc
2020-08-27 17:24 Miroslav Šulc
2020-08-18  8:11 Miroslav Šulc
2020-08-18  8:11 Miroslav Šulc
2020-08-05 14:31 Miroslav Šulc
2020-08-05 14:31 Miroslav Šulc
2020-08-05 14:31 Miroslav Šulc
2020-08-05 14:31 Miroslav Šulc
2020-08-05 14:31 Miroslav Šulc
2020-08-05 14:31 Miroslav Šulc
2020-07-24  6:41 Miroslav Šulc
2020-07-24  6:41 Miroslav Šulc
2020-07-06 10:56 Miroslav Šulc
2020-07-06 10:56 Miroslav Šulc
2020-07-06 10:56 Miroslav Šulc
2020-07-06 10:56 Miroslav Šulc
2019-11-27  9:50 Miroslav Šulc
2019-11-27  9:50 Miroslav Šulc
2019-11-03 15:14 Miroslav Šulc
2019-11-03 12:17 Miroslav Šulc
2019-11-03 12:17 Miroslav Šulc
2019-11-03 11:26 Miroslav Šulc
2019-11-03 10:37 Miroslav Šulc
2019-11-03 10:14 Miroslav Šulc
2019-11-03 10:12 Miroslav Šulc
2019-11-03 10:12 Miroslav Šulc
2019-11-02 22:27 Miroslav Šulc
2019-11-02 21:54 Miroslav Šulc
2019-11-02 21:42 Miroslav Šulc
2019-11-02 21:42 Miroslav Šulc
2019-11-01 18:43 Miroslav Šulc
2019-11-01 18:43 Miroslav Šulc
2019-11-01 18:43 Miroslav Šulc
2019-11-01 18:43 Miroslav Šulc
2019-11-01 18:43 Miroslav Šulc
2019-10-30 17:43 Miroslav Šulc
2019-10-30 17:35 Michał Górny
2019-10-30 17:35 Michał Górny
2019-10-30 17:35 Michał Górny
2019-10-30 17:35 Michał Górny

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox