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 2006/05/08 17:19:01 UTC

svn commit: r405069 - in /geronimo/devtools/eclipse-plugin/trunk: ./ maven-plugins/maven-geronimodevtools-plugin/src/main/java/org/apache/geronimo/eclipse/devtools/ plugins/org.apache.geronimo.st.core/ plugins/org.apache.geronimo.st.ui/

Author: sppatel
Date: Mon May  8 08:18:59 2006
New Revision: 405069

URL: http://svn.apache.org/viewcvs?rev=405069&view=rev
Log:
fix assemblies, add fragment dependency dynamically

Modified:
    geronimo/devtools/eclipse-plugin/trunk/maven-plugins/maven-geronimodevtools-plugin/src/main/java/org/apache/geronimo/eclipse/devtools/InstallPluginDependenciesMojo.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/pom.xml
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/pom.xml
    geronimo/devtools/eclipse-plugin/trunk/pom.xml

Modified: geronimo/devtools/eclipse-plugin/trunk/maven-plugins/maven-geronimodevtools-plugin/src/main/java/org/apache/geronimo/eclipse/devtools/InstallPluginDependenciesMojo.java
URL: http://svn.apache.org/viewcvs/geronimo/devtools/eclipse-plugin/trunk/maven-plugins/maven-geronimodevtools-plugin/src/main/java/org/apache/geronimo/eclipse/devtools/InstallPluginDependenciesMojo.java?rev=405069&r1=405068&r2=405069&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/maven-plugins/maven-geronimodevtools-plugin/src/main/java/org/apache/geronimo/eclipse/devtools/InstallPluginDependenciesMojo.java (original)
+++ geronimo/devtools/eclipse-plugin/trunk/maven-plugins/maven-geronimodevtools-plugin/src/main/java/org/apache/geronimo/eclipse/devtools/InstallPluginDependenciesMojo.java Mon May  8 08:18:59 2006
@@ -110,8 +110,7 @@
 	public void execute() throws MojoExecutionException, MojoFailureException {
 
 		if (!isValid())
-			throw new MojoFailureException("Eclipse home directory is not valid. "
-					+ eclipseHome);
+			throw new MojoFailureException("Eclipse home directory is not valid. " + eclipseHome);
 
 		processDependencies();
 		project.getDependencies().removeAll(removeList);
@@ -124,36 +123,47 @@
 		while (i.hasNext()) {
 			Dependency dependency = (Dependency) i.next();
 			if (GROUP_ID.equals(dependency.getGroupId())) {
-				updateForSWTFragment(dependency);
-				File bundle = findBundleForDependency(dependency);
-				if (bundle != null) {
-					process(bundle, dependency);
-					if (bundle.isDirectory()
-							&& getBundleName(bundle).equals(dependency.getArtifactId())) {
-						getLog().info("Removing bundle directory dependency: "
-								+ dependency.getArtifactId());
-						removeList.add(dependency);
-					}
-				} else {
-					getLog().info("Bundle for dependency not found: "
-							+ dependency.getArtifactId());
+				if ("org.eclipse.swt".equals(dependency.getArtifactId())) {
+					Dependency fragment = getSWTFragmentDependency(dependency);
+					processDependency(fragment);
+					addList.add(fragment);
 				}
+				processDependency(dependency);
 			}
 		}
 	}
 
-	private void updateForSWTFragment(Dependency dependency) {
-		if ("org.eclipse.swt.fragment".equals(dependency.getArtifactId())) {
-			String platform = System.getProperty("os.name");
-			String id = dependency.getArtifactId();
-			if (platform.startsWith("Windows")) {
-				dependency.setArtifactId(id.replaceFirst("fragment", "win32.win32.x86"));
-			} else if (platform.startsWith("Linux")) {
-				dependency.setArtifactId(id.replaceFirst("fragment", "gtk.linux.x86"));
-			} else if (platform.startsWith("Mac")) {
-				dependency.setArtifactId(id.replaceFirst("fragment", "carbon.macosx.ppc"));
+	private void processDependency(Dependency dependency) {
+		File bundle = findBundleForDependency(dependency);
+		if (bundle != null) {
+			process(bundle, dependency);
+			if (bundle.isDirectory()
+					&& getBundleName(bundle).equals(dependency.getArtifactId())) {
+				getLog().info("Removing bundle directory dependency: "
+						+ dependency.getArtifactId());
+				removeList.add(dependency);
 			}
+		} else {
+			getLog().info("Bundle for dependency not found: "
+					+ dependency.getArtifactId());
+		}
+	}
+
+	private Dependency getSWTFragmentDependency(Dependency swtDependency) {
+		Dependency fragment = new Dependency();
+		fragment.setGroupId(swtDependency.getGroupId());
+		fragment.setType(swtDependency.getType());
+		fragment.setVersion(swtDependency.getVersion());
+		String id = swtDependency.getArtifactId();
+		String platform = System.getProperty("os.name");
+		if (platform.startsWith("Windows")) {
+			fragment.setArtifactId(id.concat(".win32.win32.x86"));
+		} else if (platform.startsWith("Linux")) {
+			fragment.setArtifactId(id.concat(".gtk.linux.x86"));
+		} else if (platform.startsWith("Mac")) {
+			fragment.setArtifactId(id.concat(".carbon.macosx.ppc"));
 		}
+		return fragment;
 	}
 
 	protected boolean isValid() {
@@ -262,9 +272,7 @@
 		return artifactId;
 	}
 
-	private void doIt(File file, String groupId, String artifactId,
-			String version, String packaging) throws MojoExecutionException,
-			MojoFailureException {
+	private void doIt(File file, String groupId, String artifactId, String version, String packaging) throws MojoExecutionException, MojoFailureException {
 
 		Artifact artifact = artifactFactory.createArtifact(groupId, artifactId, version, null, packaging);
 		generatePOM(artifact, groupId, artifactId, version);
@@ -274,26 +282,21 @@
 			File destination = new File(localRepository.getBasedir(), localPath);
 
 			if (destination.exists()) {
-				getLog().info(artifactId + " : " + version
-						+ " already exists in local repository.");
+				getLog().info(artifactId + " : " + version + " already exists in local repository.");
 				return;
 			}
 
 			if (!file.getPath().equals(destination.getPath())) {
 				installer.install(file, artifact, localRepository);
 			} else {
-				throw new MojoFailureException("Cannot install artifact. Artifact is already in the local repository.\n\nFile in question is: "
-						+ file + "\n");
+				throw new MojoFailureException("Cannot install artifact. Artifact is already in the local repository.\n\nFile in question is: " + file + "\n");
 			}
 		} catch (ArtifactInstallationException e) {
-			throw new MojoExecutionException("Error installing artifact '"
-					+ artifact.getDependencyConflictId() + "': "
-					+ e.getMessage(), e);
+			throw new MojoExecutionException("Error installing artifact '" + artifact.getDependencyConflictId() + "': " + e.getMessage(), e);
 		}
 	}
 
-	private void generatePOM(Artifact artifact, String groupId,
-			String artifactId, String version) throws MojoExecutionException {
+	private void generatePOM(Artifact artifact, String groupId, String artifactId, String version) throws MojoExecutionException {
 
 		FileWriter fw = null;
 		try {
@@ -313,8 +316,7 @@
 			ArtifactMetadata metadata = new ProjectArtifactMetadata(artifact, tempFile);
 			artifact.addMetadata(metadata);
 		} catch (IOException e) {
-			throw new MojoExecutionException("Error writing temporary pom file: "
-					+ e.getMessage(), e);
+			throw new MojoExecutionException("Error writing temporary pom file: " + e.getMessage(), e);
 		} finally {
 			IOUtil.close(fw);
 		}

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/pom.xml
URL: http://svn.apache.org/viewcvs/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/pom.xml?rev=405069&r1=405068&r2=405069&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/pom.xml (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/pom.xml Mon May  8 08:18:59 2006
@@ -86,5 +86,10 @@
             <artifactId>org.apache.geronimo.runtime.common</artifactId>
             <version>${org.apache.geronimo.runtime.common_version}</version>
         </dependency>
+        <dependency>
+            <groupId>xstream</groupId>
+            <artifactId>xstream</artifactId>
+            <version>1.1.3</version>     
+        </dependency>
     </dependencies>
 </project>

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/pom.xml
URL: http://svn.apache.org/viewcvs/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/pom.xml?rev=405069&r1=405068&r2=405069&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/pom.xml (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/pom.xml Mon May  8 08:18:59 2006
@@ -70,10 +70,5 @@
             <artifactId>org.apache.geronimo.st.core</artifactId>
             <version>${org.apache.geronimo.st.core_version}</version>
         </dependency>
-        <dependency>
-            <groupId>org.eclipse.plugins</groupId>
-            <artifactId>org.eclipse.swt.fragment</artifactId>
-            <version>${org.eclipse.swt.fragment_version}</version>
-        </dependency>
     </dependencies>
 </project>

Modified: geronimo/devtools/eclipse-plugin/trunk/pom.xml
URL: http://svn.apache.org/viewcvs/geronimo/devtools/eclipse-plugin/trunk/pom.xml?rev=405069&r1=405068&r2=405069&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/pom.xml (original)
+++ geronimo/devtools/eclipse-plugin/trunk/pom.xml Mon May  8 08:18:59 2006
@@ -121,14 +121,6 @@
     <wtpUrl>http://download.eclipse.org/webtools/downloads/drops/R-1.0.2-200604200208/wtp-sdk-R-1.0.2-200604200208.zip</wtpUrl>
   </properties>
 
-  <dependencies>
-    <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-      <version>${junitVersion}</version>
-    </dependency>
-  </dependencies>
-
   <distributionManagement>
     <repository>
       <id>apache-repo</id>