You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by sp...@apache.org on 2007/01/04 20:10:44 UTC
svn commit: r492693 - in /geronimo/devtools/eclipse-plugin/trunk: ./
maven-plugins/maven-geronimodevtools-plugin/src/main/java/org/apache/geronimo/eclipse/devtools/
plugins/
plugins/org.apache.geronimo.st.v11.core/src/org/apache/geronimo/st/v11/core/in...
Author: sppatel
Date: Thu Jan 4 11:10:43 2007
New Revision: 492693
URL: http://svn.apache.org/viewvc?view=rev&rev=492693
Log:
r4236@dyn9027152175 (orig r492650): sppatel | 2007-01-04 12:44:53 -0500
validate manifest's bundleclasspath after required libs are copied into bundle
r4237@dyn9027152175 (orig r492653): sppatel | 2007-01-04 12:47:51 -0500
close inputstream
r4238@dyn9027152175 (orig r492661): sppatel | 2007-01-04 13:07:47 -0500
trim lib entry before compare
r4239@dyn9027152175 (orig r492662): sppatel | 2007-01-04 13:08:32 -0500
woops left sysout on last commit, removed.
r4240@dyn9027152175 (orig r492668): sppatel | 2007-01-04 13:23:40 -0500
remove unused class
Removed:
geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.core/src/org/apache/geronimo/st/v11/core/internal/Messages.java
Modified:
geronimo/devtools/eclipse-plugin/trunk/ (props changed)
geronimo/devtools/eclipse-plugin/trunk/maven-plugins/maven-geronimodevtools-plugin/src/main/java/org/apache/geronimo/eclipse/devtools/BundleManifestMojo.java
geronimo/devtools/eclipse-plugin/trunk/plugins/pom.xml
Propchange: geronimo/devtools/eclipse-plugin/trunk/
------------------------------------------------------------------------------
--- svk:merge (original)
+++ svk:merge Thu Jan 4 11:10:43 2007
@@ -1,2 +1,2 @@
-13f79535-47bb-0310-9956-ffa450edef68:/geronimo/devtools/eclipse-plugin/branches/1.2.1:492626
+13f79535-47bb-0310-9956-ffa450edef68:/geronimo/devtools/eclipse-plugin/branches/1.2.1:492668
47d51c14-9805-4038-8224-40f2b3020a56:/local/G1526-eclipse:3238
Modified: geronimo/devtools/eclipse-plugin/trunk/maven-plugins/maven-geronimodevtools-plugin/src/main/java/org/apache/geronimo/eclipse/devtools/BundleManifestMojo.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/maven-plugins/maven-geronimodevtools-plugin/src/main/java/org/apache/geronimo/eclipse/devtools/BundleManifestMojo.java?view=diff&rev=492693&r1=492692&r2=492693
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/maven-plugins/maven-geronimodevtools-plugin/src/main/java/org/apache/geronimo/eclipse/devtools/BundleManifestMojo.java (original)
+++ geronimo/devtools/eclipse-plugin/trunk/maven-plugins/maven-geronimodevtools-plugin/src/main/java/org/apache/geronimo/eclipse/devtools/BundleManifestMojo.java Thu Jan 4 11:10:43 2007
@@ -18,6 +18,9 @@
import java.io.File;
import java.io.FileInputStream;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.StringTokenizer;
import java.util.jar.Attributes;
import java.util.jar.Manifest;
@@ -28,7 +31,7 @@
import org.osgi.framework.Constants;
/**
- *@goal validatemanifest
+ * @goal validatemanifest
*/
public class BundleManifestMojo extends AbstractMojo {
@@ -43,20 +46,17 @@
* @required
*/
private File manifestFile;
-
- /**
- * @parameter
- */
- private File classpathEntriesDir;
-
+
/**
* @parameter
*/
- private boolean includeRootClasspathEntry = false;
-
+ private String classpathEntriesDir;
+
private Attributes attributes = null;
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.apache.maven.plugin.Mojo#execute()
*/
public void execute() throws MojoExecutionException, MojoFailureException {
@@ -64,29 +64,44 @@
FileInputStream fis = new FileInputStream(manifestFile);
Manifest manifest = new Manifest(fis);
attributes = manifest.getMainAttributes();
-
validate(Constants.BUNDLE_SYMBOLICNAME, project.getName() + ";singleton:=true");
- //validate(Constants.BUNDLE_NAME, project.getName());
validate(Constants.BUNDLE_VERSION, project.getVersion());
-
- if(classpathEntriesDir != null && classpathEntriesDir.exists()) {
- File entries[] = classpathEntriesDir.listFiles();
- if(entries.length > 0) {
- if(includeRootClasspathEntry) {
-
- }
- }
- }
-
+ validateBundleClasspath();
+ fis.close();
} catch (Exception e) {
throw new MojoExecutionException(e.getMessage(), e);
}
}
-
+
+ private void validateBundleClasspath() throws MojoFailureException {
+ if (classpathEntriesDir == null)
+ return;
+ File libs[] = new File(project.getBasedir(), classpathEntriesDir).listFiles();
+ if (libs == null)
+ return;
+ String classpath = attributes.getValue(Constants.BUNDLE_CLASSPATH);
+ StringTokenizer tokenizer = new StringTokenizer(classpath, ",");
+ List cpEntries = new ArrayList();
+ while (tokenizer.hasMoreTokens()) {
+ cpEntries.add(tokenizer.nextToken().trim());
+ }
+ List missingEntries = new ArrayList();
+ for (int i = 0; i < libs.length; i++) {
+ File lib = libs[i];
+ String expectedEntry = classpathEntriesDir + "/" + lib.getName();
+ if (!cpEntries.contains(expectedEntry)) {
+ missingEntries.add(expectedEntry);
+ }
+ }
+ if (!missingEntries.isEmpty()) {
+ throw new MojoFailureException("Manifest Bundle-Classpath is missing the following entries: " + missingEntries.toString());
+ }
+ }
+
private void validate(String attribute, String correctValue) throws MojoFailureException {
String currentValue = attributes.getValue(attribute).replaceAll(" ", "");
correctValue = correctValue.replaceAll(" ", "");
- if(!correctValue.equals(currentValue)) {
+ if (!correctValue.equals(currentValue)) {
throw new MojoFailureException("Attribute value for " + attribute + " in bundle manifest is incorrect. [Found: " + currentValue + "] [Expected: " + correctValue + "]");
}
}
Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/pom.xml?view=diff&rev=492693&r1=492692&r2=492693
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/pom.xml (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/pom.xml Thu Jan 4 11:10:43 2007
@@ -56,7 +56,7 @@
<artifactId>maven-geronimodevtools-plugin</artifactId>
<executions>
<execution>
- <id>install-dependencies</id>
+ <id>initialize</id>
<phase>validate</phase>
<goals>
<goal>qualifier</goal>
@@ -65,6 +65,16 @@
<goal>validatemanifest</goal>
</goals>
</execution>
+ <execution>
+ <id>validate-bundle-classpath</id>
+ <phase>process-resources</phase>
+ <goals>
+ <goal>validatemanifest</goal>
+ </goals>
+ <configuration>
+ <classpathEntriesDir>lib</classpathEntriesDir>
+ </configuration>
+ </execution>
</executions>
</plugin>
<plugin>
@@ -125,5 +135,6 @@
<module>org.apache.geronimo.runtime.common</module>
<module>org.apache.geronimo.runtime.v1</module>
<module>org.apache.geronimo.runtime.v11</module>
+ <!--<module>org.apache.geronimo.runtime.v12</module>-->
</modules>
</project>