[Git][java-team/takari-polyglot-maven][master] 4 commits: New upstream version 0.4.6

Sudip Mukherjee gitlab at salsa.debian.org
Sat Dec 26 19:12:44 GMT 2020



Sudip Mukherjee pushed to branch master at Debian Java Maintainers / takari-polyglot-maven


Commits:
a01b59c1 by Sudip Mukherjee at 2020-12-26T18:02:18+00:00
New upstream version 0.4.6
- - - - -
757b2791 by Sudip Mukherjee at 2020-12-26T18:02:19+00:00
Update upstream source from tag 'upstream/0.4.6'

Update to upstream version '0.4.6'
with Debian dir b505821c5947d824d327fbc41548eae948d2db5b
- - - - -
87f98ee2 by Sudip Mukherjee at 2020-12-26T18:58:23+00:00
Update Standards-Version to 4.5.1

Signed-off-by: Sudip Mukherjee <sudipm.mukherjee at gmail.com>

- - - - -
ba62d9fb by Sudip Mukherjee at 2020-12-26T18:58:52+00:00
Add changelog for 0.4.6-1 release

Signed-off-by: Sudip Mukherjee <sudipm.mukherjee at gmail.com>

- - - - -


20 changed files:

- CHANGELOG.md
- README.md
- debian/changelog
- debian/control
- polyglot-atom/pom.xml
- polyglot-clojure/pom.xml
- polyglot-common/pom.xml
- polyglot-common/src/main/java/org/sonatype/maven/polyglot/PolyglotModelManager.java
- polyglot-common/src/main/java/org/sonatype/maven/polyglot/TeslaModelProcessor.java
- + polyglot-common/src/main/java/org/sonatype/maven/polyglot/TeslaProjectBuilder.java
- polyglot-groovy/pom.xml
- polyglot-java/pom.xml
- polyglot-kotlin/pom.xml
- polyglot-maven-plugin/pom.xml
- polyglot-ruby/pom.xml
- polyglot-scala/pom.xml
- polyglot-translate-plugin/pom.xml
- polyglot-xml/pom.xml
- polyglot-yaml/pom.xml
- pom.xml


Changes:

