summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorMickael Istria2013-01-21 10:28:32 (EST)
committer Gerrit Code Review @ Eclipse.org2013-01-22 11:29:17 (EST)
commitfac96686d21689bfc3c6d90fb082eb7e5da4c6cc (patch)
tree8f014663292cf0f7a470388eb06c11a7e8309942
parent74058488a25137f2726116d57c905eb9a6a0e600 (diff)
downloadorg.eclipse.tycho.extras-fac96686d21689bfc3c6d90fb082eb7e5da4c6cc.zip
org.eclipse.tycho.extras-fac96686d21689bfc3c6d90fb082eb7e5da4c6cc.tar.gz
org.eclipse.tycho.extras-fac96686d21689bfc3c6d90fb082eb7e5da4c6cc.tar.bz2
398542 TP Validationrefs/changes/10/9810/2
* Re-enable tests * Improved error message when using '-X' This reverts commit d15ee560939de38836d12d4cbaf09a20a8e936f8. Change-Id: I9d109b23217c17112db55b4d57aba8b0c0d1ad21
-rw-r--r--target-platform-validation-plugin/src/it/validateOK/invoke.properties2
-rw-r--r--target-platform-validation-plugin/src/it/validateOK/ok.target11
-rw-r--r--target-platform-validation-plugin/src/it/validateOK/pom.xml54
-rw-r--r--target-platform-validation-plugin/src/main/java/org/eclipse/tycho/extras/tpvalidator/TPError.java16
-rw-r--r--target-platform-validation-plugin/src/main/java/org/eclipse/tycho/extras/tpvalidator/TPValidationMojo.java2
5 files changed, 84 insertions, 1 deletions
diff --git a/target-platform-validation-plugin/src/it/validateOK/invoke.properties b/target-platform-validation-plugin/src/it/validateOK/invoke.properties
new file mode 100644
index 0000000..ba7c662
--- /dev/null
+++ b/target-platform-validation-plugin/src/it/validateOK/invoke.properties
@@ -0,0 +1,2 @@
+invoker.goals = verify
+invoker.buildResult = success \ No newline at end of file
diff --git a/target-platform-validation-plugin/src/it/validateOK/ok.target b/target-platform-validation-plugin/src/it/validateOK/ok.target
new file mode 100644
index 0000000..afc08bc
--- /dev/null
+++ b/target-platform-validation-plugin/src/it/validateOK/ok.target
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?pde version="3.8"?>
+
+<target name="ok" sequenceNumber="0">
+<locations>
+<location includeAllPlatforms="false" includeMode="planner" includeSource="true" type="InstallableUnit">
+<unit id="org.eclipse.emf.sdk.feature.group" version="0.0.0"/>
+<repository location="http://download.eclipse.org/releases/indigo"/>
+</location>
+</locations>
+</target>
diff --git a/target-platform-validation-plugin/src/it/validateOK/pom.xml b/target-platform-validation-plugin/src/it/validateOK/pom.xml
new file mode 100644
index 0000000..e9da439
--- /dev/null
+++ b/target-platform-validation-plugin/src/it/validateOK/pom.xml
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.eclipse.tycho.extras.its</groupId>
+ <artifactId>validationOK</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ <name>Test for validation plugin: 1 target, validation OK</name>
+ <packaging>pom</packaging>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>tycho-maven-plugin</artifactId>
+ <version>${tycho-version}</version>
+ <extensions>true</extensions>
+ </plugin>
+ <plugin>
+ <groupId>org.eclipse.tycho.extras</groupId>
+ <artifactId>target-platform-validation-plugin</artifactId>
+ <version>${tycho-extras-version}</version>
+ <executions>
+ <execution>
+ <phase>validate</phase>
+ <goals>
+ <goal>validate-target-platform</goal>
+ </goals>
+ <configuration>
+ <targetFiles>
+ <param>ok.target</param>
+ </targetFiles>
+ <failOnError>true</failOnError>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <pluginRepositories>
+ <pluginRepository>
+ <id>tycho-snapshots</id>
+ <url>${tycho-snapshots-url}</url>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </pluginRepository>
+ </pluginRepositories>
+</project>
diff --git a/target-platform-validation-plugin/src/main/java/org/eclipse/tycho/extras/tpvalidator/TPError.java b/target-platform-validation-plugin/src/main/java/org/eclipse/tycho/extras/tpvalidator/TPError.java
index 48264c0..2d5bc47 100644
--- a/target-platform-validation-plugin/src/main/java/org/eclipse/tycho/extras/tpvalidator/TPError.java
+++ b/target-platform-validation-plugin/src/main/java/org/eclipse/tycho/extras/tpvalidator/TPError.java
@@ -10,7 +10,10 @@
*******************************************************************************/
package org.eclipse.tycho.extras.tpvalidator;
+import java.io.ByteArrayOutputStream;
import java.io.File;
+import java.io.IOException;
+import java.io.PrintStream;
import org.eclipse.tycho.p2.target.facade.TargetDefinitionResolutionException;
@@ -25,6 +28,10 @@ public class TPError extends Exception {
@Override
public String getMessage() {
+ return this.getMessage(false);
+ }
+
+ public String getMessage(boolean debug) {
StringBuilder res = new StringBuilder();
res.append("Could not resolve content of ");
res.append(this.file.getName());
@@ -32,6 +39,15 @@ public class TPError extends Exception {
if (getCause() instanceof TargetDefinitionResolutionException) {
TargetDefinitionResolutionException cause = (TargetDefinitionResolutionException) getCause();
res.append(cause.getMessage());
+ } else if (debug) {
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ getCause().printStackTrace(new PrintStream(out));
+ res.append(out.toString());
+ try {
+ out.close();
+ } catch (IOException ex) {
+ // Nothing
+ }
}
return res.toString();
}
diff --git a/target-platform-validation-plugin/src/main/java/org/eclipse/tycho/extras/tpvalidator/TPValidationMojo.java b/target-platform-validation-plugin/src/main/java/org/eclipse/tycho/extras/tpvalidator/TPValidationMojo.java
index 97ffd5d..13f9994 100644
--- a/target-platform-validation-plugin/src/main/java/org/eclipse/tycho/extras/tpvalidator/TPValidationMojo.java
+++ b/target-platform-validation-plugin/src/main/java/org/eclipse/tycho/extras/tpvalidator/TPValidationMojo.java
@@ -99,7 +99,7 @@ public class TPValidationMojo extends AbstractMojo {
res.append(" .target files:");
res.append("\n");
for (TPError error : errors) {
- res.append(error.getMessage());
+ res.append(error.getMessage(this.logger.isDebugEnabled()));
res.append("\n");
}
return res.toString();