From 78ec597001f5fd700f5aad5649a70824528ea49a Mon Sep 17 00:00:00 2001
From: david_williams <david_williams>
Date: Tue, 5 Jun 2007 22:32:32 +0000
Subject: [PATCH] tiny utility to aid getting feature versions

---
 .../releng/tools/UpdateFeatureUpdateFile.java | 78 +++++++++++++++++++
 .../tools/featuresOfInterest.properties       | 11 +++
 2 files changed, 89 insertions(+)
 create mode 100644 plugins/org.eclipse.wtp.releng.tools/src/org/eclipse/wtp/releng/tools/UpdateFeatureUpdateFile.java
 create mode 100644 plugins/org.eclipse.wtp.releng.tools/src/org/eclipse/wtp/releng/tools/featuresOfInterest.properties

diff --git a/plugins/org.eclipse.wtp.releng.tools/src/org/eclipse/wtp/releng/tools/UpdateFeatureUpdateFile.java b/plugins/org.eclipse.wtp.releng.tools/src/org/eclipse/wtp/releng/tools/UpdateFeatureUpdateFile.java
new file mode 100644
index 000000000..d8af5d624
--- /dev/null
+++ b/plugins/org.eclipse.wtp.releng.tools/src/org/eclipse/wtp/releng/tools/UpdateFeatureUpdateFile.java
@@ -0,0 +1,78 @@
+package org.eclipse.wtp.releng.tools;
+
+import java.io.File;
+
+
+public class UpdateFeatureUpdateFile {
+
+	private String featuresDirectoryLocation = "\\builds\\temp\\wtp-sdk-S-2.0RC2-200706050057\\eclipse\\features";
+	private String featureUpdateFileLocation;
+	private FullJarNameParser fullJarNameParser = new FullJarNameParser();
+
+	private String[] featuresOfInterest = new String[]{"org.eclipse.wst", "org.eclipse.jst", "org.eclipse.jst.jsf.feature", "org.eclipse.jpt.feature", "org.eclipse.wst.sdk", "org.eclipse.jst.sdk", "org.eclipse.jst.jsf_sdk.feature", "org.eclipse.jpt_sdk.feature", };//"org.eclipse.wst.xml_ui.feature", "org.eclipse.wst.xml_sdk.feature",};
+
+	private String[] shortListOfInterest = new String[]{"org.eclipse.wst", "org.eclipse.jst", "org.eclipse.jst.jsf.feature", "org.eclipse.jpt.feature", }; //"org.eclipse.wst.xml_ui.feature",};
+
+	public static void main(String[] args) {
+
+		new UpdateFeatureUpdateFile().getFeatureDirectories();
+	}
+
+	private void getFeatureDirectories() {
+		System.out.println("featuresDirectoryLocation: " + getFeaturesDirectoryLocation());
+		// System.out.println("featureUpdateFileLocation: " +
+		// getFeatureUpdateFileLocation());
+		File featureDirectory = new File(featuresDirectoryLocation);
+		String[] featureDirectories = featureDirectory.list();
+		System.out.println("Full List for main WTP site");
+		System.out.println();
+		doList(featureDirectories, featuresOfInterest);
+		System.out.println();
+		System.out.println("Short List for Europa site");
+		System.out.println();
+		doList(featureDirectories, shortListOfInterest);
+	}
+
+	private void doList(String[] featureDirectories, String[] featureOfFocus) {
+		for (int i = 0; i < featureDirectories.length; i++) {
+			String directoryName = featureDirectories[i];
+			fullJarNameParser.parse(directoryName);
+			String projectName = fullJarNameParser.getProjectString();
+			String versionString = fullJarNameParser.getVersionString();
+			if (contains(projectName, featureOfFocus)) {
+				System.out.println("        <ant antfile=\"updateMirrorProject.xml\">\r\n" + "            <property\r\n" + "                name=\"featureId\"\r\n" + "                value=\"" + projectName + "\" />\r\n" + "            <property\r\n" + "                name=\"version\"\r\n" + "                value=\"" + versionString + "\" />\r\n" + "        </ant>");
+
+			}
+
+
+		}
+	}
+
+	public String getFeaturesDirectoryLocation() {
+		return featuresDirectoryLocation;
+	}
+
+	public void setFeaturesDirectoryLocation(String featuresDirectoryLocation) {
+		this.featuresDirectoryLocation = featuresDirectoryLocation;
+	}
+
+	public String getFeatureUpdateFileLocation() {
+		return featureUpdateFileLocation;
+	}
+
+	public void setFeatureUpdateFileLocation(String featureUpdateFileLocation) {
+		this.featureUpdateFileLocation = featureUpdateFileLocation;
+	}
+
+	private boolean contains(String needle, String[] haystack) {
+		boolean result = false;
+
+		for (int i = 0; i < haystack.length; i++) {
+			if (needle.equals(haystack[i])) {
+				result = true;
+				break;
+			}
+		}
+		return result;
+	}
+}
diff --git a/plugins/org.eclipse.wtp.releng.tools/src/org/eclipse/wtp/releng/tools/featuresOfInterest.properties b/plugins/org.eclipse.wtp.releng.tools/src/org/eclipse/wtp/releng/tools/featuresOfInterest.properties
new file mode 100644
index 000000000..3bf0c4133
--- /dev/null
+++ b/plugins/org.eclipse.wtp.releng.tools/src/org/eclipse/wtp/releng/tools/featuresOfInterest.properties
@@ -0,0 +1,11 @@
+org.eclipse.wst
+org.eclipse.jst
+org.eclipse.jst.jsf.feature
+org.eclipse.jpt.feature
+org.eclipse.wst.sdk
+org.eclipse.jst.sdk
+org.eclipse.jst.jsf_sdk.feature
+org.eclipse.jpt_sdk.feature
+
+org.eclipse.wst.xml_sdk.feature
+org.eclipse.wst.xml_ui.feature
\ No newline at end of file
-- 
GitLab