From: minkee.lee Date: Tue, 12 May 2015 08:19:21 +0000 (+0900) Subject: structure: Modified emulator tools file path. X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3ef8d93a37f52d7210c7d3c32c8cee720efacc17;p=sdk%2Femulator%2Femulator-manager.git structure: Modified emulator tools file path. - Path for check-xxx should be changed later.(tools/emulator/bin) Change-Id: Ifecad5b01eaf84ab1ae2c854db559f4f9012f2dc Signed-off-by: minkee.lee --- diff --git a/common-project/src/org/tizen/emulator/manager/console/ActionList.java b/common-project/src/org/tizen/emulator/manager/console/ActionList.java index cc3958c..3b44c5e 100644 --- a/common-project/src/org/tizen/emulator/manager/console/ActionList.java +++ b/common-project/src/org/tizen/emulator/manager/console/ActionList.java @@ -687,7 +687,7 @@ class Launch extends Action { commandList.add(new Command("n", Actions.OP_NAME, Actions.DESC_LAUNCH_NAME,"", true, true)); commandList.add(new Command("p", Actions.OP_PATH, - Actions.DESC_LAUNCH_PATH, FilePathResources.getBinPath(), false, true)); + Actions.DESC_LAUNCH_PATH, FilePathResources.getEmulatorBinPath(""), false, true)); commandList.add(new Command("t", Actions.OP_TEST, Actions.DESC_TEST, "", false, false)); /* diff --git a/common-project/src/org/tizen/emulator/manager/resources/FilePathResources.java b/common-project/src/org/tizen/emulator/manager/resources/FilePathResources.java index 4a0bf10..9336197 100644 --- a/common-project/src/org/tizen/emulator/manager/resources/FilePathResources.java +++ b/common-project/src/org/tizen/emulator/manager/resources/FilePathResources.java @@ -364,16 +364,24 @@ public class FilePathResources { return getEmulatorDataPath(platformVersion) + bios_suffix; } - public static String getEmulatorQemuImgPath(String platformVersion) { - return getEmulatorBinPath(platformVersion) + qemuImg_suffic; + public static String getEmulatorQemuImgPath() { + return getEmulatorToolPath() + qemuImg_suffic; } public static String getEmulatorDataPath(String platformVersion) { return getEmulatorPath(platformVersion) + data_suffix; } + public static String getEmulatorToolPath() { + // TODO return /tools/emulator/bin + return getEmulatorPath("2.4") + bin_suffix; + } + public static String getEmulatorPath(String platformVersion) { String emulatorPath; + if (platformVersion == null || platformVersion.isEmpty()) { + platformVersion = "2.4"; // TODO Get lastest version. + } try { emulatorPath = new File(platformsPath + platform_prefix + platformVersion + common_suffix + emulator_suffix).getCanonicalPath(); diff --git a/common-project/src/org/tizen/emulator/manager/tool/CheckVirtualization.java b/common-project/src/org/tizen/emulator/manager/tool/CheckVirtualization.java index d8dfb22..0dea550 100644 --- a/common-project/src/org/tizen/emulator/manager/tool/CheckVirtualization.java +++ b/common-project/src/org/tizen/emulator/manager/tool/CheckVirtualization.java @@ -152,10 +152,10 @@ public class CheckVirtualization { int exitValue = 1; List cmd = new ArrayList(); - cmd.add(FilePathResources.getBinPath() + File.separator + + cmd.add(FilePathResources.getEmulatorToolPath() + File.separator + (System.getProperty("os.name").toLowerCase().indexOf("windows") > -1 ? "check-hax.exe" : "check-hax")); ProcessBuilder pb = new ProcessBuilder(cmd); - pb.directory(new File(FilePathResources.getBinPath())); + pb.directory(new File(FilePathResources.getEmulatorToolPath())); try { Process process = pb.start(); @@ -208,10 +208,10 @@ public class CheckVirtualization { int exitValue = 1; List cmd = new ArrayList(); - cmd.add(FilePathResources.getBinPath() + File.separator + + cmd.add(FilePathResources.getEmulatorToolPath() + File.separator + (System.getProperty("os.name").toLowerCase().indexOf("windows") > -1 ? "check-gl.exe" : "check-gl")); ProcessBuilder pb = new ProcessBuilder(cmd); - pb.directory(new File(FilePathResources.getBinPath())); + pb.directory(new File(FilePathResources.getEmulatorToolPath())); try { Process process = pb.start(); diff --git a/common-project/src/org/tizen/emulator/manager/tool/TapUtil.java b/common-project/src/org/tizen/emulator/manager/tool/TapUtil.java index c9640f8..c5d228a 100644 --- a/common-project/src/org/tizen/emulator/manager/tool/TapUtil.java +++ b/common-project/src/org/tizen/emulator/manager/tool/TapUtil.java @@ -63,7 +63,12 @@ import com.sun.jna.platform.win32.WinReg.HKEY; import com.sun.jna.platform.win32.WinReg.HKEYByReference; public class TapUtil { - private static String devconPath = FilePathResources.getBinPath() + File.separator + "devcon.exe"; + + public static String getDevconPath(String platformVersion) { + return FilePathResources.getEmulatorBinPath(platformVersion) + + File.separator + "devcon.exe"; + } + public static String getBridgeFromDevice(String device) throws VMWorkerException { @@ -918,13 +923,13 @@ public class TapUtil { } public static void createTapDevice(String tapName, String ifName, - ComboViewItem comboViewItem) { + ComboViewItem comboViewItem, String platformVersion) { if (EmulatorManager.isWin()) { MessageDialog msgDialog = new MessageDialog(); msgDialog .openNoButtonInfoDialog("Creating tap device.\nThis will take minutes.."); TapCreateWorker worker = new TapCreateWorker(tapName, ifName, - msgDialog, comboViewItem); + msgDialog, comboViewItem, platformVersion); worker.start(); } @@ -1040,7 +1045,7 @@ public class TapUtil { public static boolean isWinBridgeExist() { String proxyCommand = "check-net.exe"; boolean isExist = false; - List cmd = Arrays.asList(FilePathResources.getBinPath() + List cmd = Arrays.asList(FilePathResources.getEmulatorToolPath() + File.separator + proxyCommand, "--bridge"); ProcessResult res = HelperClass.runProcess(cmd); boolean isCommandSuccess = false; @@ -1163,13 +1168,15 @@ public class TapUtil { final String tapName; final String ifName; final ComboViewItem comboViewItem; // for refresh combo-list + final String platformVersion; public TapCreateWorker(String tapName, String ifName, - MessageDialog dialog, ComboViewItem comboViewItem) { + MessageDialog dialog, ComboViewItem comboViewItem, String platformVersion) { this.dialog = dialog; this.tapName = tapName; this.ifName = ifName; this.comboViewItem = comboViewItem; + this.platformVersion = platformVersion; } @Override @@ -1185,7 +1192,7 @@ public class TapUtil { if (!EmulatorManager.isWin8()) { EMLogger.getLogger().info( "get CompatibleIDs from pci network device"); - cmd = Arrays.asList(devconPath, "find", "=net", + cmd = Arrays.asList(getDevconPath(platformVersion), "find", "=net", "@pci*"); res = HelperClass.runProcess(cmd); boolean isCommandSuccess = false; @@ -1208,7 +1215,7 @@ public class TapUtil { // Create Bridge device and set IP EMLogger.getLogger().info("create bridge"); cmd = Arrays - .asList(devconPath, + .asList(getDevconPath(platformVersion), "install", "c:\\windows\\inf\\netbrdgm.inf", "ms_bridgemp"); @@ -1218,7 +1225,7 @@ public class TapUtil { } EMLogger.getLogger().info("bind interface to bridge"); - cmd = Arrays.asList(FilePathResources.getBinPath() + cmd = Arrays.asList(FilePathResources.getEmulatorBinPath(platformVersion) + File.separator + "bindbridge.exe", "ms_bridge", CompatibleIDs, "bind"); res = HelperClass.runProcess(cmd); @@ -1238,8 +1245,8 @@ public class TapUtil { // Create new tap EMLogger.getLogger().info("Create new tap."); - cmd = Arrays.asList(devconPath, "install", - FilePathResources.getBinPath() + File.separator + cmd = Arrays.asList(getDevconPath(platformVersion), "install", + FilePathResources.getEmulatorBinPath(platformVersion) + File.separator + "OemWin2k.inf", "Tap0901"); res = HelperClass.runProcess(cmd); @@ -1285,7 +1292,7 @@ public class TapUtil { EMLogger.getLogger().info("bind host network to bridge"); String tapPnpInstanceID = getPnpInstanceIDFromName(tapName); - cmd = Arrays.asList(FilePathResources.getBinPath() + cmd = Arrays.asList(FilePathResources.getEmulatorBinPath(platformVersion) + File.separator + "bindbridge.exe", "ms_bridge", tapPnpInstanceID, "bind"); res = HelperClass.runProcess(cmd); @@ -1296,7 +1303,7 @@ public class TapUtil { EMLogger.getLogger().info( "wait while finishing bridged network setting"); String proxyCommand = "check-net.exe"; - cmd = Arrays.asList(FilePathResources.getBinPath() + cmd = Arrays.asList(FilePathResources.getEmulatorToolPath() + File.separator + proxyCommand, "--bridge"); res = HelperClass.runProcess(cmd); while (!res.getStdOutMsg().isEmpty()) { diff --git a/common-project/src/org/tizen/emulator/manager/ui/detail/item/property/NetTapDeviceViewItemWin.java b/common-project/src/org/tizen/emulator/manager/ui/detail/item/property/NetTapDeviceViewItemWin.java index e01365b..f00af9b 100644 --- a/common-project/src/org/tizen/emulator/manager/ui/detail/item/property/NetTapDeviceViewItemWin.java +++ b/common-project/src/org/tizen/emulator/manager/ui/detail/item/property/NetTapDeviceViewItemWin.java @@ -67,6 +67,7 @@ public class NetTapDeviceViewItemWin extends ComboViewItem { boolean isBridge = false; NetTapDeviceViewItemWin thisItem; + String platformVersion = ""; public NetTapDeviceViewItemWin(Item template, LineLabelViewItem lineLabelViewItem) { @@ -152,7 +153,7 @@ public class NetTapDeviceViewItemWin extends ComboViewItem { @Override public void widgetSelected(SelectionEvent arg0) { - TapDeviceDialogForWin.open(thisItem); + TapDeviceDialogForWin.open(thisItem, platformVersion); resetCombo(NetConnectTypeViewItem.VALUE_BRIDGE); } @@ -166,6 +167,7 @@ public class NetTapDeviceViewItemWin extends ComboViewItem { @Override public boolean settingModifyItem(VMPropertyValue value) { oldValue = newValue = value.getAdvancedOptionValue(name); + platformVersion = value.version; // text.setText(newValue); AdvancedViewItem item = lineLabelViewItem diff --git a/common-project/src/org/tizen/emulator/manager/ui/dialog/TapDeviceDialogForWin.java b/common-project/src/org/tizen/emulator/manager/ui/dialog/TapDeviceDialogForWin.java index 2e744b6..58cd688 100644 --- a/common-project/src/org/tizen/emulator/manager/ui/dialog/TapDeviceDialogForWin.java +++ b/common-project/src/org/tizen/emulator/manager/ui/dialog/TapDeviceDialogForWin.java @@ -82,12 +82,13 @@ public class TapDeviceDialogForWin { private static String ifName; private static ComboViewItem comboViewItem; + private static String platformVersion; public static ArrayList getInterfaceList() { // Get intereface list ProcessResult res; ArrayList ifList = new ArrayList(); - List cmd = Arrays.asList(FilePathResources.getBinPath() + List cmd = Arrays.asList(FilePathResources.getEmulatorBinPath(platformVersion) + File.separator + "devcon.exe", "find", "=net", "@pci*"); res = HelperClass.runProcess(cmd); boolean isCommandSuccess = false; @@ -109,8 +110,9 @@ public class TapDeviceDialogForWin { return ifList; } - public static void open(ComboViewItem comboViewItem) { + public static void open(ComboViewItem comboViewItem, String platformVersion) { TapDeviceDialogForWin.comboViewItem = comboViewItem; + TapDeviceDialogForWin.platformVersion = platformVersion; makeDialog(); dialog.open(); while (!dialog.isDisposed()) { @@ -291,7 +293,7 @@ public class TapDeviceDialogForWin { } dialog.close(); - TapUtil.createTapDevice(tapName, ifName, comboViewItem); + TapUtil.createTapDevice(tapName, ifName, comboViewItem, platformVersion); // } else { // new MessageDialog().openWarningDialog("Name already exist."); diff --git a/common-project/src/org/tizen/emulator/manager/vms/Creator.java b/common-project/src/org/tizen/emulator/manager/vms/Creator.java index 7a7b021..c8145f8 100644 --- a/common-project/src/org/tizen/emulator/manager/vms/Creator.java +++ b/common-project/src/org/tizen/emulator/manager/vms/Creator.java @@ -278,17 +278,18 @@ public class Creator { ec.getBaseInformation().setDiskImage(factory.createBaseInformationTypeDiskImage()); if (newVM.isStandard) { ec.getBaseInformation().getDiskImage().setType("standard"); - // TODO : get version - if (newVM.version != null) { - ec.getBaseInformation().getDiskImage().setVersion(newVM.version); - } else { - // TODO : temp name - ec.getBaseInformation().getDiskImage().setVersion("Standard"); - } } else { ec.getBaseInformation().getDiskImage().setType("custom"); ec.getBaseInformation().setArchitecture(EmulatorVMList.getInstance().CustomArch); } + + // TODO : get version + if (newVM.version != null) { + ec.getBaseInformation().getDiskImage().setVersion(newVM.version); + } else { + // TODO : temp name + ec.getBaseInformation().getDiskImage().setVersion("Standard"); + } if (newVM.baseName != null) { ec.getBaseInformation().getDiskImage().setBase(newVM.baseName); } @@ -300,6 +301,8 @@ public class Creator { // TODO : ec.getBaseInformation().getDiskImage().getBaseDiskImage().setFormat("qcow2"); ec.getBaseInformation().getDiskImage().getBaseDiskImage().setValue(newVM.baseImagePath); + ec.getBaseInformation().getDiskImage().setBase(newVM.baseName); + if (!newVM.baseImage.getBinaryVersion().isEmpty()) { ec.getBaseInformation().getDiskImage().getBaseDiskImage().setVersion(newVM.baseImage.getBinaryVersion()); } @@ -401,7 +404,7 @@ public class Creator { private String getQemuImgPath() { // return FilePathResources.getBinPath() + File.separator + "qemu-img"; - return FilePathResources.getEmulatorQemuImgPath(newVM.version); + return FilePathResources.getEmulatorQemuImgPath(); } } diff --git a/common-project/src/org/tizen/emulator/manager/vms/VMLauncher.java b/common-project/src/org/tizen/emulator/manager/vms/VMLauncher.java index 956c8da..0fd996b 100644 --- a/common-project/src/org/tizen/emulator/manager/vms/VMLauncher.java +++ b/common-project/src/org/tizen/emulator/manager/vms/VMLauncher.java @@ -66,7 +66,8 @@ public class VMLauncher { CheckingRunningEmulator.addEmulator(property); MonitoringEmulator monitor = new MonitoringEmulator(property); - Process process = launch(property.getName(), cmd, path); + Process process = launch(property.getName(), property.getPropertyValue().version, + cmd, path); if (process != null) { monitor.setProcess(process); monitor.start(); @@ -102,8 +103,8 @@ public class VMLauncher { private static List getCommand(VMProperty property) throws VMLauncherException { - String binaryPath = FilePathResources.getBinPath() + File.separator - + getBinary(property.getArch().toString()); + String binaryPath = FilePathResources.getEmulatorBinPath(property.getPropertyValue().version) + + File.separator + getBinary(property.getArch().toString()); String configPath = LaunchConfig .getLaunchConfigPath(property.getName()); if (!new File(configPath).exists()) { @@ -165,7 +166,8 @@ public class VMLauncher { return binary; } - public static Process launch(String vmName, List cmd, String binPath) { + public static Process launch(String vmName, String platformVersion, + List cmd, String binPath) { ProcessBuilder pb = new ProcessBuilder(cmd); // Make backup log. @@ -177,7 +179,7 @@ public class VMLauncher { String value = env.get("LD_LIBRARY_PATH"); env.put("LD_LIBRARY_PATH", ((value == null) ? "" : value + ":") - + FilePathResources.getBinPath() + ":" + + FilePathResources.getEmulatorBinPath(platformVersion) + ":" + FilePathResources.getRemotePath() + File.separator + "lib:"); EMLogger.getLogger().log(Level.INFO, @@ -185,7 +187,7 @@ public class VMLauncher { } if (binPath == null || binPath.isEmpty()) { - pb.directory(new File(FilePathResources.getBinPath())); + pb.directory(new File(FilePathResources.getEmulatorBinPath(platformVersion))); } else { pb.directory(new File(binPath)); } diff --git a/common-project/src/org/tizen/emulator/manager/vms/VMWorkerCommon.java b/common-project/src/org/tizen/emulator/manager/vms/VMWorkerCommon.java index 7b727a9..6a58aee 100644 --- a/common-project/src/org/tizen/emulator/manager/vms/VMWorkerCommon.java +++ b/common-project/src/org/tizen/emulator/manager/vms/VMWorkerCommon.java @@ -230,7 +230,7 @@ public class VMWorkerCommon { + baseImage.getAbsolutePath()); } - String exe_path = FilePathResources.getEmulatorQemuImgPath(property.getPropertyValue().version); + String exe_path = FilePathResources.getEmulatorQemuImgPath(); List cmd = new ArrayList(); cmd.add(exe_path); diff --git a/common-project/src/org/tizen/emulator/manager/vms/helper/QemuImgProc.java b/common-project/src/org/tizen/emulator/manager/vms/helper/QemuImgProc.java index da70ed2..cc7aba7 100644 --- a/common-project/src/org/tizen/emulator/manager/vms/helper/QemuImgProc.java +++ b/common-project/src/org/tizen/emulator/manager/vms/helper/QemuImgProc.java @@ -54,7 +54,7 @@ public class QemuImgProc { isError = false; ProcessBuilder pb = new ProcessBuilder(cmd); - pb.directory(new File(FilePathResources.getBinPath())); + pb.directory(new File(FilePathResources.getEmulatorToolPath())); try { Process process = pb.start(); if (process != null) { @@ -162,7 +162,7 @@ public class QemuImgProc { isError = false; ProcessBuilder pb = new ProcessBuilder(cmd); - pb.directory(new File(FilePathResources.getBinPath())); + pb.directory(new File(FilePathResources.getEmulatorToolPath())); try { Process process = pb.start(); if (process != null) { diff --git a/common-project/src/org/tizen/emulator/manager/vms/option/CommonOption.java b/common-project/src/org/tizen/emulator/manager/vms/option/CommonOption.java index 34fae55..04b7f8b 100644 --- a/common-project/src/org/tizen/emulator/manager/vms/option/CommonOption.java +++ b/common-project/src/org/tizen/emulator/manager/vms/option/CommonOption.java @@ -58,12 +58,13 @@ public class CommonOption extends Option { config.addQemuOption("-device virtconsole,chardev=con1"); } + String platformVersion = property.getPropertyValue().version; // bios - config.addVariable(VAR_BIOS_PATH, FilePathResources.getBiosPath()); + config.addVariable(VAR_BIOS_PATH, FilePathResources.getEmulatorBiosPath(platformVersion)); config.addQemuOption("-L", varForm(VAR_BIOS_PATH)); // kernel image - config.addVariable(VAR_KERNEL, FilePathResources.getKernelPath() + config.addVariable(VAR_KERNEL, FilePathResources.getEmulatorKernelPath(platformVersion) + File.separator + "bzImage." + property.getArch().toString()); config.addQemuOption("-kernel", varForm(VAR_KERNEL)); diff --git a/common-project/src/org/tizen/emulator/manager/vms/option/NetProxyOption.java b/common-project/src/org/tizen/emulator/manager/vms/option/NetProxyOption.java index 602127a..4213130 100644 --- a/common-project/src/org/tizen/emulator/manager/vms/option/NetProxyOption.java +++ b/common-project/src/org/tizen/emulator/manager/vms/option/NetProxyOption.java @@ -62,7 +62,7 @@ public class NetProxyOption extends Option { .getAdvancedOptionSubValue(ItemName.NET_PROXY, NetProxyViewItem.ITEM_PROXY_MODE); if (proxyMode.equals(NetProxyViewItem.MODE_AUTO)) { - proxyConfig = getHostProxy(); + proxyConfig = getHostProxy(property.getPropertyValue().version); } else if (proxyMode.equals(NetProxyViewItem.MODE_MANUAL)) { proxyConfig = "http_proxy=" @@ -86,14 +86,14 @@ public class NetProxyOption extends Option { } - private String getHostProxy() throws VMWorkerException { + private String getHostProxy(String platformVersion) throws VMWorkerException { String result = null; String proxyCommand = "check-net"; if (EmulatorManager.isWin()) { proxyCommand = "check-net.exe"; } - List cmd = Arrays.asList(FilePathResources.getBinPath() + List cmd = Arrays.asList(FilePathResources.getEmulatorToolPath() + File.separator + proxyCommand, "--proxy"); ProcessResult res = HelperClass.runProcess(cmd); boolean isCommandSuccess = false;