refactored sdk & bld inf import scriptable classes
authortimkelly
Thu, 29 Oct 2009 09:33:29 -0500
changeset 549 993ad514bab5
parent 548 7b0ddf4b33fa
child 550 ec814507e15f
child 553 fe69ca72a1a0
refactored sdk & bld inf import scriptable classes
core/com.nokia.carbide.cpp.sdk.core/plugin.xml
core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/scripting/SDKScriptManager.java
core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/scripting/SymbianSDKs.java
project/com.nokia.carbide.cpp.project.ui/plugin.xml
project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/scripting/ImportBldInfWrapper.java
project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/scripting/SymbianProject.java
--- a/core/com.nokia.carbide.cpp.sdk.core/plugin.xml	Wed Oct 28 14:47:52 2009 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core/plugin.xml	Thu Oct 29 09:33:29 2009 -0500
@@ -25,8 +25,8 @@
   <extension
          point="org.eclipse.cdt.scripting.scriptableFeature">
       <scriptableClass
-            class="com.nokia.carbide.cpp.internal.sdk.core.scripting.SDKScriptManager"
-            name="sdkScriptManager">
+            class="com.nokia.carbide.cpp.internal.sdk.core.scripting.SymbianSDKs"
+            name="symbianSDKs">
       </scriptableClass>
    </extension>
 
--- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/scripting/SDKScriptManager.java	Wed Oct 28 14:47:52 2009 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,53 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-package com.nokia.carbide.cpp.internal.sdk.core.scripting;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import com.nokia.carbide.cpp.sdk.core.ISDKManager;
-import com.nokia.carbide.cpp.sdk.core.ISymbianSDK;
-import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin;
-
-public class SDKScriptManager {
-	
-	private static final String KEY_SDK_ID = "KEY_SDK_ID";
-	private static final String KEY_SDK_EPOCROOT = "KEY_SDK_EPOCROOT";
-	private static final String KEY_SDK_NAME = "KEY_SDK_NAME";
-	
-	static private ISDKManager getSDKManager(){
-		return SDKCorePlugin.getSDKManager();
-	}
-		
-	static public Map<?, ?>[] getSDKMapList(){
-		ArrayList<Map<String,String>> sdkMapArray = new ArrayList<Map<String,String>>();
-		List<ISymbianSDK> sdkList = getSDKManager().getSDKList();
-		for (ISymbianSDK sdk : sdkList){
-			Map<String,String> mp = new HashMap<String, String>();
-			mp.put(KEY_SDK_ID, sdk.getUniqueId());
-			mp.put(KEY_SDK_NAME, sdk.getName());
-			mp.put(KEY_SDK_EPOCROOT, sdk.getEPOCROOT());
-			sdkMapArray.add(mp);
-		}
-		
-		
-		return sdkMapArray.toArray(new HashMap<?, ?>[sdkMapArray.size()]);
-	}
-	
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/scripting/SymbianSDKs.java	Thu Oct 29 09:33:29 2009 -0500
@@ -0,0 +1,53 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+package com.nokia.carbide.cpp.internal.sdk.core.scripting;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import com.nokia.carbide.cpp.sdk.core.ISDKManager;
+import com.nokia.carbide.cpp.sdk.core.ISymbianSDK;
+import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin;
+
+public class SymbianSDKs {
+	
+	private static final String KEY_SDK_ID = "KEY_SDK_ID";
+	private static final String KEY_SDK_EPOCROOT = "KEY_SDK_EPOCROOT";
+	private static final String KEY_SDK_NAME = "KEY_SDK_NAME";
+	
+	static private ISDKManager getSDKManager(){
+		return SDKCorePlugin.getSDKManager();
+	}
+		
+	static public Map<?, ?>[] getSDKMapList(){
+		ArrayList<Map<String,String>> sdkMapArray = new ArrayList<Map<String,String>>();
+		List<ISymbianSDK> sdkList = getSDKManager().getSDKList();
+		for (ISymbianSDK sdk : sdkList){
+			Map<String,String> mp = new HashMap<String, String>();
+			mp.put(KEY_SDK_ID, sdk.getUniqueId());
+			mp.put(KEY_SDK_NAME, sdk.getName());
+			mp.put(KEY_SDK_EPOCROOT, sdk.getEPOCROOT());
+			sdkMapArray.add(mp);
+		}
+		
+		
+		return sdkMapArray.toArray(new HashMap<?, ?>[sdkMapArray.size()]);
+	}
+	
+}
--- a/project/com.nokia.carbide.cpp.project.ui/plugin.xml	Wed Oct 28 14:47:52 2009 -0500
+++ b/project/com.nokia.carbide.cpp.project.ui/plugin.xml	Thu Oct 29 09:33:29 2009 -0500
@@ -537,8 +537,8 @@
   <extension
          point="org.eclipse.cdt.scripting.scriptableFeature">
       <scriptableClass
-            class="com.nokia.carbide.cpp.internal.scripting.ImportBldInfWrapper"
-            name="importBldInfWrapper">
+            class="com.nokia.carbide.cpp.internal.scripting.SymbianProject"
+            name="symbianProject">
       </scriptableClass>
    </extension>
 
--- a/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/scripting/ImportBldInfWrapper.java	Wed Oct 28 14:47:52 2009 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,93 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-package com.nokia.carbide.cpp.internal.scripting;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.resources.IProject;
-
-import com.nokia.carbide.cpp.internal.api.sdk.SymbianBuildContext;
-import com.nokia.carbide.cpp.sdk.core.ISDKManager;
-import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext;
-import com.nokia.carbide.cpp.sdk.core.ISymbianSDK;
-import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin;
-
-
-public class ImportBldInfWrapper {
-	
-	private static final String KEY_SDKID = "KEY_SDKID";
-	private static final String KEY_PLATFORM = "KEY_PLATFORM";
-	private static final String KEY_TARGET = "KEY_TARGET";
-	
-	static public String importBldInf(String projectName, String rootDirectory,
-		String bldInfFile, String[] buildComponents,
-		Map<String, String>[] buildContextMap) {
-
-		List<ISymbianBuildContext> contexts = new ArrayList<ISymbianBuildContext>();
-		ISDKManager sdkMgr = SDKCorePlugin.getSDKManager();
-		for (Map<String, String> currMap : buildContextMap) {
-			ISymbianSDK sdk = sdkMgr.getSDK(currMap.get(KEY_SDKID), false);
-			if (sdk != null) {
-				if (!ImporterScritpingUtils.checkProjectIsOnSDKDrive(
-						rootDirectory, sdk)) {
-					// AssertTestCase.fail("!" + projectPath +
-					// " is not on the same drive as SDK: " + sdkName
-					// + " and could not import: " + projectName);
-				}
-				contexts.add(new SymbianBuildContext(sdk, currMap
-						.get(KEY_PLATFORM), currMap.get(KEY_TARGET)));
-			}
-		}
-
-		IProject project = ImporterScritpingUtils.importINF(projectName,
-				bldInfFile, contexts, 0, false);
-
-		if (project == null)
-			return null;
-		else
-			return projectName;
-	}
-	
-	static public Map<String, String> createSymbianBuildContext(String sdkID, String platform, String target){
-		Map<String,String> mp = new HashMap<String, String>();
-
-		mp.put(KEY_SDKID, sdkID);
-		mp.put(KEY_PLATFORM, platform);
-		mp.put(KEY_TARGET, target);
-		
-		return mp;
-	}
-	
-	static public boolean buildProject(String projectName){
-		// TODO:
-		return false;
-	}
-	
-	static public boolean cleanProject(int cleanLevel){
-		// TODO:
-		return false;
-	}
-	
-	static public boolean changeBuildConfiguration(Map<String, String> buildContextMap){
-		// TODO:
-		return false;
-	}
-	
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/scripting/SymbianProject.java	Thu Oct 29 09:33:29 2009 -0500
@@ -0,0 +1,93 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+package com.nokia.carbide.cpp.internal.scripting;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.resources.IProject;
+
+import com.nokia.carbide.cpp.internal.api.sdk.SymbianBuildContext;
+import com.nokia.carbide.cpp.sdk.core.ISDKManager;
+import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext;
+import com.nokia.carbide.cpp.sdk.core.ISymbianSDK;
+import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin;
+
+
+public class SymbianProject {
+	
+	private static final String KEY_SDKID = "KEY_SDKID";
+	private static final String KEY_PLATFORM = "KEY_PLATFORM";
+	private static final String KEY_TARGET = "KEY_TARGET";
+	
+	static public String importBldInf(String projectName, String rootDirectory,
+		String bldInfFile, String[] buildComponents,
+		Map<String, String>[] buildContextMap) {
+
+		List<ISymbianBuildContext> contexts = new ArrayList<ISymbianBuildContext>();
+		ISDKManager sdkMgr = SDKCorePlugin.getSDKManager();
+		for (Map<String, String> currMap : buildContextMap) {
+			ISymbianSDK sdk = sdkMgr.getSDK(currMap.get(KEY_SDKID), false);
+			if (sdk != null) {
+				if (!ImporterScritpingUtils.checkProjectIsOnSDKDrive(
+						rootDirectory, sdk)) {
+					// AssertTestCase.fail("!" + projectPath +
+					// " is not on the same drive as SDK: " + sdkName
+					// + " and could not import: " + projectName);
+				}
+				contexts.add(new SymbianBuildContext(sdk, currMap
+						.get(KEY_PLATFORM), currMap.get(KEY_TARGET)));
+			}
+		}
+
+		IProject project = ImporterScritpingUtils.importINF(projectName,
+				bldInfFile, contexts, 0, false);
+
+		if (project == null)
+			return null;
+		else
+			return projectName;
+	}
+	
+	static public Map<String, String> createSymbianBuildContext(String sdkID, String platform, String target){
+		Map<String,String> mp = new HashMap<String, String>();
+
+		mp.put(KEY_SDKID, sdkID);
+		mp.put(KEY_PLATFORM, platform);
+		mp.put(KEY_TARGET, target);
+		
+		return mp;
+	}
+	
+	static public boolean buildProject(String projectName){
+		// TODO:
+		return false;
+	}
+	
+	static public boolean cleanProject(int cleanLevel){
+		// TODO:
+		return false;
+	}
+	
+	static public boolean changeBuildConfiguration(Map<String, String> buildContextMap){
+		// TODO:
+		return false;
+	}
+	
+}