camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject camel git commit: CAMEL-8924: Camel maven plugin only save file if there is a change to avoid maven compiler plugin would re-compile all the source code.
Date Wed, 08 Jul 2015 08:18:36 GMT
Repository: camel
Updated Branches:
  refs/heads/master b9bcff279 -> 044a12c21


CAMEL-8924: Camel maven plugin only save file if there is a change to avoid maven compiler
plugin would re-compile all the source code.


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/044a12c2
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/044a12c2
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/044a12c2

Branch: refs/heads/master
Commit: 044a12c21db8b8cc58eb797617164ca450159e0d
Parents: b9bcff2
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Wed Jul 8 10:24:58 2015 +0200
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Wed Jul 8 10:24:58 2015 +0200

----------------------------------------------------------------------
 .../maven/packaging/PackageComponentMojo.java   | 24 +++++++++++++++++++-
 .../maven/packaging/PackageDataFormatMojo.java  | 21 +++++++++++++++++
 .../maven/packaging/PackageLanguageMojo.java    | 21 +++++++++++++++++
 3 files changed, 65 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/044a12c2/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PackageComponentMojo.java
----------------------------------------------------------------------
diff --git a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PackageComponentMojo.java
b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PackageComponentMojo.java
index 774e49c..a51601c 100644
--- a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PackageComponentMojo.java
+++ b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PackageComponentMojo.java
@@ -17,7 +17,9 @@
 package org.apache.camel.maven.packaging;
 
 import java.io.File;
+import java.io.FileInputStream;
 import java.io.IOException;
+import java.io.InputStream;
 import java.io.OutputStream;
 import java.util.Collections;
 import java.util.Properties;
@@ -29,7 +31,6 @@ import org.apache.maven.plugin.MojoFailureException;
 import org.apache.maven.plugin.logging.Log;
 import org.apache.maven.project.MavenProject;
 import org.apache.maven.project.MavenProjectHelper;
-import org.omg.IOP.IORHelper;
 import org.sonatype.plexus.build.incremental.BuildContext;
 
 /**
@@ -141,6 +142,27 @@ public class PackageComponentMojo extends AbstractMojo {
 
             camelMetaDir.mkdirs();
             File outFile = new File(camelMetaDir, "component.properties");
+
+            // check if the existing file has the same content, and if so then leave it as
is so we do not write any changes
+            // which can cause a re-compile of all the source code
+            if (outFile.exists()) {
+                try {
+                    Properties existing = new Properties();
+
+                    InputStream is = new FileInputStream(outFile);
+                    existing.load(is);
+                    is.close();
+
+                    // are the content the same?
+                    if (existing.equals(properties)) {
+                        log.debug("No component changes detected");
+                        return;
+                    }
+                } catch (IOException e) {
+                    // ignore
+                }
+            }
+
             try {
                 OutputStream os = buildContext.newFileOutputStream(outFile);
                 properties.store(os, "Generated by camel-package-maven-plugin");

http://git-wip-us.apache.org/repos/asf/camel/blob/044a12c2/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PackageDataFormatMojo.java
----------------------------------------------------------------------
diff --git a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PackageDataFormatMojo.java
b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PackageDataFormatMojo.java
index d7e3371..88d7057 100644
--- a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PackageDataFormatMojo.java
+++ b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PackageDataFormatMojo.java
@@ -261,6 +261,27 @@ public class PackageDataFormatMojo extends AbstractMojo {
 
             camelMetaDir.mkdirs();
             File outFile = new File(camelMetaDir, "dataformat.properties");
+
+            // check if the existing file has the same content, and if so then leave it as
is so we do not write any changes
+            // which can cause a re-compile of all the source code
+            if (outFile.exists()) {
+                try {
+                    Properties existing = new Properties();
+
+                    InputStream is = new FileInputStream(outFile);
+                    existing.load(is);
+                    is.close();
+
+                    // are the content the same?
+                    if (existing.equals(properties)) {
+                        log.debug("No dataformat changes detected");
+                        return;
+                    }
+                } catch (IOException e) {
+                    // ignore
+                }
+            }
+
             try {
                 OutputStream os = buildContext.newFileOutputStream(outFile);
                 properties.store(os, "Generated by camel-package-maven-plugin");

http://git-wip-us.apache.org/repos/asf/camel/blob/044a12c2/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PackageLanguageMojo.java
----------------------------------------------------------------------
diff --git a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PackageLanguageMojo.java
b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PackageLanguageMojo.java
index 0ff7a8d..d6596db 100644
--- a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PackageLanguageMojo.java
+++ b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PackageLanguageMojo.java
@@ -259,6 +259,27 @@ public class PackageLanguageMojo extends AbstractMojo {
 
             camelMetaDir.mkdirs();
             File outFile = new File(camelMetaDir, "language.properties");
+
+            // check if the existing file has the same content, and if so then leave it as
is so we do not write any changes
+            // which can cause a re-compile of all the source code
+            if (outFile.exists()) {
+                try {
+                    Properties existing = new Properties();
+
+                    InputStream is = new FileInputStream(outFile);
+                    existing.load(is);
+                    is.close();
+
+                    // are the content the same?
+                    if (existing.equals(properties)) {
+                        log.debug("No language changes detected");
+                        return;
+                    }
+                } catch (IOException e) {
+                    // ignore
+                }
+            }
+
             try {
                 OutputStream os = buildContext.newFileOutputStream(outFile);
                 properties.store(os, "Generated by camel-package-maven-plugin");


Mime
View raw message