core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/sdk/core/SymbianSDKFactory.java
branchC3_BUILDER_WORK
changeset 1462 b38491fd06da
parent 1453 bd6bc4d000fd
child 1667 352fb86872dd
equal deleted inserted replaced
1460:26f585ac8a88 1462:b38491fd06da
    12 */
    12 */
    13 package com.nokia.carbide.cpp.sdk.core;
    13 package com.nokia.carbide.cpp.sdk.core;
    14 
    14 
    15 import org.osgi.framework.Version;
    15 import org.osgi.framework.Version;
    16 
    16 
    17 import com.nokia.carbide.cpp.internal.api.sdk.ISBSv1BuildInfo;
       
    18 import com.nokia.carbide.cpp.internal.sdk.core.gen.Devices.DefaultType;
    17 import com.nokia.carbide.cpp.internal.sdk.core.gen.Devices.DefaultType;
    19 import com.nokia.carbide.cpp.internal.sdk.core.gen.Devices.DeviceType;
    18 import com.nokia.carbide.cpp.internal.sdk.core.gen.Devices.DeviceType;
    20 import com.nokia.carbide.cpp.internal.sdk.core.gen.Devices.DevicesFactory;
    19 import com.nokia.carbide.cpp.internal.sdk.core.gen.Devices.DevicesFactory;
    21 import com.nokia.carbide.cpp.internal.sdk.core.model.SymbianSDK;
    20 import com.nokia.carbide.cpp.internal.sdk.core.model.SymbianSDK;
    22 /**
    21 /**
    39 	 */
    38 	 */
    40 	public static ISymbianSDK createInstance(String id, 
    39 	public static ISymbianSDK createInstance(String id, 
    41 											 String epocRoot, 
    40 											 String epocRoot, 
    42 											 String name, 
    41 											 String name, 
    43 											 Version osVersion,
    42 											 Version osVersion,
    44 											 String osBranch,
    43 											 Version sdkVersion) {
    45 											 Version sdkVersion, 
       
    46 											 boolean isDefault){
       
    47 		DeviceType newDeviceEntry = DevicesFactory.eINSTANCE.createDeviceType();
    44 		DeviceType newDeviceEntry = DevicesFactory.eINSTANCE.createDeviceType();
    48 		newDeviceEntry.setId(id);
    45 		newDeviceEntry.setId(id);
    49 		newDeviceEntry.setEpocroot(epocRoot);
    46 		newDeviceEntry.setEpocroot(epocRoot);
    50 		newDeviceEntry.setName(name);
    47 		newDeviceEntry.setName(name);
    51 		if (isDefault){
    48 		newDeviceEntry.setDefault(DefaultType.NO_LITERAL);
    52 			newDeviceEntry.setDefault(DefaultType.YES_LITERAL);
       
    53 		} else {
       
    54 			newDeviceEntry.setDefault(DefaultType.NO_LITERAL);
       
    55 		}
       
    56 		
    49 		
    57 		SymbianSDK sdk = new SymbianSDK(newDeviceEntry); // create SDK and set the attribs found in devices.xml
    50 		SymbianSDK sdk = new SymbianSDK(newDeviceEntry); // create SDK and set the attribs found in devices.xml
    58 		// Set other essential parameters not in devices.xml
    51 		// Set other essential parameters not in devices.xml
    59 		ISBSv1BuildInfo sbsv1BuildInfo = (ISBSv1BuildInfo)sdk.getBuildInfo(ISymbianBuilderID.SBSV1_BUILDER);
       
    60 		if (sdk.getOSVersion().getMajor() != 0) {
    52 		if (sdk.getOSVersion().getMajor() != 0) {
    61 			// use the version detected from the SDK creation
    53 			// use the version detected from the SDK creation
    62 		} else {
    54 		} else {
    63 			sdk.setOSVersion(osVersion);
    55 			sdk.setOSVersion(osVersion);
    64 			if (sbsv1BuildInfo != null) {
       
    65 				sbsv1BuildInfo.setOSSDKBranch(sdk, osBranch);
       
    66 			}
       
    67 		}
    56 		}
    68 		
    57 		
    69 		if (sbsv1BuildInfo != null) {
    58 		if (sdk.getSDKVersion().getMajor() == 0) {
    70 			if (sbsv1BuildInfo.getSDKVersion(sdk).getMajor() == 0){
    59 			sdk.setSDKVersion(sdkVersion);
    71 				sbsv1BuildInfo.setSDKVersion(sdk, sdkVersion);
       
    72 			}
       
    73 		}
    60 		}
    74 		
    61 		
    75 		return sdk;
    62 		return sdk;
    76 	}
    63 	}
    77 	
    64