=====================================
CHANGELOG.md
=====================================
@@ -4,10 +4,30 @@ The [git commit history](https://github.com/takari/polyglot-maven/commits/master
 is the detailed source of all changes. The following provides most information
 at an easier glance.
 
+## Version 0.4.6 - 2020-12-16
+
+- Avoid returning null when reading pom from file in some cases
+  - see https://github.com/takari/polyglot-maven/pull/219
+  - fixes https://github.com/takari/polyglot-maven/issues/198
+  - contributed by Christoph Läubrich https://github.com/laeubi
+- Do not Maven deploy goal fails with -f because of missing .polyglot.pom.*
+  - see https://github.com/takari/polyglot-maven/pull/221
+  - fixes https://github.com/takari/polyglot-maven/issues/220
+  - contributed by Robert Thornton https://github.com/thorntonrp
+- Upgrade to Kotlin 1.4.0
+  - see
+    https://github.com/takari/polyglot-maven/commit/d204e38db3995cc7fdc2b2bd2724c6dba6932429
+  - fixes https://github.com/takari/polyglot-maven/issues/214
+  - contributed by Robert Thornton https://github.com/thorntonrp
+- Upgrade to Groovy 2.5.14
+- Upgrade commons-beanutils to 1.9.4
+  - contributed by Manfred Moser - http://www.simpligility.com
+- Release performed by Manfred Moser - http://www.simpligility.com  
+
 ## Version 0.4.5 - 2020-03-03
 
 - Remove upper bound for JDK version to allow Java 11 and newer
- - contributed by Manfred Moser - http://www.simpligility.com
+  - contributed by Manfred Moser - http://www.simpligility.com
 - polyglot-kotlin - revert automatic source folder setting to koltin
   - fixes https://github.com/takari/polyglot-maven/issues/205
   - contributed by Manfred Moser - http://www.simpligility.com
@@ -23,6 +43,7 @@ at an easier glance.
   - contributed by Christoph Läubrich https://github.com/laeubi
 - Upgrade scala-maven-plugin, clojure-maven-plugin and Clojure
   - contributed by Manfred Moser - http://www.simpligility.com
+- Release performed by Manfred Moser - http://www.simpligility.com
 
 ## Version 0.4.4 - 2019-11-24
 


=====================================
README.md
=====================================
@@ -102,7 +102,7 @@ the artifactId for your chosen language.
   <extension>
     <groupId>io.takari.polyglot</groupId>
     <artifactId>ARTIFACTID</artifactId>
-    <version>0.4.5</version>
+    <version>0.4.6</version>
   </extension>
 </extensions>
 ```


=====================================
debian/changelog
=====================================
@@ -1,3 +1,10 @@
+takari-polyglot-maven (0.4.6-1) unstable; urgency=medium
+
+  * New upstream version 0.4.6
+  * Update Standards-Version to 4.5.1
+
+ -- Sudip Mukherjee <sudipm.mukherjee at gmail.com>  Sat, 26 Dec 2020 18:58:31 +0000
+
 takari-polyglot-maven (0.4.5-3) unstable; urgency=medium
 
   * Team upload.


=====================================
debian/control
=====================================
@@ -19,7 +19,7 @@ Build-Depends:
  maven-debian-helper
 Conflicts:
  libpolyglot-maven-java
-Standards-Version: 4.5.0
+Standards-Version: 4.5.1
 Rules-Requires-Root: no
 Vcs-Git: https://salsa.debian.org/java-team/takari-polyglot-maven.git
 Vcs-Browser: https://salsa.debian.org/java-team/takari-polyglot-maven


=====================================
polyglot-atom/pom.xml
=====================================
@@ -15,7 +15,7 @@
   <parent>
     <groupId>io.takari.polyglot</groupId>
     <artifactId>polyglot</artifactId>
-    <version>0.4.5</version>
+    <version>0.4.6</version>
   </parent>
 
   <artifactId>polyglot-atom</artifactId>


=====================================
polyglot-clojure/pom.xml
=====================================
@@ -15,7 +15,7 @@
   <parent>
     <groupId>io.takari.polyglot</groupId>
     <artifactId>polyglot</artifactId>
-    <version>0.4.5</version>
+    <version>0.4.6</version>
   </parent>
 
   <artifactId>polyglot-clojure</artifactId>


=====================================
polyglot-common/pom.xml
=====================================
@@ -10,7 +10,7 @@
   <parent>
     <groupId>io.takari.polyglot</groupId>
     <artifactId>polyglot</artifactId>
-    <version>0.4.5</version>
+    <version>0.4.6</version>
   </parent>
 
   <artifactId>polyglot-common</artifactId>


=====================================
polyglot-common/src/main/java/org/sonatype/maven/polyglot/PolyglotModelManager.java
=====================================
@@ -17,7 +17,6 @@ import java.util.Properties;
 
 import org.apache.maven.model.io.ModelReader;
 import org.apache.maven.model.io.ModelWriter;
-import org.apache.maven.model.locator.ModelLocator;
 import org.codehaus.plexus.component.annotations.Component;
 import org.codehaus.plexus.component.annotations.Requirement;
 import org.codehaus.plexus.logging.Logger;
@@ -31,7 +30,7 @@ import org.sonatype.maven.polyglot.mapping.Mapping;
  * @since 0.7
  */
 @Component(role = PolyglotModelManager.class)
-public class PolyglotModelManager implements ModelLocator {
+public class PolyglotModelManager {
   @Requirement
   protected Logger log;
 
@@ -85,17 +84,16 @@ public class PolyglotModelManager implements ModelLocator {
     throw new RuntimeException("Unable to determine model output format; options=" + options);
   }
 
-  @Override
-  public File locatePom(final File dir) {
+	public File findPom(final File dir) {
     assert dir != null;
 
-    File pomFile = null;
-    float mappingPriority = Float.MIN_VALUE;
+	File pomFile = null;
+    float currentPriority = Float.MIN_VALUE;
     for (Mapping mapping : mappings) {
       File file = mapping.locatePom(dir);
-      if (file != null && (pomFile == null || mappingPriority < mapping.getPriority())) {
+		if (file != null && (pomFile == null || mapping.getPriority() > currentPriority)) {
         pomFile = file;
-        mappingPriority = mapping.getPriority();
+        currentPriority = mapping.getPriority();
       }
     }
 


=====================================
polyglot-common/src/main/java/org/sonatype/maven/polyglot/TeslaModelProcessor.java
=====================================
@@ -16,6 +16,8 @@ import java.io.InputStreamReader;
 import java.io.Reader;
 import java.io.StringWriter;
 import java.util.Map;
+import java.util.Optional;
+import java.util.regex.Pattern;
 
 import org.apache.maven.model.Model;
 import org.apache.maven.model.building.FileModelSource;
@@ -41,15 +43,17 @@ import org.codehaus.plexus.util.IOUtil;
 @Component(role = ModelProcessor.class)
 public class TeslaModelProcessor implements ModelProcessor {
 
+  private static final String DEFAULT_POM_FILE = "pom.xml";
   private static final String NEW_LINE = System.getProperty("line.separator");
   private static final String WARNING = "?>" + NEW_LINE + "<!--" +
       NEW_LINE + "" +
       NEW_LINE + "" +
-      NEW_LINE + "DO NOT MODIFIY - GENERATED CODE" +
+      NEW_LINE + "DO NOT MODIFY - GENERATED CODE" +
       NEW_LINE + "" +
       NEW_LINE + "" +
       NEW_LINE + "-->";
-        
+  private static final String POM_FILE_PREFIX = ".polyglot.";
+
   @Requirement
   private PolyglotModelManager manager;
   @Requirement
@@ -59,18 +63,18 @@ public class TeslaModelProcessor implements ModelProcessor {
   public File locatePom(final File dir) {
     assert manager != null;
 
-    File pomFile = manager.locatePom(dir);
+	File pomFile = manager.findPom(dir);
     if (pomFile == null) {
-      throw new AssertionError("pom file must not be null from PolyglotModelManager as per API");
+		return new File(dir, DEFAULT_POM_FILE);
     }
-    if (pomFile.getName().equals("pom.xml") && pomFile.getParentFile().equals(dir)) {
+	if (pomFile.getName().equals(DEFAULT_POM_FILE) && pomFile.getParentFile().equals(dir)) {
       // behave like proper maven in case there is no pom from manager
       return pomFile;
     }
-    File polyglotPomFile = new File(pomFile.getParentFile(), ".polyglot." + pomFile.getName());
+    File polyglotPomFile = new File(pomFile.getParentFile(), POM_FILE_PREFIX + pomFile.getName());
     try {
-      if (polyglotPomFile.createNewFile()) {
-      polyglotPomFile.deleteOnExit();
+      if (!polyglotPomFile.exists() && polyglotPomFile.createNewFile()) {
+        polyglotPomFile.deleteOnExit();
       }
     } catch (IOException e) {
       throw new RuntimeException("error creating empty file", e);
@@ -103,12 +107,11 @@ public class TeslaModelProcessor implements ModelProcessor {
   })
   public Model read(final Reader input, final Map<String, ?> options) throws IOException, ModelParseException {
     assert manager != null;
-    ModelSource source = (ModelSource) options.get(ModelProcessor.SOURCE);
-    if (("" + source).contains(".polyglot.")) {
-      log.debug(source.getLocation());
-
-      File pom = new File(source.getLocation());
-      File realPom = new File(pom.getPath().replaceFirst("[.]polyglot[.]", ""));
+    Optional<File> optionalPomXml = getPomXmlFile(options);
+    if (optionalPomXml.isPresent()) {
+      File pom = optionalPomXml.get();
+      log.debug(pom.toString());
+      File realPom = new File(pom.getPath().replaceFirst(Pattern.quote(POM_FILE_PREFIX), ""));
 
       ((Map) options).put(ModelProcessor.SOURCE, new FileModelSource(realPom));
 
@@ -145,4 +148,25 @@ public class TeslaModelProcessor implements ModelProcessor {
       return reader.read(input, options);
     }
   }
+
+  private Optional<File> getPomXmlFile(Map<String, ?> options) {
+    ModelSource source = (ModelSource) options.get(ModelProcessor.SOURCE);
+    if (source != null) {
+      return getPomXmlFile(new File(source.getLocation()));
+    }
+    return Optional.empty();
+  }
+
+  Optional<File> getPomXmlFile(File sourceFile) {
+    String filename = sourceFile.getName();
+    if (filename.startsWith(POM_FILE_PREFIX)) {
+      return Optional.of(sourceFile);
+    } else if (!filename.equals("pom.xml") && !filename.endsWith(".pom")) {
+      File pom = locatePom(sourceFile.getParentFile());
+      if (pom.getName().startsWith(POM_FILE_PREFIX)) {
+        return Optional.of(pom);
+      }
+    }
+    return Optional.empty();
+  }
 }


=====================================
polyglot-common/src/main/java/org/sonatype/maven/polyglot/TeslaProjectBuilder.java
=====================================
@@ -0,0 +1,108 @@
+package org.sonatype.maven.polyglot;
+
+import java.io.File;
+import java.util.List;
+import java.util.stream.Collectors;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.model.building.ModelProblem;
+import org.apache.maven.model.building.ModelProcessor;
+import org.apache.maven.model.building.ModelSource;
+import org.apache.maven.project.*;
+import org.codehaus.plexus.component.annotations.Component;
+import org.codehaus.plexus.component.annotations.Requirement;
+
+ at Component(role = ProjectBuilder.class)
+public class TeslaProjectBuilder extends DefaultProjectBuilder {
+
+    @Requirement(role = ModelProcessor.class)
+    private TeslaModelProcessor teslaModelProcessor; // Must be named differently than the one in the superclass
+
+    @Override
+    public ProjectBuildingResult build(File pomFile, ProjectBuildingRequest request) throws ProjectBuildingException {
+        return convert(super.build(pomFile, request));
+    }
+
+    @Override
+    public ProjectBuildingResult build(ModelSource modelSource, ProjectBuildingRequest request) throws ProjectBuildingException {
+        return convert(super.build(modelSource, request));
+    }
+
+    @Override
+    public ProjectBuildingResult build(Artifact artifact, ProjectBuildingRequest request) throws ProjectBuildingException {
+        return convert(super.build(artifact, request));
+    }
+
+    @Override
+    public ProjectBuildingResult build(Artifact artifact, boolean allowStubModel, ProjectBuildingRequest request) throws ProjectBuildingException {
+        return convert(super.build(artifact, allowStubModel, request));
+    }
+
+    @Override
+    public List<ProjectBuildingResult> build(List<File> pomFiles, boolean recursive, ProjectBuildingRequest request) throws ProjectBuildingException {
+        List<ProjectBuildingResult> results = super.build(pomFiles, recursive, request);
+        return results.stream().map(this::convert).collect(Collectors.toList());
+    }
+
+    private ProjectBuildingResult convert(ProjectBuildingResult result) {
+        if (result.getPomFile() == null) return result;
+        String projectId = result.getProjectId();
+        MavenProject project = result.getProject();
+        List<ModelProblem> problems = result.getProblems();
+        DependencyResolutionResult dependencyResolutionResult = result.getDependencyResolutionResult();
+
+        // When running with the argument `-f <pomFile>`, we must restore the location of the generated pom xml file.
+        // Otherwise, it retains a reference to the polyglot pom, which causes a `409 Conflict` error when deployed.
+        File pomFile = teslaModelProcessor.getPomXmlFile(result.getPomFile()).orElse(result.getPomFile());
+        project.setPomFile(pomFile);
+        project.getModel().setPomFile(pomFile);
+
+        return new TeslaProjectBuildingResult(projectId, pomFile, project, problems, dependencyResolutionResult);
+    }
+
+    private static class TeslaProjectBuildingResult implements ProjectBuildingResult {
+
+        private final String projectId;
+        private final File pomFile;
+        private final MavenProject project;
+        private final List<ModelProblem> problems;
+        private final DependencyResolutionResult dependencyResolutionResult;
+
+        public TeslaProjectBuildingResult(String projectId,
+                                          File pomFile,
+                                          MavenProject project,
+                                          List<ModelProblem> problems,
+                                          DependencyResolutionResult dependencyResolutionResult) {
+            this.projectId = projectId;
+            this.pomFile = pomFile;
+            this.project = project;
+            this.problems = problems;
+            this.dependencyResolutionResult = dependencyResolutionResult;
+        }
+
+        @Override
+        public String getProjectId() {
+            return projectId;
+        }
+
+        @Override
+        public File getPomFile() {
+            return pomFile;
+        }
+
+        @Override
+        public MavenProject getProject() {
+            return project;
+        }
+
+        @Override
+        public List<ModelProblem> getProblems() {
+            return problems;
+        }
+
+        @Override
+        public DependencyResolutionResult getDependencyResolutionResult() {
+            return dependencyResolutionResult;
+        }
+    }
+}


=====================================
polyglot-groovy/pom.xml
=====================================
@@ -10,7 +10,7 @@
   <parent>
     <groupId>io.takari.polyglot</groupId>
     <artifactId>polyglot</artifactId>
-    <version>0.4.5</version>
+    <version>0.4.6</version>
   </parent>
 
   <artifactId>polyglot-groovy</artifactId>
@@ -30,7 +30,7 @@
     <dependency>
       <groupId>org.codehaus.groovy</groupId>
       <artifactId>groovy</artifactId>
-      <version>2.4.4</version>
+      <version>2.5.14</version>
       <exclusions>
         <exclusion>
           <groupId>jline</groupId>


=====================================
polyglot-java/pom.xml
=====================================
@@ -10,7 +10,7 @@
   <parent>
     <groupId>io.takari.polyglot</groupId>
     <artifactId>polyglot</artifactId>
-    <version>0.4.5</version>
+    <version>0.4.6</version>
   </parent>
 
   <artifactId>polyglot-java</artifactId>
@@ -36,7 +36,7 @@
     <dependency>
       <groupId>commons-beanutils</groupId>
       <artifactId>commons-beanutils</artifactId>
-      <version>1.9.3</version>
+      <version>1.9.4</version>
       <scope>compile</scope>
     </dependency>
     <dependency>


=====================================
polyglot-kotlin/pom.xml
=====================================
@@ -15,7 +15,7 @@
   <parent>
     <groupId>io.takari.polyglot</groupId>
     <artifactId>polyglot</artifactId>
-    <version>0.4.5</version>
+    <version>0.4.6</version>
   </parent>
 
   <artifactId>polyglot-kotlin</artifactId>
@@ -39,7 +39,7 @@
     </dependency>
     <dependency>
       <groupId>org.jetbrains.kotlin</groupId>
-      <artifactId>kotlin-scripting-jvm-host-embeddable</artifactId>
+      <artifactId>kotlin-scripting-jvm-host</artifactId>
       <version>${kotlin.version}</version>
     </dependency>
 
@@ -64,7 +64,7 @@
 
   <properties>
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-    <kotlin.version>1.3.60</kotlin.version>
+    <kotlin.version>1.4.10</kotlin.version>
     <commons-lang3.version>3.8.1</commons-lang3.version>
     <skipTests>false</skipTests>
     <invoker.skip>${skipTests}</invoker.skip>
@@ -75,6 +75,7 @@
     <testSourceDirectory>src/test/kotlin</testSourceDirectory>
     <plugins>
       <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-invoker-plugin</artifactId>
         <configuration>
           <failIfNoProjects>true</failIfNoProjects>
@@ -140,7 +141,7 @@
           <value>${project.version}</value>
         </configuration>
       </plugin>
-</plugins>
+    </plugins>
   </build>
 
 </project>


=====================================
polyglot-maven-plugin/pom.xml
=====================================
@@ -10,7 +10,7 @@
   <parent>
     <groupId>io.takari.polyglot</groupId>
     <artifactId>polyglot</artifactId>
-    <version>0.4.5</version>
+    <version>0.4.6</version>
   </parent>
 
   <artifactId>polyglot-maven-plugin</artifactId>


=====================================
polyglot-ruby/pom.xml
=====================================
@@ -15,7 +15,7 @@
   <parent>
     <groupId>io.takari.polyglot</groupId>
     <artifactId>polyglot</artifactId>
-    <version>0.4.5</version>
+    <version>0.4.6</version>
   </parent>
 
   <artifactId>polyglot-ruby</artifactId>


=====================================
polyglot-scala/pom.xml
=====================================
@@ -13,7 +13,7 @@
   <parent>
     <groupId>io.takari.polyglot</groupId>
     <artifactId>polyglot</artifactId>
-    <version>0.4.5</version>
+    <version>0.4.6</version>
   </parent>
   <artifactId>polyglot-scala</artifactId>
   <packaging>takari-jar</packaging>


=====================================
polyglot-translate-plugin/pom.xml
=====================================
@@ -10,7 +10,7 @@
   <parent>
     <groupId>io.takari.polyglot</groupId>
     <artifactId>polyglot</artifactId>
-    <version>0.4.5</version>
+    <version>0.4.6</version>
   </parent>
 
   <artifactId>polyglot-translate-plugin</artifactId>


=====================================
polyglot-xml/pom.xml
=====================================
@@ -9,7 +9,7 @@
 	<parent>
 		<groupId>io.takari.polyglot</groupId>
 		<artifactId>polyglot</artifactId>
-		<version>0.4.5</version>
+		<version>0.4.6</version>
 	</parent>
 	<artifactId>polyglot-xml</artifactId>
   <packaging>takari-jar</packaging>


=====================================
polyglot-yaml/pom.xml
=====================================
@@ -14,7 +14,7 @@
   <parent>
     <groupId>io.takari.polyglot</groupId>
     <artifactId>polyglot</artifactId>
-    <version>0.4.5</version>
+    <version>0.4.6</version>
   </parent>
   <artifactId>polyglot-yaml</artifactId>
   <packaging>takari-jar</packaging>


=====================================
pom.xml
=====================================
@@ -15,7 +15,7 @@
 
   <groupId>io.takari.polyglot</groupId>
   <artifactId>polyglot</artifactId>
-  <version>0.4.5</version>
+  <version>0.4.6</version>
   <name>Polyglot :: Aggregator</name>
   <packaging>pom</packaging>
 
@@ -37,7 +37,7 @@
     <connection>scm:git:git at github.com:takari/polyglot-maven.git</connection>
     <developerConnection>scm:git:git at github.com:takari/polyglot-maven.git</developerConnection>
     <url>https://github.com/takari/polyglot-maven</url>
-    <tag>polyglot-0.4.5</tag>
+    <tag>polyglot-0.4.6</tag>
   </scm>
 
   <modules>



View it on GitLab: https://salsa.debian.org/java-team/takari-polyglot-maven/-/compare/7bb996ac6947fc4e4f43703bd839fdc8fce6b079...ba62d9fbfd223ee371722ae20b5f94e321894f40

-- 
View it on GitLab: https://salsa.debian.org/java-team/takari-polyglot-maven/-/compare/7bb996ac6947fc4e4f43703bd839fdc8fce6b079...ba62d9fbfd223ee371722ae20b5f94e321894f40
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-java-commits/attachments/20201226/dccce37a/attachment.html>


More information about the pkg-java-commits mailing list