Introducing a YoctoSDKCMakeProjectNature
cover Introducing a YoctoSDKCMakeProjectNature
From: Atanas Gegov <[email protected]>
Hi,
This patch series introduces a YoctoSDKCMakeProjectNature as a new nature for CMake-based Yocto Projects in the IDE. It requires the basic YoctoSDKProjectNature and is an alternative to the YoctoSDKAutotoolsProjectNature.
This does not affect the currently existing Autotools template projects.
Upcoming patch series will add the last missing parts for having CMake projects in the IDE: a ManagedBuilder for CMake (CMake toolchain for building in Eclipse) and some template projects.
Cheers, Atanas
P.S: This patch series apply on the current master "Fix the issue introduced by code refactoring since DialogHandler inherit IHandler, execute expect to return an object" (dd7ab69282f7c9cc18ff06fffaa9681e4b297cfa).
Atanas Gegov (7):
plugins/sdk.ide: Prepared templates for CMake nature plugins/sdk.ide: Added a new YoctoSDKCMakeProjectNature plugins/sdk.ide: Enable the creation of CMake projects plugins/sdk.ide: Update CMake projects on Yocto settings change plugins/sdk.ide: Renamed template process plugins/sdk.ide: Fixed whitespace issues plugins/sdk.ide: Extracted member variables
.../OSGI-INF/l10n/bundle.properties | 1 + plugins/org.yocto.sdk.ide/plugin.xml | 25 +- .../ide/natures/YoctoSDKCMakeProjectNature.java | 92 +++++++ .../src/org/yocto/sdk/ide/utils/YoctoSDKUtils.java | 7 +- .../sdk/ide/wizard/NewYoctoCProjectTemplate.java | 245 ------------------ .../ide/wizard/NewYoctoProjectTemplateProcess.java | 267 ++++++++++++++++++++ .../EmptyCAutotoolsProject/template.xml | 1 + .../EmptyCPPAutotoolsProject/template.xml | 1 + .../HelloWorldCAutotoolsProject/template.xml | 1 + .../HelloWorldCGTKAutotoolsProject/template.xml | 1 + .../HelloWorldCPPAutotoolsProject/template.xml | 1 + 11 files changed, 395 insertions(+), 247 deletions(-) create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKCMakeProjectNature.java delete mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/wizard/NewYoctoCProjectTemplate.java create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/wizard/NewYoctoProjectTemplateProcess.java
Signature · 1 line
1.7.9.5
PATCH 1/7 plugins/sdk.ide: Prepared templates for CMake nature
From: Atanas Gegov <[email protected]>
Added an extra variable to the templates and the creating process to prepare them for the new CMake nature.
--- plugins/org.yocto.sdk.ide/plugin.xml | 4 ++++ .../sdk/ide/wizard/NewYoctoCProjectTemplate.java | 2 ++ .../EmptyCAutotoolsProject/template.xml | 1 + .../EmptyCPPAutotoolsProject/template.xml | 1 + .../HelloWorldCAutotoolsProject/template.xml | 1 + .../HelloWorldCGTKAutotoolsProject/template.xml | 1 + .../HelloWorldCPPAutotoolsProject/template.xml | 1 + 7 files changed, 11 insertions(+)
plugins/org.yocto.sdk.ide/plugin.xml +4 -0
@@ -162,6 +162,10 @@ external="true" name="isAutotoolsProject"> </simple> + <simple + external="true" + name="isCMakeProject"> + </simple> </processType> <processType name="NewYoctoAutotoolsProjectPostProcess"
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/wizard/NewYoctoCProjectTemplate.java +2 -0
@@ -88,9 +88,11 @@ public class NewYoctoCProjectTemplate extends ProcessRunner { String isCProjectValue = args[3].getSimpleValue(); String isEmptyProjetValue = args[4].getSimpleValue(); String isAutotoolsProjectValue = args[5].getSimpleValue(); + String isCMakeProjectValue = args[6].getSimpleValue(); boolean isCProject = Boolean.valueOf(isCProjectValue).booleanValue(); boolean isEmptyProject = Boolean.valueOf(isEmptyProjetValue).booleanValue(); boolean isAutotoolsProject = Boolean.valueOf(isAutotoolsProjectValue).booleanValue(); + boolean isCMakeProject = Boolean.valueOf(isCMakeProjectValue).booleanValue(); IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName); try {
plugins/org.yocto.sdk.ide/templates/projecttemplates/EmptyCAutotoolsProject/template.xml +1 -0
@@ -11,6 +11,7 @@ <simple name="isCProject" value="true" /> <simple name="isEmptyProject" value="true" /> <simple name="isAutotoolsProject" value="true" /> + <simple name="isCMakeProject" value="false" /> </process> </template>
plugins/org.yocto.sdk.ide/templates/projecttemplates/EmptyCPPAutotoolsProject/template.xml +1 -0
@@ -10,6 +10,7 @@ <simple name="isCProject" value="false" /> <simple name="isEmptyProject" value="true" /> <simple name="isAutotoolsProject" value="true" /> + <simple name="isCMakeProject" value="false" /> </process> </template>
plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/template.xml +1 -0
@@ -56,6 +56,7 @@ <simple name="isCProject" value="true" /> <simple name="isEmptyProject" value="false" /> <simple name="isAutotoolsProject" value="true" /> + <simple name="isCMakeProject" value="false" /> </process> <process type="org.eclipse.cdt.core.CreateSourceFolder">
plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/template.xml +1 -0
@@ -56,6 +56,7 @@ <simple name="isCProject" value="true" /> <simple name="isEmptyProject" value="false" /> <simple name="isAutotoolsProject" value="true" /> + <simple name="isCMakeProject" value="false" /> </process> <process type="org.eclipse.cdt.core.CreateSourceFolder">
plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCPPAutotoolsProject/template.xml +1 -0
@@ -56,6 +56,7 @@ <simple name="isCProject" value="false" /> <simple name="isEmptyProject" value="false" /> <simple name="isAutotoolsProject" value="true" /> + <simple name="isCMakeProject" value="false" /> </process> <process type="org.eclipse.cdt.core.CreateSourceFolder">
Signature · 1 line
1.7.9.5
PATCH 2/7 plugins/sdk.ide: Added a new YoctoSDKCMakeProjectNature
In reply to Atanas GegovFrom: Atanas Gegov <[email protected]>
This nature is intended for Yocto projects that
use CMake as a build system. It requires the
YoctoSDKProjectNature and can be used by upcoming
CMake project templates. It excludes the
YoctoSDKAutotoolsProjectNature, e.g. their
relation in plugin.xml is declared as
"one-of-nature".
--- .../OSGI-INF/l10n/bundle.properties | 1 + plugins/org.yocto.sdk.ide/plugin.xml | 19 +++++++++++++++++++ .../ide/natures/YoctoSDKCMakeProjectNature.java | 20 ++++++++++++++++++++ 3 files changed, 40 insertions(+) create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKCMakeProjectNature.java
plugins/org.yocto.sdk.ide/OSGI-INF/l10n/bundle.properties +1 -0
@@ -2,6 +2,7 @@ page.name.0 = Yocto Project ADT extension.name.0 = YoctoSDKNature extension.name.1 = YoctoSDKAutotoolsNature +extension.name.2 = YoctoSDKCMakeNature command.name = ReconfigureYoctoProject command.label.0 = Change Yocto Project Settings command.mnemonic = C
plugins/org.yocto.sdk.ide/plugin.xml +19 -0
@@ -40,11 +40,30 @@ class="org.yocto.sdk.ide.natures.YoctoSDKAutotoolsProjectNature"> </run> </runtime> + <one-of-nature + id="org.yocto.sdk.ide.buildsystemNaturesSet"> + </one-of-nature> <builder id="org.eclipse.cdt.autotools.core.genmakebuilderV2"> </builder> </extension> <extension + id="YoctoSDKCMakeNature" + name="%extension.name.2" + point="org.eclipse.core.resources.natures"> + <requires-nature + id="org.yocto.sdk.ide.YoctoSDKNature"> + </requires-nature> + <runtime> + <run + class="org.yocto.sdk.ide.natures.YoctoSDKCMakeProjectNature"> + </run> + </runtime> + <one-of-nature + id="org.yocto.sdk.ide.buildsystemNaturesSet"> + </one-of-nature> + </extension> + <extension id="YoctoSDKEmptyNature" point="org.eclipse.core.resources.natures"> <requires-nature
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKCMakeProjectNature.java new file +20 -0
@@ -0,0 +1,20 @@ +/******************************************************************************* + * 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.natures; + +import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.CoreException; +import org.yocto.sdk.ide.YoctoSDKPlugin; + +public class YoctoSDKCMakeProjectNature extends YoctoSDKProjectNature { + public static final String YoctoSDK_CMAKE_NATURE_ID = YoctoSDKPlugin.getUniqueIdentifier() + ".YoctoSDKCMakeNature"; + +}
Signature · 1 line
1.7.9.5
PATCH 3/7 plugins/sdk.ide: Enable the creation of CMake projects
In reply to Atanas GegovFrom: Atanas Gegov <[email protected]>
This enables creating projects with the introduced CMake nature. What is still upcoming are the template projects and a corresponfig CMake ManagedBuilder (CMake build toolchain for Eclipse).
--- .../ide/natures/YoctoSDKCMakeProjectNature.java | 72 ++++++++++++++++++++ .../sdk/ide/wizard/NewYoctoCProjectTemplate.java | 12 ++-- 2 files changed, 80 insertions(+), 4 deletions(-)
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKCMakeProjectNature.java +72 -0
@@ -10,11 +10,83 @@ *******************************************************************************/ package org.yocto.sdk.ide.natures; +import org.eclipse.cdt.core.CCorePlugin; +import org.eclipse.cdt.core.envvar.IContributedEnvironment; +import org.eclipse.cdt.core.envvar.IEnvironmentVariable; +import org.eclipse.cdt.core.envvar.IEnvironmentVariableManager; +import org.eclipse.cdt.core.model.CoreModel; +import org.eclipse.cdt.core.settings.model.ICConfigurationDescription; +import org.eclipse.cdt.core.settings.model.ICProjectDescription; import org.eclipse.core.resources.IProject; import org.eclipse.core.runtime.CoreException; import org.yocto.sdk.ide.YoctoSDKPlugin; +import org.yocto.sdk.ide.utils.YoctoSDKUtils; public class YoctoSDKCMakeProjectNature extends YoctoSDKProjectNature { public static final String YoctoSDK_CMAKE_NATURE_ID = YoctoSDKPlugin.getUniqueIdentifier() + ".YoctoSDKCMakeNature"; + // Considered poky's cmake.bbclass for this method + public static void extendProjectEnvironmentForCMake(IProject project) { + ICProjectDescription cpdesc = CoreModel.getDefault().getProjectDescription(project, true); + ICConfigurationDescription ccdesc = cpdesc.getActiveConfiguration(); + IEnvironmentVariableManager manager = CCorePlugin.getDefault().getBuildEnvironmentManager(); + IContributedEnvironment env = manager.getContributedEnvironment(); + String delimiter = manager.getDefaultDelimiter(); + + env.addVariable("CCACHE", "", IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc); + + env.addVariable("OECMAKE_SOURCEPATH", "..", + IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc); + + String oecmakeBuildPathString = ""; + env.addVariable("OECMAKE_BUILDPATH", oecmakeBuildPathString, + IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc); + env.addVariable("EXTRA_OEMAKE", "-C " + oecmakeBuildPathString, + IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc); + + String ccString = YoctoSDKUtils.getEnvValue(project, "CC"); + + if (!ccString.equals("") && !ccString.equals(" ")) { + ccString.trim(); + ccString = ccString.split(" ")[0]; + } + + env.addVariable("OECMAKE_C_COMPILER", ccString, + IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc); + String cxxString = YoctoSDKUtils.getEnvValue(project, "CXX"); + + if (!cxxString.equals("") && !cxxString.equals(" ")) { + cxxString.trim(); + cxxString = cxxString.split(" ")[0]; + } + + env.addVariable("OECMAKE_CXX_COMPILER", cxxString, + IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc); + + String hostCCArchString = YoctoSDKUtils.getEnvValue(project, "HOST_CC_ARCH"); + String toolchainOptionsString = YoctoSDKUtils.getEnvValue(project, "TOOLCHAIN_OPTIONS"); + String cppFlagsString = YoctoSDKUtils.getEnvValue(project, "CPPFLAGS"); + String cxxFlagsString = YoctoSDKUtils.getEnvValue(project, "CXXFLAGS"); + String selectedOptimizationString = YoctoSDKUtils.getEnvValue(project, "SELECTED_OPTIMIZATION"); + env.addVariable("OECMAKE_C_FLAGS", hostCCArchString + " " + toolchainOptionsString + " " + cppFlagsString, + IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc); + env.addVariable("OECMAKE_CXX_FLAGS", hostCCArchString + " " + toolchainOptionsString + " " + cxxFlagsString + + " -fpermissive", + IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc); + env.addVariable("OECMAKE_C_FLAGS_RELEASE", selectedOptimizationString + " " + cppFlagsString + " -DNDEBUG", + IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc); + env.addVariable("OECMAKE_CXX_FLAGS_RELEASE", selectedOptimizationString + " " + cxxFlagsString + " -DNDEBUG", + IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc); + + env.addVariable("OECMAKE_RPATH", "", + IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc); + env.addVariable("OECMAKE_PERLNATIVE_DIR", "", + IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc); + + try { + CoreModel.getDefault().setProjectDescription(project, cpdesc); + } catch (CoreException e) { + e.printStackTrace(); + } + } }
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/wizard/NewYoctoCProjectTemplate.java +8 -4
@@ -56,6 +56,7 @@ import org.yocto.sdk.ide.YoctoSDKMessages; import org.yocto.sdk.ide.YoctoSDKPlugin; import org.yocto.sdk.ide.YoctoUIElement; import org.yocto.sdk.ide.natures.YoctoSDKAutotoolsProjectNature; +import org.yocto.sdk.ide.natures.YoctoSDKCMakeProjectNature; import org.yocto.sdk.ide.natures.YoctoSDKEmptyProjectNature; import org.yocto.sdk.ide.natures.YoctoSDKNatureUtils; import org.yocto.sdk.ide.natures.YoctoSDKProjectNature;
@@ -129,7 +130,7 @@ public class NewYoctoCProjectTemplate extends ProcessRunner { pca.setArtifactExtension(artifactExtension); info = pca.createProject(monitor, CCorePlugin.DEFAULT_INDEXER, isCProject); - addNatures(project, false, isEmptyProject, isAutotoolsProject, monitor); + addNatures(project, false, isEmptyProject, isAutotoolsProject, isCMakeProject, monitor); info.setValid(true); ManagedBuildManager.saveBuildInfo(project, true);
@@ -142,7 +143,7 @@ public class NewYoctoCProjectTemplate extends ProcessRunner { YoctoSDKChecker.checkIfGloballySelectedYoctoProfileIsValid(); - addNatures(project, true, isEmptyProject, isAutotoolsProject, monitor); + addNatures(project, true, isEmptyProject, isAutotoolsProject, isCMakeProject, monitor); //restoreAutoBuild(workspace); IDiscoveredPathManager manager = MakeCorePlugin.getDefault().getDiscoveryManager();
@@ -181,7 +182,7 @@ public class NewYoctoCProjectTemplate extends ProcessRunner { } private void addNatures(IProject project, boolean projectExists, boolean isEmptyProject, - boolean isAutotoolsProject, IProgressMonitor monitor) + boolean isAutotoolsProject, boolean isCMakeProject, IProgressMonitor monitor) throws CoreException, YoctoGeneralException { YoctoSDKNatureUtils.addNature(project, YoctoSDKProjectNature.YoctoSDK_NATURE_ID, monitor);
@@ -201,7 +202,7 @@ public class NewYoctoCProjectTemplate extends ProcessRunner { if (isAutotoolsProject) { AutotoolsNewProjectNature.addAutotoolsNature(project, monitor); - if(!projectExists) { + if (!projectExists) { // For each IConfiguration, create a corresponding Autotools Configuration for (IConfiguration cfg : pca.getConfigs()) { AutotoolsConfigurationManager.getInstance().getConfiguration(project, cfg.getName(), true);
@@ -211,6 +212,9 @@ public class NewYoctoCProjectTemplate extends ProcessRunner { YoctoSDKNatureUtils.addNature(project, YoctoSDKAutotoolsProjectNature.YoctoSDK_AUTOTOOLS_NATURE_ID, monitor); YoctoSDKAutotoolsProjectNature.configureAutotoolsOptions(project); + } else if (isCMakeProject) { + YoctoSDKNatureUtils.addNature(project, YoctoSDKCMakeProjectNature.YoctoSDK_CMAKE_NATURE_ID, monitor); + YoctoSDKCMakeProjectNature.extendProjectEnvironmentForCMake(project); } }
Signature · 1 line
1.7.9.5
PATCH 4/7 plugins/sdk.ide: Update CMake projects on Yocto settings change
In reply to Atanas GegovFrom: Atanas Gegov <[email protected]>
CMake projects will use additional variables in
the environment. They have to be set if the Yocto
settings are changed.
--- .../src/org/yocto/sdk/ide/utils/YoctoSDKUtils.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/utils/YoctoSDKUtils.java +6 -1
@@ -55,6 +55,7 @@ import org.yocto.sdk.ide.YoctoSDKMessages; import org.yocto.sdk.ide.YoctoSDKPlugin; import org.yocto.sdk.ide.YoctoUIElement; import org.yocto.sdk.ide.natures.YoctoSDKAutotoolsProjectNature; +import org.yocto.sdk.ide.natures.YoctoSDKCMakeProjectNature; import org.yocto.sdk.ide.natures.YoctoSDKEmptyProjectNature; import org.yocto.sdk.ide.preferences.PreferenceConstants;
@@ -427,9 +428,13 @@ public class YoctoSDKUtils { try { setEnvironmentVariables(project, elem); - if(project.hasNature(YoctoSDKAutotoolsProjectNature.YoctoSDK_AUTOTOOLS_NATURE_ID)) { + + if (project.hasNature(YoctoSDKAutotoolsProjectNature.YoctoSDK_AUTOTOOLS_NATURE_ID)) { YoctoSDKAutotoolsProjectNature.configureAutotoolsOptions(project); + } else if (project.hasNature(YoctoSDKCMakeProjectNature.YoctoSDK_CMAKE_NATURE_ID)) { + YoctoSDKCMakeProjectNature.extendProjectEnvironmentForCMake(project); } + IConsole console = CCorePlugin.getDefault().getConsole("org.yocto.sdk.ide.YoctoConsole"); console.start(project); consoleOutStream = console.getOutputStream();
Signature · 1 line
1.7.9.5
PATCH 5/7 plugins/sdk.ide: Renamed template process
In reply to Atanas GegovFrom: Atanas Gegov <[email protected]>
The original name of the class had two drawbacks:
firstly, it suggested that it applies only for C
projects and secondly, it did not state that this
is a process.
--- plugins/org.yocto.sdk.ide/plugin.xml | 2 +- .../sdk/ide/wizard/NewYoctoCProjectTemplate.java | 251 -------------------- .../ide/wizard/NewYoctoProjectTemplateProcess.java | 251 ++++++++++++++++++++ 3 files changed, 252 insertions(+), 252 deletions(-) delete mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/wizard/NewYoctoCProjectTemplate.java create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/wizard/NewYoctoProjectTemplateProcess.java
plugins/org.yocto.sdk.ide/plugin.xml +1 -1
@@ -156,7 +156,7 @@ point="org.eclipse.cdt.core.templateProcessTypes"> <processType name="NewYoctoProject" - processRunner="org.yocto.sdk.ide.wizard.NewYoctoCProjectTemplate"> + processRunner="org.yocto.sdk.ide.wizard.NewYoctoProjectTemplateProcess"> <simple name="name"> </simple>
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/wizard/NewYoctoCProjectTemplate.java deleted +0 -251
251 lines not on this page · raw message
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/wizard/NewYoctoProjectTemplateProcess.java new file +251 -0
251 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH 6/7 plugins/sdk.ide: Fixed whitespace issues
In reply to Atanas GegovFrom: Atanas Gegov <[email protected]>
Resolved whitespace issues which popped up while
renaming the NewYoctoProjectTemplateProcess. Also
added some missing "//$NON-NLS-1$" declarations.
--- .../ide/wizard/NewYoctoProjectTemplateProcess.java | 37 +++++++++++--------- 1 file changed, 21 insertions(+), 16 deletions(-)
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/wizard/NewYoctoProjectTemplateProcess.java +21 -16
@@ -62,7 +62,6 @@ import org.yocto.sdk.ide.natures.YoctoSDKNatureUtils; import org.yocto.sdk.ide.natures.YoctoSDKProjectNature; import org.yocto.sdk.ide.utils.YoctoSDKUtils; - @SuppressWarnings("restriction") public class NewYoctoProjectTemplateProcess extends ProcessRunner { protected boolean savedAutoBuildingValue;
@@ -70,10 +69,11 @@ public class NewYoctoProjectTemplateProcess extends ProcessRunner { protected IManagedBuildInfo info; protected List<Character> illegalChars = Arrays.asList('$', '"','#','%','&','\'','(',')','*', '+', ',','.','/',':',';','<','=','>','?','@','[','\\',']','^','`','{','|','}','~'); private static final String PROJECT_NAME_ERROR = "Wizard.SDK.Error.ProjectName"; - + public NewYoctoProjectTemplateProcess() { pca = new ProjectCreatedActions(); } + private String printIllegalChars(){ String print = ""; for (Character ch : illegalChars)
@@ -98,7 +98,7 @@ public class NewYoctoProjectTemplateProcess extends ProcessRunner { IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName); try { if (!isValidProjectName(projectName)) { - + IWizardPage[] pages = MBSCustomPageManager.getPages(); if(pages != null && pages.length > 0) { CDTMainWizardPage cdtMainPage = (CDTMainWizardPage)pages[0];
@@ -110,6 +110,7 @@ public class NewYoctoProjectTemplateProcess extends ProcessRunner { } throw new ProcessFailureException(YoctoSDKMessages.getFormattedString(PROJECT_NAME_ERROR, new Object[]{projectName, printIllegalChars()})); } + if (!project.exists()) { IWorkspace workspace = ResourcesPlugin.getWorkspace(); turnOffAutoBuild(workspace);
@@ -120,6 +121,7 @@ public class NewYoctoProjectTemplateProcess extends ProcessRunner { } List<?> configs = template.getTemplateInfo().getConfigurations(); + if (configs == null || configs.size() == 0) { throw new ProcessFailureException(Messages.getString("NewManagedProject.4") + projectName); //$NON-NLS-1$ }
@@ -137,7 +139,7 @@ public class NewYoctoProjectTemplateProcess extends ProcessRunner { restoreAutoBuild(workspace); } else { - + IWorkspace workspace = ResourcesPlugin.getWorkspace(); turnOffAutoBuild(workspace);
@@ -148,19 +150,20 @@ public class NewYoctoProjectTemplateProcess extends ProcessRunner { //restoreAutoBuild(workspace); IDiscoveredPathManager manager = MakeCorePlugin.getDefault().getDiscoveryManager(); IDiscoveredPathInfo pathInfo = manager.getDiscoveredInfo(project); + if (pathInfo instanceof IPerProjectDiscoveredPathInfo) { - IPerProjectDiscoveredPathInfo projectPathInfo = - (IPerProjectDiscoveredPathInfo) pathInfo; - projectPathInfo.setIncludeMap(new LinkedHashMap<String, Boolean>()); - projectPathInfo.setSymbolMap(new LinkedHashMap<String, SymbolEntry>()); - manager.removeDiscoveredInfo(project); + IPerProjectDiscoveredPathInfo projectPathInfo = + (IPerProjectDiscoveredPathInfo) pathInfo; + projectPathInfo.setIncludeMap(new LinkedHashMap<String, Boolean>()); + projectPathInfo.setSymbolMap(new LinkedHashMap<String, SymbolEntry>()); + manager.removeDiscoveredInfo(project); } } } catch (CoreException e) { throw new ProcessFailureException(Messages.getString("NewManagedProject.3") + e.getMessage(), e); //$NON-NLS-1$ - } + } catch (BuildException e) { throw new ProcessFailureException(Messages.getString("NewManagedProject.3") + e.getMessage()); //$NON-NLS-1$
@@ -170,16 +173,18 @@ public class NewYoctoProjectTemplateProcess extends ProcessRunner { try { project.delete(true, monitor); } catch (CoreException err) { - throw new ProcessFailureException(Messages.getString("NewManagedProject.3") + e.getMessage() + " " + err.getMessage()); + throw new ProcessFailureException(Messages.getString("NewManagedProject.3") + e.getMessage() //$NON-NLS-1$ + + " " + err.getMessage()); //$NON-NLS-1$ } - throw new OperationCanceledException(Messages.getString("NewManagedProject.3") + e.getMessage()); + throw new OperationCanceledException(Messages.getString("NewManagedProject.3") + e.getMessage()); //$NON-NLS-1$ } } + private boolean isValidProjectName(String projectName) { - Pattern pattern = Pattern.compile("^[a-zA-Z][a-zA-Z0-9_\\-]*$"); + Pattern pattern = Pattern.compile("^[a-zA-Z][a-zA-Z0-9_\\-]*$"); //$NON-NLS-1$ Matcher matcher = pattern.matcher(projectName); return matcher.find(); -} + } private void addNatures(IProject project, boolean projectExists, boolean isEmptyProject, boolean isAutotoolsProject, boolean isCMakeProject, IProgressMonitor monitor)
@@ -224,13 +229,13 @@ public class NewYoctoProjectTemplateProcess extends ProcessRunner { workspaceDesc.setAutoBuilding(false); workspace.setDescription(workspaceDesc); } - + protected final void restoreAutoBuild(IWorkspace workspace) throws CoreException { IWorkspaceDescription workspaceDesc = workspace.getDescription(); workspaceDesc.setAutoBuilding(savedAutoBuildingValue); workspace.setDescription(workspaceDesc); } - + /** * setOptionValue * @param config
Signature · 1 line
1.7.9.5
PATCH 7/7 plugins/sdk.ide: Extracted member variables
In reply to Atanas GegovFrom: Atanas Gegov <[email protected]>
Simplified the calling of the addNatures(...) method. Variables describing the nature of the project are not more local for the process(...) method, but private object members.
--- .../ide/wizard/NewYoctoProjectTemplateProcess.java | 29 ++++++++++++++------ 1 file changed, 20 insertions(+), 9 deletions(-)
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/wizard/NewYoctoProjectTemplateProcess.java +20 -9
@@ -70,8 +70,18 @@ public class NewYoctoProjectTemplateProcess extends ProcessRunner { protected List<Character> illegalChars = Arrays.asList('$', '"','#','%','&','\'','(',')','*', '+', ',','.','/',':',';','<','=','>','?','@','[','\\',']','^','`','{','|','}','~'); private static final String PROJECT_NAME_ERROR = "Wizard.SDK.Error.ProjectName"; + private boolean isCProject; + private boolean isEmptyProject; + private boolean isAutotoolsProject; + private boolean isCMakeProject; + public NewYoctoProjectTemplateProcess() { pca = new ProjectCreatedActions(); + + isCProject = false; + isEmptyProject = false; + isAutotoolsProject = false; + isCMakeProject = false; } private String printIllegalChars(){
@@ -81,6 +91,7 @@ public class NewYoctoProjectTemplateProcess extends ProcessRunner { print = print.substring(0, print.length() - 2); return print; } + public void process(TemplateCore template, ProcessArgument[] args, String processId, IProgressMonitor monitor) throws ProcessFailureException { String projectName = args[0].getSimpleValue();
@@ -90,10 +101,11 @@ public class NewYoctoProjectTemplateProcess extends ProcessRunner { String isEmptyProjetValue = args[4].getSimpleValue(); String isAutotoolsProjectValue = args[5].getSimpleValue(); String isCMakeProjectValue = args[6].getSimpleValue(); - boolean isCProject = Boolean.valueOf(isCProjectValue).booleanValue(); - boolean isEmptyProject = Boolean.valueOf(isEmptyProjetValue).booleanValue(); - boolean isAutotoolsProject = Boolean.valueOf(isAutotoolsProjectValue).booleanValue(); - boolean isCMakeProject = Boolean.valueOf(isCMakeProjectValue).booleanValue(); + + isCProject = Boolean.valueOf(isCProjectValue).booleanValue(); + isEmptyProject = Boolean.valueOf(isEmptyProjetValue).booleanValue(); + isAutotoolsProject = Boolean.valueOf(isAutotoolsProjectValue).booleanValue(); + isCMakeProject = Boolean.valueOf(isCMakeProjectValue).booleanValue(); IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName); try {
@@ -132,7 +144,7 @@ public class NewYoctoProjectTemplateProcess extends ProcessRunner { pca.setArtifactExtension(artifactExtension); info = pca.createProject(monitor, CCorePlugin.DEFAULT_INDEXER, isCProject); - addNatures(project, false, isEmptyProject, isAutotoolsProject, isCMakeProject, monitor); + addNatures(project, false, monitor); info.setValid(true); ManagedBuildManager.saveBuildInfo(project, true);
@@ -145,7 +157,7 @@ public class NewYoctoProjectTemplateProcess extends ProcessRunner { YoctoSDKChecker.checkIfGloballySelectedYoctoProfileIsValid(); - addNatures(project, true, isEmptyProject, isAutotoolsProject, isCMakeProject, monitor); + addNatures(project, true, monitor); //restoreAutoBuild(workspace); IDiscoveredPathManager manager = MakeCorePlugin.getDefault().getDiscoveryManager();
@@ -186,9 +198,8 @@ public class NewYoctoProjectTemplateProcess extends ProcessRunner { return matcher.find(); } - private void addNatures(IProject project, boolean projectExists, boolean isEmptyProject, - boolean isAutotoolsProject, boolean isCMakeProject, IProgressMonitor monitor) - throws CoreException, YoctoGeneralException { + private void addNatures(IProject project, boolean projectExists, IProgressMonitor monitor) + throws CoreException, YoctoGeneralException { YoctoSDKNatureUtils.addNature(project, YoctoSDKProjectNature.YoctoSDK_NATURE_ID, monitor); YoctoSDKChecker.checkIfGloballySelectedYoctoProfileIsValid();
Signature · 1 line
1.7.9.5
Hi Atanas,
All the cmake related patches have been merged to eclipse-poky master. Also, can you provide some detailed information regarding how to test the feature so QA can add adequate test cases in the existing eclipse plug-in testing.
Thanks,
Jessica
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Atanas Gegov
Sent: Friday, May 24, 2013 5:03 AM
To: [email protected]
Subject: [yocto] [eclipse-poky][PATCH 0/7] Introducing a YoctoSDKCMakeProjectNature
From: Atanas Gegov <[email protected]>
Hi,
This patch series introduces a YoctoSDKCMakeProjectNature as a new nature for CMake-based Yocto Projects in the IDE. It requires the basic YoctoSDKProjectNature and is an alternative to the YoctoSDKAutotoolsProjectNature.
This does not affect the currently existing Autotools template projects.
Upcoming patch series will add the last missing parts for having CMake projects in the IDE: a ManagedBuilder for CMake (CMake toolchain for building in Eclipse) and some template projects.
Cheers, Atanas
P.S: This patch series apply on the current master "Fix the issue introduced by code refactoring since DialogHandler inherit IHandler, execute expect to return an object" (dd7ab69282f7c9cc18ff06fffaa9681e4b297cfa).
Atanas Gegov (7):
plugins/sdk.ide: Prepared templates for CMake nature plugins/sdk.ide: Added a new YoctoSDKCMakeProjectNature plugins/sdk.ide: Enable the creation of CMake projects plugins/sdk.ide: Update CMake projects on Yocto settings change plugins/sdk.ide: Renamed template process plugins/sdk.ide: Fixed whitespace issues plugins/sdk.ide: Extracted member variables
.../OSGI-INF/l10n/bundle.properties | 1 + plugins/org.yocto.sdk.ide/plugin.xml | 25 +- .../ide/natures/YoctoSDKCMakeProjectNature.java | 92 +++++++ .../src/org/yocto/sdk/ide/utils/YoctoSDKUtils.java | 7 +- .../sdk/ide/wizard/NewYoctoCProjectTemplate.java | 245 ------------------ .../ide/wizard/NewYoctoProjectTemplateProcess.java | 267 ++++++++++++++++++++ .../EmptyCAutotoolsProject/template.xml | 1 + .../EmptyCPPAutotoolsProject/template.xml | 1 + .../HelloWorldCAutotoolsProject/template.xml | 1 + .../HelloWorldCGTKAutotoolsProject/template.xml | 1 + .../HelloWorldCPPAutotoolsProject/template.xml | 1 + 11 files changed, 395 insertions(+), 247 deletions(-) create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKCMakeProjectNature.java delete mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/wizard/NewYoctoCProjectTemplate.java create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/wizard/NewYoctoProjectTemplateProcess.java
--
1.7.9.5
_______________________________________________
yocto mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/yocto
Hi Jessica,
Thank you for merging our patches!
About QA, I took a look in Bugzilla and the "Eclipse Plugin" Test Cases there. I thought something like the following might be reasonable to test the CMake feature:
0. Precondition: Set up at least 2 "Cross development profiles" (e.g. one for "i586-..." and one for "arm...") in the Yocto IDE. (Window > Preferences > Yocto Project ADT)
1. Select File -> New -> Project.
2. Double click C or C++ (two separate test cases).
3. Expand the category "Yocto ADT CMake Project".
4. Select "Hello World C++ CMake Project" (or "Hello World C CMake Project" if C chosen in Step 2.).
5. Put a name in the Project name.
6. Click Next.
7. Add information in the fields about Author, Vendor etc..
8. Click Finish.
9. (optional) Right-click on the created project > Properties > C/C++ Build
Quoted 1 line
Settings > choose "CMake Options" in the tab "Tool settings". Change some
options there (e.g. enter "--debug-output" in the field "Other flags"). Press Apply and OK.
10. Press the hammer symbol to build the project.
11. Check the output of the build process:
a) The console "Configure using CMake [<project name>]" should list the correct C/C++ cross-compilers of the chosen cross development profile (and also provide some more verbose output if "--debug-output" was set in Step 9.)
b) The console "CDT build console [<project name>]" shows the usage of the correct cross-compiler and sysroot (if verbose Makefile generated (this is the default option but can be changed from the "CMake Options") in Step 9.)
c) The file "toolchain.cmake" has been generated with correct cross development settings (compiler, sysroot etc.).
d) A binary is created in the Debug folder
12. Change the cross development profile for the project (Right-click on the created project > Properties > Yocto Project Settings > choose another profile from the drop-down box > Apply > OK) and go back to Step 9. to build the project again with another cross development profile.
Do you think the test case is OK like this?
Best regards,
Atanas
Quoted 78 lines · Jessica
Hi Atanas,
All the cmake related patches have been merged to eclipse-poky master. Also, can you provide some detailed information regarding how to test the feature so QA can add adequate test cases in the existing eclipse plug-in testing.
Thanks,
Jessica-----Original Message-----
From: [email protected] [mailto:
[email protected]] On Behalf Of Atanas Gegov
Sent: Friday, May 24, 2013 5:03 AM
To: [email protected]
Subject: [yocto] [eclipse-poky][PATCH 0/7] Introducing a YoctoSDKCMakeProjectNatureFrom: Atanas Gegov <[email protected]>
Hi,
This patch series introduces a YoctoSDKCMakeProjectNature as a new nature for CMake-based Yocto Projects in the IDE. It requires the basic YoctoSDKProjectNature and is an alternative to the YoctoSDKAutotoolsProjectNature.
This does not affect the currently existing Autotools template projects.
Upcoming patch series will add the last missing parts for having CMake projects in the IDE: a ManagedBuilder for CMake (CMake toolchain for building in Eclipse) and some template projects.
Cheers, Atanas
P.S: This patch series apply on the current master "Fix the issue introduced by code refactoring since DialogHandler inherit IHandler, execute expect to return an object" (dd7ab69282f7c9cc18ff06fffaa9681e4b297cfa).Atanas Gegov (7):
plugins/sdk.ide: Prepared templates for CMake nature plugins/sdk.ide: Added a new YoctoSDKCMakeProjectNature plugins/sdk.ide: Enable the creation of CMake projects plugins/sdk.ide: Update CMake projects on Yocto settings change plugins/sdk.ide: Renamed template process plugins/sdk.ide: Fixed whitespace issues plugins/sdk.ide: Extracted member variables.../OSGI-INF/l10n/bundle.properties | 1 + plugins/org.yocto.sdk.ide/plugin.xml | 25 +- .../ide/natures/YoctoSDKCMakeProjectNature.java | 92 +++++++ .../src/org/yocto/sdk/ide/utils/YoctoSDKUtils.java | 7 +- .../sdk/ide/wizard/NewYoctoCProjectTemplate.java | 245 ------------------ .../ide/wizard/NewYoctoProjectTemplateProcess.java | 267 ++++++++++++++++++++ .../EmptyCAutotoolsProject/template.xml | 1 + .../EmptyCPPAutotoolsProject/template.xml | 1 + .../HelloWorldCAutotoolsProject/template.xml | 1 + .../HelloWorldCGTKAutotoolsProject/template.xml | 1 + .../HelloWorldCPPAutotoolsProject/template.xml | 1 + 11 files changed, 395 insertions(+), 247 deletions(-) create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKCMakeProjectNature.java delete mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/wizard/NewYoctoCProjectTemplate.java create mode 100644plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/wizard/NewYoctoProjectTemplateProcess.java
--
1.7.9.5_______________________________________________
yocto mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/yocto
Hi Atanas,
Thanks, this is perfect to get our QA a standard test case for the function. They can add other corner case tests for stress test.
Thanks,
Jessica
From: Atanas Gegov [mailto:[email protected]]
Sent: Tuesday, May 28, 2013 5:36 AM
To: Zhang, Jessica
Cc: [email protected]
Subject: Re: [yocto] [eclipse-poky][PATCH 0/7] Introducing a YoctoSDKCMakeProjectNature
Hi Jessica,
Thank you for merging our patches!
About QA, I took a look in Bugzilla and the "Eclipse Plugin" Test Cases there. I thought something like the following might be reasonable to test the CMake feature:
0. Precondition: Set up at least 2 "Cross development profiles" (e.g. one for "i586-..." and one for "arm...") in the Yocto IDE.
(Window > Preferences > Yocto Project ADT)
1. Select File -> New -> Project.
2. Double click C or C++ (two separate test cases).
3. Expand the category "Yocto ADT CMake Project".
4. Select "Hello World C++ CMake Project" (or "Hello World C CMake Project" if C chosen in Step 2.).
5. Put a name in the Project name.
6. Click Next.
7. Add information in the fields about Author, Vendor etc..
8. Click Finish.
9. (optional) Right-click on the created project > Properties > C/C++ Build > Settings > choose "CMake Options" in the tab "Tool settings". Change some options there (e.g. enter "--debug-output" in the field "Other flags"). Press Apply and OK.
10. Press the hammer symbol to build the project.
11. Check the output of the build process:
a) The console "Configure using CMake [<project name>]" should list the correct C/C++ cross-compilers of the chosen cross development profile (and also provide some more verbose output if "--debug-output" was set in Step 9.)
b) The console "CDT build console [<project name>]" shows the usage of the correct cross-compiler and sysroot (if verbose Makefile generated (this is the default option but can be changed from the "CMake Options") in Step 9.)
c) The file "toolchain.cmake" has been generated with correct cross development settings (compiler, sysroot etc.).
d) A binary is created in the Debug folder
12. Change the cross development profile for the project (Right-click on the created project > Properties > Yocto Project Settings > choose
another profile from the drop-down box > Apply > OK) and go back to Step 9. to build the project again with another cross development profile.
Do you think the test case is OK like this?
Best regards,
Atanas
On Fri, May 24, 2013 at 8:55 PM, Zhang, Jessica <[email protected]<mailto:[email protected]>> wrote:
Hi Atanas,
All the cmake related patches have been merged to eclipse-poky master. Also, can you provide some detailed information regarding how to test the feature so QA can add adequate test cases in the existing eclipse plug-in testing.
Thanks,
Jessica
-----Original Message-----
From: [email protected]<mailto:[email protected]> [mailto:[email protected]<mailto:[email protected]>] On Behalf Of Atanas Gegov
Sent: Friday, May 24, 2013 5:03 AM
To: [email protected]<mailto:[email protected]>
Subject: [yocto] [eclipse-poky][PATCH 0/7] Introducing a YoctoSDKCMakeProjectNature
From: Atanas Gegov <[email protected]<mailto:[email protected]>>
Hi,
This patch series introduces a YoctoSDKCMakeProjectNature as a new nature for CMake-based Yocto Projects in the IDE. It requires the basic YoctoSDKProjectNature and is an alternative to the YoctoSDKAutotoolsProjectNature.
This does not affect the currently existing Autotools template projects.
Upcoming patch series will add the last missing parts for having CMake projects in the IDE: a ManagedBuilder for CMake (CMake toolchain for building in Eclipse) and some template projects.
Cheers, Atanas
P.S: This patch series apply on the current master "Fix the issue introduced by code refactoring since DialogHandler inherit IHandler, execute expect to return an object" (dd7ab69282f7c9cc18ff06fffaa9681e4b297cfa).
Atanas Gegov (7):
plugins/sdk.ide: Prepared templates for CMake nature plugins/sdk.ide: Added a new YoctoSDKCMakeProjectNature plugins/sdk.ide: Enable the creation of CMake projects plugins/sdk.ide: Update CMake projects on Yocto settings change plugins/sdk.ide: Renamed template process plugins/sdk.ide: Fixed whitespace issues plugins/sdk.ide: Extracted member variables
.../OSGI-INF/l10n/bundle.properties | 1 + plugins/org.yocto.sdk.ide/plugin.xml | 25 +- .../ide/natures/YoctoSDKCMakeProjectNature.java | 92 +++++++ .../src/org/yocto/sdk/ide/utils/YoctoSDKUtils.java | 7 +- .../sdk/ide/wizard/NewYoctoCProjectTemplate.java | 245 ------------------ .../ide/wizard/NewYoctoProjectTemplateProcess.java | 267 ++++++++++++++++++++ .../EmptyCAutotoolsProject/template.xml | 1 + .../EmptyCPPAutotoolsProject/template.xml | 1 + .../HelloWorldCAutotoolsProject/template.xml | 1 + .../HelloWorldCGTKAutotoolsProject/template.xml | 1 + .../HelloWorldCPPAutotoolsProject/template.xml | 1 + 11 files changed, 395 insertions(+), 247 deletions(-) create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKCMakeProjectNature.java delete mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/wizard/NewYoctoCProjectTemplate.java create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/wizard/NewYoctoProjectTemplateProcess.java
--
1.7.9.5
_______________________________________________
yocto mailing list [email protected]<mailto:[email protected]>
https://lists.yoctoproject.org/listinfo/yocto