[jbosstools-commits] JBoss Tools SVN: r43999 - trunk/tests/scripts/installation-updates/src/main/groovy.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Tue Sep 25 10:34:57 EDT 2012


Author: mickael_istria
Date: 2012-09-25 10:34:57 -0400 (Tue, 25 Sep 2012)
New Revision: 43999

Added:
   trunk/tests/scripts/installation-updates/src/main/groovy/getAndInstallEclipse.groovy
Log:
Multi-platfrom getEclipse script

Added: trunk/tests/scripts/installation-updates/src/main/groovy/getAndInstallEclipse.groovy
===================================================================
--- trunk/tests/scripts/installation-updates/src/main/groovy/getAndInstallEclipse.groovy	                        (rev 0)
+++ trunk/tests/scripts/installation-updates/src/main/groovy/getAndInstallEclipse.groovy	2012-09-25 14:34:57 UTC (rev 43999)
@@ -0,0 +1,45 @@
+import groovy.util.AntBuilder
+import org.apache.tools.ant.taskdefs.Get;
+
+File eclipseCacheDirectory = System.properties['eclipseCacheDirectory'] != null ? new File(System.properties['eclipseCacheDirectory']) : new File(".");
+String eclipseFlavour = System.properties['eclipseFlavour'] != null ? System.properties['eclipseFlavour'] : "jee";
+String releaseTrainId = System.properties['releaseTrainId'] != null ? System.properties['releaseTrainId'] : "juno";
+String versionLabel = System.properties['versionLabel'] != null ? System.properties['versionLabel'] : "R";
+
+String osLabel = System.properties['os.name'].toLowerCase();
+String fileExtension = null;
+if (osLabel.contains("windows")) {
+	osLabel = "win32";
+	fileExtension = "zip";
+} else if (osLabel.contains("linux")) {
+	osLabel = "linux-gtk";
+	fileExtension = "tar.gz";
+} else if (osLabel.contains("mac")) {
+	osLabel = "macosx-cocoa";
+	fileExtension = "tar.gz";
+}
+String archLabel = System.properties['os.arch'].contains("64") ? "-x86_64" : "";
+
+String eclipseArchive = "eclipse-" + eclipseFlavour + "-" + releaseTrainId + "-" + osLabel + archLabel + "." + fileExtension;
+String downloadURL = "http://www.eclipse.org/downloads/download.php?r=1&file=/technology/epp/downloads/release/" + releaseTrainId + "/" + versionLabel +"/" + eclipseArchive;
+println("Will retrieve " + eclipseArchive)
+
+File cachedFile = new File(eclipseCacheDirectory, eclipseArchive);
+if (!cachedFile.isFile()) {
+	new AntBuilder().get(
+		src: downloadURL,
+		dest: cachedFile);
+	if (fileExtension.equals("tar.gz")) {
+		new AntBuilder().gunzip(src: cachedFile.getAbsolutePath());
+	}
+}
+// Unzip
+if (fileExtension.equals("zip")) {
+	new AntBuilder().unzip(
+		src: cachedFile.getAbsolutePath(),
+		dest: new File().getAbsolutePath());
+} else if (fileExtension.equals("tar.gz")) {
+	new AntBuilder().untar(
+		src: cachedFile.getAbsolutePath()[0..- (".gz".length() + 1)],
+		dest: new File(".").getAbsolutePath());
+}
\ No newline at end of file



More information about the jbosstools-commits mailing list