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. However, I already wanted to post this series for a review and make sure that the concept is acceptable, so that we can build on top of it.
Cheers, Atanas
P.S: This patch series apply on the current master "plugins/sdk.ide:
Extracted error message to YoctoSDKMessages" (7142c5fc82a41a9d5f86c48b289db0ef44f5a897).
Atanas Gegov (6):
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
.../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 | 256 ++++++++++++++++++++ .../EmptyCAutotoolsProject/template.xml | 1 + .../EmptyCPPAutotoolsProject/template.xml | 1 + .../HelloWorldCAutotoolsProject/template.xml | 1 + .../HelloWorldCGTKAutotoolsProject/template.xml | 1 + .../HelloWorldCPPAutotoolsProject/template.xml | 1 + 11 files changed, 384 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
RFC 1/6 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
RFC 2/6 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
RFC 3/6 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
RFC 4/6 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
RFC 5/6 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
RFC 6/6 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
Hi Atanas,
Overall, the patches look good. Couple comments:
1. So from the end user perspective, after the 2nd patch set, user will see "Yocto Project ADT CMake Project" category when they want to create a new project?
2. Can we change the API for addNatures by using an enum type for projectNature instead of explicitly listing all of them out. This way is easier for code maintenance and API usability.
3. Don't know whether you've created a bugzilla account at bugzilla.yoctoproject.org or not, if not, please do, since I'd hope you're able to help fixing certain bugs in this area down the road. Also, from project planning process wise, we're right in the 1.5 planning, and I'd like to create an entry in the bugzilla for extending eclipse for CMake support and assign that to you, so it's easier to track what are the community contribution to the project.
Thanks,
Jessica
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Atanas Gegov
Sent: Monday, April 22, 2013 5:06 AM
To: [email protected]
Subject: [yocto] [eclipse-poky][RFC 0/6] 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. However, I already wanted to post this series for a review and make sure that the concept is acceptable, so that we can build on top of it.
Cheers, Atanas
P.S: This patch series apply on the current master "plugins/sdk.ide:
Extracted error message to YoctoSDKMessages" (7142c5fc82a41a9d5f86c48b289db0ef44f5a897).
Atanas Gegov (6):
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
.../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 | 256 ++++++++++++++++++++ .../EmptyCAutotoolsProject/template.xml | 1 + .../EmptyCPPAutotoolsProject/template.xml | 1 + .../HelloWorldCAutotoolsProject/template.xml | 1 + .../HelloWorldCGTKAutotoolsProject/template.xml | 1 + .../HelloWorldCPPAutotoolsProject/template.xml | 1 + 11 files changed, 384 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 the comments!
1. Yes, the idea is that at the end there are the current category ("Yocto Project ADT Autotools Project" with some Autotools-based project templates) and a new category "Yocto Project ADT CMake Project" with e.g. its own "Hello World C++ CMake Project". The latter category and the templates will be implemented in the upcoming patch series.
2. Could you please give me a small example how it should look like?Should the method addNatures receive a list of natures to add? What is the case if more natures are added to a project (e.g. SDKNature + AutotoolsNature + EmptyNature)? Or do you think of enum based on the buildsystem natures only (Autotools vs. CMake) and not based on all 4 natures?
3. I just created an account in bugzilla.yoctoproject.org, so you can assign me the CMake support entry.
Thanks,
Atanas
Quoted 88 lines · Jessica
Hi Atanas,
Overall, the patches look good. Couple comments:
1. So from the end user perspective, after the 2nd patch set, user will see "Yocto Project ADT CMake Project" category when they want to create a new project?
2. Can we change the API for addNatures by using an enum type for projectNature instead of explicitly listing all of them out. This way is easier for code maintenance and API usability.
3. Don't know whether you've created a bugzilla account at bugzilla.yoctoproject.org or not, if not, please do, since I'd hope you're able to help fixing certain bugs in this area down the road. Also, from project planning process wise, we're right in the 1.5 planning, and I'd like to create an entry in the bugzilla for extending eclipse for CMake support and assign that to you, so it's easier to track what are the community contribution to the project.Thanks,
Jessica-----Original Message-----
From: [email protected] [mailto:
[email protected]] On Behalf Of Atanas Gegov
Sent: Monday, April 22, 2013 5:06 AM
To: [email protected]
Subject: [yocto] [eclipse-poky][RFC 0/6] 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. However, I already wanted to post this series for a review and make sure that the concept is acceptable, so that we can build on top of it.
Cheers, Atanas
P.S: This patch series apply on the current master "plugins/sdk.ide:
Extracted error message to YoctoSDKMessages" (7142c5fc82a41a9d5f86c48b289db0ef44f5a897).Atanas Gegov (6):
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.../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 | 256 ++++++++++++++++++++ .../EmptyCAutotoolsProject/template.xml | 1 + .../EmptyCPPAutotoolsProject/template.xml | 1 + .../HelloWorldCAutotoolsProject/template.xml | 1 + .../HelloWorldCGTKAutotoolsProject/template.xml | 1 + .../HelloWorldCPPAutotoolsProject/template.xml | 1 + 11 files changed, 384 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,
Please see my comments below...
Thanks,
Jessica
From: Atanas Gegov [mailto:[email protected]]
Sent: Wednesday, April 24, 2013 8:48 AM
To: Zhang, Jessica
Cc: [email protected]
Subject: Re: [yocto] [eclipse-poky][RFC 0/6] Introducing a YoctoSDKCMakeProjectNature
Hi Jessica,
thank you for the comments!
1. Yes, the idea is that at the end there are the current category ("Yocto Project ADT Autotools Project" with some Autotools-based project templates) and a new category "Yocto Project ADT CMake Project" with e.g. its own "Hello World C++ CMake Project". The latter category and the templates will be implemented in the upcoming patch series.
Great that's what I'd expected .
2. Could you please give me a small example how it should look like?Should the method addNatures receive a list of natures to add? What is the case if more natures are added to a project (e.g. SDKNature + AutotoolsNature + EmptyNature)? Or do you think of enum based on the buildsystem natures only (Autotools vs. CMake) and not based on all 4 natures?
I took another look of the class, we should be able to even further simplify the API of addNatures. We can make all the natures as instance variables of the class. In process method we assign them values and totally eliminate passing natures in addNatures API. So the code should be(please ignore the incorrect capitalization due to auto correction):
Public class NewYoctoProjectTemplateProcess extends ProcessRunner {
...
Private Boolean isEmptyProject;
Private Boolean isAutotoolsProject;
Private Boolean isCMakeProject;...
Public void process(...) {
...
isEmptyProject = ...
isAutotoolsProject = ...
isCMakeProject = ...
...
addNatures(project, false, monitor);
...
}
...
Private void addNatures(IProject project, Boolean projectExists, IProgressMonitor monitor) {
...
}3. I just created an account in bugzilla.yoctoproject.org<http://bugzilla.yoctoproject.org/>, so you can assign me the CMake support entry.
Super. You'll get your first assignment J
Thanks,
Atanas
On Tue, Apr 23, 2013 at 8:50 PM, Zhang, Jessica <[email protected]<mailto:[email protected]>> wrote:
Hi Atanas,
Overall, the patches look good. Couple comments:
1. So from the end user perspective, after the 2nd patch set, user will see "Yocto Project ADT CMake Project" category when they want to create a new project?
2. Can we change the API for addNatures by using an enum type for projectNature instead of explicitly listing all of them out. This way is easier for code maintenance and API usability.
3. Don't know whether you've created a bugzilla account at bugzilla.yoctoproject.org<http://bugzilla.yoctoproject.org> or not, if not, please do, since I'd hope you're able to help fixing certain bugs in this area down the road. Also, from project planning process wise, we're right in the 1.5 planning, and I'd like to create an entry in the bugzilla for extending eclipse for CMake support and assign that to you, so it's easier to track what are the community contribution to the project.
Thanks,
Jessica
-----Original Message-----
From: [email protected]<mailto:[email protected]> [mailto:[email protected]<mailto:[email protected]>] On Behalf Of Atanas Gegov
Sent: Monday, April 22, 2013 5:06 AM
To: [email protected]<mailto:[email protected]>
Subject: [yocto] [eclipse-poky][RFC 0/6] 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. However, I already wanted to post this series for a review and make sure that the concept is acceptable, so that we can build on top of it.
Cheers, Atanas
P.S: This patch series apply on the current master "plugins/sdk.ide:
Extracted error message to YoctoSDKMessages" (7142c5fc82a41a9d5f86c48b289db0ef44f5a897).
Atanas Gegov (6):
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
.../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 | 256 ++++++++++++++++++++ .../EmptyCAutotoolsProject/template.xml | 1 + .../EmptyCPPAutotoolsProject/template.xml | 1 + .../HelloWorldCAutotoolsProject/template.xml | 1 + .../HelloWorldCGTKAutotoolsProject/template.xml | 1 + .../HelloWorldCPPAutotoolsProject/template.xml | 1 + 11 files changed, 384 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
Hi Jessica,
thank you for the input, I will resend the patches.
Best regards,
Atanas
Quoted 200 lines · Jessica
Hi Atanas,****
** **
Please see my comments below…****
** **
Thanks,****
Jessica****
** **
*From:* Atanas Gegov [mailto:[email protected]] *Sent:* Wednesday, April 24, 2013 8:48 AM
*To:* Zhang, Jessica
*Cc:* [email protected]
*Subject:* Re: [yocto] [eclipse-poky][RFC 0/6] Introducing a YoctoSDKCMakeProjectNature****** **
Hi Jessica,
thank you for the comments!****
** **
**1. **Yes, the idea is that at the end there are the current
category ("Yocto Project ADT Autotools Project" with some Autotools-based project templates) and a new category "Yocto Project ADT CMake Project" with e.g. its own "Hello World C++ CMake Project". The latter category and the templates will be implemented in the upcoming patch series. ****Great that’s what I’d expected .****
** **
**2. **Could you please give me a small example how it should look
like?Should the method addNatures receive a list of natures to add? What is the case if more natures are added to a project (e.g. SDKNature + AutotoolsNature + EmptyNature)? Or do you think of enum based on the buildsystem natures only (Autotools vs. CMake) and not based on all 4 natures?****I took another look of the class, we should be able to even further simplify the API of addNatures. We can make all the natures as instance variables of the class. In process method we assign them values and totally eliminate passing natures in addNatures API. So the code should be(please ignore the incorrect capitalization due to auto correction):****
** **
Public class NewYoctoProjectTemplateProcess extends ProcessRunner {****
…****
Private Boolean isEmptyProject; ****
Private Boolean isAutotoolsProject;****
Private Boolean isCMakeProject;****
…****
Public void process(…) {****
…****
isEmptyProject = …****
isAutotoolsProject = …****
isCMakeProject = …****
…****
addNatures(project, false, monitor);****…****
}****
…****
Private void addNatures(IProject project, Boolean
projectExists, IProgressMonitor monitor) {****…**** }****** **
**3. **I just created an account in bugzilla.yoctoproject.org, so
you can assign me the CMake support entry.****Super. You’ll get your first assignment J****
Thanks,
Atanas****** **
On Tue, Apr 23, 2013 at 8:50 PM, Zhang, Jessica <[email protected]> wrote:****
Hi Atanas,
Overall, the patches look good. Couple comments:
1. So from the end user perspective, after the 2nd patch set, user will see "Yocto Project ADT CMake Project" category when they want to create a new project?
2. Can we change the API for addNatures by using an enum type for projectNature instead of explicitly listing all of them out. This way is easier for code maintenance and API usability.
3. Don't know whether you've created a bugzilla account at bugzilla.yoctoproject.org or not, if not, please do, since I'd hope you're able to help fixing certain bugs in this area down the road. Also, from project planning process wise, we're right in the 1.5 planning, and I'd like to create an entry in the bugzilla for extending eclipse for CMake support and assign that to you, so it's easier to track what are the community contribution to the project.Thanks,
Jessica****-----Original Message-----
From: [email protected] [mailto:
[email protected]] On Behalf Of Atanas Gegov
Sent: Monday, April 22, 2013 5:06 AM
To: [email protected]
Subject: [yocto] [eclipse-poky][RFC 0/6] 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. However, I already wanted to post this series for a review and make sure that the concept is acceptable, so that we can build on top of it.
Cheers, Atanas
P.S: This patch series apply on the current master "plugins/sdk.ide:
Extracted error message to YoctoSDKMessages" (7142c5fc82a41a9d5f86c48b289db0ef44f5a897).Atanas Gegov (6):
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.../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 | 256 ++++++++++++++++++++ .../EmptyCAutotoolsProject/template.xml | 1 + .../EmptyCPPAutotoolsProject/template.xml | 1 + .../HelloWorldCAutotoolsProject/template.xml | 1 + .../HelloWorldCGTKAutotoolsProject/template.xml | 1 + .../HelloWorldCPPAutotoolsProject/template.xml | 1 + 11 files changed, 384 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****** **