aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Gradl2011-08-16 10:53:27 (EDT)
committerjsievers2011-09-23 05:20:47 (EDT)
commit18b7b82d16ec7024ee9afb40e63b8e9d5deb496f (patch)
treeff2d5d4f70b6bfdbeef8fa20f70c954a248da174
parent17793c0534adbae113c148b1e589b988854de331 (diff)
downloadorg.eclipse.tycho-18b7b82d16ec7024ee9afb40e63b8e9d5deb496f.zip
org.eclipse.tycho-18b7b82d16ec7024ee9afb40e63b8e9d5deb496f.tar.gz
org.eclipse.tycho-18b7b82d16ec7024ee9afb40e63b8e9d5deb496f.tar.bz2
355046 tycho-versions-plugin: Ignore whitespace in GAV values in pom
Just like Maven treats whitespace characters in between the GAV tags; we ignore them now when deciding whether to apply the version change to the module
-rw-r--r--tycho-release/tycho-versions-plugin/src/main/java/org/eclipse/tycho/versions/pom/GAV.java6
-rw-r--r--tycho-release/tycho-versions-plugin/src/main/java/org/eclipse/tycho/versions/pom/MutablePomFile.java8
-rw-r--r--tycho-release/tycho-versions-plugin/src/test/java/org/eclipse/tycho/versions/engine/tests/VersionsEngineTest.java14
-rw-r--r--tycho-release/tycho-versions-plugin/src/test/resources/projects/ignorewhitespace/bundle/META-INF/MANIFEST.MF7
-rw-r--r--tycho-release/tycho-versions-plugin/src/test/resources/projects/ignorewhitespace/bundle/META-INF/MANIFEST.MF_expected7
-rw-r--r--tycho-release/tycho-versions-plugin/src/test/resources/projects/ignorewhitespace/bundle/pom.xml19
-rw-r--r--tycho-release/tycho-versions-plugin/src/test/resources/projects/ignorewhitespace/bundle/pom.xml_expected19
-rw-r--r--tycho-release/tycho-versions-plugin/src/test/resources/projects/ignorewhitespace/pom.xml13
-rw-r--r--tycho-release/tycho-versions-plugin/src/test/resources/projects/ignorewhitespace/pom.xml_expected13
9 files changed, 99 insertions, 7 deletions
diff --git a/tycho-release/tycho-versions-plugin/src/main/java/org/eclipse/tycho/versions/pom/GAV.java b/tycho-release/tycho-versions-plugin/src/main/java/org/eclipse/tycho/versions/pom/GAV.java
index 36391d8..b734f19 100644
--- a/tycho-release/tycho-versions-plugin/src/main/java/org/eclipse/tycho/versions/pom/GAV.java
+++ b/tycho-release/tycho-versions-plugin/src/main/java/org/eclipse/tycho/versions/pom/GAV.java
@@ -20,16 +20,16 @@ public class GAV {
}
public String getGroupId() {
- return dom.getChild("groupId").getText();
+ return dom.getChild("groupId").getText().trim();
}
public String getArtifactId() {
- return dom.getChild("artifactId").getText();
+ return dom.getChild("artifactId").getText().trim();
}
public String getVersion() {
Element child = dom.getChild("version");
- return child != null ? child.getText() : null;
+ return child != null ? child.getText().trim() : null;
}
public void setVersion(String version) {
diff --git a/tycho-release/tycho-versions-plugin/src/main/java/org/eclipse/tycho/versions/pom/MutablePomFile.java b/tycho-release/tycho-versions-plugin/src/main/java/org/eclipse/tycho/versions/pom/MutablePomFile.java
index 14f9881..744f0e6 100644
--- a/tycho-release/tycho-versions-plugin/src/main/java/org/eclipse/tycho/versions/pom/MutablePomFile.java
+++ b/tycho-release/tycho-versions-plugin/src/main/java/org/eclipse/tycho/versions/pom/MutablePomFile.java
@@ -96,7 +96,7 @@ public class MutablePomFile {
public String getVersion() {
Element element = project.getChild("version");
- return element != null ? element.getText() : null;
+ return element != null ? element.getText().trim() : null;
}
public String getEffectiveVersion() {
@@ -109,7 +109,7 @@ public class MutablePomFile {
public String getPackaging() {
Element packaging = project.getChild("packaging");
- return packaging != null ? packaging.getText() : "jar";
+ return packaging != null ? packaging.getText().trim() : "jar";
}
public String getParentVersion() {
@@ -131,7 +131,7 @@ public class MutablePomFile {
public String getArtifactId() {
Element element = project.getChild("artifactId");
- return element != null ? element.getText() : null;
+ return element != null ? element.getText().trim() : null;
}
public GAV getParent() {
@@ -143,7 +143,7 @@ public class MutablePomFile {
LinkedHashSet<String> result = new LinkedHashSet<String>();
for (Element modules : project.getChildren("modules")) {
for (Element module : modules.getChildren("module")) {
- result.add(module.getText());
+ result.add(module.getText().trim());
}
}
return new ArrayList<String>(result);
diff --git a/tycho-release/tycho-versions-plugin/src/test/java/org/eclipse/tycho/versions/engine/tests/VersionsEngineTest.java b/tycho-release/tycho-versions-plugin/src/test/java/org/eclipse/tycho/versions/engine/tests/VersionsEngineTest.java
index ee11236..ae8bf44 100644
--- a/tycho-release/tycho-versions-plugin/src/test/java/org/eclipse/tycho/versions/engine/tests/VersionsEngineTest.java
+++ b/tycho-release/tycho-versions-plugin/src/test/java/org/eclipse/tycho/versions/engine/tests/VersionsEngineTest.java
@@ -225,6 +225,20 @@ public class VersionsEngineTest extends PlexusTestCase {
assertPom(new File(basedir, "module"));
}
+ public void testIgnoreWhitespace() throws Exception {
+ File basedir = TestUtil.getBasedir("projects/ignorewhitespace");
+
+ VersionsEngine engine = lookup(VersionsEngine.class);
+ engine.addBasedir(basedir);
+ engine.addVersionChange("parent", "1.0.1.qualifier");
+ engine.apply();
+
+ assertPom(basedir);
+
+ assertPom(new File(basedir, "bundle"));
+ assertBundleManifest(new File(basedir, "bundle"));
+ }
+
private void assertPom(File basedir) throws IOException {
assertFileContent(new File(basedir, "pom.xml"));
}
diff --git a/tycho-release/tycho-versions-plugin/src/test/resources/projects/ignorewhitespace/bundle/META-INF/MANIFEST.MF b/tycho-release/tycho-versions-plugin/src/test/resources/projects/ignorewhitespace/bundle/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..59fb31f
--- /dev/null
+++ b/tycho-release/tycho-versions-plugin/src/test/resources/projects/ignorewhitespace/bundle/META-INF/MANIFEST.MF
@@ -0,0 +1,7 @@
+Manifest-Version: 1.0
+Bundle-Version: 1.0.0.qualifier
+Bundle-Name: bundle
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: bundle
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+
diff --git a/tycho-release/tycho-versions-plugin/src/test/resources/projects/ignorewhitespace/bundle/META-INF/MANIFEST.MF_expected b/tycho-release/tycho-versions-plugin/src/test/resources/projects/ignorewhitespace/bundle/META-INF/MANIFEST.MF_expected
new file mode 100644
index 0000000..2ed8cbd
--- /dev/null
+++ b/tycho-release/tycho-versions-plugin/src/test/resources/projects/ignorewhitespace/bundle/META-INF/MANIFEST.MF_expected
@@ -0,0 +1,7 @@
+Manifest-Version: 1.0
+Bundle-Version: 1.0.1.qualifier
+Bundle-Name: bundle
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: bundle
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+
diff --git a/tycho-release/tycho-versions-plugin/src/test/resources/projects/ignorewhitespace/bundle/pom.xml b/tycho-release/tycho-versions-plugin/src/test/resources/projects/ignorewhitespace/bundle/pom.xml
new file mode 100644
index 0000000..3d46e32
--- /dev/null
+++ b/tycho-release/tycho-versions-plugin/src/test/resources/projects/ignorewhitespace/bundle/pom.xml
@@ -0,0 +1,19 @@
+<project>
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>ignorewhitespace </groupId>
+ <artifactId>
+ parent
+ </artifactId>
+ <version> 1.0.0-SNAPSHOT </version>
+ </parent>
+
+ <groupId>ignorewhitespace </groupId>
+ <artifactId>bundle</artifactId>
+ <version>1.0.0-SNAPSHOT </version>
+ <packaging>
+ eclipse-plugin
+ </packaging>
+
+</project> \ No newline at end of file
diff --git a/tycho-release/tycho-versions-plugin/src/test/resources/projects/ignorewhitespace/bundle/pom.xml_expected b/tycho-release/tycho-versions-plugin/src/test/resources/projects/ignorewhitespace/bundle/pom.xml_expected
new file mode 100644
index 0000000..dcc9d1b
--- /dev/null
+++ b/tycho-release/tycho-versions-plugin/src/test/resources/projects/ignorewhitespace/bundle/pom.xml_expected
@@ -0,0 +1,19 @@
+<project>
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>ignorewhitespace </groupId>
+ <artifactId>
+ parent
+ </artifactId>
+ <version>1.0.1-SNAPSHOT</version>
+ </parent>
+
+ <groupId>ignorewhitespace </groupId>
+ <artifactId>bundle</artifactId>
+ <version>1.0.1-SNAPSHOT</version>
+ <packaging>
+ eclipse-plugin
+ </packaging>
+
+</project> \ No newline at end of file
diff --git a/tycho-release/tycho-versions-plugin/src/test/resources/projects/ignorewhitespace/pom.xml b/tycho-release/tycho-versions-plugin/src/test/resources/projects/ignorewhitespace/pom.xml
new file mode 100644
index 0000000..aaeb832
--- /dev/null
+++ b/tycho-release/tycho-versions-plugin/src/test/resources/projects/ignorewhitespace/pom.xml
@@ -0,0 +1,13 @@
+<project>
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>ignorewhitespace</groupId>
+ <artifactId>parent</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+
+ <modules>
+ <module>bundle </module>
+ </modules>
+
+</project> \ No newline at end of file
diff --git a/tycho-release/tycho-versions-plugin/src/test/resources/projects/ignorewhitespace/pom.xml_expected b/tycho-release/tycho-versions-plugin/src/test/resources/projects/ignorewhitespace/pom.xml_expected
new file mode 100644
index 0000000..09b41ef
--- /dev/null
+++ b/tycho-release/tycho-versions-plugin/src/test/resources/projects/ignorewhitespace/pom.xml_expected
@@ -0,0 +1,13 @@
+<project>
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>ignorewhitespace</groupId>
+ <artifactId>parent</artifactId>
+ <version>1.0.1-SNAPSHOT</version>
+ <packaging>pom</packaging>
+
+ <modules>
+ <module>bundle </module>
+ </modules>
+
+</project> \ No newline at end of file