Refactorings in org.yocto.sdk.ide plugin
v2 cover Refactorings in org.yocto.sdk.ide plugin
From: Atanas Gegov <[email protected]>
Hi,
Currently the org.yocto.sdk.ide plugin has the YoctoSDKEmptyProjectNature and the YoctoSDKProjectNature. The latter is strongly coupled with the Autotools nature since this is by now the only supported build system. It would be nice if it is possible to introduce Yocto IDE projects, e.g. projects using CMake for building.
This patch series does some refactoring in the org.yocto.sdk.ide plugin. This allows a simplified addition of further natures and enables the decoupling between YoctoSDKProjectNature and the Autotools nature.
The natures and the utils get their own packages. Some methods and members were also moved to suitable classes.
Cheers,
Atanas
Atanas Gegov (5):
Moved YoctoSDK natures to their own package
Moved functionality that does not belong to YoctoSDKProjectNature Moved utils to their own package
Moved nature-related utils in own class
Export the new subpackages of org.yocto.sdk.ide
plugins/org.yocto.sdk.ide/META-INF/MANIFEST.MF | 2 + plugins/org.yocto.sdk.ide/plugin.xml | 4 +- .../src/org/yocto/sdk/ide/YoctoSDKChecker.java | 12 +- .../yocto/sdk/ide/YoctoSDKEmptyProjectNature.java | 38 - .../org/yocto/sdk/ide/YoctoSDKProjectNature.java | 267 ------- .../src/org/yocto/sdk/ide/YoctoSDKUtils.java | 623 ---------------- .../ide/natures/YoctoSDKEmptyProjectNature.java | 39 + .../yocto/sdk/ide/natures/YoctoSDKNatureUtils.java | 39 + .../sdk/ide/natures/YoctoSDKProjectNature.java | 111 +++ .../ide/preferences/YoctoSDKPreferencePage.java | 4 +- .../preferences/YoctoSDKProjectPropertyPage.java | 2 +- .../src/org/yocto/sdk/ide/utils/YoctoSDKUtils.java | 758 ++++++++++++++++++++ .../sdk/ide/utils/YoctoSDKUtilsConstants.java | 18 + .../sdk/ide/wizard/NewYoctoCProjectTemplate.java | 6 +- 14 files changed, 984 insertions(+), 939 deletions(-) delete mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKEmptyProjectNature.java delete mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKProjectNature.java delete mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtils.java create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKEmptyProjectNature.java create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKNatureUtils.java create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKProjectNature.java create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/utils/YoctoSDKUtils.java create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/utils/YoctoSDKUtilsConstants.java
Signature · 1 line
1.7.9.5
PATCH v2 1/5 Moved YoctoSDK natures to their own package
From: Atanas Gegov <[email protected]>
If further natures are added, they will fit into
this package and not overpopulate the org.yocto.sdk.ide package.
--- plugins/org.yocto.sdk.ide/plugin.xml | 4 +- .../src/org/yocto/sdk/ide/YoctoSDKChecker.java | 2 + .../yocto/sdk/ide/YoctoSDKEmptyProjectNature.java | 38 --- .../org/yocto/sdk/ide/YoctoSDKProjectNature.java | 267 ------------------- .../src/org/yocto/sdk/ide/YoctoSDKUtils.java | 1 + .../ide/natures/YoctoSDKEmptyProjectNature.java | 40 +++ .../sdk/ide/natures/YoctoSDKProjectNature.java | 275 ++++++++++++++++++++ .../ide/preferences/YoctoSDKPreferencePage.java | 2 +- .../sdk/ide/wizard/NewYoctoCProjectTemplate.java | 4 +- 9 files changed, 323 insertions(+), 310 deletions(-) delete mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKEmptyProjectNature.java delete mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKProjectNature.java create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKEmptyProjectNature.java create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKProjectNature.java
plugins/org.yocto.sdk.ide/plugin.xml +2 -2
@@ -24,7 +24,7 @@ </requires-nature> <runtime> <run - class="org.yocto.sdk.ide.YoctoSDKProjectNature"> + class="org.yocto.sdk.ide.natures.YoctoSDKProjectNature"> </run> </runtime> <builder
@@ -36,7 +36,7 @@ point="org.eclipse.core.resources.natures"> <runtime> <run - class="org.yocto.sdk.ide.YoctoSDKEmptyProjectNature"> + class="org.yocto.sdk.ide.natures.YoctoSDKEmptyProjectNature"> </run> </runtime> </extension>
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKChecker.java +2 -0
@@ -19,6 +19,8 @@ import java.io.FileReader; import java.io.FilenameFilter; import java.io.IOException; +import org.yocto.sdk.ide.natures.YoctoSDKProjectNature; + public class YoctoSDKChecker { private static final String[] saInvalidVer = {"1.0", "0.9", "0.9+"}; private static final String SYSROOTS_DIR = "sysroots";
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKEmptyProjectNature.java deleted +0 -38
@@ -1,38 +0,0 @@ -package org.yocto.sdk.ide; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IProjectNature; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; - -public class YoctoSDKEmptyProjectNature implements IProjectNature { - - public static final String YoctoSDK_EMPTY_NATURE_ID = YoctoSDKPlugin.getUniqueIdentifier() + ".YoctoSDKEmptyNature"; - - private IProject proj; - - public void configure() throws CoreException { - // TODO Auto-generated method stub - - } - - public void deconfigure() throws CoreException { - // TODO Auto-generated method stub - - } - - public IProject getProject() { - // TODO Auto-generated method stub - return proj; - } - - public void setProject(IProject project) { - // TODO Auto-generated method stub - this.proj = project; - } - - public static void addYoctoSDKEmptyNature(IProject project, IProgressMonitor monitor) throws CoreException { - YoctoSDKUtils.addNature(project, YoctoSDK_EMPTY_NATURE_ID, monitor); - } - -}
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKProjectNature.java deleted +0 -267
267 lines not on this page · raw message
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtils.java +1 -0
@@ -39,6 +39,7 @@ import org.eclipse.core.runtime.preferences.IEclipsePreferences; import org.eclipse.core.runtime.preferences.IScopeContext; import org.eclipse.jface.preference.IPreferenceStore; import org.osgi.service.prefs.BackingStoreException; +import org.yocto.sdk.ide.natures.YoctoSDKProjectNature; import org.yocto.sdk.ide.preferences.PreferenceConstants; public class YoctoSDKUtils {
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKEmptyProjectNature.java new file +40 -0
@@ -0,0 +1,40 @@ +package org.yocto.sdk.ide.natures; + +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IProjectNature; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; +import org.yocto.sdk.ide.YoctoSDKPlugin; +import org.yocto.sdk.ide.YoctoSDKUtils; + +public class YoctoSDKEmptyProjectNature implements IProjectNature { + + public static final String YoctoSDK_EMPTY_NATURE_ID = YoctoSDKPlugin.getUniqueIdentifier() + ".YoctoSDKEmptyNature"; + + private IProject proj; + + public void configure() throws CoreException { + // TODO Auto-generated method stub + + } + + public void deconfigure() throws CoreException { + // TODO Auto-generated method stub + + } + + public IProject getProject() { + // TODO Auto-generated method stub + return proj; + } + + public void setProject(IProject project) { + // TODO Auto-generated method stub + this.proj = project; + } + + public static void addYoctoSDKEmptyNature(IProject project, IProgressMonitor monitor) throws CoreException { + YoctoSDKUtils.addNature(project, YoctoSDK_EMPTY_NATURE_ID, monitor); + } + +}
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKProjectNature.java new file +275 -0
275 lines not on this page · raw message
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/YoctoSDKPreferencePage.java +1 -1
@@ -33,9 +33,9 @@ import org.yocto.sdk.ide.YoctoProfileElement; import org.yocto.sdk.ide.YoctoProfileSetting; import org.yocto.sdk.ide.YoctoSDKChecker.SDKCheckRequestFrom; import org.yocto.sdk.ide.YoctoSDKChecker.SDKCheckResults; +import org.yocto.sdk.ide.natures.YoctoSDKProjectNature; import org.yocto.sdk.ide.YoctoSDKMessages; import org.yocto.sdk.ide.YoctoSDKPlugin; -import org.yocto.sdk.ide.YoctoSDKProjectNature; import org.yocto.sdk.ide.YoctoSDKUtils; import org.yocto.sdk.ide.YoctoUIElement; import org.yocto.sdk.ide.YoctoUISetting;
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/wizard/NewYoctoCProjectTemplate.java +2 -2
@@ -46,9 +46,9 @@ import org.yocto.sdk.ide.YoctoProfileElement; import org.yocto.sdk.ide.YoctoSDKChecker; import org.yocto.sdk.ide.YoctoSDKChecker.SDKCheckRequestFrom; import org.yocto.sdk.ide.YoctoSDKChecker.SDKCheckResults; -import org.yocto.sdk.ide.YoctoSDKEmptyProjectNature; +import org.yocto.sdk.ide.natures.YoctoSDKEmptyProjectNature; +import org.yocto.sdk.ide.natures.YoctoSDKProjectNature; import org.yocto.sdk.ide.YoctoSDKPlugin; -import org.yocto.sdk.ide.YoctoSDKProjectNature; import org.yocto.sdk.ide.YoctoSDKUtils; import org.yocto.sdk.ide.YoctoUIElement;
Signature · 1 line
1.7.9.5
PATCH v2 2/5 Moved functionality that does not belong to YoctoSDKProjectNature
In reply to Atanas GegovFrom: Atanas Gegov <[email protected]>
This functionality is not directly connected to the YoctoSDKProjectNature itself. Moreover, it might also be used by other natures.Made a lot of constants private as they are used only locally. Globally used constants are moved in an own class.
--- .../src/org/yocto/sdk/ide/YoctoSDKChecker.java | 8 +- .../src/org/yocto/sdk/ide/YoctoSDKUtils.java | 153 +++++++++++++++++- .../org/yocto/sdk/ide/YoctoSDKUtilsConstants.java | 18 +++ .../sdk/ide/natures/YoctoSDKProjectNature.java | 166 +------------------- 4 files changed, 175 insertions(+), 170 deletions(-) create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtilsConstants.java
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKChecker.java +5 -3
@@ -24,6 +24,7 @@ import org.yocto.sdk.ide.natures.YoctoSDKProjectNature; public class YoctoSDKChecker { private static final String[] saInvalidVer = {"1.0", "0.9", "0.9+"}; private static final String SYSROOTS_DIR = "sysroots"; + private static final String SDK_VERSION = "OECORE_SDK_VERSION"; public static enum SDKCheckResults { SDK_PASS("", false),
@@ -148,10 +149,11 @@ public class YoctoSDKChecker { String sFileName; if (elem.getEnumPokyMode() == YoctoUIElement.PokyMode.POKY_SDK_MODE) { - sFileName = elem.getStrToolChainRoot()+"/" + YoctoSDKProjectNature.DEFAULT_ENV_FILE_PREFIX+elem.getStrTarget(); + sFileName = elem.getStrToolChainRoot()+"/" + YoctoSDKUtilsConstants.DEFAULT_ENV_FILE_PREFIX + elem.getStrTarget(); } else { //POKY TREE Mode - sFileName = elem.getStrToolChainRoot() + YoctoSDKProjectNature.DEFAULT_TMP_PREFIX + YoctoSDKProjectNature.DEFAULT_ENV_FILE_PREFIX + elem.getStrTarget(); + sFileName = elem.getStrToolChainRoot() + YoctoSDKUtilsConstants.DEFAULT_TMP_PREFIX + + YoctoSDKUtilsConstants.DEFAULT_ENV_FILE_PREFIX + elem.getStrTarget(); } try {
@@ -165,7 +167,7 @@ public class YoctoSDKChecker { String line = null; while ((line = input.readLine()) != null) { - if (line.startsWith("export "+ YoctoSDKProjectNature.SDK_VERSION)) { + if (line.startsWith("export "+ SDK_VERSION)) { int beginIndex = 2; String sVersion = ""; for (;;) {
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtils.java +151 -2
203 lines not on this page · raw message
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtilsConstants.java new file +18 -0
@@ -0,0 +1,18 @@ +/******************************************************************************* + * Copyright (c) 2013 BMW Car IT GmbH. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * BMW Car IT - initial API and implementation + *******************************************************************************/ +package org.yocto.sdk.ide; + +public class YoctoSDKUtilsConstants { + + public static final String DEFAULT_ENV_FILE_PREFIX = "environment-setup-"; + public static final String DEFAULT_TMP_PREFIX = "/tmp/"; + +}
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKProjectNature.java +1 -165
208 lines not on this page · raw message
Signature · 1 line
1.7.9.5
Re: [PATCHv2 2/5] Moved functionality that does not belong to YoctoSDKProjectNature
Hi Atanas,
When I tried to apply this patch, I'm getting following errors, can you verify your patch?
Thanks,
Jessica
Applying: Moved functionality that does not belong to YoctoSDKProjectNature /home/jzhang/eclipse-poky/.git/rebase-apply/patch:105: trailing whitespace.
"-I " + env.getVariable(NATIVE_SYSROOT, ccdesc).getValue() + "/usr/share/aclocal",/home/jzhang/eclipse-poky/.git/rebase-apply/patch:112: trailing whitespace.
/home/jzhang/eclipse-poky/.git/rebase-apply/patch:116: trailing whitespace.
/home/jzhang/eclipse-poky/.git/rebase-apply/patch:132: trailing whitespace.
ILaunchConfigurationType configType =/home/jzhang/eclipse-poky/.git/rebase-apply/patch:134: trailing whitespace.
ILaunchConfigurationType debug_configType =
error: patch failed: plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtils.java:14
error: plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtils.java: patch does not apply Patch failed at 0001 Moved functionality that does not belong to YoctoSDKProjectNature When you have resolved this problem run "git am --resolved".
If you would prefer to skip this patch, instead run "git am --skip".
To restore the original branch and stop patching run "git am --abort".
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Atanas Gegov
Sent: Wednesday, March 06, 2013 8:12 AM
To: [email protected]
Subject: [yocto] [PATCHv2 2/5] Moved functionality that does not belong to YoctoSDKProjectNature
From: Atanas Gegov <[email protected]>
This functionality is not directly connected to the YoctoSDKProjectNature itself. Moreover, it might also be used by other natures.Made a lot of constants private as they are used only locally. Globally used constants are moved in an own class.
--- .../src/org/yocto/sdk/ide/YoctoSDKChecker.java | 8 +- .../src/org/yocto/sdk/ide/YoctoSDKUtils.java | 153 +++++++++++++++++- .../org/yocto/sdk/ide/YoctoSDKUtilsConstants.java | 18 +++ .../sdk/ide/natures/YoctoSDKProjectNature.java | 166 +------------------- 4 files changed, 175 insertions(+), 170 deletions(-) create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtilsConstants.java
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKChecker.ja renamed from plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKChecker.java +0 -0
+++ va
@@ -24,6 +24,7 @@ import org.yocto.sdk.ide.natures.YoctoSDKProjectNature;
public class YoctoSDKChecker {
private static final String[] saInvalidVer = {"1.0", "0.9", "0.9+"};
private static final String SYSROOTS_DIR = "sysroots";+ private static final String SDK_VERSION = "OECORE_SDK_VERSION";
public static enum SDKCheckResults {
SDK_PASS("", false),
@@ -148,10 +149,11 @@ public class YoctoSDKChecker {
String sFileName;
if (elem.getEnumPokyMode() == YoctoUIElement.PokyMode.POKY_SDK_MODE) {
- sFileName = elem.getStrToolChainRoot()+"/" + YoctoSDKProjectNature.DEFAULT_ENV_FILE_PREFIX+elem.getStrTarget();
+ sFileName = elem.getStrToolChainRoot()+"/" +
+YoctoSDKUtilsConstants.DEFAULT_ENV_FILE_PREFIX + elem.getStrTarget();
} else {
//POKY TREE Mode
- sFileName = elem.getStrToolChainRoot() + YoctoSDKProjectNature.DEFAULT_TMP_PREFIX + YoctoSDKProjectNature.DEFAULT_ENV_FILE_PREFIX + elem.getStrTarget();
+ sFileName = elem.getStrToolChainRoot() + YoctoSDKUtilsConstants.DEFAULT_TMP_PREFIX +
+ YoctoSDKUtilsConstants.DEFAULT_ENV_FILE_PREFIX +
+elem.getStrTarget();
}
try {
@@ -165,7 +167,7 @@ public class YoctoSDKChecker {
String line = null;
while ((line = input.readLine()) != null) {
- if (line.startsWith("export "+ YoctoSDKProjectNature.SDK_VERSION)) {
+ if (line.startsWith("export "+ SDK_VERSION)) {
int beginIndex = 2;
String sVersion = "";
for (;;) {plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtils.java +16 -0
@@ -14,12 +14,17 @@ package org.yocto.sdk.ide; import java.io.BufferedReader; import java.io.File; import java.io.FileReader; +import java.io.FileWriter; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; +import java.util.ArrayList; import java.util.HashMap; +import java.util.HashSet; import java.util.Iterator; import java.util.Map; +import java.util.Set; +import java.util.StringTokenizer; import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.ConsoleOutputStream;
@@ -30,6 +35,8 @@ import org.eclipse.cdt.core.model.CoreModel; import org.eclipse.cdt.core.resources.IConsole; import org.eclipse.cdt.core.settings.model.ICConfigurationDescription; import org.eclipse.cdt.core.settings.model.ICProjectDescription; +import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants; +import org.eclipse.cdt.debug.mi.core.IMILaunchConfigurationConstants; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IProjectDescription; import org.eclipse.core.resources.ProjectScope;
@@ -37,8 +44,14 @@ import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.preferences.IEclipsePreferences; import org.eclipse.core.runtime.preferences.IScopeContext; +import org.eclipse.debug.core.DebugPlugin; +import org.eclipse.debug.core.ILaunchConfiguration; +import org.eclipse.debug.core.ILaunchConfigurationType; +import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; +import org.eclipse.debug.core.ILaunchManager; import org.eclipse.jface.preference.IPreferenceStore; import org.osgi.service.prefs.BackingStoreException; +import org.yocto.sdk.ide.natures.YoctoSDKEmptyProjectNature; import org.yocto.sdk.ide.natures.YoctoSDKProjectNature; import org.yocto.sdk.ide.preferences.PreferenceConstants;
@@ -49,6 +62,9 @@ public class YoctoSDKUtils { private static final String LIBTOOL_SYSROOT_PREFIX = "--with-libtool-sysroot="; private static final String CONSOLE_MESSAGE = "Menu.SDK.Console.Configure.Message"; + private static final String DEFAULT_USR_BIN = "/usr/bin/"; + private static final String NATIVE_SYSROOT = "OECORE_NATIVE_SYSROOT"; + public static String getEnvValue(IProject project, String strKey) { ICProjectDescription cpdesc = CoreModel.getDefault().getProjectDescription(project, true); @@ -181,13 +197,146 @@ public class YoctoSDKUtils {
}
//add ACLOCAL OPTS for libtool 2.4 support
env.addVariable("OECORE_ACLOCAL_OPTS",
- "-I " + env.getVariable(YoctoSDKProjectNature.NATIVE_SYSROOT, ccdesc).getValue() + "/usr/share/aclocal",
+ "-I " + env.getVariable(NATIVE_SYSROOT, ccdesc).getValue() +
+"/usr/share/aclocal",
IEnvironmentVariable.ENVVAR_REPLACE,
delimiter,
ccdesc);
return;
}+
+ public static void setEnvironmentVariables(IProject project, YoctoUIElement elem) throws YoctoGeneralException{
+ String sFileName;
+ ICProjectDescription cpdesc =
+CoreModel.getDefault().getProjectDescription(project, true); +
+
+ if (elem.getEnumPokyMode() == YoctoUIElement.PokyMode.POKY_SDK_MODE) {
+ sFileName = elem.getStrToolChainRoot()+"/" + YoctoSDKUtilsConstants.DEFAULT_ENV_FILE_PREFIX + elem.getStrTarget();
+ }
+ else {
+ //POKY TREE Mode
+ sFileName = elem.getStrToolChainRoot() + YoctoSDKUtilsConstants.DEFAULT_TMP_PREFIX +
+ YoctoSDKUtilsConstants.DEFAULT_ENV_FILE_PREFIX + elem.getStrTarget();
+ }
+
+ HashMap<String, String> envMap = parseEnvScript(sFileName);
+ setEnvVars(cpdesc, elem, envMap);
+
+ try {
+ ILaunchManager lManager = DebugPlugin.getDefault().getLaunchManager();
+ ILaunchConfigurationType configType =
+ lManager.getLaunchConfigurationType("org.eclipse.ui.externaltools.ProgramLaunchConfigurationType");
+ ILaunchConfigurationType debug_configType =
+ +lManager.getLaunchConfigurationType("org.eclipse.cdt.launch.remoteAppli +cationLaunchType");
+
+ String sPath = envMap.get("PATH");
+ String sDebugName = envMap.get("GDB");
+ String sysroot_str = elem.getStrSysrootLoc();
+ if (configType == null || debug_configType == null)+ throw new YoctoGeneralException("Failed to get program or remote debug launcher!");
+ createRemoteDebugLauncher(project, lManager, debug_configType,
+elem.getStrTarget(), sPath, sDebugName, sysroot_str); +
+ ArrayList<String> listValue = new ArrayList<String>();
+ listValue.add(new String("org.eclipse.ui.externaltools.launchGroup"));
+ if (elem.getEnumDeviceMode() == YoctoUIElement.DeviceMode.QEMU_MODE) {+ createQemuLauncher(project, configType, listValue, sFileName, elem);
+ }
+ CoreModel.getDefault().setProjectDescription(project,cpdesc);
+ } catch (CoreException e) {
+ e.printStackTrace();
+ }
+ }
+
+ protected static void createRemoteDebugLauncher(IProject project,
+ ILaunchManager lManager, ILaunchConfigurationType configType,
+ String sTargetTriplet, String strPath, String sDebugName, String sSysroot) {
+ try {
+
+ String sDebugSubDir = DEFAULT_USR_BIN + sTargetTriplet;
+ StringTokenizer token = new StringTokenizer(strPath, ":");
+ String strDebugger = "";
+ while (token.hasMoreTokens())
+ {+ String sTemp = token.nextToken();
+ if (sTemp.endsWith(sDebugSubDir)) {
+ strDebugger = sTemp + "/" + sDebugName;
+ break;
+ }
+ }
+ if (strDebugger.isEmpty())
+ return;
+ //If get default Debugger successfully, go ahead!
+
+ //create the gdbinit file
+ String sDebugInitFile = project.getLocation().toString() + "/.gdbinit";
+ FileWriter out = new FileWriter(new File(sDebugInitFile));
+ out.write("set sysroot " + sSysroot);
+ out.flush();
+ out.close();
+
+ //set the launch configuration
+ String projectName = project.getName();
+ String configName = projectName+"_gdb_"+sTargetTriplet;
+ int i;
+ ILaunchConfiguration[] configs=lManager.getLaunchConfigurations(configType);
+ for(i=0; i<configs.length; i++)
+ { //delete the old configuration+ ILaunchConfiguration config=configs[i];
+ if(config.getName().equals(configName)) {
+ config.delete();
+ break;
+ }
+ }
+ ILaunchConfigurationWorkingCopy w_copy = configType.newInstance(project, configName);
+ Set<String> modes=new HashSet<String>();
+ modes.add("debug");
+ w_copy.setPreferredLaunchDelegate(modes, "org.eclipse.rse.remotecdt.launch");
+ w_copy.setAttribute(IMILaunchConfigurationConstants.ATTR_GDB_INIT, sDebugInitFile);
+ w_copy.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_AUTO_SOLIB, false);
+ w_copy.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, strDebugger);
+ w_copy.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_PROTOCOL, "mi");
+ //TWEAK avoid loading default values in org.eclipse.cdt.launch.remote.tabs.RemoteCDebuggerTab
+ w_copy.setAttribute("org.eclipse.cdt.launch.remote.RemoteCDSFDebuggerTab.DEFAULTS_SET",true);
+ w_copy.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, projectName);
+ if(!project.hasNature(YoctoSDKEmptyProjectNature.YoctoSDK_EMPTY_NATURE_ID))
+ {+ String project_src = "src/"+projectName;
+ w_copy.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, project_src);
+ }
+
+ w_copy.doSave();
+ }
+ catch (CoreException e)
+ {
+ System.out.println(e.getMessage());
+ }
+ catch (IOException e)
+ {+ System.out.println("Failed to generate debug init file!");
+ System.out.println(e.getMessage());
+ }
+ }
+
+ protected static void createQemuLauncher(IProject project,
+ ILaunchConfigurationType configType,
+ ArrayList<String> listValue, String sScriptFile,
+ YoctoUIElement elem) {+ try {
+
+ ILaunchConfigurationWorkingCopy w_copy =
+configType.newInstance(null, "qemu_"+elem.getStrTarget()); +
+ w_copy.setAttribute("org.eclipse.debug.ui.favoriteGroups", listValue);
+ w_copy.setAttribute("org.eclipse.ui.externaltools.ATTR_LOCATION",
+"/usr/bin/xterm");
+
+ String argument = "-e \"source " + sScriptFile + ";runqemu " + YoctoSDKUtils.qemuTargetTranslate(elem.getStrTarget()) + " "+
+ elem.getStrQemuKernelLoc() + " " + elem.getStrSysrootLoc() + " " +
+elem.getStrQemuOption() + ";bash\"";
+
+ w_copy.setAttribute("org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS", argument);
+ w_copy.doSave();
+ } catch (CoreException e) {
+ }
+
+ }
/* Get POKY Preference settings from project's preference store */
public static YoctoUIElement getElemFromProjectPreferences(IProject project) @@ -289,7 +438,7 @@ public class YoctoSDKUtils {
ConsoleOutputStream consoleOutStream = null;
try {
- YoctoSDKProjectNature.setEnvironmentVariables(project, elem);
+ setEnvironmentVariables(project, elem);
YoctoSDKProjectNature.configureAutotoolsOptions(project);
IConsole console = CCorePlugin.getDefault().getConsole("org.yocto.sdk.ide.YoctoConsole");
console.start(project);plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtilsConst new file +0 -0
+++ ants.java
@@ -0,0 +1,18 @@ +/**********************************************************************
+*********
+ * Copyright (c) 2013 BMW Car IT GmbH.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License +v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BMW Car IT - initial API and implementation
+***********************************************************************
+********/
+package org.yocto.sdk.ide;
+
+public class YoctoSDKUtilsConstants {
+
+ public static final String DEFAULT_ENV_FILE_PREFIX = "environment-setup-";
+ public static final String DEFAULT_TMP_PREFIX = "/tmp/";
+
+}
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKPr renamed from plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKProjectNature.java +0 -0
+++ ojectNature.java
@@ -10,19 +10,6 @@
*******************************************************************************/
package org.yocto.sdk.ide.natures;
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Set;
-import java.util.StringTokenizer;
-
-import org.eclipse.cdt.core.model.CoreModel;
-import org.eclipse.cdt.core.settings.model.ICProjectDescription;
-import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
-import org.eclipse.cdt.debug.mi.core.IMILaunchConfigurationConstants;
import org.eclipse.cdt.internal.autotools.core.configure.AutotoolsConfigurationManager;
import org.eclipse.cdt.internal.autotools.core.configure.IAConfiguration;
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
@@ -32,11 +19,6 @@ import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IProjectNature;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.debug.core.ILaunchConfigurationType;
-import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
-import org.eclipse.debug.core.ILaunchManager;
import org.eclipse.jface.preference.IPreferenceStore;
import org.yocto.sdk.ide.YoctoGeneralException;
import org.yocto.sdk.ide.YoctoProfileElement;
@@ -46,26 +28,17 @@ import org.yocto.sdk.ide.YoctoSDKUtils; import org.yocto.sdk.ide.YoctoUIElement; import org.yocto.sdk.ide.YoctoSDKChecker.SDKCheckRequestFrom;
import org.yocto.sdk.ide.YoctoSDKChecker.SDKCheckResults;
-import org.yocto.sdk.ide.YoctoUIElement.DeviceMode;
-import org.yocto.sdk.ide.YoctoUIElement.PokyMode;
@SuppressWarnings("restriction")
public class YoctoSDKProjectNature implements IProjectNature {
public static final String YoctoSDK_NATURE_ID = YoctoSDKPlugin.getUniqueIdentifier() + ".YoctoSDKNature";
- private static final String DEFAULT_USR_BIN = "/usr/bin/";
- public static final String DEFAULT_ENV_FILE_PREFIX = "environment-setup-";
- public static final String DEFAULT_TMP_PREFIX = "/tmp/";
- public static final String NATIVE_SYSROOT = "OECORE_NATIVE_SYSROOT";
- public static final String SDK_VERSION = "OECORE_SDK_VERSION";
-
private static final String DEFAULT_HOST_STR = "host";
private static final String DEFAULT_TARGET_STR = "target";
private static final String DEFAULT_BUILD_STR = "build";
private static final String DEFAULT_AUTOGEN_OPT_STR = "autogenOpts";-
private static final String DEFAULT_CONFIGURE_STR = "configure";
private static final String DEFAULT_AUTOGEN_STR = "autogen";
private static final String DEFAULT_LIBTOOL_SYSROOT_PREFIX = " --with-libtool-sysroot="; @@ -90,48 +63,6 @@ public class YoctoSDKProjectNature implements IProjectNature {
YoctoSDKUtils.addNature(project, YoctoSDK_NATURE_ID, monitor);
}-
- public static void setEnvironmentVariables(IProject project, YoctoUIElement elem) throws YoctoGeneralException{
- String sFileName;
- ICProjectDescription cpdesc = CoreModel.getDefault().getProjectDescription(project, true);
-
-
- if (elem.getEnumPokyMode() == YoctoUIElement.PokyMode.POKY_SDK_MODE) {
- sFileName = elem.getStrToolChainRoot()+"/" + DEFAULT_ENV_FILE_PREFIX+elem.getStrTarget();
- }
- else {
- //POKY TREE Mode
- sFileName = elem.getStrToolChainRoot() + DEFAULT_TMP_PREFIX + DEFAULT_ENV_FILE_PREFIX + elem.getStrTarget();
- }
-
- HashMap<String, String> envMap = YoctoSDKUtils.parseEnvScript(sFileName);
- YoctoSDKUtils.setEnvVars(cpdesc, elem, envMap);
-
- try {
- ILaunchManager lManager = DebugPlugin.getDefault().getLaunchManager();
- ILaunchConfigurationType configType =
- lManager.getLaunchConfigurationType("org.eclipse.ui.externaltools.ProgramLaunchConfigurationType");
- ILaunchConfigurationType debug_configType =
- lManager.getLaunchConfigurationType("org.eclipse.cdt.launch.remoteApplicationLaunchType");
-
- String sPath = envMap.get("PATH");
- String sDebugName = envMap.get("GDB");
- String sysroot_str = elem.getStrSysrootLoc();
- if (configType == null || debug_configType == null)
- throw new YoctoGeneralException("Failed to get program or remote debug launcher!");
- createRemoteDebugLauncher(project, lManager, debug_configType, elem.getStrTarget(), sPath, sDebugName, sysroot_str);
-
- ArrayList<String> listValue = new ArrayList<String>();
- listValue.add(new String("org.eclipse.ui.externaltools.launchGroup"));
- if (elem.getEnumDeviceMode() == YoctoUIElement.DeviceMode.QEMU_MODE) {- createQemuLauncher(project, configType, listValue, sFileName, elem);
- }
- CoreModel.getDefault().setProjectDescription(project,cpdesc);
- } catch (CoreException e) {
- e.printStackTrace();
- }
- }
-
public static void configureAutotoolsOptions(IProject project) {
IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project);
IConfiguration icfg = info.getDefaultConfiguration(); @@ -173,103 +104,8 @@ public class YoctoSDKProjectNature implements IProjectNature {
}
else
{
- setEnvironmentVariables(project, elem);
+ YoctoSDKUtils.setEnvironmentVariables(project, elem);
configureAutotoolsOptions(project);
}
}-
- protected static void createRemoteDebugLauncher(IProject project,
- ILaunchManager lManager, ILaunchConfigurationType configType,
- String sTargetTriplet, String strPath, String sDebugName, String sSysroot) {
- try {
-
- String sDebugSubDir = DEFAULT_USR_BIN + sTargetTriplet;
- StringTokenizer token = new StringTokenizer(strPath, ":");
- String strDebugger = "";
- while (token.hasMoreTokens())
- {- String sTemp = token.nextToken();
- if (sTemp.endsWith(sDebugSubDir)) {
- strDebugger = sTemp + "/" + sDebugName;
- break;
- }
- }
- if (strDebugger.isEmpty())
- return;
- //If get default Debugger successfully, go ahead!
-
- //create the gdbinit file
- String sDebugInitFile = project.getLocation().toString() + "/.gdbinit";
- FileWriter out = new FileWriter(new File(sDebugInitFile));
- out.write("set sysroot " + sSysroot);
- out.flush();
- out.close();
-
- //set the launch configuration
- String projectName = project.getName();
- String configName = projectName+"_gdb_"+sTargetTriplet;
- int i;
- ILaunchConfiguration[] configs=lManager.getLaunchConfigurations(configType);
- for(i=0; i<configs.length; i++)
- { //delete the old configuration- ILaunchConfiguration config=configs[i];
- if(config.getName().equals(configName)) {
- config.delete();
- break;
- }
- }
- ILaunchConfigurationWorkingCopy w_copy = configType.newInstance(project, configName);
- Set<String> modes=new HashSet<String>();
- modes.add("debug");
- w_copy.setPreferredLaunchDelegate(modes, "org.eclipse.rse.remotecdt.launch");
- w_copy.setAttribute(IMILaunchConfigurationConstants.ATTR_GDB_INIT, sDebugInitFile);
- w_copy.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_AUTO_SOLIB, false);
- w_copy.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, strDebugger);
- w_copy.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_PROTOCOL, "mi");
- //TWEAK avoid loading default values in org.eclipse.cdt.launch.remote.tabs.RemoteCDebuggerTab
- w_copy.setAttribute("org.eclipse.cdt.launch.remote.RemoteCDSFDebuggerTab.DEFAULTS_SET",true);
- w_copy.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, projectName);
- if(!project.hasNature(YoctoSDKEmptyProjectNature.YoctoSDK_EMPTY_NATURE_ID))
- {- String project_src = "src/"+projectName;
- w_copy.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, project_src);
- }
-
- w_copy.doSave();
- }
- catch (CoreException e)
- {
- System.out.println(e.getMessage());
- }
- catch (IOException e)
- {- System.out.println("Failed to generate debug init file!");
- System.out.println(e.getMessage());
- }
-
-
- }
-
- protected static void createQemuLauncher(IProject project,
- ILaunchConfigurationType configType,
- ArrayList<String> listValue, String sScriptFile,
- YoctoUIElement elem) {- try {
-
- ILaunchConfigurationWorkingCopy w_copy = configType.newInstance(null, "qemu_"+elem.getStrTarget());
-
- w_copy.setAttribute("org.eclipse.debug.ui.favoriteGroups", listValue);
- w_copy.setAttribute("org.eclipse.ui.externaltools.ATTR_LOCATION", "/usr/bin/xterm");
-
- String argument = "-e \"source " + sScriptFile + ";runqemu " + YoctoSDKUtils.qemuTargetTranslate(elem.getStrTarget()) + " "+
- elem.getStrQemuKernelLoc() + " " + elem.getStrSysrootLoc() + " " + elem.getStrQemuOption() + ";bash\"";
-
- w_copy.setAttribute("org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS", argument);
- w_copy.doSave();
- } catch (CoreException e) {
- }
-
- }
-
-
}
--
1.7.9.5
_______________________________________________
yocto mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/yocto
Re: [PATCHv2 2/5] Moved functionality that does not belong to YoctoSDKProjectNature
Hi Jessica,
sorry for the mistake, I will resend the patches and they should apply on the current master "Use bash instead of sh for yocto-bsp build directory" (bad4d9e9befcf6d8595dcd1886a3523ba0ea031a).
Best regards,
Atanas
Quoted 708 lines · Jessica
Hi Atanas,
When I tried to apply this patch, I'm getting following errors, can you verify your patch?
Thanks,
JessicaApplying: Moved functionality that does not belong to YoctoSDKProjectNature
/home/jzhang/eclipse-poky/.git/rebase-apply/patch:105: trailing whitespace.
"-I " + env.getVariable(NATIVE_SYSROOT,
ccdesc).getValue() + "/usr/share/aclocal",/home/jzhang/eclipse-poky/.git/rebase-apply/patch:112: trailing whitespace.
/home/jzhang/eclipse-poky/.git/rebase-apply/patch:116: trailing whitespace.
/home/jzhang/eclipse-poky/.git/rebase-apply/patch:132: trailing whitespace.
ILaunchConfigurationType configType =/home/jzhang/eclipse-poky/.git/rebase-apply/patch:134: trailing whitespace.
ILaunchConfigurationTypedebug_configType=
error: patch failed:
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtils.java:14
error: plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtils.java:
patch does not apply
Patch failed at 0001 Moved functionality that does not belong to YoctoSDKProjectNature
When you have resolved this problem run "git am --resolved".
If you would prefer to skip this patch, instead run "git am --skip". To restore the original branch and stop patching run "git am --abort".-----Original Message-----
From: [email protected] [mailto:
[email protected]] On Behalf Of Atanas Gegov
Sent: Wednesday, March 06, 2013 8:12 AM
To: [email protected]
Subject: [yocto] [PATCHv2 2/5] Moved functionality that does not belong to YoctoSDKProjectNatureFrom: Atanas Gegov <[email protected]>
This functionality is not directly connected to the YoctoSDKProjectNature itself. Moreover, it might also be used by other natures.Made a lot of constants private as they are used only locally. Globally used constants are moved in an own class.
--- .../src/org/yocto/sdk/ide/YoctoSDKChecker.java | 8 +- .../src/org/yocto/sdk/ide/YoctoSDKUtils.java | 153 +++++++++++++++++- .../org/yocto/sdk/ide/YoctoSDKUtilsConstants.java | 18 +++ .../sdk/ide/natures/YoctoSDKProjectNature.java | 166 +------------------- 4 files changed, 175 insertions(+), 170 deletions(-) create mode 100644plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtilsConstants.java
diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKChecker.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKChecker.java index 3047641..bab6ade 100644
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKChecker.ja renamed from plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKChecker.java +2
-0+++ va@@ -24,6 +24,7 @@ import org.yocto.sdk.ide.natures.YoctoSDKProjectNature; public class YoctoSDKChecker { private static final String[] saInvalidVer = {"1.0", "0.9", "0.9+"}; private static final String SYSROOTS_DIR = "sysroots"; + private static final String SDK_VERSION = "OECORE_SDK_VERSION"; public static enum SDKCheckResults {SDK_PASS("", false),plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKChecker.ja renamed from plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKChecker.java +4
-2@@ -148,10 +149,11 @@ public class YoctoSDKChecker { String sFileName; if (elem.getEnumPokyMode() == YoctoUIElement.PokyMode.POKY_SDK_MODE) { - sFileName = elem.getStrToolChainRoot()+"/" + YoctoSDKProjectNature.DEFAULT_ENV_FILE_PREFIX+elem.getStrTarget(); + sFileName = elem.getStrToolChainRoot()+"/" + +YoctoSDKUtilsConstants.DEFAULT_ENV_FILE_PREFIX + elem.getStrTarget(); } else { //POKY TREE Mode - sFileName = elem.getStrToolChainRoot() +YoctoSDKProjectNature.DEFAULT_TMP_PREFIX + YoctoSDKProjectNature.DEFAULT_ENV_FILE_PREFIX +
elem.getStrTarget();
+ sFileName =elem.getStrToolChainRoot()+
YoctoSDKUtilsConstants.DEFAULT_TMP_PREFIX +
+
YoctoSDKUtilsConstants.DEFAULT_ENV_FILE_PREFIX +plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKChecker.ja renamed from plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKChecker.java +2
-1+elem.getStrTarget(); } try {@@ -165,7 +167,7 @@ public class YoctoSDKChecker { String line = null; while ((line = input.readLine()) != null) { - if (line.startsWith("export "+ YoctoSDKProjectNature.SDK_VERSION)) { + if (line.startsWith("export "+ SDK_VERSION)) {int
beginIndex = 2;
StringsVersion = ""; for (;;) {diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtils.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtils.java index ae95bcf..5b957d2 100644
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtils.java +16
-0@@ -14,12 +14,17 @@ package org.yocto.sdk.ide; import java.io.BufferedReader; import java.io.File; import java.io.FileReader; +import java.io.FileWriter; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; +import java.util.ArrayList; import java.util.HashMap; +import java.util.HashSet; import java.util.Iterator; import java.util.Map; +import java.util.Set; +import java.util.StringTokenizer; import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.ConsoleOutputStream;@@ -30,6 +35,8 @@ import org.eclipse.cdt.core.model.CoreModel; import org.eclipse.cdt.core.resources.IConsole; import org.eclipse.cdt.core.settings.model.ICConfigurationDescription; import org.eclipse.cdt.core.settings.model.ICProjectDescription; +import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants; +import org.eclipse.cdt.debug.mi.core.IMILaunchConfigurationConstants; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IProjectDescription; import org.eclipse.core.resources.ProjectScope;@@ -37,8 +44,14 @@ import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.preferences.IEclipsePreferences; import org.eclipse.core.runtime.preferences.IScopeContext; +import org.eclipse.debug.core.DebugPlugin; +import org.eclipse.debug.core.ILaunchConfiguration; +import org.eclipse.debug.core.ILaunchConfigurationType; +import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; +import org.eclipse.debug.core.ILaunchManager; import org.eclipse.jface.preference.IPreferenceStore; import org.osgi.service.prefs.BackingStoreException; +import org.yocto.sdk.ide.natures.YoctoSDKEmptyProjectNature; import org.yocto.sdk.ide.natures.YoctoSDKProjectNature; import org.yocto.sdk.ide.preferences.PreferenceConstants;@@ -49,6 +62,9 @@ public class YoctoSDKUtils { private static final String LIBTOOL_SYSROOT_PREFIX = "--with-libtool-sysroot="; private static final String CONSOLE_MESSAGE = "Menu.SDK.Console.Configure.Message"; + private static final String DEFAULT_USR_BIN = "/usr/bin/"; + private static final String NATIVE_SYSROOT = "OECORE_NATIVE_SYSROOT"; +public static String
getEnvValue(IProject project, String strKey){
ICProjectDescription cpdesc =
CoreModel.getDefault().getProjectDescription(project, true); @@ -181,13+197,146 @@ public class YoctoSDKUtils { } //add ACLOCAL OPTS for libtool 2.4 support env.addVariable("OECORE_ACLOCAL_OPTS",- "-I " +
env.getVariable(YoctoSDKProjectNature.NATIVE_SYSROOT, ccdesc).getValue() + "/usr/share/aclocal",
+ "-I " + env.getVariable(NATIVE_SYSROOT,
ccdesc).getValue() +
+"/usr/share/aclocal",IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc); return; }plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtils.java +2
-0+ + public static void setEnvironmentVariables(IProject project,YoctoUIElement elem) throws YoctoGeneralException{
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtils.java +6
-0+ String sFileName; + ICProjectDescription cpdesc = +CoreModel.getDefault().getProjectDescription(project, true); + + + if (elem.getEnumPokyMode() ==YoctoUIElement.PokyMode.POKY_SDK_MODE) {
+ sFileName = elem.getStrToolChainRoot()+"/" +
YoctoSDKUtilsConstants.DEFAULT_ENV_FILE_PREFIX +elem.getStrTarget();plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtils.java +4
-0+ } + else { + //POKY TREE Mode + sFileName = elem.getStrToolChainRoot() +YoctoSDKUtilsConstants.DEFAULT_TMP_PREFIX +
+
YoctoSDKUtilsConstants.DEFAULT_ENV_FILE_PREFIX +elem.getStrTarget();plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtils.java +7
-0+ } + + HashMap<String, String> envMap = parseEnvScript(sFileName); + setEnvVars(cpdesc, elem, envMap); + + try { + ILaunchManager lManager =DebugPlugin.getDefault().getLaunchManager();
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtils.java +2
-0+ ILaunchConfigurationType configType = +
lManager.getLaunchConfigurationType("org.eclipse.ui.externaltools.ProgramLaunchConfigurationType");plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtils.java +10
-0+ ILaunchConfigurationType debug_configType = + +lManager.getLaunchConfigurationType("org.eclipse.cdt.launch.remoteAppli +cationLaunchType"); + + String sPath = envMap.get("PATH"); + String sDebugName = envMap.get("GDB"); + String sysroot_str = elem.getStrSysrootLoc(); + if (configType == null || debug_configType == null) + throw new YoctoGeneralException("Failed toget program or remote debug launcher!");
+ createRemoteDebugLauncher(project, lManager,debug_configType,plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtils.java +3
-0+elem.getStrTarget(), sPath, sDebugName, sysroot_str); + + ArrayList<String> listValue = newArrayList<String>();
+ listValue.add(newString("org.eclipse.ui.externaltools.launchGroup"));
+ if (elem.getEnumDeviceMode()==
YoctoUIElement.DeviceMode.QEMU_MODE) {
+ createQemuLauncher(project, configType,
listValue, sFileName, elem);plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtils.java +2
-0+ } +CoreModel.getDefault().setProjectDescription(project,cpdesc);
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtils.java +7
-0+ } catch (CoreException e) { + e.printStackTrace(); + } + } + + protected static void createRemoteDebugLauncher(IProject project, + ILaunchManager lManager, ILaunchConfigurationTypeconfigType,
+ String sTargetTriplet, String strPath, String
sDebugName, String sSysroot) {plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtils.java +3
-0+ try { + + String sDebugSubDir = DEFAULT_USR_BIN +sTargetTriplet;
+ StringTokenizer token = newStringTokenizer(strPath, ":");plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtils.java +6
-0+ String strDebugger = ""; + while (token.hasMoreTokens()) + { + String sTemp = token.nextToken(); + if (sTemp.endsWith(sDebugSubDir)) { + strDebugger = sTemp + "/" +sDebugName;
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtils.java +9
-0+ break; + } + } + if (strDebugger.isEmpty()) + return; + //If get default Debugger successfully, go ahead! + + //create the gdbinit file + String sDebugInitFile =project.getLocation().toString() + "/.gdbinit";
+ FileWriter out = new FileWriter(new
File(sDebugInitFile));plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtils.java +7
-0+ out.write("set sysroot " + sSysroot); + out.flush(); + out.close(); + + //set the launch configuration + String projectName = project.getName(); + String configName =projectName+"_gdb_"+sTargetTriplet;
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtils.java +2
-0+ int i; + ILaunchConfiguration[]configs=lManager.getLaunchConfigurations(configType);
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtils.java +9
-0+ for(i=0; i<configs.length; i++) + { //delete the old configuration + ILaunchConfiguration config=configs[i]; + if(config.getName().equals(configName)) { + config.delete(); + break; + } + } + ILaunchConfigurationWorkingCopy w_copy =
configType.newInstance(project, configName);plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtils.java +3
-0+ Set<String> modes=new HashSet<String>(); + modes.add("debug"); + w_copy.setPreferredLaunchDelegate(modes,"org.eclipse.rse.remotecdt.launch");
+w_copy.setAttribute(IMILaunchConfigurationConstants.ATTR_GDB_INIT, sDebugInitFile);
+w_copy.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_AUTO_SOLIB, false);
+w_copy.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, strDebugger);
+w_copy.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_PROTOCOL, "mi");
+ //TWEAK avoid loading default values in
org.eclipse.cdt.launch.remote.tabs.RemoteCDebuggerTab
+w_copy.setAttribute("org.eclipse.cdt.launch.remote.RemoteCDSFDebuggerTab.DEFAULTS_SET",true); +w_copy.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, projectName);
+
if(!project.hasNature(YoctoSDKEmptyProjectNature.YoctoSDK_EMPTY_NATURE_ID))plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtils.java +3
-0+ { + String project_src = "src/"+projectName; +
w_copy.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, project_src);plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtils.java +11
-0+ } + + w_copy.doSave(); + } + catch (CoreException e) + { + System.out.println(e.getMessage()); + } + catch (IOException e) + { + System.out.println("Failed to generate debug initfile!");
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtils.java +14
-0+ System.out.println(e.getMessage()); + } + } + + protected static void createQemuLauncher(IProject project, + ILaunchConfigurationType configType, + ArrayList<String> listValue, String sScriptFile, + YoctoUIElement elem) { + try { + + ILaunchConfigurationWorkingCopy w_copy = +configType.newInstance(null, "qemu_"+elem.getStrTarget()); + +
w_copy.setAttribute("org.eclipse.debug.ui.favoriteGroups", listValue); +w_copy.setAttribute("org.eclipse.ui.externaltools.ATTR_LOCATION", +"/usr/bin/xterm");plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtils.java +2
-0+ + String argument = "-e \"source " + sScriptFile +";runqemu " + YoctoSDKUtils.qemuTargetTranslate(elem.getStrTarget()) + " "+
+elem.getStrQemuKernelLoc()+ " " +elem.getStrSysrootLoc()+ " " +plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtils.java +3
-0+elem.getStrQemuOption() + ";bash\""; + +
w_copy.setAttribute("org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS", argument);plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtils.java +5
-0+ w_copy.doSave(); + } catch (CoreException e) { + } + + } /* Get POKY Preference settings from project's preference store */ public static YoctoUIElementgetElemFromProjectPreferences(IProject project) @@ -289,7 +438,7 @@ public
class YoctoSDKUtils { ConsoleOutputStream consoleOutStream = null; try {-
YoctoSDKProjectNature.setEnvironmentVariables(project, elem);
+setEnvironmentVariables(project, elem);
YoctoSDKProjectNature.configureAutotoolsOptions(project);
IConsole console =CCorePlugin.getDefault().getConsole("org.yocto.sdk.ide.YoctoConsole"); console.start(project);diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtilsConstants.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtilsConstants.java new file mode 100644
index 0000000..2ead684plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtilsConst new file +19
-0+++ ants.java@@ -0,0 +1,18 @@ +/********************************************************************** +********* + * Copyright (c) 2013 BMW Car IT GmbH. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License +v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * BMW Car IT - initial API and implementation +*********************************************************************** +********/ +package org.yocto.sdk.ide; + +public class YoctoSDKUtilsConstants { + + public static final String DEFAULT_ENV_FILE_PREFIX ="environment-setup-";
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtilsConst new file +3
-0+ public static final String DEFAULT_TMP_PREFIX = "/tmp/"; + +}diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKProjectNature.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKProjectNature.java index 72237f4..3c842bf 100644
---
a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKProjectNature.java +++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKPr +++ ojectNature.javaplugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtilsConst new file +0
-13@@ -10,19 +10,6 @@ *******************************************************************************/ package org.yocto.sdk.ide.natures; -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Set; -import java.util.StringTokenizer; - -import org.eclipse.cdt.core.model.CoreModel; -import org.eclipse.cdt.core.settings.model.ICProjectDescription; -import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants; -import org.eclipse.cdt.debug.mi.core.IMILaunchConfigurationConstants; import org.eclipse.cdt.internal.autotools.core.configure.AutotoolsConfigurationManager;import org.eclipse.cdt.internal.autotools.core.configure.IAConfiguration; import org.eclipse.cdt.managedbuilder.core.IConfiguration;
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtilsConst new file +0
-5@@ -32,11 +19,6 @@ import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IProjectNature; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.debug.core.DebugPlugin; -import org.eclipse.debug.core.ILaunchConfiguration; -import org.eclipse.debug.core.ILaunchConfigurationType; -import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; -import org.eclipse.debug.core.ILaunchManager; import org.eclipse.jface.preference.IPreferenceStore; import org.yocto.sdk.ide.YoctoGeneralException; import org.yocto.sdk.ide.YoctoProfileElement;@@ -46,26 +28,17 @@ import org.yocto.sdk.ide.YoctoSDKUtils; importorg.yocto.sdk.ide.YoctoUIElement; import org.yocto.sdk.ide.YoctoSDKChecker.SDKCheckRequestFrom;
import org.yocto.sdk.ide.YoctoSDKChecker.SDKCheckResults;plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtilsConst new file +0
-2-import org.yocto.sdk.ide.YoctoUIElement.DeviceMode; -import org.yocto.sdk.ide.YoctoUIElement.PokyMode; @SuppressWarnings("restriction") public class YoctoSDKProjectNature implements IProjectNature { public static final String YoctoSDK_NATURE_ID =
YoctoSDKPlugin.getUniqueIdentifier()+ ".YoctoSDKNature";plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtilsConst new file +0
-2- private static final String DEFAULT_USR_BIN = "/usr/bin/"; - public static final String DEFAULT_ENV_FILE_PREFIX ="environment-setup-";
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtilsConst new file +0
-2- public static final String DEFAULT_TMP_PREFIX = "/tmp/"; - public static final String NATIVE_SYSROOT ="
OECORE_NATIVE_SYSROOT";plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtilsConst new file +0
-2- public static final String SDK_VERSION = "OECORE_SDK_VERSION"; - private static final String DEFAULT_HOST_STR = "host"; private static final String DEFAULT_TARGET_STR = "target"; private static final String DEFAULT_BUILD_STR = "build"; private static final String DEFAULT_AUTOGEN_OPT_STR ="autogenOpts";
-
private static final String DEFAULT_CONFIGURE_STR = "configure"; private static final String DEFAULT_AUTOGEN_STR = "autogen"; private static final String DEFAULT_LIBTOOL_SYSROOT_PREFIX = " --with-libtool-sysroot="; @@ -90,48 +63,6 @@ public class YoctoSDKProjectNature implements IProjectNature { YoctoSDKUtils.addNature(project, YoctoSDK_NATURE_ID, monitor); }plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtilsConst new file +0
-2- - public static void setEnvironmentVariables(IProject project,YoctoUIElement elem) throws YoctoGeneralException{
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtilsConst new file +0
-2- String sFileName; - ICProjectDescription cpdesc =CoreModel.getDefault().getProjectDescription(project, true);
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtilsConst new file +0
-3- - - if (elem.getEnumPokyMode() ==YoctoUIElement.PokyMode.POKY_SDK_MODE) {
- sFileName = elem.getStrToolChainRoot()+"/" +
DEFAULT_ENV_FILE_PREFIX+elem.getStrTarget();plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtilsConst new file +0
-4- } - else { - //POKY TREE Mode - sFileName = elem.getStrToolChainRoot() +
DEFAULT_TMP_PREFIX+DEFAULT_ENV_FILE_PREFIX+elem.getStrTarget();plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtilsConst new file +0
-3- } - - HashMap<String, String> envMap =
YoctoSDKUtils.parseEnvScript(sFileName);plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtilsConst new file +0
-4- YoctoSDKUtils.setEnvVars(cpdesc, elem, envMap); - - try { - ILaunchManager lManager =DebugPlugin.getDefault().getLaunchManager();
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtilsConst new file +0
-2- ILaunchConfigurationType configType = -
lManager.getLaunchConfigurationType("org.eclipse.ui.externaltools.ProgramLaunchConfigurationType");plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtilsConst new file +0
-2- ILaunchConfigurationType debug_configType = -
lManager.getLaunchConfigurationType("org.eclipse.cdt.launch.remoteApplicationLaunchType");plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtilsConst new file +0
-6- - String sPath = envMap.get("PATH"); - String sDebugName = envMap.get("GDB"); - String sysroot_str = elem.getStrSysrootLoc(); - if (configType == null || debug_configType == null) - throw new YoctoGeneralException("Failed toget program or remote debug launcher!");
- createRemoteDebugLauncher(project, lManager,debug_configType,elem.getStrTarget(), sPath, sDebugName,sysroot_str);plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtilsConst new file +0
-2- - ArrayList<String> listValue = newArrayList<String>();
- listValue.add(newString("org.eclipse.ui.externaltools.launchGroup"));
- if (elem.getEnumDeviceMode()==
YoctoUIElement.DeviceMode.QEMU_MODE) {
- createQemuLauncher(project, configType,
listValue, sFileName, elem);plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtilsConst new file +0
-2- } -CoreModel.getDefault().setProjectDescription(project,cpdesc);
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtilsConst new file +0
-5- } catch (CoreException e) { - e.printStackTrace(); - } - } - public static void configureAutotoolsOptions(IProject project) { IManagedBuildInfo info =ManagedBuildManager.getBuildInfo(project); IConfiguration icfg = info.getDefaultConfiguration(); @@ -173,103 +104,8 @@ public class YoctoSDKProjectNature implements IProjectNature { } else {plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtilsConst new file +1
-1- setEnvironmentVariables(project, elem); + YoctoSDKUtils.setEnvironmentVariables(project,elem); configureAutotoolsOptions(project); } }plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtilsConst new file +0
-3- - protected static void createRemoteDebugLauncher(IProject project, - ILaunchManager lManager, ILaunchConfigurationTypeconfigType,
- String sTargetTriplet, String strPath, String
sDebugName, String sSysroot) {plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtilsConst new file +0
-3- try { - - String sDebugSubDir = DEFAULT_USR_BIN +sTargetTriplet;
- StringTokenizer token = newStringTokenizer(strPath, ":");plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtilsConst new file +0
-6- String strDebugger = ""; - while (token.hasMoreTokens()) - { - String sTemp = token.nextToken(); - if (sTemp.endsWith(sDebugSubDir)) { - strDebugger = sTemp + "/" +sDebugName;
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtilsConst new file +0
-9- break; - } - } - if (strDebugger.isEmpty()) - return; - //If get default Debugger successfully, go ahead! - - //create the gdbinit file - String sDebugInitFile =project.getLocation().toString() + "/.gdbinit";
- FileWriter out = new FileWriter(new
File(sDebugInitFile));plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtilsConst new file +0
-7- out.write("set sysroot " + sSysroot); - out.flush(); - out.close(); - - //set the launch configuration - String projectName = project.getName(); - String configName =projectName+"_gdb_"+sTargetTriplet;
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtilsConst new file +0
-2- int i; - ILaunchConfiguration[]configs=lManager.getLaunchConfigurations(configType);
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtilsConst new file +0
-9- for(i=0; i<configs.length; i++) - { //delete the old configuration - ILaunchConfiguration config=configs[i]; - if(config.getName().equals(configName)) { - config.delete(); - break; - } - } - ILaunchConfigurationWorkingCopy w_copy =
configType.newInstance(project, configName);plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtilsConst new file +0
-3- Set<String> modes=new HashSet<String>(); - modes.add("debug"); - w_copy.setPreferredLaunchDelegate(modes,"org.eclipse.rse.remotecdt.launch");
-w_copy.setAttribute(IMILaunchConfigurationConstants.ATTR_GDB_INIT, sDebugInitFile);
-w_copy.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_AUTO_SOLIB, false);
-w_copy.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, strDebugger);
-w_copy.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_PROTOCOL, "mi");
- //TWEAK avoid loading default values in
org.eclipse.cdt.launch.remote.tabs.RemoteCDebuggerTab
-w_copy.setAttribute("org.eclipse.cdt.launch.remote.RemoteCDSFDebuggerTab.DEFAULTS_SET",true); -w_copy.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, projectName);
-
if(!project.hasNature(YoctoSDKEmptyProjectNature.YoctoSDK_EMPTY_NATURE_ID))plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtilsConst new file +0
-3- { - String project_src = "src/"+projectName; -
w_copy.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, project_src);plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtilsConst new file +0
-11- } - - w_copy.doSave(); - } - catch (CoreException e) - { - System.out.println(e.getMessage()); - } - catch (IOException e) - { - System.out.println("Failed to generate debug initfile!");
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtilsConst new file +0
-13- System.out.println(e.getMessage()); - } - - - } - - protected static void createQemuLauncher(IProject project, - ILaunchConfigurationType configType, - ArrayList<String> listValue, String sScriptFile, - YoctoUIElement elem) { - try { - - ILaunchConfigurationWorkingCopy w_copy =
configType.newInstance(null, "qemu_"+elem.getStrTarget());plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtilsConst new file +0
-2- -
w_copy.setAttribute("org.eclipse.debug.ui.favoriteGroups", listValue); -w_copy.setAttribute("org.eclipse.ui.externaltools.ATTR_LOCATION", "/usr/bin/xterm");plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtilsConst new file +0
-2- - String argument = "-e \"source " + sScriptFile +";runqemu " + YoctoSDKUtils.qemuTargetTranslate(elem.getStrTarget()) + " "+
-elem.getStrQemuKernelLoc()+ " " +elem.getStrSysrootLoc()+ " " +elem.getStrQemuOption()+ ";bash\"";plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtilsConst new file +0
-2- -
w_copy.setAttribute("org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS", argument);plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtilsConst new file +0
-8- w_copy.doSave(); - } catch (CoreException e) { - } - - } - - } --1.7.9.5
_______________________________________________
yocto mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/yocto
PATCH v2 3/5 Moved utils to their own package
In reply to Atanas GegovFrom: Atanas Gegov <[email protected]>
Made the default package (org.yocto.sdk.ide) a little bit more compact.
--- .../src/org/yocto/sdk/ide/YoctoSDKChecker.java | 2 + .../src/org/yocto/sdk/ide/YoctoSDKUtils.java | 773 ------------------- .../org/yocto/sdk/ide/YoctoSDKUtilsConstants.java | 18 - .../ide/natures/YoctoSDKEmptyProjectNature.java | 2 +- .../sdk/ide/natures/YoctoSDKProjectNature.java | 2 +- .../ide/preferences/YoctoSDKPreferencePage.java | 2 +- .../preferences/YoctoSDKProjectPropertyPage.java | 2 +- .../src/org/yocto/sdk/ide/utils/YoctoSDKUtils.java | 778 ++++++++++++++++++++ .../sdk/ide/utils/YoctoSDKUtilsConstants.java | 18 + .../sdk/ide/wizard/NewYoctoCProjectTemplate.java | 2 +- 10 files changed, 803 insertions(+), 796 deletions(-) delete mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtils.java delete mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtilsConstants.java create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/utils/YoctoSDKUtils.java create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/utils/YoctoSDKUtilsConstants.java
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKChecker.java +2 -0
@@ -20,6 +20,8 @@ import java.io.FilenameFilter; import java.io.IOException; import org.yocto.sdk.ide.natures.YoctoSDKProjectNature; +import org.yocto.sdk.ide.utils.YoctoSDKUtils; +import org.yocto.sdk.ide.utils.YoctoSDKUtilsConstants; public class YoctoSDKChecker { private static final String[] saInvalidVer = {"1.0", "0.9", "0.9+"};
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtils.java deleted +0 -773
773 lines not on this page · raw message
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtilsConstants.java deleted +0 -18
@@ -1,18 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013 BMW Car IT GmbH. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * BMW Car IT - initial API and implementation - *******************************************************************************/ -package org.yocto.sdk.ide; - -public class YoctoSDKUtilsConstants { - - public static final String DEFAULT_ENV_FILE_PREFIX = "environment-setup-"; - public static final String DEFAULT_TMP_PREFIX = "/tmp/"; - -}
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKEmptyProjectNature.java +1 -1
@@ -5,7 +5,7 @@ import org.eclipse.core.resources.IProjectNature; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IProgressMonitor; import org.yocto.sdk.ide.YoctoSDKPlugin; -import org.yocto.sdk.ide.YoctoSDKUtils; +import org.yocto.sdk.ide.utils.YoctoSDKUtils; public class YoctoSDKEmptyProjectNature implements IProjectNature {
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKProjectNature.java +1 -1
@@ -24,10 +24,10 @@ import org.yocto.sdk.ide.YoctoGeneralException; import org.yocto.sdk.ide.YoctoProfileElement; import org.yocto.sdk.ide.YoctoSDKChecker; import org.yocto.sdk.ide.YoctoSDKPlugin; -import org.yocto.sdk.ide.YoctoSDKUtils; import org.yocto.sdk.ide.YoctoUIElement; import org.yocto.sdk.ide.YoctoSDKChecker.SDKCheckRequestFrom; import org.yocto.sdk.ide.YoctoSDKChecker.SDKCheckResults; +import org.yocto.sdk.ide.utils.YoctoSDKUtils; @SuppressWarnings("restriction")
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/YoctoSDKPreferencePage.java +1 -1
@@ -34,9 +34,9 @@ import org.yocto.sdk.ide.YoctoProfileSetting; import org.yocto.sdk.ide.YoctoSDKChecker.SDKCheckRequestFrom; import org.yocto.sdk.ide.YoctoSDKChecker.SDKCheckResults; import org.yocto.sdk.ide.natures.YoctoSDKProjectNature; +import org.yocto.sdk.ide.utils.YoctoSDKUtils; import org.yocto.sdk.ide.YoctoSDKMessages; import org.yocto.sdk.ide.YoctoSDKPlugin; -import org.yocto.sdk.ide.YoctoSDKUtils; import org.yocto.sdk.ide.YoctoUIElement; import org.yocto.sdk.ide.YoctoUISetting;
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/YoctoSDKProjectPropertyPage.java +1 -1
@@ -29,8 +29,8 @@ import org.yocto.sdk.ide.YoctoProjectSpecificSetting; import org.yocto.sdk.ide.YoctoSDKChecker.SDKCheckRequestFrom; import org.yocto.sdk.ide.YoctoSDKChecker.SDKCheckResults; import org.yocto.sdk.ide.YoctoSDKMessages; +import org.yocto.sdk.ide.utils.YoctoSDKUtils; import org.yocto.sdk.ide.YoctoSDKPlugin; -import org.yocto.sdk.ide.YoctoSDKUtils; import org.yocto.sdk.ide.YoctoUIElement; import org.yocto.sdk.ide.YoctoUISetting;
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/utils/YoctoSDKUtils.java new file +778 -0
778 lines not on this page · raw message
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/utils/YoctoSDKUtilsConstants.java new file +18 -0
@@ -0,0 +1,18 @@ +/******************************************************************************* + * Copyright (c) 2013 BMW Car IT GmbH. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * BMW Car IT - initial API and implementation + *******************************************************************************/ +package org.yocto.sdk.ide.utils; + +public class YoctoSDKUtilsConstants { + + public static final String DEFAULT_ENV_FILE_PREFIX = "environment-setup-"; + public static final String DEFAULT_TMP_PREFIX = "/tmp/"; + +}
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/wizard/NewYoctoCProjectTemplate.java +1 -1
@@ -48,8 +48,8 @@ import org.yocto.sdk.ide.YoctoSDKChecker.SDKCheckRequestFrom; import org.yocto.sdk.ide.YoctoSDKChecker.SDKCheckResults; import org.yocto.sdk.ide.natures.YoctoSDKEmptyProjectNature; import org.yocto.sdk.ide.natures.YoctoSDKProjectNature; +import org.yocto.sdk.ide.utils.YoctoSDKUtils; import org.yocto.sdk.ide.YoctoSDKPlugin; -import org.yocto.sdk.ide.YoctoSDKUtils; import org.yocto.sdk.ide.YoctoUIElement;
Signature · 1 line
1.7.9.5
PATCH v2 4/5 Moved nature-related utils in own class
In reply to Atanas GegovFrom: Atanas Gegov <[email protected]>
Created a nature specific utils class and moved a method that is only relevant in the natures context.
--- .../ide/natures/YoctoSDKEmptyProjectNature.java | 3 +- .../yocto/sdk/ide/natures/YoctoSDKNatureUtils.java | 39 ++++++++++++++++++++ .../sdk/ide/natures/YoctoSDKProjectNature.java | 2 +- .../src/org/yocto/sdk/ide/utils/YoctoSDKUtils.java | 20 ---------- 4 files changed, 41 insertions(+), 23 deletions(-) create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKNatureUtils.java
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKEmptyProjectNature.java +1 -2
@@ -5,7 +5,6 @@ import org.eclipse.core.resources.IProjectNature; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IProgressMonitor; import org.yocto.sdk.ide.YoctoSDKPlugin; -import org.yocto.sdk.ide.utils.YoctoSDKUtils; public class YoctoSDKEmptyProjectNature implements IProjectNature {
@@ -34,7 +33,7 @@ public class YoctoSDKEmptyProjectNature implements IProjectNature { } public static void addYoctoSDKEmptyNature(IProject project, IProgressMonitor monitor) throws CoreException { - YoctoSDKUtils.addNature(project, YoctoSDK_EMPTY_NATURE_ID, monitor); + YoctoSDKNatureUtils.addNature(project, YoctoSDK_EMPTY_NATURE_ID, monitor); } }
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKNatureUtils.java new file +39 -0
@@ -0,0 +1,39 @@ +/******************************************************************************* + * Copyright (c) 2010 Intel Corporation. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Intel - initial API and implementation + * BMW Car IT - extracted in an own class + *******************************************************************************/ +package org.yocto.sdk.ide.natures; + +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IProjectDescription; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; + +public class YoctoSDKNatureUtils { + + public static void addNature(IProject project, String natureId, IProgressMonitor monitor) throws CoreException + { + IProjectDescription description = project.getDescription(); + String[] natures = description.getNatureIds(); + + for (int i = 0; i < natures.length; ++i) { + if (natureId.equals(natures[i])) + return; + } + + String[] newNatures = new String[natures.length + 1]; + System.arraycopy(natures, 0, newNatures, 0, natures.length); + newNatures[natures.length] = natureId; + description.setNatureIds(newNatures); + project.setDescription(description, monitor); + + } + +}
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKProjectNature.java +1 -1
@@ -60,7 +60,7 @@ public class YoctoSDKProjectNature implements IProjectNature { } public static void addYoctoSDKNature(IProject project, IProgressMonitor monitor) throws CoreException { - YoctoSDKUtils.addNature(project, YoctoSDK_NATURE_ID, monitor); + YoctoSDKNatureUtils.addNature(project, YoctoSDK_NATURE_ID, monitor); } public static void configureAutotoolsOptions(IProject project) {
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/utils/YoctoSDKUtils.java +0 -20
@@ -38,10 +38,8 @@ import org.eclipse.cdt.core.settings.model.ICProjectDescription; import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants; import org.eclipse.cdt.debug.mi.core.IMILaunchConfigurationConstants; import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IProjectDescription; import org.eclipse.core.resources.ProjectScope; import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.preferences.IEclipsePreferences; import org.eclipse.core.runtime.preferences.IScopeContext; import org.eclipse.debug.core.DebugPlugin;
@@ -631,24 +629,6 @@ public class YoctoSDKUtils { } - public static void addNature(IProject project, String natureId, IProgressMonitor monitor) throws CoreException - { - IProjectDescription description = project.getDescription(); - String[] natures = description.getNatureIds(); - - for (int i = 0; i < natures.length; ++i) { - if (natureId.equals(natures[i])) - return; - } - - String[] newNatures = new String[natures.length + 1]; - System.arraycopy(natures, 0, newNatures, 0, natures.length); - newNatures[natures.length] = natureId; - description.setNatureIds(newNatures); - project.setDescription(description, monitor); - - } - public static String getPlatformArch() { String value = null;
Signature · 1 line
1.7.9.5
PATCH v2 5/5 Export the new subpackages of org.yocto.sdk.ide
In reply to Atanas GegovFrom: Atanas Gegov <[email protected]>
--- plugins/org.yocto.sdk.ide/META-INF/MANIFEST.MF | 2 ++ 1 file changed, 2 insertions(+)
plugins/org.yocto.sdk.ide/META-INF/MANIFEST.MF +2 -0
@@ -29,6 +29,8 @@ Require-Bundle: org.eclipse.ui, Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Bundle-ActivationPolicy: lazy Export-Package: org.yocto.sdk.ide, + org.yocto.sdk.ide.natures, + org.yocto.sdk.ide.utils, org.yocto.sdk.ide.actions, org.yocto.sdk.ide.preferences, org.yocto.sdk.ide.wizard
Signature · 1 line
1.7.9.5