Skip to contentSkip to conversation

Introducing a YoctoSDKAutotoolsProjectNature

PATCH Superseded Atanas Gegov 2 participants 14 messages Apr 11, 2013 – Apr 17, 2013

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover Introducing a YoctoSDKAutotoolsProjectNature

From: Atanas Gegov <[email protected]>

Hi,

this patch series does a refactoring in the project natures. It does not add new functionality. In detail, this means the following:

Initially, the org.yocto.sdk.ide plugin defined 2 natures:
1/ YoctoSDKProjectNature (every template project has this nature, strongly coupled with Autotools)
2/ YoctoSDKEmptyProjectNature (additional nature for empty projects)

With this change there are now 3 natures available:
1/ YoctoSDKProjectNature (the "basic" nature,
every Yocto IDE project has this nature)
2/ YoctoSDKAutotoolsProjectNature (requires YoctoSDKProjectNature, strongly coupled with Autotools, all existing template projects get it) 3/ YoctoSDKEmptyProjectNature (additional nature for empty projects, requires YoctoSDKProjectNature)

All current templates are renamed as Autotools projects to reflect their project type and nature.
Now it is possible to introduce new type of Yocto projects that for example use CMake instead of Autotools. These projects still have the YoctoSDKProjectNature which provides the right environment, the cross-development profiles, etc.

Cheers,
Atanas

P.S: This patch series apply on the current master "Fixed an issue for Invalid Project Name error message" (78c77f8387c0a74a4f345b51edb5e86924a1e2e8).

Atanas Gegov (9):
plugins/sdk.ide: Prepared templates for autotools nature plugins/sdk.ide: Added a new YoctoSDKAutotoolsProjectNature plugins/sdk.ide: Added a check method for the global target profie plugins/sdk.ide: Switch to YoctoSDKAutotoolsProjectNature plugins/sdk.ide: Renamed existing project type plugins/sdk.ide: Renamed existing templates plugins/sdk.ide: Renamed the NewYoctoProjectPostProcess plugins/sdk.ide: Improved usage of strings in class plugins/sdk.ide: Extracted error message to YoctoSDKMessages

 .../OSGI-INF/l10n/bundle.properties                |    3 +-
 plugins/org.yocto.sdk.ide/plugin.xml               |   34 ++++-
 .../src/org/yocto/sdk/ide/YoctoSDKChecker.java     |   13 ++
 .../org/yocto/sdk/ide/YoctoSDKMessages.properties  |    3 +
 .../natures/YoctoSDKAutotoolsProjectNature.java    |   86 ++++++++++++
 .../sdk/ide/natures/YoctoSDKProjectNature.java     |   70 ----------
 .../src/org/yocto/sdk/ide/utils/YoctoSDKUtils.java |    6 +-
 .../NewYoctoAutotoolsProjectPostProcess.java       |   81 +++++++++++
 .../sdk/ide/wizard/NewYoctoCProjectTemplate.java   |   82 ++++++-----
 .../sdk/ide/wizard/NewYoctoProjectPostProcess.java |   73 ----------
 .../EmptyCAutotoolsProject/template.properties     |   14 ++
 .../EmptyCAutotoolsProject/template.xml            |   17 +++
 .../EmptyCPPAutotoolsProject/template.properties   |   14 ++
 .../EmptyCPPAutotoolsProject/template.xml          |   16 +++
 .../EmptyCPPProject/template.properties            |   14 --
 .../projecttemplates/EmptyCPPProject/template.xml  |   15 ---
 .../EmptyCProject/template.properties              |   14 --
 .../projecttemplates/EmptyCProject/template.xml    |   16 ---
 .../HelloWorldCAutotoolsProject/template.xml       |    5 +-
 .../HelloWorldCGTKAutotoolsProject/src/Basename.c  |   50 +++++++
 .../src/Basename.desktop.in.src                    |    9 ++
 .../HelloWorldCGTKAutotoolsProject/src/INSTALL     |    9 ++
 .../src/Makefile.am.src                            |    8 ++
 .../src/Makefile.am.top                            |    7 +
 .../HelloWorldCGTKAutotoolsProject/src/README      |   25 ++++
 .../HelloWorldCGTKAutotoolsProject/src/autogen.sh  |   10 ++
 .../src/configure.ac.top                           |   49 +++++++
 .../src/configure.ac.top.old                       |   37 +++++
 .../template.properties                            |   28 ++++
 .../HelloWorldCGTKAutotoolsProject/template.xml    |  142 ++++++++++++++++++++
 .../HelloWorldCGTKProject/src/Basename.c           |   50 -------
 .../src/Basename.desktop.in.src                    |    9 --
 .../HelloWorldCGTKProject/src/INSTALL              |    9 --
 .../HelloWorldCGTKProject/src/Makefile.am.src      |    8 --
 .../HelloWorldCGTKProject/src/Makefile.am.top      |    7 -
 .../HelloWorldCGTKProject/src/README               |   25 ----
 .../HelloWorldCGTKProject/src/autogen.sh           |   10 --
 .../HelloWorldCGTKProject/src/configure.ac.top     |   49 -------
 .../HelloWorldCGTKProject/src/configure.ac.top.old |   37 -----
 .../HelloWorldCGTKProject/template.properties      |   28 ----
 .../HelloWorldCGTKProject/template.xml             |  141 -------------------
 .../HelloWorldCPPAutotoolsProject/template.xml     |    5 +-
 42 files changed, 706 insertions(+), 622 deletions(-)
 create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKAutotoolsProjectNature.java
 create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/wizard/NewYoctoAutotoolsProjectPostProcess.java
 delete mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/wizard/NewYoctoProjectPostProcess.java
 create mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/EmptyCAutotoolsProject/template.properties
 create mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/EmptyCAutotoolsProject/template.xml
 create mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/EmptyCPPAutotoolsProject/template.properties
 create mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/EmptyCPPAutotoolsProject/template.xml
 delete mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/EmptyCPPProject/template.properties
 delete mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/EmptyCPPProject/template.xml
 delete mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/EmptyCProject/template.properties
 delete mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/EmptyCProject/template.xml
 create mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/Basename.c
 create mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/Basename.desktop.in.src
 create mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/ChangeLog
 create mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/INSTALL
 create mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/Makefile.am.src
 create mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/Makefile.am.top
 create mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/NEWS
 create mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/README
 create mode 100755 plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/autogen.sh
 create mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/configure.ac.top
 create mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/configure.ac.top.old
 create mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/template.properties
 create mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/template.xml
 delete mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKProject/src/Basename.c
 delete mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKProject/src/Basename.desktop.in.src
 delete mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKProject/src/ChangeLog
 delete mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKProject/src/INSTALL
 delete mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKProject/src/Makefile.am.src
 delete mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKProject/src/Makefile.am.top
 delete mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKProject/src/NEWS
 delete mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKProject/src/README
 delete mode 100755 plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKProject/src/autogen.sh
 delete mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKProject/src/configure.ac.top
 delete mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKProject/src/configure.ac.top.old
 delete mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKProject/template.properties
 delete mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKProject/template.xml
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH v2 1/9 plugins/sdk.ide: Prepared templates for autotools nature

From: Atanas Gegov <[email protected]>

Added an extra variable to the templates and the
creating process. They are now prepared for a new
autotools nature.

---
 plugins/org.yocto.sdk.ide/plugin.xml               |    4 ++++
 .../sdk/ide/wizard/NewYoctoCProjectTemplate.java   |    3 +++
 .../projecttemplates/EmptyCPPProject/template.xml  |    1 +
 .../projecttemplates/EmptyCProject/template.xml    |    1 +
 .../HelloWorldCAutotoolsProject/template.xml       |    1 +
 .../HelloWorldCGTKProject/template.xml             |    1 +
 .../HelloWorldCPPAutotoolsProject/template.xml     |    1 +
 7 files changed, 12 insertions(+)
plugins/org.yocto.sdk.ide/plugin.xml +4 -0
index 8e8daac..1fbca80 100644
@@ -142,6 +142,10 @@
                external="true"
                name="isEmptyProject">
          </simple>
+         <simple
+               external="true"
+               name="isAutotoolsProject">
+         </simple>
       </processType>
       <processType
             name="NewYoctoProjectPostProcess"
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/wizard/NewYoctoCProjectTemplate.java +3 -0
index b8bef6b..73531e5 100644
@@ -86,8 +86,11 @@ public class NewYoctoCProjectTemplate extends ProcessRunner {
 		String artifactExtension = args[2].getSimpleValue();
 		String isCProjectValue = args[3].getSimpleValue();
 		String isEmptyProjetValue = args[4].getSimpleValue();
+		String isAutotoolsProjectValue = args[5].getSimpleValue();
 		boolean isCProject = Boolean.valueOf(isCProjectValue).booleanValue();
 		boolean isEmptryProject = Boolean.valueOf(isEmptyProjetValue).booleanValue();
+		boolean isAutotoolsProject = Boolean.valueOf(isAutotoolsProjectValue).booleanValue();
+
 		IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
 		try {
 			if (!isValidProjectName(projectName)) {
plugins/org.yocto.sdk.ide/templates/projecttemplates/EmptyCPPProject/template.xml +1 -0
index e1b2338..0f0a7e8 100644
@@ -9,6 +9,7 @@
 		<simple name="artifactExtension" value="exe" /> 
 		<simple name="isCProject" value="false" /> 
 		<simple name="isEmptyProject" value="true" />
+		<simple name="isAutotoolsProject" value="true" />
 	</process>
 
 </template>
plugins/org.yocto.sdk.ide/templates/projecttemplates/EmptyCProject/template.xml +1 -0
index f5c595c..8f821af 100644
@@ -10,6 +10,7 @@
 		<simple name="artifactExtension" value="exe" /> 
 		<simple name="isCProject" value="true" /> 
 		<simple name="isEmptyProject" value="true" />
+		<simple name="isAutotoolsProject" value="true" />
 	</process>
 
 </template>
plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/template.xml +1 -0
index 52ac355..ca58158 100644
@@ -55,6 +55,7 @@
 		<simple name="artifactExtension" value="exe" /> 
 		<simple name="isCProject" value="true" /> 
 		<simple name="isEmptyProject" value="false" />
+		<simple name="isAutotoolsProject" value="true" />
 	</process>
 
 	<process type="org.eclipse.cdt.core.CreateSourceFolder">
plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKProject/template.xml +1 -0
index e552a54..bbcf153 100644
@@ -55,6 +55,7 @@
 		<simple name="artifactExtension" value="exe" /> 
 		<simple name="isCProject" value="true" /> 
 		<simple name="isEmptyProject" value="false" />
+		<simple name="isAutotoolsProject" value="true" />
 	</process>
 
 	<process type="org.eclipse.cdt.core.CreateSourceFolder">
plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCPPAutotoolsProject/template.xml +1 -0
index a6bac07..7ec9e05 100644
@@ -55,6 +55,7 @@
 		<simple name="artifactExtension" value="exe" /> 
 		<simple name="isCProject" value="false" /> 
 		<simple name="isEmptyProject" value="false" />
+		<simple name="isAutotoolsProject" value="true" />
 	</process>
 
 	<process type="org.eclipse.cdt.core.CreateSourceFolder">
Signature · 1 line
1.7.9.5
#2 lore raw

PATCH v2 2/9 plugins/sdk.ide: Added a new YoctoSDKAutotoolsProjectNature

In reply to Atanas Gegov

From: Atanas Gegov <[email protected]>

This nature is intended for Yocto projects that use Autotools as a build system. It requires the YoctoSDKProjectNature and will be used by the existing templates.

---
 .../OSGI-INF/l10n/bundle.properties                |    1 +
 plugins/org.yocto.sdk.ide/plugin.xml               |   18 ++++++++-
 .../natures/YoctoSDKAutotoolsProjectNature.java    |   41 ++++++++++++++++++++
 3 files changed, 59 insertions(+), 1 deletion(-)
 create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKAutotoolsProjectNature.java
plugins/org.yocto.sdk.ide/OSGI-INF/l10n/bundle.properties +1 -0
index a7172be..3d491fb 100644
@@ -1,6 +1,7 @@
 #Properties file for org.Yocto.sdk.ide
 page.name.0 = Yocto Project ADT
 extension.name.0 = YoctoSDKNature
+extension.name.1 = YoctoSDKAutotoolsNature
 command.name = ReconfigureYoctoProject
 command.label.0 = Change Yocto Project Settings
 command.mnemonic = C
plugins/org.yocto.sdk.ide/plugin.xml +17 -1
index 1fbca80..f21434b 100644
@@ -19,12 +19,25 @@
          id="YoctoSDKNature"
          name="%extension.name.0"
          point="org.eclipse.core.resources.natures">
+      <runtime>
+         <run
+               class="org.yocto.sdk.ide.natures.YoctoSDKProjectNature">
+         </run>
+      </runtime>
+   </extension>
+   <extension
+         id="YoctoSDKAutotoolsNature"
+         name="%extension.name.1"
+         point="org.eclipse.core.resources.natures">
+      <requires-nature
+            id="org.yocto.sdk.ide.YoctoSDKNature">
+      </requires-nature>
       <requires-nature
             id="org.eclipse.cdt.autotools.core.autotoolsNatureV2">
       </requires-nature>
       <runtime>
          <run
-               class="org.yocto.sdk.ide.natures.YoctoSDKProjectNature">
+               class="org.yocto.sdk.ide.natures.YoctoSDKAutotoolsProjectNature">
          </run>
       </runtime>
       <builder
@@ -34,6 +47,9 @@
    <extension
          id="YoctoSDKEmptyNature"
          point="org.eclipse.core.resources.natures">
+      <requires-nature
+            id="org.yocto.sdk.ide.YoctoSDKNature">
+      </requires-nature>
       <runtime>
          <run
                class="org.yocto.sdk.ide.natures.YoctoSDKEmptyProjectNature">
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKAutotoolsProjectNature.java new file +41 -0

41 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#3 lore raw

PATCH v2 3/9 plugins/sdk.ide: Added a check method for the global target profie

In reply to Atanas Gegov

From: Atanas Gegov <[email protected]>

Added an own method (copied code) in YoctoSDKChecker that checks the validity of the globally selected profile. This method will be used in the next patch and will replace duplicated code.

---
 .../src/org/yocto/sdk/ide/YoctoSDKChecker.java     |   13 +++++++++++++
 1 file changed, 13 insertions(+)
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKChecker.java +13 -0
index 74d97a0..92db72a 100644
@@ -19,6 +19,7 @@ import java.io.FileReader;
 import java.io.FilenameFilter;
 import java.io.IOException;
 
+import org.eclipse.jface.preference.IPreferenceStore;
 import org.yocto.sdk.ide.natures.YoctoSDKProjectNature;
 import org.yocto.sdk.ide.utils.YoctoSDKUtils;
 import org.yocto.sdk.ide.utils.YoctoSDKUtilsConstants;
@@ -98,6 +99,18 @@ public class YoctoSDKChecker {
 		}
 	};
 
+	public static void checkIfGloballySelectedYoctoProfileIsValid() throws YoctoGeneralException {
+		YoctoProfileElement profileElement = YoctoSDKUtils.getProfilesFromDefaultStore();
+		IPreferenceStore selectedProfileStore = YoctoSDKPlugin.getProfilePreferenceStore(profileElement.getSelectedProfile());
+		YoctoUIElement elem = YoctoSDKUtils.getElemFromStore(selectedProfileStore);
+
+		SDKCheckResults result = checkYoctoSDK(elem);
+		if (result != SDKCheckResults.SDK_PASS){
+			String strErrorMsg =  getErrorMessage(result, SDKCheckRequestFrom.Wizard);
+			throw new YoctoGeneralException(strErrorMsg);
+		}
+	}
+
 	public static SDKCheckResults checkYoctoSDK(YoctoUIElement elem) {
 		if (elem.getStrToolChainRoot().isEmpty())
 			return SDKCheckResults.TOOLCHAIN_LOCATION_EMPTY;
Signature · 1 line
1.7.9.5
#4 lore raw

PATCH v2 4/9 plugins/sdk.ide: Switch to YoctoSDKAutotoolsProjectNature

In reply to Atanas Gegov

From: Atanas Gegov <[email protected]>

The YoctoSDKProjectNature remains the basic nature for all Yocto projects in the IDE. The projects using Autotools (all templates) get the YoctoSDKProjectNature and additionally the YoctoSDKAutotoolsProjectNature. The process NewYoctoCProjectTemplate is adapted accordingly.

---
 plugins/org.yocto.sdk.ide/plugin.xml               |    2 +-
 .../natures/YoctoSDKAutotoolsProjectNature.java    |   45 +++++++++++
 .../sdk/ide/natures/YoctoSDKProjectNature.java     |   70 -----------------
 .../src/org/yocto/sdk/ide/utils/YoctoSDKUtils.java |    6 +-
 .../sdk/ide/wizard/NewYoctoCProjectTemplate.java   |   79 ++++++++++++--------
 5 files changed, 96 insertions(+), 106 deletions(-)
plugins/org.yocto.sdk.ide/plugin.xml +1 -1
index f21434b..35e34b4 100644
@@ -91,7 +91,7 @@
                            type="org.eclipse.core.resources.IResource">
                         <test
                               property="org.eclipse.core.resources.projectNature"
-                              value="org.yocto.sdk.ide.YoctoSDKNature">
+                              value="org.yocto.sdk.ide.YoctoSDKAutotoolsNature">
                         </test>
                      </adapt>
                   </iterate>
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKAutotoolsProjectNature.java +45 -0

64 lines not on this page · raw message

plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKProjectNature.java +0 -70

89 lines not on this page · raw message

plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/utils/YoctoSDKUtils.java +4 -2
index bd781b3..1e2e424 100644
@@ -54,8 +54,8 @@ import org.yocto.sdk.ide.YoctoProfileElement;
 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.YoctoSDKEmptyProjectNature;
-import org.yocto.sdk.ide.natures.YoctoSDKProjectNature;
 import org.yocto.sdk.ide.preferences.PreferenceConstants;
 
 public class YoctoSDKUtils {
@@ -427,7 +427,9 @@ public class YoctoSDKUtils {
 
 		try {
 			setEnvironmentVariables(project, elem);
-			YoctoSDKProjectNature.configureAutotoolsOptions(project);
+			if(project.hasNature(YoctoSDKAutotoolsProjectNature.YoctoSDK_AUTOTOOLS_NATURE_ID)) {
+				YoctoSDKAutotoolsProjectNature.configureAutotoolsOptions(project);
+			}
 			IConsole console = CCorePlugin.getDefault().getConsole("org.yocto.sdk.ide.YoctoConsole");
 			console.start(project);
 			consoleOutStream = console.getOutputStream();
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/wizard/NewYoctoCProjectTemplate.java +46 -33

121 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#5 lore raw

Re: [PATCHv2 4/9] plugins/sdk.ide: Switch to YoctoSDKAutotoolsProjectNature

Hi Atanas,

Everything looks good for the patch series except can we make YoctoSDKAutotoolsProjectNature subclass of YoctoSDKProjectNature by extending it to better show the classes relationship. In this way, you don't need to introduce the special method of addYoctoSDKAutotoolsNature in YoctoSDKAutotoolsProjectNature which makes the interface a little bit cleaner via encapsulation.

Thanks,
Jessica

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Atanas Gegov
Sent: Thursday, April 11, 2013 4:25 AM
To: [email protected]
Subject: [yocto] [PATCHv2 4/9] plugins/sdk.ide: Switch to YoctoSDKAutotoolsProjectNature

From: Atanas Gegov <[email protected]>

The YoctoSDKProjectNature remains the basic nature for all Yocto projects in the IDE. The projects using Autotools (all templates) get the YoctoSDKProjectNature and additionally the YoctoSDKAutotoolsProjectNature. The process NewYoctoCProjectTemplate is adapted accordingly.

---
 plugins/org.yocto.sdk.ide/plugin.xml               |    2 +-
 .../natures/YoctoSDKAutotoolsProjectNature.java    |   45 +++++++++++
 .../sdk/ide/natures/YoctoSDKProjectNature.java     |   70 -----------------
 .../src/org/yocto/sdk/ide/utils/YoctoSDKUtils.java |    6 +-
 .../sdk/ide/wizard/NewYoctoCProjectTemplate.java   |   79 ++++++++++++--------
 5 files changed, 96 insertions(+), 106 deletions(-)
plugins/org.yocto.sdk.ide/plugin.xml +2 -1
index f21434b..35e34b4 100644
@@ -91,7 +91,7 @@
                            type="org.eclipse.core.resources.IResource">
                         <test
                               property="org.eclipse.core.resources.projectNature"
-                              value="org.yocto.sdk.ide.YoctoSDKNature">
+
+ value="org.yocto.sdk.ide.YoctoSDKAutotoolsNature">
                         </test>
                      </adapt>
                   </iterate>
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKAu renamed from plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKAutotoolsProjectNature.java +0 -0
index ac73878..767c005 100644

+++ totoolsProjectNature.java
@@ -10,15 +10,31 @@
*******************************************************************************/
package org.yocto.sdk.ide.natures;

+import +org.eclipse.cdt.internal.autotools.core.configure.AutotoolsConfiguratio +nManager; import +org.eclipse.cdt.internal.autotools.core.configure.IAConfiguration; +import org.eclipse.cdt.managedbuilder.core.IConfiguration; +import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo; +import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
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.YoctoUIElement; import +org.yocto.sdk.ide.utils.YoctoSDKUtils;

public class YoctoSDKAutotoolsProjectNature implements IProjectNature {

        public static final  String YoctoSDK_AUTOTOOLS_NATURE_ID = YoctoSDKPlugin.getUniqueIdentifier() + ".YoctoSDKAutotoolsNature";
+       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=";
+
        private IProject proj;

        public void configure() throws CoreException { @@ -38,4 +54,33 @@ public class YoctoSDKAutotoolsProjectNature implements IProjectNature {
        public static void addYoctoSDKAutotoolsNature(IProject project, IProgressMonitor monitor) throws CoreException {
                YoctoSDKNatureUtils.addNature(project, YoctoSDK_AUTOTOOLS_NATURE_ID, monitor);
        }
+
+       public static void configureAutotoolsOptions(IProject project) {
+               IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project);
+               IConfiguration icfg = info.getDefaultConfiguration();
+               YoctoUIElement elem = YoctoSDKUtils.getElemFromProjectEnv(project);
+               String sysroot_str = elem.getStrSysrootLoc();
+               String id = icfg.getId();
+               String CFLAGS_str = YoctoSDKUtils.getEnvValue(project, "CFLAGS");
+               String CXXFLAGS_str = YoctoSDKUtils.getEnvValue(project, "CXXFLAGS");
+               String CPPFLAGS_str = YoctoSDKUtils.getEnvValue(project, "CPPFLAGS");
+               String LDFLAGS_str = YoctoSDKUtils.getEnvValue(project, "LDFLAGS");
+
+               String command_prefix = "CFLAGS=\" -g -O0 " + CFLAGS_str + "\" CXXFLAGS=\" -g -O0 "
+                               + CXXFLAGS_str + "\" LDFLAGS=\"" + LDFLAGS_str + "\" CPPFLAGS=\"" + CPPFLAGS_str + "\"";
+               String autogen_setting = command_prefix+" autogen.sh" + DEFAULT_LIBTOOL_SYSROOT_PREFIX + sysroot_str;
+               String configure_setting = command_prefix + " configure" + DEFAULT_LIBTOOL_SYSROOT_PREFIX + sysroot_str;
+               IAConfiguration cfg = AutotoolsConfigurationManager.getInstance().getConfiguration(project, id);
+               String strConfigure = YoctoSDKUtils.getEnvValue(project,
+"CONFIGURE_FLAGS");
+
+               cfg.setOption(DEFAULT_CONFIGURE_STR, configure_setting);
+               cfg.setOption(DEFAULT_BUILD_STR, YoctoSDKUtils.splitString(strConfigure, "--build="));
+               cfg.setOption(DEFAULT_HOST_STR, YoctoSDKUtils.splitString(strConfigure, "--host="));
+               cfg.setOption(DEFAULT_TARGET_STR, YoctoSDKUtils.splitString(strConfigure, "--target="));
+               cfg.setOption(DEFAULT_AUTOGEN_STR, autogen_setting);
+               cfg.setOption(DEFAULT_AUTOGEN_OPT_STR, strConfigure);

+
+ AutotoolsConfigurationManager.getInstance().addConfiguration(project, cfg);
+ AutotoolsConfigurationManager.getInstance().saveConfigs(project);
+ }
}

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
index fcb296d..51926fb 100644

+++ ojectNature.java
@@ -10,39 +10,15 @@
*******************************************************************************/
package org.yocto.sdk.ide.natures;

-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;
-import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
-import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
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.jface.preference.IPreferenceStore;
-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.YoctoUIElement; -import org.yocto.sdk.ide.YoctoSDKChecker.SDKCheckRequestFrom;
-import org.yocto.sdk.ide.YoctoSDKChecker.SDKCheckResults;
-import org.yocto.sdk.ide.utils.YoctoSDKUtils;

-
-@SuppressWarnings("restriction")
public class YoctoSDKProjectNature implements IProjectNature {

        public static final  String YoctoSDK_NATURE_ID = YoctoSDKPlugin.getUniqueIdentifier() + ".YoctoSDKNature";
-       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=";
-
        private IProject proj;

        public void configure() throws CoreException { @@ -62,50 +38,4 @@ public class YoctoSDKProjectNature implements IProjectNature {
        public static void addYoctoSDKNature(IProject project, IProgressMonitor monitor) throws CoreException {
                YoctoSDKNatureUtils.addNature(project, YoctoSDK_NATURE_ID, monitor);
        }
-
-       public static void configureAutotoolsOptions(IProject project) {
-               IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project);
-               IConfiguration icfg = info.getDefaultConfiguration();
-               YoctoUIElement elem = YoctoSDKUtils.getElemFromProjectEnv(project);
-               String sysroot_str = elem.getStrSysrootLoc();
-               String id = icfg.getId();
-               String CFLAGS_str = YoctoSDKUtils.getEnvValue(project, "CFLAGS");
-               String CXXFLAGS_str = YoctoSDKUtils.getEnvValue(project, "CXXFLAGS");
-               String CPPFLAGS_str = YoctoSDKUtils.getEnvValue(project, "CPPFLAGS");
-               String LDFLAGS_str = YoctoSDKUtils.getEnvValue(project, "LDFLAGS");
-
-               String command_prefix = "CFLAGS=\" -g -O0 " + CFLAGS_str + "\" CXXFLAGS=\" -g -O0 "
-               + CXXFLAGS_str + "\" LDFLAGS=\"" + LDFLAGS_str + "\" CPPFLAGS=\"" + CPPFLAGS_str + "\"";
-               String autogen_setting = command_prefix+" autogen.sh" + DEFAULT_LIBTOOL_SYSROOT_PREFIX + sysroot_str;
-               String configure_setting = command_prefix + " configure" + DEFAULT_LIBTOOL_SYSROOT_PREFIX + sysroot_str;
-               IAConfiguration cfg = AutotoolsConfigurationManager.getInstance().getConfiguration(project, id);
-               String strConfigure = YoctoSDKUtils.getEnvValue(project, "CONFIGURE_FLAGS");
-
-               cfg.setOption(DEFAULT_CONFIGURE_STR, configure_setting);
-               cfg.setOption(DEFAULT_BUILD_STR, YoctoSDKUtils.splitString(strConfigure, "--build="));
-               cfg.setOption(DEFAULT_HOST_STR, YoctoSDKUtils.splitString(strConfigure, "--host="));
-               cfg.setOption(DEFAULT_TARGET_STR, YoctoSDKUtils.splitString(strConfigure, "--target="));
-               cfg.setOption(DEFAULT_AUTOGEN_STR, autogen_setting);
-               cfg.setOption(DEFAULT_AUTOGEN_OPT_STR, strConfigure);

-
- AutotoolsConfigurationManager.getInstance().addConfiguration(project, cfg);
- AutotoolsConfigurationManager.getInstance().saveConfigs(project);
- }
-
- public static void configureAutotools(IProject project) throws YoctoGeneralException {

-               YoctoProfileElement profileElement = YoctoSDKUtils.getProfilesFromDefaultStore();
-               YoctoSDKUtils.saveProfilesToProjectPreferences(profileElement, project);
-               IPreferenceStore selecteProfileStore = YoctoSDKPlugin.getProfilePreferenceStore(profileElement.getSelectedProfile());
-               YoctoUIElement elem = YoctoSDKUtils.getElemFromStore(selecteProfileStore);
-               SDKCheckResults result = YoctoSDKChecker.checkYoctoSDK(elem);
-               if (result != SDKCheckResults.SDK_PASS){
-                       String strErrorMsg =  YoctoSDKChecker.getErrorMessage(result, SDKCheckRequestFrom.Wizard);
-                       throw new YoctoGeneralException(strErrorMsg);
-               }
-               else
-               {

- YoctoSDKUtils.setEnvironmentVariables(project, elem);
- configureAutotoolsOptions(project);
- }
- }
}

plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/utils/YoctoSDKUtil renamed from plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/utils/YoctoSDKUtils.java +0 -0
index bd781b3..1e2e424 100644

+++ s.java
@@ -54,8 +54,8 @@ import org.yocto.sdk.ide.YoctoProfileElement;
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.YoctoSDKEmptyProjectNature;
-import org.yocto.sdk.ide.natures.YoctoSDKProjectNature;
import org.yocto.sdk.ide.preferences.PreferenceConstants;

public class YoctoSDKUtils {
@@ -427,7 +427,9 @@ public class YoctoSDKUtils {

                try {
                        setEnvironmentVariables(project, elem);

- YoctoSDKProjectNature.configureAutotoolsOptions(project);
+ if(project.hasNature(YoctoSDKAutotoolsProjectNature.YoctoSDK_AUTOTOOLS_NATURE_ID)) {
+ YoctoSDKAutotoolsProjectNature.configureAutotoolsOptions(project);
+ }

                        IConsole console = CCorePlugin.getDefault().getConsole("org.yocto.sdk.ide.YoctoConsole");
                        console.start(project);
                        consoleOutStream = console.getOutputStream(); diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/wizard/NewYoctoCProjectTemplate.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/wizard/NewYoctoCProjectTemplate.java

index 73531e5..239cbf8 100644
--- a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/wizard/NewYoctoCProjectTemplate.java +++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/wizard/NewYoctoCPr
+++ ojectTemplate.java
@@ -28,6 +28,7 @@ import org.eclipse.cdt.make.core.MakeCorePlugin;
import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager;
import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo; import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IPerProjectDiscoveredPathInfo;
+import
+org.eclipse.cdt.make.internal.core.scannerconfig.util.SymbolEntry;
import org.eclipse.cdt.managedbuilder.core.BuildException;
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
@@ -56,6 +57,7 @@ import org.yocto.sdk.ide.YoctoSDKChecker.SDKCheckResults;
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.YoctoSDKEmptyProjectNature;
import org.yocto.sdk.ide.natures.YoctoSDKProjectNature;
import org.yocto.sdk.ide.utils.YoctoSDKUtils;

@@ -88,7 +90,7 @@ public class NewYoctoCProjectTemplate extends ProcessRunner {
                String isEmptyProjetValue = args[4].getSimpleValue();
                String isAutotoolsProjectValue = args[5].getSimpleValue();
                boolean isCProject = Boolean.valueOf(isCProjectValue).booleanValue();
-               boolean isEmptryProject = Boolean.valueOf(isEmptyProjetValue).booleanValue();
+               boolean isEmptyProject =
+Boolean.valueOf(isEmptyProjetValue).booleanValue();
                boolean isAutotoolsProject = Boolean.valueOf(isAutotoolsProjectValue).booleanValue();

                IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
@@ -126,19 +128,8 @@ public class NewYoctoCProjectTemplate extends ProcessRunner {
                                pca.setArtifactExtension(artifactExtension);
                                info = pca.createProject(monitor, CCorePlugin.DEFAULT_INDEXER, isCProject);
-                               AutotoolsNewProjectNature.addAutotoolsNature(project, monitor);
-                               // For each IConfiguration, create a corresponding Autotools Configuration
-                               IConfiguration[] cfgs = pca.getConfigs();
-                               for (int i = 0; i < cfgs.length; ++i) {
-                                       IConfiguration cfg = cfgs[i];
-                                       AutotoolsConfigurationManager.getInstance().getConfiguration(project, cfg.getName(), true);
-                               }
-                               AutotoolsConfigurationManager.getInstance().saveConfigs(project);
-                               if(isEmptryProject) {
-                                       YoctoSDKEmptyProjectNature.addYoctoSDKEmptyNature(project, monitor);
-                               }
-                               YoctoSDKProjectNature.addYoctoSDKNature(project, monitor);
-                               YoctoSDKProjectNature.configureAutotools(project);
+                               addNatures(project, false, isEmptyProject, isAutotoolsProject,
+monitor);
+
                                info.setValid(true);
                                ManagedBuildManager.saveBuildInfo(project, true);

@@ -147,31 +138,19 @@ public class NewYoctoCProjectTemplate extends ProcessRunner {

                                IWorkspace workspace = ResourcesPlugin.getWorkspace();
                                turnOffAutoBuild(workspace);
-                               YoctoProfileElement profileElement = YoctoSDKUtils.getProfilesFromDefaultStore();
-                               IPreferenceStore selecteProfileStore = YoctoSDKPlugin.getProfilePreferenceStore(profileElement.getSelectedProfile());
-                               YoctoUIElement elem = YoctoSDKUtils.getElemFromStore(selecteProfileStore);
-                               SDKCheckResults result = YoctoSDKChecker.checkYoctoSDK(elem);
-                               if (result != SDKCheckResults.SDK_PASS){
-                                       String strErrorMsg =  YoctoSDKChecker.getErrorMessage(result, SDKCheckRequestFrom.Wizard);
-                                       throw new YoctoGeneralException(strErrorMsg);
-                               }
-                               AutotoolsNewProjectNature.addAutotoolsNature(project, monitor);
-                               if(isEmptryProject) {

- YoctoSDKEmptyProjectNature.addYoctoSDKEmptyNature(project, monitor);
- }
-
- YoctoSDKProjectNature.addYoctoSDKNature(project, monitor);
- YoctoSDKProjectNature.configureAutotools(project);
-
- AutotoolsConfigurationManager.getInstance().saveConfigs(project);
+
+ YoctoSDKChecker.checkIfGloballySelectedYoctoProfileIsValid();
+
+ addNatures(project, true, isEmptyProject, isAutotoolsProject,
+monitor);
+

                                //restoreAutoBuild(workspace);
                                IDiscoveredPathManager manager = MakeCorePlugin.getDefault().getDiscoveryManager();
                                IDiscoveredPathInfo pathInfo = manager.getDiscoveredInfo(project);
                                if (pathInfo instanceof IPerProjectDiscoveredPathInfo) {
                                    IPerProjectDiscoveredPathInfo projectPathInfo =
                                        (IPerProjectDiscoveredPathInfo) pathInfo;
-                                   projectPathInfo.setIncludeMap(new LinkedHashMap());
-                                   projectPathInfo.setSymbolMap(new LinkedHashMap());
+                                   projectPathInfo.setIncludeMap(new LinkedHashMap<String, Boolean>());
+                                   projectPathInfo.setSymbolMap(new LinkedHashMap<String,
+SymbolEntry>());
                                    manager.removeDiscoveredInfo(project);
                                }
                        }
@@ -200,6 +179,40 @@ public class NewYoctoCProjectTemplate extends ProcessRunner {
                return matcher.find();

}

+ private void addNatures(IProject project, boolean projectExists, boolean isEmptyProject,
+ boolean isAutotoolsProject, IProgressMonitor monitor)
+ throws CoreException, YoctoGeneralException {
+ YoctoSDKProjectNature.addYoctoSDKNature(project, monitor);
+
+ YoctoSDKChecker.checkIfGloballySelectedYoctoProfileIsValid();
+
+ YoctoProfileElement profileElement = YoctoSDKUtils.getProfilesFromDefaultStore();
+ YoctoSDKUtils.saveProfilesToProjectPreferences(profileElement,
+project);
+

+               IPreferenceStore selecteProfileStore = YoctoSDKPlugin.getProfilePreferenceStore(profileElement.getSelectedProfile());
+               YoctoUIElement elem = YoctoSDKUtils.getElemFromStore(selecteProfileStore);
+               YoctoSDKUtils.setEnvironmentVariables(project, elem);

+
+ if (isEmptyProject) {
+ YoctoSDKEmptyProjectNature.addYoctoSDKEmptyNature(project, monitor);
+ }
+
+ if (isAutotoolsProject) {
+ AutotoolsNewProjectNature.addAutotoolsNature(project, monitor);
+
+ if(!projectExists) {
+ // For each IConfiguration, create a corresponding Autotools Configuration
+ for (IConfiguration cfg : pca.getConfigs()) {
+ AutotoolsConfigurationManager.getInstance().getConfiguration(project, cfg.getName(), true);
+ }
+ AutotoolsConfigurationManager.getInstance().saveConfigs(project);
+ }
+
+ YoctoSDKAutotoolsProjectNature.addYoctoSDKAutotoolsNature(project, monitor);
+ YoctoSDKAutotoolsProjectNature.configureAutotoolsOptions(project);
+ }
+ }
+

        protected final void turnOffAutoBuild(IWorkspace workspace) throws CoreException {
                IWorkspaceDescription workspaceDesc = workspace.getDescription();
                savedAutoBuildingValue = workspaceDesc.isAutoBuilding();

--
1.7.9.5

_______________________________________________
yocto mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/yocto

#6 lore raw

Re: [PATCHv2 4/9] plugins/sdk.ide: Switch to YoctoSDKAutotoolsProjectNature

Hi Jessica,

My idea was that the YoctoSDKAutotoolsProjectNature and
the YoctoSDKProjectNature are related through the "requires-nature" tag in plugin.xml. The YoctoSDKAutotoolsProjectNature has also an another
"requires-nature" relation to the
org.eclipse.cdt.autotools.core.autotoolsNatureV2. If I make the YoctoSDKAutotoolsProjectNature a subclass of the YoctoSDKProjectNature it would suggest (according to my mind) a stronger connection to the YoctoSDKProjectNature than to the org.eclipse.cdt.autotools.core.autotoolsNatureV2. It would be like YoctoSDKAutotoolsProjectNature "requires more" YoctoSDKProjectNature than org.eclipse.cdt.autotools.core.autotoolsNatureV2...I am not sure if it is a problem or not. So, I can make the YoctoSDKAutotoolsProjectNature a subclass of the YoctoSDKProjectNature if you think that it is a better design.

What do you mean by "In this way, you don't need to introduce the special method of addYoctoSDKAutotoolsNature in YoctoSDKAutotoolsProjectNature which makes the interface a little bit cleaner via encapsulation"? In order to add the two natures to the project I think we need both static methods:
- YoctoSDKProjectNature.addYoctoSDKNature(project, monitor);
- YoctoSDKAutotoolsProjectNature.addYoctoSDKAutotoolsNature(project, monitor);
Or do you mean some other solution?

Looking forward to your feedback!

Best regards,
Atanas

Quoted 529 lines · Jessica

Hi Atanas,

Everything looks good for the patch series except can we make YoctoSDKAutotoolsProjectNature subclass of YoctoSDKProjectNature by extending it to better show the classes relationship. In this way, you don't need to introduce the special method of addYoctoSDKAutotoolsNature in YoctoSDKAutotoolsProjectNature which makes the interface a little bit cleaner via encapsulation.

Thanks,
Jessica

-----Original Message-----
From: [email protected] [mailto:
[email protected]] On Behalf Of Atanas Gegov
Sent: Thursday, April 11, 2013 4:25 AM
To: [email protected]
Subject: [yocto] [PATCHv2 4/9] plugins/sdk.ide: Switch to YoctoSDKAutotoolsProjectNature

From: Atanas Gegov <[email protected]>

The YoctoSDKProjectNature remains the basic nature for all Yocto projects in the IDE. The projects using Autotools (all templates) get the YoctoSDKProjectNature and additionally the YoctoSDKAutotoolsProjectNature. The process NewYoctoCProjectTemplate is adapted accordingly.

---
 plugins/org.yocto.sdk.ide/plugin.xml               |    2 +-
 .../natures/YoctoSDKAutotoolsProjectNature.java    |   45 +++++++++++
 .../sdk/ide/natures/YoctoSDKProjectNature.java     |   70
-----------------
 .../src/org/yocto/sdk/ide/utils/YoctoSDKUtils.java |    6 +-
 .../sdk/ide/wizard/NewYoctoCProjectTemplate.java   |   79
++++++++++++--------
 5 files changed, 96 insertions(+), 106 deletions(-)
plugins/org.yocto.sdk.ide/plugin.xml +2 -1
index f21434b..35e34b4 100644
@@ -91,7 +91,7 @@
                            type="org.eclipse.core.resources.IResource">
                         <test
 
 property="org.eclipse.core.resources.projectNature"
-                              value="org.yocto.sdk.ide.YoctoSDKNature">
+
+ value="org.yocto.sdk.ide.YoctoSDKAutotoolsNature">
                         </test>
                      </adapt>
                   </iterate>

diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKAutotoolsProjectNature.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKAutotoolsProjectNature.java index ac73878..767c005 100644
---
a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKAutotoolsProjectNature.java +++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKAu
+++ totoolsProjectNature.java

plugins/org.yocto.sdk.ide/plugin.xml +19 -0
@@ -10,15 +10,31 @@
 
 *******************************************************************************/
 package org.yocto.sdk.ide.natures;
 
+import
+org.eclipse.cdt.internal.autotools.core.configure.AutotoolsConfiguratio
+nManager; import
+org.eclipse.cdt.internal.autotools.core.configure.IAConfiguration;
+import org.eclipse.cdt.managedbuilder.core.IConfiguration;
+import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
+import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
 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.YoctoUIElement; import
+org.yocto.sdk.ide.utils.YoctoSDKUtils;
 
 public class YoctoSDKAutotoolsProjectNature implements IProjectNature {
        public static final  String YoctoSDK_AUTOTOOLS_NATURE_ID =
 YoctoSDKPlugin.getUniqueIdentifier() + ".YoctoSDKAutotoolsNature";
 
+       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=";
+
        private IProject proj;
 
        public void configure() throws CoreException { @@ -38,4 +54,33 @@

public class YoctoSDKAutotoolsProjectNature implements IProjectNature {
public static void addYoctoSDKAutotoolsNature(IProject project,
IProgressMonitor monitor) throws CoreException {
YoctoSDKNatureUtils.addNature(project,

YoctoSDK_AUTOTOOLS_NATURE_ID, monitor);
        }
plugins/org.yocto.sdk.ide/plugin.xml +3 -0
+
+       public static void configureAutotoolsOptions(IProject project) {
+               IManagedBuildInfo info =

ManagedBuildManager.getBuildInfo(project);

plugins/org.yocto.sdk.ide/plugin.xml +2 -0
+               IConfiguration icfg = info.getDefaultConfiguration();
+               YoctoUIElement elem =

YoctoSDKUtils.getElemFromProjectEnv(project);

plugins/org.yocto.sdk.ide/plugin.xml +3 -0
+               String sysroot_str = elem.getStrSysrootLoc();
+               String id = icfg.getId();
+               String CFLAGS_str = YoctoSDKUtils.getEnvValue(project,

"CFLAGS");
+ String CXXFLAGS_str = YoctoSDKUtils.getEnvValue(project,
"CXXFLAGS");
+ String CPPFLAGS_str = YoctoSDKUtils.getEnvValue(project,
"CPPFLAGS");
+ String LDFLAGS_str = YoctoSDKUtils.getEnvValue(project,
"LDFLAGS");

plugins/org.yocto.sdk.ide/plugin.xml +2 -0
+
+               String command_prefix = "CFLAGS=\" -g -O0 " + CFLAGS_str +

"\" CXXFLAGS=\" -g -O0 "
+ + CXXFLAGS_str + "\" LDFLAGS=\"" +
LDFLAGS_str + "\" CPPFLAGS=\"" + CPPFLAGS_str + "\"";
+ String autogen_setting = command_prefix+" autogen.sh" +
DEFAULT_LIBTOOL_SYSROOT_PREFIX + sysroot_str;
+ String configure_setting = command_prefix + " configure" +
DEFAULT_LIBTOOL_SYSROOT_PREFIX + sysroot_str;
+ IAConfiguration cfg =
AutotoolsConfigurationManager.getInstance().getConfiguration(project, id);

plugins/org.yocto.sdk.ide/plugin.xml +5 -0
+               String strConfigure = YoctoSDKUtils.getEnvValue(project,
+"CONFIGURE_FLAGS");
+
+               cfg.setOption(DEFAULT_CONFIGURE_STR, configure_setting);
+               cfg.setOption(DEFAULT_BUILD_STR,

YoctoSDKUtils.splitString(strConfigure, "--build="));
+ cfg.setOption(DEFAULT_HOST_STR,
YoctoSDKUtils.splitString(strConfigure, "--host="));
+ cfg.setOption(DEFAULT_TARGET_STR,
YoctoSDKUtils.splitString(strConfigure, "--target="));

plugins/org.yocto.sdk.ide/plugin.xml +4 -0
+               cfg.setOption(DEFAULT_AUTOGEN_STR, autogen_setting);
+               cfg.setOption(DEFAULT_AUTOGEN_OPT_STR, strConfigure);
+
+

AutotoolsConfigurationManager.getInstance().addConfiguration(project, cfg); +
AutotoolsConfigurationManager.getInstance().saveConfigs(project);
+ }
}
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 fcb296d..51926fb 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.java

plugins/org.yocto.sdk.ide/plugin.xml +0 -9
@@ -10,39 +10,15 @@
 
 *******************************************************************************/
 package org.yocto.sdk.ide.natures;
 
-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;
-import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
-import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
 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.jface.preference.IPreferenceStore;
-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.YoctoUIElement; -import org.yocto.sdk.ide.YoctoSDKChecker.SDKCheckRequestFrom;

plugins/org.yocto.sdk.ide/plugin.xml +0 -4
-import org.yocto.sdk.ide.YoctoSDKChecker.SDKCheckResults;
-import org.yocto.sdk.ide.utils.YoctoSDKUtils;
 
-
-@SuppressWarnings("restriction")
 public class YoctoSDKProjectNature implements IProjectNature {
        public static final  String YoctoSDK_NATURE_ID =

YoctoSDKPlugin.getUniqueIdentifier() + ".YoctoSDKNature";

plugins/org.yocto.sdk.ide/plugin.xml +0 -4
-       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";

plugins/org.yocto.sdk.ide/plugin.xml +0 -6
-
-       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=";
-
        private IProject proj;
 
        public void configure() throws CoreException { @@ -62,50 +38,4 @@

public class YoctoSDKProjectNature implements IProjectNature {
public static void addYoctoSDKNature(IProject project,
IProgressMonitor monitor) throws CoreException {
YoctoSDKNatureUtils.addNature(project, YoctoSDK_NATURE_ID,

monitor);
        }
plugins/org.yocto.sdk.ide/plugin.xml +0 -3
-
-       public static void configureAutotoolsOptions(IProject project) {
-               IManagedBuildInfo info =

ManagedBuildManager.getBuildInfo(project);

plugins/org.yocto.sdk.ide/plugin.xml +0 -2
-               IConfiguration icfg = info.getDefaultConfiguration();
-               YoctoUIElement elem =

YoctoSDKUtils.getElemFromProjectEnv(project);

plugins/org.yocto.sdk.ide/plugin.xml +0 -3
-               String sysroot_str = elem.getStrSysrootLoc();
-               String id = icfg.getId();
-               String CFLAGS_str = YoctoSDKUtils.getEnvValue(project,

"CFLAGS");
- String CXXFLAGS_str = YoctoSDKUtils.getEnvValue(project,
"CXXFLAGS");
- String CPPFLAGS_str = YoctoSDKUtils.getEnvValue(project,
"CPPFLAGS");
- String LDFLAGS_str = YoctoSDKUtils.getEnvValue(project,
"LDFLAGS");

plugins/org.yocto.sdk.ide/plugin.xml +0 -2
-
-               String command_prefix = "CFLAGS=\" -g -O0 " + CFLAGS_str +

"\" CXXFLAGS=\" -g -O0 "
- + CXXFLAGS_str + "\" LDFLAGS=\"" + LDFLAGS_str + "\"
CPPFLAGS=\"" + CPPFLAGS_str + "\"";
- String autogen_setting = command_prefix+" autogen.sh" +
DEFAULT_LIBTOOL_SYSROOT_PREFIX + sysroot_str;
- String configure_setting = command_prefix + " configure" +
DEFAULT_LIBTOOL_SYSROOT_PREFIX + sysroot_str;
- IAConfiguration cfg =
AutotoolsConfigurationManager.getInstance().getConfiguration(project, id);
- String strConfigure = YoctoSDKUtils.getEnvValue(project,
"CONFIGURE_FLAGS");

plugins/org.yocto.sdk.ide/plugin.xml +0 -3
-
-               cfg.setOption(DEFAULT_CONFIGURE_STR, configure_setting);
-               cfg.setOption(DEFAULT_BUILD_STR,

YoctoSDKUtils.splitString(strConfigure, "--build="));
- cfg.setOption(DEFAULT_HOST_STR,
YoctoSDKUtils.splitString(strConfigure, "--host="));
- cfg.setOption(DEFAULT_TARGET_STR,
YoctoSDKUtils.splitString(strConfigure, "--target="));

plugins/org.yocto.sdk.ide/plugin.xml +0 -4
-               cfg.setOption(DEFAULT_AUTOGEN_STR, autogen_setting);
-               cfg.setOption(DEFAULT_AUTOGEN_OPT_STR, strConfigure);
-
-

AutotoolsConfigurationManager.getInstance().addConfiguration(project, cfg); - AutotoolsConfigurationManager.getInstance().saveConfigs(project);

plugins/org.yocto.sdk.ide/plugin.xml +0 -3
-       }
-
-       public static void configureAutotools(IProject project) throws

YoctoGeneralException {
- YoctoProfileElement profileElement =
YoctoSDKUtils.getProfilesFromDefaultStore();
-
YoctoSDKUtils.saveProfilesToProjectPreferences(profileElement, project);
- IPreferenceStore selecteProfileStore =
YoctoSDKPlugin.getProfilePreferenceStore(profileElement.getSelectedProfile());
- YoctoUIElement elem =
YoctoSDKUtils.getElemFromStore(selecteProfileStore);
- SDKCheckResults result =
YoctoSDKChecker.checkYoctoSDK(elem);

plugins/org.yocto.sdk.ide/plugin.xml +0 -7
-               if (result != SDKCheckResults.SDK_PASS){
-                       String strErrorMsg =
 YoctoSDKChecker.getErrorMessage(result, SDKCheckRequestFrom.Wizard);
-                       throw new YoctoGeneralException(strErrorMsg);
-               }
-               else
-               {
-                       YoctoSDKUtils.setEnvironmentVariables(project,

elem);

plugins/org.yocto.sdk.ide/plugin.xml +0 -3
-                       configureAutotoolsOptions(project);
-               }
-       }
 }

diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/utils/YoctoSDKUtils.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/utils/YoctoSDKUtils.java index bd781b3..1e2e424 100644
---
a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/utils/YoctoSDKUtils.java +++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/utils/YoctoSDKUtil +++ s.java

plugins/org.yocto.sdk.ide/plugin.xml +3 -2
@@ -54,8 +54,8 @@ import org.yocto.sdk.ide.YoctoProfileElement;
 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.YoctoSDKEmptyProjectNature;
-import org.yocto.sdk.ide.natures.YoctoSDKProjectNature;
 import org.yocto.sdk.ide.preferences.PreferenceConstants;
 
 public class YoctoSDKUtils {
@@ -427,7 +427,9 @@ public class YoctoSDKUtils {
 
                try {
                        setEnvironmentVariables(project, elem);
-
 YoctoSDKProjectNature.configureAutotoolsOptions(project);
+
 if(project.hasNature(YoctoSDKAutotoolsProjectNature.YoctoSDK_AUTOTOOLS_NATURE_ID))
 {
+

YoctoSDKAutotoolsProjectNature.configureAutotoolsOptions(project);
+ }
IConsole console =

CCorePlugin.getDefault().getConsole("org.yocto.sdk.ide.YoctoConsole");
                        console.start(project);
                        consoleOutStream = console.getOutputStream(); diff

--git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/wizard/NewYoctoCProjectTemplate.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/wizard/NewYoctoCProjectTemplate.java index 73531e5..239cbf8 100644
---
a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/wizard/NewYoctoCProjectTemplate.java +++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/wizard/NewYoctoCPr +++ ojectTemplate.java

plugins/org.yocto.sdk.ide/plugin.xml +5 -1
@@ -28,6 +28,7 @@ import org.eclipse.cdt.make.core.MakeCorePlugin;
 import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager;
 import
 org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo;
 import
 org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IPerProjectDiscoveredPathInfo;
+import
+org.eclipse.cdt.make.internal.core.scannerconfig.util.SymbolEntry;
 import org.eclipse.cdt.managedbuilder.core.BuildException;
 import org.eclipse.cdt.managedbuilder.core.IConfiguration;
 import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
@@ -56,6 +57,7 @@ import org.yocto.sdk.ide.YoctoSDKChecker.SDKCheckResults;
 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.YoctoSDKEmptyProjectNature;
 import org.yocto.sdk.ide.natures.YoctoSDKProjectNature;
 import org.yocto.sdk.ide.utils.YoctoSDKUtils;
@@ -88,7 +90,7 @@ public class NewYoctoCProjectTemplate extends
 ProcessRunner {
                String isEmptyProjetValue = args[4].getSimpleValue();
                String isAutotoolsProjectValue = args[5].getSimpleValue();
                boolean isCProject =
 Boolean.valueOf(isCProjectValue).booleanValue();
-               boolean isEmptryProject =
 Boolean.valueOf(isEmptyProjetValue).booleanValue();
+               boolean isEmptyProject =
+Boolean.valueOf(isEmptyProjetValue).booleanValue();
                boolean isAutotoolsProject =

Boolean.valueOf(isAutotoolsProjectValue).booleanValue();

IProject project =
ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);

plugins/org.yocto.sdk.ide/plugin.xml +0 -2
@@ -126,19 +128,8 @@ public class NewYoctoCProjectTemplate extends
 ProcessRunner {
 
 pca.setArtifactExtension(artifactExtension);
                                info = pca.createProject(monitor,
 CCorePlugin.DEFAULT_INDEXER, isCProject);
 
-
 AutotoolsNewProjectNature.addAutotoolsNature(project, monitor);
-                               // For each IConfiguration, create a

corresponding Autotools Configuration

plugins/org.yocto.sdk.ide/plugin.xml +0 -4
-                               IConfiguration[] cfgs = pca.getConfigs();
-                               for (int i = 0; i < cfgs.length; ++i) {
-                                       IConfiguration cfg = cfgs[i];
-

AutotoolsConfigurationManager.getInstance().getConfiguration(project, cfg.getName(), true);

plugins/org.yocto.sdk.ide/plugin.xml +0 -2
-                               }
-

AutotoolsConfigurationManager.getInstance().saveConfigs(project);

plugins/org.yocto.sdk.ide/plugin.xml +0 -2
-                               if(isEmptryProject) {
-

YoctoSDKEmptyProjectNature.addYoctoSDKEmptyNature(project, monitor);

plugins/org.yocto.sdk.ide/plugin.xml +0 -2
-                               }
-

YoctoSDKProjectNature.addYoctoSDKNature(project, monitor); - YoctoSDKProjectNature.configureAutotools(project);
+ addNatures(project, false, isEmptyProject,
isAutotoolsProject,

plugins/org.yocto.sdk.ide/plugin.xml +2 -0
+monitor);
+
                                info.setValid(true);
                                ManagedBuildManager.saveBuildInfo(project,

true);

plugins/org.yocto.sdk.ide/plugin.xml +0 -17
@@ -147,31 +138,19 @@ public class NewYoctoCProjectTemplate extends
 ProcessRunner {
 
                                IWorkspace workspace =
 ResourcesPlugin.getWorkspace();
                                turnOffAutoBuild(workspace);
-                               YoctoProfileElement profileElement =
 YoctoSDKUtils.getProfilesFromDefaultStore();
-                               IPreferenceStore selecteProfileStore =
 YoctoSDKPlugin.getProfilePreferenceStore(profileElement.getSelectedProfile());
-                               YoctoUIElement elem =
 YoctoSDKUtils.getElemFromStore(selecteProfileStore);
-                               SDKCheckResults result =
 YoctoSDKChecker.checkYoctoSDK(elem);
-                               if (result != SDKCheckResults.SDK_PASS){
-                                       String strErrorMsg =
 YoctoSDKChecker.getErrorMessage(result, SDKCheckRequestFrom.Wizard);
-                                       throw new
 YoctoGeneralException(strErrorMsg);
-                               }
-
 AutotoolsNewProjectNature.addAutotoolsNature(project, monitor);
-                               if(isEmptryProject) {
-
 YoctoSDKEmptyProjectNature.addYoctoSDKEmptyNature(project, monitor);
-                               }
-
-
 YoctoSDKProjectNature.addYoctoSDKNature(project, monitor);
-
 YoctoSDKProjectNature.configureAutotools(project);
-
-

AutotoolsConfigurationManager.getInstance().saveConfigs(project);

plugins/org.yocto.sdk.ide/plugin.xml +2 -0
+
+

YoctoSDKChecker.checkIfGloballySelectedYoctoProfileIsValid();

plugins/org.yocto.sdk.ide/plugin.xml +2 -0
+
+                               addNatures(project, true, isEmptyProject,

isAutotoolsProject,

plugins/org.yocto.sdk.ide/plugin.xml +2 -0
+monitor);
+
                                //restoreAutoBuild(workspace);
                                IDiscoveredPathManager manager =

MakeCorePlugin.getDefault().getDiscoveryManager();
IDiscoveredPathInfo pathInfo =
manager.getDiscoveredInfo(project);
if (pathInfo instanceof
IPerProjectDiscoveredPathInfo) {
IPerProjectDiscoveredPathInfo
projectPathInfo =
(IPerProjectDiscoveredPathInfo)
pathInfo;
- projectPathInfo.setIncludeMap(new
LinkedHashMap());
- projectPathInfo.setSymbolMap(new
LinkedHashMap());
+ projectPathInfo.setIncludeMap(new
LinkedHashMap<String, Boolean>());
+ projectPathInfo.setSymbolMap(new
LinkedHashMap<String,

plugins/org.yocto.sdk.ide/plugin.xml +4 -0
+SymbolEntry>());
                                    manager.removeDiscoveredInfo(project);
                                }
                        }
@@ -200,6 +179,40 @@ public class NewYoctoCProjectTemplate extends
 ProcessRunner {
                return matcher.find();
 }
 
+       private void addNatures(IProject project, boolean projectExists,
 boolean isEmptyProject,
+                       boolean isAutotoolsProject, IProgressMonitor
 monitor)
+                                       throws CoreException,

YoctoGeneralException {

plugins/org.yocto.sdk.ide/plugin.xml +3 -0
+               YoctoSDKProjectNature.addYoctoSDKNature(project, monitor);
+
+

YoctoSDKChecker.checkIfGloballySelectedYoctoProfileIsValid();

plugins/org.yocto.sdk.ide/plugin.xml +2 -0
+
+               YoctoProfileElement profileElement =

YoctoSDKUtils.getProfilesFromDefaultStore();
+ YoctoSDKUtils.saveProfilesToProjectPreferences(profileElement,

plugins/org.yocto.sdk.ide/plugin.xml +3 -0
+project);
+
+               IPreferenceStore selecteProfileStore =

YoctoSDKPlugin.getProfilePreferenceStore(profileElement.getSelectedProfile());
+ YoctoUIElement elem =
YoctoSDKUtils.getElemFromStore(selecteProfileStore);

plugins/org.yocto.sdk.ide/plugin.xml +4 -0
+               YoctoSDKUtils.setEnvironmentVariables(project, elem);
+
+               if (isEmptyProject) {
+

YoctoSDKEmptyProjectNature.addYoctoSDKEmptyNature(project, monitor);

plugins/org.yocto.sdk.ide/plugin.xml +4 -0
+               }
+
+               if (isAutotoolsProject) {
+

AutotoolsNewProjectNature.addAutotoolsNature(project, monitor);

plugins/org.yocto.sdk.ide/plugin.xml +3 -0
+
+                       if(!projectExists) {
+                               // For each IConfiguration, create a

corresponding Autotools Configuration
+ for (IConfiguration cfg :
pca.getConfigs()) {
+ AutotoolsConfigurationManager.getInstance().getConfiguration(project, cfg.getName(), true);

plugins/org.yocto.sdk.ide/plugin.xml +2 -0
+                               }
+

AutotoolsConfigurationManager.getInstance().saveConfigs(project);

plugins/org.yocto.sdk.ide/plugin.xml +3 -0
+                       }
+
+

YoctoSDKAutotoolsProjectNature.addYoctoSDKAutotoolsNature(project, monitor); + YoctoSDKAutotoolsProjectNature.configureAutotoolsOptions(project);

plugins/org.yocto.sdk.ide/plugin.xml +3 -0
+               }
+       }
+
        protected final void turnOffAutoBuild(IWorkspace workspace) throws

CoreException {
IWorkspaceDescription workspaceDesc =

workspace.getDescription();
                savedAutoBuildingValue = workspaceDesc.isAutoBuilding();

--
1.7.9.5

_______________________________________________
yocto mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/yocto

#7 lore raw

Re: [PATCHv2 4/9] plugins/sdk.ide: Switch to YoctoSDKAutotoolsProjectNature

Hi Atanas,

I ask for building the class hierarch is mainly from the Java side class design point of view and I see your point of the relationship consideration from the eclipse plug-in side. Just purely from the class name and the implementation, it's obviously YoctoSDKAutotoolsProjectNature has a closer relationship to YoctoSDKProjectNature whereas the requirements for autotoolsNatureV2 is less obvious.

My comments regarding eliminate addYoctoSDKAutotoolsNature, but instead just make it the same as addYoctoSDKNature with same signature. But the implementation of them will be difference via the NATURE_ID value. But this makes more sense if we make AutotoolsProjectNature subclass ProjectNature, if there's no such relationship between the two classes, with separate method name as in your patch is just fine.

Thoughts?

Jessica

From: Atanas Gegov [mailto:[email protected]]
Sent: Tuesday, April 16, 2013 5:39 AM
To: Zhang, Jessica
Cc: [email protected]
Subject: Re: [yocto] [PATCHv2 4/9] plugins/sdk.ide: Switch to YoctoSDKAutotoolsProjectNature

Hi Jessica,

My idea was that the YoctoSDKAutotoolsProjectNature and the YoctoSDKProjectNature are related through the "requires-nature" tag in plugin.xml. The YoctoSDKAutotoolsProjectNature has also an another "requires-nature" relation to the org.eclipse.cdt.autotools.core.autotoolsNatureV2. If I make the YoctoSDKAutotoolsProjectNature a subclass of the YoctoSDKProjectNature it would suggest (according to my mind) a stronger connection to the YoctoSDKProjectNature than to the org.eclipse.cdt.autotools.core.autotoolsNatureV2. It would be like YoctoSDKAutotoolsProjectNature "requires more" YoctoSDKProjectNature than org.eclipse.cdt.autotools.core.autotoolsNatureV2...I am not sure if it is a problem or not. So, I can make the YoctoSDKAutotoolsProjectNature a subclass of the YoctoSDKProjectNature if you think that it is a better design.

What do you mean by "In this way, you don't need to introduce the special method of addYoctoSDKAutotoolsNature in YoctoSDKAutotoolsProjectNature which makes the interface a little bit cleaner via encapsulation"? In order to add the two natures to the project I think we need both static methods:
- YoctoSDKProjectNature.addYoctoSDKNature(project, monitor);

- YoctoSDKAutotoolsProjectNature.addYoctoSDKAutotoolsNature(project, monitor);

Or do you mean some other solution?

Looking forward to your feedback!

Best regards,
Atanas

On Mon, Apr 15, 2013 at 9:12 PM, Zhang, Jessica <[email protected]<mailto:[email protected]>> wrote:

Hi Atanas,

Everything looks good for the patch series except can we make YoctoSDKAutotoolsProjectNature subclass of YoctoSDKProjectNature by extending it to better show the classes relationship. In this way, you don't need to introduce the special method of addYoctoSDKAutotoolsNature in YoctoSDKAutotoolsProjectNature which makes the interface a little bit cleaner via encapsulation.

Thanks,
Jessica

-----Original Message-----
From: [email protected]<mailto:[email protected]> [mailto:[email protected]<mailto:[email protected]>] On Behalf Of Atanas Gegov
Sent: Thursday, April 11, 2013 4:25 AM
To: [email protected]<mailto:[email protected]>
Subject: [yocto] [PATCHv2 4/9] plugins/sdk.ide: Switch to YoctoSDKAutotoolsProjectNature

From: Atanas Gegov <[email protected]<mailto:[email protected]>>

The YoctoSDKProjectNature remains the basic nature for all Yocto projects in the IDE. The projects using Autotools (all templates) get the YoctoSDKProjectNature and additionally the YoctoSDKAutotoolsProjectNature. The process NewYoctoCProjectTemplate is adapted accordingly.

---
 plugins/org.yocto.sdk.ide/plugin.xml               |    2 +-
 .../natures/YoctoSDKAutotoolsProjectNature.java    |   45 +++++++++++
 .../sdk/ide/natures/YoctoSDKProjectNature.java     |   70 -----------------
 .../src/org/yocto/sdk/ide/utils/YoctoSDKUtils.java |    6 +-
 .../sdk/ide/wizard/NewYoctoCProjectTemplate.java   |   79 ++++++++++++--------
 5 files changed, 96 insertions(+), 106 deletions(-)
plugins/org.yocto.sdk.ide/plugin.xml +2 -1
index f21434b..35e34b4 100644
@@ -91,7 +91,7 @@
                            type="org.eclipse.core.resources.IResource">
                         <test
                               property="org.eclipse.core.resources.projectNature"
-                              value="org.yocto.sdk.ide.YoctoSDKNature">
+
+ value="org.yocto.sdk.ide.YoctoSDKAutotoolsNature">
                         </test>
                      </adapt>
                   </iterate>
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKAu renamed from plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKAutotoolsProjectNature.java +0 -0
index ac73878..767c005 100644

+++ totoolsProjectNature.java

@@ -10,15 +10,31 @@
*******************************************************************************/
package org.yocto.sdk.ide.natures;

+import

+org.eclipse.cdt.internal.autotools.core.configure.AutotoolsConfiguratio +nManager; import +org.eclipse.cdt.internal.autotools.core.configure.IAConfiguration;

+import org.eclipse.cdt.managedbuilder.core.IConfiguration; +import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo; +import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
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.YoctoUIElement; import
+org.yocto.sdk.ide.utils.YoctoSDKUtils;

public class YoctoSDKAutotoolsProjectNature implements IProjectNature {

        public static final  String YoctoSDK_AUTOTOOLS_NATURE_ID = YoctoSDKPlugin.getUniqueIdentifier() + ".YoctoSDKAutotoolsNature";
+       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=";

+

        private IProject proj;

        public void configure() throws CoreException { @@ -38,4 +54,33 @@ public class YoctoSDKAutotoolsProjectNature implements IProjectNature {
        public static void addYoctoSDKAutotoolsNature(IProject project, IProgressMonitor monitor) throws CoreException {
                YoctoSDKNatureUtils.addNature(project, YoctoSDK_AUTOTOOLS_NATURE_ID, monitor);
        }
+
+       public static void configureAutotoolsOptions(IProject project) {
+               IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project);
+               IConfiguration icfg = info.getDefaultConfiguration();
+               YoctoUIElement elem = YoctoSDKUtils.getElemFromProjectEnv(project);
+               String sysroot_str = elem.getStrSysrootLoc();
+               String id = icfg.getId();
+               String CFLAGS_str = YoctoSDKUtils.getEnvValue(project, "CFLAGS");
+               String CXXFLAGS_str = YoctoSDKUtils.getEnvValue(project, "CXXFLAGS");
+               String CPPFLAGS_str = YoctoSDKUtils.getEnvValue(project, "CPPFLAGS");
+               String LDFLAGS_str = YoctoSDKUtils.getEnvValue(project, "LDFLAGS");
+
+               String command_prefix = "CFLAGS=\" -g -O0 " + CFLAGS_str + "\" CXXFLAGS=\" -g -O0 "
+                               + CXXFLAGS_str + "\" LDFLAGS=\"" + LDFLAGS_str + "\" CPPFLAGS=\"" + CPPFLAGS_str + "\"";
+               String autogen_setting = command_prefix+" autogen.sh" + DEFAULT_LIBTOOL_SYSROOT_PREFIX + sysroot_str;
+               String configure_setting = command_prefix + " configure" + DEFAULT_LIBTOOL_SYSROOT_PREFIX + sysroot_str;
+               IAConfiguration cfg = AutotoolsConfigurationManager.getInstance().getConfiguration(project, id);
+               String strConfigure = YoctoSDKUtils.getEnvValue(project,

+"CONFIGURE_FLAGS");

+

+               cfg.setOption(DEFAULT_CONFIGURE_STR, configure_setting);
+               cfg.setOption(DEFAULT_BUILD_STR, YoctoSDKUtils.splitString(strConfigure, "--build="));
+               cfg.setOption(DEFAULT_HOST_STR, YoctoSDKUtils.splitString(strConfigure, "--host="));
+               cfg.setOption(DEFAULT_TARGET_STR, YoctoSDKUtils.splitString(strConfigure, "--target="));
+               cfg.setOption(DEFAULT_AUTOGEN_STR, autogen_setting);
+               cfg.setOption(DEFAULT_AUTOGEN_OPT_STR, strConfigure);

+
+ AutotoolsConfigurationManager.getInstance().addConfiguration(project, cfg);
+ AutotoolsConfigurationManager.getInstance().saveConfigs(project);
+ }
}

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
index fcb296d..51926fb 100644

+++ ojectNature.java

@@ -10,39 +10,15 @@
*******************************************************************************/
package org.yocto.sdk.ide.natures;

-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;
-import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
-import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
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.jface.preference.IPreferenceStore;
-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.YoctoUIElement; -import org.yocto.sdk.ide.YoctoSDKChecker.SDKCheckRequestFrom;
-import org.yocto.sdk.ide.YoctoSDKChecker.SDKCheckResults;
-import org.yocto.sdk.ide.utils.YoctoSDKUtils;

-
-@SuppressWarnings("restriction")
public class YoctoSDKProjectNature implements IProjectNature {

        public static final  String YoctoSDK_NATURE_ID = YoctoSDKPlugin.getUniqueIdentifier() + ".YoctoSDKNature";
-       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=";
-
        private IProject proj;

        public void configure() throws CoreException { @@ -62,50 +38,4 @@ public class YoctoSDKProjectNature implements IProjectNature {
        public static void addYoctoSDKNature(IProject project, IProgressMonitor monitor) throws CoreException {
                YoctoSDKNatureUtils.addNature(project, YoctoSDK_NATURE_ID, monitor);
        }
-
-       public static void configureAutotoolsOptions(IProject project) {
-               IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project);
-               IConfiguration icfg = info.getDefaultConfiguration();
-               YoctoUIElement elem = YoctoSDKUtils.getElemFromProjectEnv(project);
-               String sysroot_str = elem.getStrSysrootLoc();
-               String id = icfg.getId();
-               String CFLAGS_str = YoctoSDKUtils.getEnvValue(project, "CFLAGS");
-               String CXXFLAGS_str = YoctoSDKUtils.getEnvValue(project, "CXXFLAGS");
-               String CPPFLAGS_str = YoctoSDKUtils.getEnvValue(project, "CPPFLAGS");
-               String LDFLAGS_str = YoctoSDKUtils.getEnvValue(project, "LDFLAGS");
-
-               String command_prefix = "CFLAGS=\" -g -O0 " + CFLAGS_str + "\" CXXFLAGS=\" -g -O0 "
-               + CXXFLAGS_str + "\" LDFLAGS=\"" + LDFLAGS_str + "\" CPPFLAGS=\"" + CPPFLAGS_str + "\"";
-               String autogen_setting = command_prefix+" autogen.sh" + DEFAULT_LIBTOOL_SYSROOT_PREFIX + sysroot_str;
-               String configure_setting = command_prefix + " configure" + DEFAULT_LIBTOOL_SYSROOT_PREFIX + sysroot_str;
-               IAConfiguration cfg = AutotoolsConfigurationManager.getInstance().getConfiguration(project, id);
-               String strConfigure = YoctoSDKUtils.getEnvValue(project, "CONFIGURE_FLAGS");
-
-               cfg.setOption(DEFAULT_CONFIGURE_STR, configure_setting);
-               cfg.setOption(DEFAULT_BUILD_STR, YoctoSDKUtils.splitString(strConfigure, "--build="));
-               cfg.setOption(DEFAULT_HOST_STR, YoctoSDKUtils.splitString(strConfigure, "--host="));
-               cfg.setOption(DEFAULT_TARGET_STR, YoctoSDKUtils.splitString(strConfigure, "--target="));
-               cfg.setOption(DEFAULT_AUTOGEN_STR, autogen_setting);
-               cfg.setOption(DEFAULT_AUTOGEN_OPT_STR, strConfigure);

-
- AutotoolsConfigurationManager.getInstance().addConfiguration(project, cfg);
- AutotoolsConfigurationManager.getInstance().saveConfigs(project);
- }
-
- public static void configureAutotools(IProject project) throws YoctoGeneralException {

-               YoctoProfileElement profileElement = YoctoSDKUtils.getProfilesFromDefaultStore();
-               YoctoSDKUtils.saveProfilesToProjectPreferences(profileElement, project);
-               IPreferenceStore selecteProfileStore = YoctoSDKPlugin.getProfilePreferenceStore(profileElement.getSelectedProfile());
-               YoctoUIElement elem = YoctoSDKUtils.getElemFromStore(selecteProfileStore);
-               SDKCheckResults result = YoctoSDKChecker.checkYoctoSDK(elem);
-               if (result != SDKCheckResults.SDK_PASS){
-                       String strErrorMsg =  YoctoSDKChecker.getErrorMessage(result, SDKCheckRequestFrom.Wizard);
-                       throw new YoctoGeneralException(strErrorMsg);
-               }
-               else
-               {

- YoctoSDKUtils.setEnvironmentVariables(project, elem);
- configureAutotoolsOptions(project);
- }
- }
}

plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/utils/YoctoSDKUtil renamed from plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/utils/YoctoSDKUtils.java +0 -0
index bd781b3..1e2e424 100644

+++ s.java

@@ -54,8 +54,8 @@ import org.yocto.sdk.ide.YoctoProfileElement;
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.YoctoSDKEmptyProjectNature;
-import org.yocto.sdk.ide.natures.YoctoSDKProjectNature;
import org.yocto.sdk.ide.preferences.PreferenceConstants;

public class YoctoSDKUtils {
@@ -427,7 +427,9 @@ public class YoctoSDKUtils {

                try {
                        setEnvironmentVariables(project, elem);

- YoctoSDKProjectNature.configureAutotoolsOptions(project);
+ if(project.hasNature(YoctoSDKAutotoolsProjectNature.YoctoSDK_AUTOTOOLS_NATURE_ID)) {
+ YoctoSDKAutotoolsProjectNature.configureAutotoolsOptions(project);
+ }

                        IConsole console = CCorePlugin.getDefault().getConsole("org.yocto.sdk.ide.YoctoConsole");
                        console.start(project);
                        consoleOutStream = console.getOutputStream(); diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/wizard/NewYoctoCProjectTemplate.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/wizard/NewYoctoCProjectTemplate.java

index 73531e5..239cbf8 100644
--- a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/wizard/NewYoctoCProjectTemplate.java +++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/wizard/NewYoctoCPr

+++ ojectTemplate.java

@@ -28,6 +28,7 @@ import org.eclipse.cdt.make.core.MakeCorePlugin;
import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager;
import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo; import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IPerProjectDiscoveredPathInfo;
+import

+org.eclipse.cdt.make.internal.core.scannerconfig.util.SymbolEntry;

import org.eclipse.cdt.managedbuilder.core.BuildException;
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
@@ -56,6 +57,7 @@ import org.yocto.sdk.ide.YoctoSDKChecker.SDKCheckResults;
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.YoctoSDKEmptyProjectNature;
import org.yocto.sdk.ide.natures.YoctoSDKProjectNature;
import org.yocto.sdk.ide.utils.YoctoSDKUtils;

@@ -88,7 +90,7 @@ public class NewYoctoCProjectTemplate extends ProcessRunner {
                String isEmptyProjetValue = args[4].getSimpleValue();
                String isAutotoolsProjectValue = args[5].getSimpleValue();
                boolean isCProject = Boolean.valueOf(isCProjectValue).booleanValue();

- boolean isEmptryProject = Boolean.valueOf(isEmptyProjetValue).booleanValue();
+ boolean isEmptyProject =

+Boolean.valueOf(isEmptyProjetValue).booleanValue();

                boolean isAutotoolsProject = Boolean.valueOf(isAutotoolsProjectValue).booleanValue();

                IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
@@ -126,19 +128,8 @@ public class NewYoctoCProjectTemplate extends ProcessRunner {
                                pca.setArtifactExtension(artifactExtension);
                                info = pca.createProject(monitor, CCorePlugin.DEFAULT_INDEXER, isCProject);
-                               AutotoolsNewProjectNature.addAutotoolsNature(project, monitor);
-                               // For each IConfiguration, create a corresponding Autotools Configuration
-                               IConfiguration[] cfgs = pca.getConfigs();
-                               for (int i = 0; i < cfgs.length; ++i) {
-                                       IConfiguration cfg = cfgs[i];
-                                       AutotoolsConfigurationManager.getInstance().getConfiguration(project, cfg.getName(), true);
-                               }
-                               AutotoolsConfigurationManager.getInstance().saveConfigs(project);
-                               if(isEmptryProject) {
-                                       YoctoSDKEmptyProjectNature.addYoctoSDKEmptyNature(project, monitor);
-                               }
-                               YoctoSDKProjectNature.addYoctoSDKNature(project, monitor);
-                               YoctoSDKProjectNature.configureAutotools(project);
+                               addNatures(project, false, isEmptyProject, isAutotoolsProject,

+monitor);

+

                                info.setValid(true);
                                ManagedBuildManager.saveBuildInfo(project, true);

@@ -147,31 +138,19 @@ public class NewYoctoCProjectTemplate extends ProcessRunner {

                                IWorkspace workspace = ResourcesPlugin.getWorkspace();
                                turnOffAutoBuild(workspace);
-                               YoctoProfileElement profileElement = YoctoSDKUtils.getProfilesFromDefaultStore();
-                               IPreferenceStore selecteProfileStore = YoctoSDKPlugin.getProfilePreferenceStore(profileElement.getSelectedProfile());
-                               YoctoUIElement elem = YoctoSDKUtils.getElemFromStore(selecteProfileStore);
-                               SDKCheckResults result = YoctoSDKChecker.checkYoctoSDK(elem);
-                               if (result != SDKCheckResults.SDK_PASS){
-                                       String strErrorMsg =  YoctoSDKChecker.getErrorMessage(result, SDKCheckRequestFrom.Wizard);
-                                       throw new YoctoGeneralException(strErrorMsg);
-                               }
-                               AutotoolsNewProjectNature.addAutotoolsNature(project, monitor);
-                               if(isEmptryProject) {

- YoctoSDKEmptyProjectNature.addYoctoSDKEmptyNature(project, monitor);
- }
-
- YoctoSDKProjectNature.addYoctoSDKNature(project, monitor);
- YoctoSDKProjectNature.configureAutotools(project);
-
- AutotoolsConfigurationManager.getInstance().saveConfigs(project);
+
+ YoctoSDKChecker.checkIfGloballySelectedYoctoProfileIsValid();
+
+ addNatures(project, true, isEmptyProject, isAutotoolsProject,

+monitor);

+

                                //restoreAutoBuild(workspace);
                                IDiscoveredPathManager manager = MakeCorePlugin.getDefault().getDiscoveryManager();
                                IDiscoveredPathInfo pathInfo = manager.getDiscoveredInfo(project);
                                if (pathInfo instanceof IPerProjectDiscoveredPathInfo) {
                                    IPerProjectDiscoveredPathInfo projectPathInfo =
                                        (IPerProjectDiscoveredPathInfo) pathInfo;
-                                   projectPathInfo.setIncludeMap(new LinkedHashMap());
-                                   projectPathInfo.setSymbolMap(new LinkedHashMap());
+                                   projectPathInfo.setIncludeMap(new LinkedHashMap<String, Boolean>());
+                                   projectPathInfo.setSymbolMap(new LinkedHashMap<String,

+SymbolEntry>());

                                    manager.removeDiscoveredInfo(project);
                                }
                        }
@@ -200,6 +179,40 @@ public class NewYoctoCProjectTemplate extends ProcessRunner {
                return matcher.find();

}

+ private void addNatures(IProject project, boolean projectExists, boolean isEmptyProject,
+ boolean isAutotoolsProject, IProgressMonitor monitor)
+ throws CoreException, YoctoGeneralException {
+ YoctoSDKProjectNature.addYoctoSDKNature(project, monitor);
+
+ YoctoSDKChecker.checkIfGloballySelectedYoctoProfileIsValid();
+
+ YoctoProfileElement profileElement = YoctoSDKUtils.getProfilesFromDefaultStore();
+ YoctoSDKUtils.saveProfilesToProjectPreferences(profileElement,

+project);

+

+               IPreferenceStore selecteProfileStore = YoctoSDKPlugin.getProfilePreferenceStore(profileElement.getSelectedProfile());
+               YoctoUIElement elem = YoctoSDKUtils.getElemFromStore(selecteProfileStore);
+               YoctoSDKUtils.setEnvironmentVariables(project, elem);

+
+ if (isEmptyProject) {
+ YoctoSDKEmptyProjectNature.addYoctoSDKEmptyNature(project, monitor);
+ }
+
+ if (isAutotoolsProject) {
+ AutotoolsNewProjectNature.addAutotoolsNature(project, monitor);
+
+ if(!projectExists) {
+ // For each IConfiguration, create a corresponding Autotools Configuration
+ for (IConfiguration cfg : pca.getConfigs()) {
+ AutotoolsConfigurationManager.getInstance().getConfiguration(project, cfg.getName(), true);
+ }
+ AutotoolsConfigurationManager.getInstance().saveConfigs(project);
+ }
+
+ YoctoSDKAutotoolsProjectNature.addYoctoSDKAutotoolsNature(project, monitor);
+ YoctoSDKAutotoolsProjectNature.configureAutotoolsOptions(project);
+ }
+ }
+

        protected final void turnOffAutoBuild(IWorkspace workspace) throws CoreException {
                IWorkspaceDescription workspaceDesc = workspace.getDescription();
                savedAutoBuildingValue = workspaceDesc.isAutoBuilding();

--
1.7.9.5

_______________________________________________
yocto mailing list [email protected]<mailto:[email protected]>
https://lists.yoctoproject.org/listinfo/yocto

#8 lore raw

Re: [PATCHv2 4/9] plugins/sdk.ide: Switch to YoctoSDKAutotoolsProjectNature

Hi Jessica,

Thanks for the feedback. I got your point and it seems to be the better solution. We can indeed avoid some duplications in the code.

I will give it a try and resend the patches.

Cheers,
Atanas

Quoted 644 lines · Jessica

Hi Atanas,****

** **

I ask for building the class hierarch is mainly from the Java side class design point of view and I see your point of the relationship consideration from the eclipse plug-in side. Just purely from the class name and the implementation, it’s obviously YoctoSDKAutotoolsProjectNature has a closer relationship to YoctoSDKProjectNature whereas the requirements for autotoolsNatureV2 is less obvious.****

** **

My comments regarding eliminate addYoctoSDKAutotoolsNature, but instead just make it the same as addYoctoSDKNature with same signature. But the implementation of them will be difference via the NATURE_ID value. But this makes more sense if we make AutotoolsProjectNature subclass ProjectNature, if there’s no such relationship between the two classes, with separate method name as in your patch is just fine.****

** **

Thoughts?****

** **

Jessica ****

** **

*From:* Atanas Gegov [mailto:[email protected]] *Sent:* Tuesday, April 16, 2013 5:39 AM
*To:* Zhang, Jessica
*Cc:* [email protected]
*Subject:* Re: [yocto] [PATCHv2 4/9] plugins/sdk.ide: Switch to YoctoSDKAutotoolsProjectNature****

** **

Hi Jessica,****

** **

My idea was that the YoctoSDKAutotoolsProjectNature and
the YoctoSDKProjectNature are related through the "requires-nature" tag in plugin.xml. The YoctoSDKAutotoolsProjectNature has also an another
"requires-nature" relation to the
org.eclipse.cdt.autotools.core.autotoolsNatureV2. If I make the YoctoSDKAutotoolsProjectNature a subclass of the YoctoSDKProjectNature it would suggest (according to my mind) a stronger connection to the YoctoSDKProjectNature than to the org.eclipse.cdt.autotools.core.autotoolsNatureV2. It would be like YoctoSDKAutotoolsProjectNature "requires more" YoctoSDKProjectNature than org.eclipse.cdt.autotools.core.autotoolsNatureV2...I am not sure if it is a problem or not. So, I can make the YoctoSDKAutotoolsProjectNature a subclass of the YoctoSDKProjectNature if you think that it is a better design.****

What do you mean by "In this way, you don't need to introduce the special method of addYoctoSDKAutotoolsNature in YoctoSDKAutotoolsProjectNature which makes the interface a little bit cleaner via encapsulation"? In order to add the two natures to the project I think we need both static methods:
- YoctoSDKProjectNature.addYoctoSDKNature(project, monitor);****

- YoctoSDKAutotoolsProjectNature.addYoctoSDKAutotoolsNature(project, monitor);****

Or do you mean some other solution?****

Looking forward to your feedback!

Best regards,
Atanas****

On Mon, Apr 15, 2013 at 9:12 PM, Zhang, Jessica <[email protected]> wrote:****

Hi Atanas,

Everything looks good for the patch series except can we make YoctoSDKAutotoolsProjectNature subclass of YoctoSDKProjectNature by extending it to better show the classes relationship. In this way, you don't need to introduce the special method of addYoctoSDKAutotoolsNature in YoctoSDKAutotoolsProjectNature which makes the interface a little bit cleaner via encapsulation.

Thanks,
Jessica****

-----Original Message-----
From: [email protected] [mailto:
[email protected]] On Behalf Of Atanas Gegov
Sent: Thursday, April 11, 2013 4:25 AM
To: [email protected]
Subject: [yocto] [PATCHv2 4/9] plugins/sdk.ide: Switch to YoctoSDKAutotoolsProjectNature

From: Atanas Gegov <[email protected]>

The YoctoSDKProjectNature remains the basic nature for all Yocto projects in the IDE. The projects using Autotools (all templates) get the YoctoSDKProjectNature and additionally the YoctoSDKAutotoolsProjectNature. The process NewYoctoCProjectTemplate is adapted accordingly.

---
 plugins/org.yocto.sdk.ide/plugin.xml               |    2 +-
 .../natures/YoctoSDKAutotoolsProjectNature.java    |   45 +++++++++++
 .../sdk/ide/natures/YoctoSDKProjectNature.java     |   70
-----------------
 .../src/org/yocto/sdk/ide/utils/YoctoSDKUtils.java |    6 +-
 .../sdk/ide/wizard/NewYoctoCProjectTemplate.java   |   79
++++++++++++--------
 5 files changed, 96 insertions(+), 106 deletions(-)
plugins/org.yocto.sdk.ide/plugin.xml +2 -1
index f21434b..35e34b4 100644
@@ -91,7 +91,7 @@
                            type="org.eclipse.core.resources.IResource">
                         <test
 
 property="org.eclipse.core.resources.projectNature"
-                              value="org.yocto.sdk.ide.YoctoSDKNature">
+
+ value="org.yocto.sdk.ide.YoctoSDKAutotoolsNature">
                         </test>
                      </adapt>
                   </iterate>

diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKAutotoolsProjectNature.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKAutotoolsProjectNature.java index ac73878..767c005 100644
---
a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKAutotoolsProjectNature.java +++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKAu**
**

+++ totoolsProjectNature.java****

plugins/org.yocto.sdk.ide/plugin.xml +9 -0
@@ -10,15 +10,31 @@
 
 *******************************************************************************/
 package org.yocto.sdk.ide.natures;
 
+import****
 
+org.eclipse.cdt.internal.autotools.core.configure.AutotoolsConfiguratio
+nManager; import
+org.eclipse.cdt.internal.autotools.core.configure.IAConfiguration;****
 
+import org.eclipse.cdt.managedbuilder.core.IConfiguration;
+import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
+import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
 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.YoctoUIElement; import
+org.yocto.sdk.ide.utils.YoctoSDKUtils;****
 
 
 public class YoctoSDKAutotoolsProjectNature implements IProjectNature {
        public static final  String YoctoSDK_AUTOTOOLS_NATURE_ID =

YoctoSDKPlugin.getUniqueIdentifier() + ".YoctoSDKAutotoolsNature";

plugins/org.yocto.sdk.ide/plugin.xml +4 -0
+       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";

plugins/org.yocto.sdk.ide/plugin.xml +6 -0
+
+       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=";****
 
+
        private IProject proj;
 
        public void configure() throws CoreException { @@ -38,4 +54,33 @@

public class YoctoSDKAutotoolsProjectNature implements IProjectNature {
public static void addYoctoSDKAutotoolsNature(IProject project,
IProgressMonitor monitor) throws CoreException {
YoctoSDKNatureUtils.addNature(project,

YoctoSDK_AUTOTOOLS_NATURE_ID, monitor);
        }
plugins/org.yocto.sdk.ide/plugin.xml +3 -0
+
+       public static void configureAutotoolsOptions(IProject project) {
+               IManagedBuildInfo info =

ManagedBuildManager.getBuildInfo(project);

plugins/org.yocto.sdk.ide/plugin.xml +2 -0
+               IConfiguration icfg = info.getDefaultConfiguration();
+               YoctoUIElement elem =

YoctoSDKUtils.getElemFromProjectEnv(project);

plugins/org.yocto.sdk.ide/plugin.xml +3 -0
+               String sysroot_str = elem.getStrSysrootLoc();
+               String id = icfg.getId();
+               String CFLAGS_str = YoctoSDKUtils.getEnvValue(project,

"CFLAGS");
+ String CXXFLAGS_str = YoctoSDKUtils.getEnvValue(project,
"CXXFLAGS");
+ String CPPFLAGS_str = YoctoSDKUtils.getEnvValue(project,
"CPPFLAGS");
+ String LDFLAGS_str = YoctoSDKUtils.getEnvValue(project,
"LDFLAGS");

plugins/org.yocto.sdk.ide/plugin.xml +2 -0
+
+               String command_prefix = "CFLAGS=\" -g -O0 " + CFLAGS_str +

"\" CXXFLAGS=\" -g -O0 "
+ + CXXFLAGS_str + "\" LDFLAGS=\"" +
LDFLAGS_str + "\" CPPFLAGS=\"" + CPPFLAGS_str + "\"";
+ String autogen_setting = command_prefix+" autogen.sh" +
DEFAULT_LIBTOOL_SYSROOT_PREFIX + sysroot_str;
+ String configure_setting = command_prefix + " configure" +
DEFAULT_LIBTOOL_SYSROOT_PREFIX + sysroot_str;
+ IAConfiguration cfg =
AutotoolsConfigurationManager.getInstance().getConfiguration(project, id);
+ String strConfigure = YoctoSDKUtils.getEnvValue(project,**
**

+"CONFIGURE_FLAGS");****

plugins/org.yocto.sdk.ide/plugin.xml +3 -0
+
+               cfg.setOption(DEFAULT_CONFIGURE_STR, configure_setting);
+               cfg.setOption(DEFAULT_BUILD_STR,

YoctoSDKUtils.splitString(strConfigure, "--build="));
+ cfg.setOption(DEFAULT_HOST_STR,
YoctoSDKUtils.splitString(strConfigure, "--host="));
+ cfg.setOption(DEFAULT_TARGET_STR,
YoctoSDKUtils.splitString(strConfigure, "--target="));

plugins/org.yocto.sdk.ide/plugin.xml +4 -0
+               cfg.setOption(DEFAULT_AUTOGEN_STR, autogen_setting);
+               cfg.setOption(DEFAULT_AUTOGEN_OPT_STR, strConfigure);
+
+

AutotoolsConfigurationManager.getInstance().addConfiguration(project, cfg); +
AutotoolsConfigurationManager.getInstance().saveConfigs(project);
+ }
}
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 fcb296d..51926fb 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.java****

plugins/org.yocto.sdk.ide/plugin.xml +0 -9
@@ -10,39 +10,15 @@
 
 *******************************************************************************/
 package org.yocto.sdk.ide.natures;
 
-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;
-import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
-import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
 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.jface.preference.IPreferenceStore;
-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.YoctoUIElement; -import org.yocto.sdk.ide.YoctoSDKChecker.SDKCheckRequestFrom;

plugins/org.yocto.sdk.ide/plugin.xml +0 -4
-import org.yocto.sdk.ide.YoctoSDKChecker.SDKCheckResults;
-import org.yocto.sdk.ide.utils.YoctoSDKUtils;
 
-
-@SuppressWarnings("restriction")
 public class YoctoSDKProjectNature implements IProjectNature {
        public static final  String YoctoSDK_NATURE_ID =

YoctoSDKPlugin.getUniqueIdentifier() + ".YoctoSDKNature";

plugins/org.yocto.sdk.ide/plugin.xml +0 -4
-       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";

plugins/org.yocto.sdk.ide/plugin.xml +0 -6
-
-       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=";
-
        private IProject proj;
 
        public void configure() throws CoreException { @@ -62,50 +38,4 @@

public class YoctoSDKProjectNature implements IProjectNature {
public static void addYoctoSDKNature(IProject project,
IProgressMonitor monitor) throws CoreException {
YoctoSDKNatureUtils.addNature(project, YoctoSDK_NATURE_ID,

monitor);
        }
plugins/org.yocto.sdk.ide/plugin.xml +0 -3
-
-       public static void configureAutotoolsOptions(IProject project) {
-               IManagedBuildInfo info =

ManagedBuildManager.getBuildInfo(project);

plugins/org.yocto.sdk.ide/plugin.xml +0 -2
-               IConfiguration icfg = info.getDefaultConfiguration();
-               YoctoUIElement elem =

YoctoSDKUtils.getElemFromProjectEnv(project);

plugins/org.yocto.sdk.ide/plugin.xml +0 -3
-               String sysroot_str = elem.getStrSysrootLoc();
-               String id = icfg.getId();
-               String CFLAGS_str = YoctoSDKUtils.getEnvValue(project,

"CFLAGS");
- String CXXFLAGS_str = YoctoSDKUtils.getEnvValue(project,
"CXXFLAGS");
- String CPPFLAGS_str = YoctoSDKUtils.getEnvValue(project,
"CPPFLAGS");
- String LDFLAGS_str = YoctoSDKUtils.getEnvValue(project,
"LDFLAGS");

plugins/org.yocto.sdk.ide/plugin.xml +0 -2
-
-               String command_prefix = "CFLAGS=\" -g -O0 " + CFLAGS_str +

"\" CXXFLAGS=\" -g -O0 "
- + CXXFLAGS_str + "\" LDFLAGS=\"" + LDFLAGS_str + "\"
CPPFLAGS=\"" + CPPFLAGS_str + "\"";
- String autogen_setting = command_prefix+" autogen.sh" +
DEFAULT_LIBTOOL_SYSROOT_PREFIX + sysroot_str;
- String configure_setting = command_prefix + " configure" +
DEFAULT_LIBTOOL_SYSROOT_PREFIX + sysroot_str;
- IAConfiguration cfg =
AutotoolsConfigurationManager.getInstance().getConfiguration(project, id);
- String strConfigure = YoctoSDKUtils.getEnvValue(project,
"CONFIGURE_FLAGS");

plugins/org.yocto.sdk.ide/plugin.xml +0 -3
-
-               cfg.setOption(DEFAULT_CONFIGURE_STR, configure_setting);
-               cfg.setOption(DEFAULT_BUILD_STR,

YoctoSDKUtils.splitString(strConfigure, "--build="));
- cfg.setOption(DEFAULT_HOST_STR,
YoctoSDKUtils.splitString(strConfigure, "--host="));
- cfg.setOption(DEFAULT_TARGET_STR,
YoctoSDKUtils.splitString(strConfigure, "--target="));

plugins/org.yocto.sdk.ide/plugin.xml +0 -4
-               cfg.setOption(DEFAULT_AUTOGEN_STR, autogen_setting);
-               cfg.setOption(DEFAULT_AUTOGEN_OPT_STR, strConfigure);
-
-

AutotoolsConfigurationManager.getInstance().addConfiguration(project, cfg); - AutotoolsConfigurationManager.getInstance().saveConfigs(project);

plugins/org.yocto.sdk.ide/plugin.xml +0 -3
-       }
-
-       public static void configureAutotools(IProject project) throws

YoctoGeneralException {
- YoctoProfileElement profileElement =
YoctoSDKUtils.getProfilesFromDefaultStore();
-
YoctoSDKUtils.saveProfilesToProjectPreferences(profileElement, project);
- IPreferenceStore selecteProfileStore =
YoctoSDKPlugin.getProfilePreferenceStore(profileElement.getSelectedProfile());
- YoctoUIElement elem =
YoctoSDKUtils.getElemFromStore(selecteProfileStore);
- SDKCheckResults result =
YoctoSDKChecker.checkYoctoSDK(elem);

plugins/org.yocto.sdk.ide/plugin.xml +0 -7
-               if (result != SDKCheckResults.SDK_PASS){
-                       String strErrorMsg =
 YoctoSDKChecker.getErrorMessage(result, SDKCheckRequestFrom.Wizard);
-                       throw new YoctoGeneralException(strErrorMsg);
-               }
-               else
-               {
-                       YoctoSDKUtils.setEnvironmentVariables(project,

elem);

plugins/org.yocto.sdk.ide/plugin.xml +0 -3
-                       configureAutotoolsOptions(project);
-               }
-       }
 }

diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/utils/YoctoSDKUtils.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/utils/YoctoSDKUtils.java index bd781b3..1e2e424 100644
---
a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/utils/YoctoSDKUtils.java +++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/utils/YoctoSDKUtil** **

+++ s.java****

plugins/org.yocto.sdk.ide/plugin.xml +3 -2
@@ -54,8 +54,8 @@ import org.yocto.sdk.ide.YoctoProfileElement;
 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.YoctoSDKEmptyProjectNature;
-import org.yocto.sdk.ide.natures.YoctoSDKProjectNature;
 import org.yocto.sdk.ide.preferences.PreferenceConstants;
 
 public class YoctoSDKUtils {
@@ -427,7 +427,9 @@ public class YoctoSDKUtils {
 
                try {
                        setEnvironmentVariables(project, elem);
-
 YoctoSDKProjectNature.configureAutotoolsOptions(project);
+
 if(project.hasNature(YoctoSDKAutotoolsProjectNature.YoctoSDK_AUTOTOOLS_NATURE_ID))
 {
+

YoctoSDKAutotoolsProjectNature.configureAutotoolsOptions(project);
+ }
IConsole console =

CCorePlugin.getDefault().getConsole("org.yocto.sdk.ide.YoctoConsole");
                        console.start(project);
                        consoleOutStream = console.getOutputStream(); diff

--git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/wizard/NewYoctoCProjectTemplate.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/wizard/NewYoctoCProjectTemplate.java index 73531e5..239cbf8 100644
---
a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/wizard/NewYoctoCProjectTemplate.java +++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/wizard/NewYoctoCPr** **

+++ ojectTemplate.java****

plugins/org.yocto.sdk.ide/plugin.xml +5 -1
@@ -28,6 +28,7 @@ import org.eclipse.cdt.make.core.MakeCorePlugin;
 import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager;
 import
 org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo;
 import
 org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IPerProjectDiscoveredPathInfo;
+import****
 
+org.eclipse.cdt.make.internal.core.scannerconfig.util.SymbolEntry;****
 
 import org.eclipse.cdt.managedbuilder.core.BuildException;
 import org.eclipse.cdt.managedbuilder.core.IConfiguration;
 import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
@@ -56,6 +57,7 @@ import org.yocto.sdk.ide.YoctoSDKChecker.SDKCheckResults;
 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.YoctoSDKEmptyProjectNature;
 import org.yocto.sdk.ide.natures.YoctoSDKProjectNature;
 import org.yocto.sdk.ide.utils.YoctoSDKUtils;
@@ -88,7 +90,7 @@ public class NewYoctoCProjectTemplate extends
 ProcessRunner {
                String isEmptyProjetValue = args[4].getSimpleValue();
                String isAutotoolsProjectValue = args[5].getSimpleValue();
                boolean isCProject =
 Boolean.valueOf(isCProjectValue).booleanValue();
-               boolean isEmptryProject =
 Boolean.valueOf(isEmptyProjetValue).booleanValue();
+               boolean isEmptyProject =****
 
+Boolean.valueOf(isEmptyProjetValue).booleanValue();****
 
                boolean isAutotoolsProject =

Boolean.valueOf(isAutotoolsProjectValue).booleanValue();

IProject project =
ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);

plugins/org.yocto.sdk.ide/plugin.xml +0 -2
@@ -126,19 +128,8 @@ public class NewYoctoCProjectTemplate extends
 ProcessRunner {
 
 pca.setArtifactExtension(artifactExtension);
                                info = pca.createProject(monitor,
 CCorePlugin.DEFAULT_INDEXER, isCProject);
 
-
 AutotoolsNewProjectNature.addAutotoolsNature(project, monitor);
-                               // For each IConfiguration, create a

corresponding Autotools Configuration

plugins/org.yocto.sdk.ide/plugin.xml +0 -4
-                               IConfiguration[] cfgs = pca.getConfigs();
-                               for (int i = 0; i < cfgs.length; ++i) {
-                                       IConfiguration cfg = cfgs[i];
-

AutotoolsConfigurationManager.getInstance().getConfiguration(project, cfg.getName(), true);

plugins/org.yocto.sdk.ide/plugin.xml +0 -2
-                               }
-

AutotoolsConfigurationManager.getInstance().saveConfigs(project);

plugins/org.yocto.sdk.ide/plugin.xml +0 -2
-                               if(isEmptryProject) {
-

YoctoSDKEmptyProjectNature.addYoctoSDKEmptyNature(project, monitor);

plugins/org.yocto.sdk.ide/plugin.xml +0 -2
-                               }
-

YoctoSDKProjectNature.addYoctoSDKNature(project, monitor); - YoctoSDKProjectNature.configureAutotools(project);
+ addNatures(project, false, isEmptyProject,
isAutotoolsProject,****

plugins/org.yocto.sdk.ide/plugin.xml +2 -0
+monitor);****
 
+
                                info.setValid(true);
                                ManagedBuildManager.saveBuildInfo(project,

true);

plugins/org.yocto.sdk.ide/plugin.xml +0 -17
@@ -147,31 +138,19 @@ public class NewYoctoCProjectTemplate extends
 ProcessRunner {
 
                                IWorkspace workspace =
 ResourcesPlugin.getWorkspace();
                                turnOffAutoBuild(workspace);
-                               YoctoProfileElement profileElement =
 YoctoSDKUtils.getProfilesFromDefaultStore();
-                               IPreferenceStore selecteProfileStore =
 YoctoSDKPlugin.getProfilePreferenceStore(profileElement.getSelectedProfile());
-                               YoctoUIElement elem =
 YoctoSDKUtils.getElemFromStore(selecteProfileStore);
-                               SDKCheckResults result =
 YoctoSDKChecker.checkYoctoSDK(elem);
-                               if (result != SDKCheckResults.SDK_PASS){
-                                       String strErrorMsg =
 YoctoSDKChecker.getErrorMessage(result, SDKCheckRequestFrom.Wizard);
-                                       throw new
 YoctoGeneralException(strErrorMsg);
-                               }
-
 AutotoolsNewProjectNature.addAutotoolsNature(project, monitor);
-                               if(isEmptryProject) {
-
 YoctoSDKEmptyProjectNature.addYoctoSDKEmptyNature(project, monitor);
-                               }
-
-
 YoctoSDKProjectNature.addYoctoSDKNature(project, monitor);
-
 YoctoSDKProjectNature.configureAutotools(project);
-
-

AutotoolsConfigurationManager.getInstance().saveConfigs(project);

plugins/org.yocto.sdk.ide/plugin.xml +2 -0
+
+

YoctoSDKChecker.checkIfGloballySelectedYoctoProfileIsValid();

plugins/org.yocto.sdk.ide/plugin.xml +2 -0
+
+                               addNatures(project, true, isEmptyProject,

isAutotoolsProject,****

plugins/org.yocto.sdk.ide/plugin.xml +2 -0
+monitor);****
 
+
                                //restoreAutoBuild(workspace);
                                IDiscoveredPathManager manager =

MakeCorePlugin.getDefault().getDiscoveryManager();
IDiscoveredPathInfo pathInfo =
manager.getDiscoveredInfo(project);
if (pathInfo instanceof
IPerProjectDiscoveredPathInfo) {
IPerProjectDiscoveredPathInfo
projectPathInfo =
(IPerProjectDiscoveredPathInfo)
pathInfo;
- projectPathInfo.setIncludeMap(new
LinkedHashMap());
- projectPathInfo.setSymbolMap(new
LinkedHashMap());
+ projectPathInfo.setIncludeMap(new
LinkedHashMap<String, Boolean>());
+ projectPathInfo.setSymbolMap(new
LinkedHashMap<String,****

plugins/org.yocto.sdk.ide/plugin.xml +4 -0
+SymbolEntry>());****
 
                                    manager.removeDiscoveredInfo(project);
                                }
                        }
@@ -200,6 +179,40 @@ public class NewYoctoCProjectTemplate extends
 ProcessRunner {
                return matcher.find();
 }
 
+       private void addNatures(IProject project, boolean projectExists,
 boolean isEmptyProject,
+                       boolean isAutotoolsProject, IProgressMonitor
 monitor)
+                                       throws CoreException,

YoctoGeneralException {

plugins/org.yocto.sdk.ide/plugin.xml +3 -0
+               YoctoSDKProjectNature.addYoctoSDKNature(project, monitor);
+
+

YoctoSDKChecker.checkIfGloballySelectedYoctoProfileIsValid();

plugins/org.yocto.sdk.ide/plugin.xml +2 -0
+
+               YoctoProfileElement profileElement =

YoctoSDKUtils.getProfilesFromDefaultStore();
+ YoctoSDKUtils.saveProfilesToProjectPreferences(profileElement,****

plugins/org.yocto.sdk.ide/plugin.xml +3 -0
+project);****
 
+
+               IPreferenceStore selecteProfileStore =

YoctoSDKPlugin.getProfilePreferenceStore(profileElement.getSelectedProfile());
+ YoctoUIElement elem =
YoctoSDKUtils.getElemFromStore(selecteProfileStore);

plugins/org.yocto.sdk.ide/plugin.xml +4 -0
+               YoctoSDKUtils.setEnvironmentVariables(project, elem);
+
+               if (isEmptyProject) {
+

YoctoSDKEmptyProjectNature.addYoctoSDKEmptyNature(project, monitor);

plugins/org.yocto.sdk.ide/plugin.xml +4 -0
+               }
+
+               if (isAutotoolsProject) {
+

AutotoolsNewProjectNature.addAutotoolsNature(project, monitor);

plugins/org.yocto.sdk.ide/plugin.xml +3 -0
+
+                       if(!projectExists) {
+                               // For each IConfiguration, create a

corresponding Autotools Configuration
+ for (IConfiguration cfg :
pca.getConfigs()) {
+ AutotoolsConfigurationManager.getInstance().getConfiguration(project, cfg.getName(), true);

plugins/org.yocto.sdk.ide/plugin.xml +2 -0
+                               }
+

AutotoolsConfigurationManager.getInstance().saveConfigs(project);

plugins/org.yocto.sdk.ide/plugin.xml +3 -0
+                       }
+
+

YoctoSDKAutotoolsProjectNature.addYoctoSDKAutotoolsNature(project, monitor); + YoctoSDKAutotoolsProjectNature.configureAutotoolsOptions(project);

plugins/org.yocto.sdk.ide/plugin.xml +3 -0
+               }
+       }
+
        protected final void turnOffAutoBuild(IWorkspace workspace) throws

CoreException {
IWorkspaceDescription workspaceDesc =

workspace.getDescription();
                savedAutoBuildingValue = workspaceDesc.isAutoBuilding();

--
1.7.9.5****

_______________________________________________
yocto mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/yocto****

** **

#9 lore raw

PATCH v2 5/9 plugins/sdk.ide: Renamed existing project type

In reply to Atanas Gegov

From: Atanas Gegov <[email protected]>

The existing project type is suitable only for Autotools projects, as it is a subClass of an Autotools project type. The name should reflect this.

---
 .../OSGI-INF/l10n/bundle.properties                |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
plugins/org.yocto.sdk.ide/OSGI-INF/l10n/bundle.properties +1 -1
index 3d491fb..1a4e3c9 100644
@@ -5,7 +5,7 @@ extension.name.1 = YoctoSDKAutotoolsNature
 command.name = ReconfigureYoctoProject
 command.label.0 = Change Yocto Project Settings
 command.mnemonic = C
-projectType.name.0 = Yocto Project ADT Project
+projectType.name.0 = Yocto Project ADT Autotools Project
 projectProperties.label.0 = Yocto Project Settings
 Bundle-Vendor = yoctoproject.org
 Bundle-Name = Yocto Plugin IDE
Signature · 1 line
1.7.9.5
#10 lore raw

PATCH v2 6/9 plugins/sdk.ide: Renamed existing templates

In reply to Atanas Gegov

From: Atanas Gegov <[email protected]>

The existing templates are all Autotools-based. Ensured that ids, names and file names reflect this.

---
 plugins/org.yocto.sdk.ide/plugin.xml               |    6 +-
 .../EmptyCAutotoolsProject/template.properties     |   14 ++
 .../EmptyCAutotoolsProject/template.xml            |   17 +++
 .../EmptyCPPAutotoolsProject/template.properties   |   14 ++
 .../EmptyCPPAutotoolsProject/template.xml          |   16 +++
 .../EmptyCPPProject/template.properties            |   14 --
 .../projecttemplates/EmptyCPPProject/template.xml  |   16 ---
 .../EmptyCProject/template.properties              |   14 --
 .../projecttemplates/EmptyCProject/template.xml    |   17 ---
 .../HelloWorldCAutotoolsProject/template.xml       |    2 +-
 .../HelloWorldCGTKAutotoolsProject/src/Basename.c  |   50 +++++++
 .../src/Basename.desktop.in.src                    |    9 ++
 .../HelloWorldCGTKAutotoolsProject/src/INSTALL     |    9 ++
 .../src/Makefile.am.src                            |    8 ++
 .../src/Makefile.am.top                            |    7 +
 .../HelloWorldCGTKAutotoolsProject/src/README      |   25 ++++
 .../HelloWorldCGTKAutotoolsProject/src/autogen.sh  |   10 ++
 .../src/configure.ac.top                           |   49 +++++++
 .../src/configure.ac.top.old                       |   37 +++++
 .../template.properties                            |   28 ++++
 .../HelloWorldCGTKAutotoolsProject/template.xml    |  142 ++++++++++++++++++++
 .../HelloWorldCGTKProject/src/Basename.c           |   50 -------
 .../src/Basename.desktop.in.src                    |    9 --
 .../HelloWorldCGTKProject/src/INSTALL              |    9 --
 .../HelloWorldCGTKProject/src/Makefile.am.src      |    8 --
 .../HelloWorldCGTKProject/src/Makefile.am.top      |    7 -
 .../HelloWorldCGTKProject/src/README               |   25 ----
 .../HelloWorldCGTKProject/src/autogen.sh           |   10 --
 .../HelloWorldCGTKProject/src/configure.ac.top     |   49 -------
 .../HelloWorldCGTKProject/src/configure.ac.top.old |   37 -----
 .../HelloWorldCGTKProject/template.properties      |   28 ----
 .../HelloWorldCGTKProject/template.xml             |  142 --------------------
 .../HelloWorldCPPAutotoolsProject/template.xml     |    2 +-
 33 files changed, 440 insertions(+), 440 deletions(-)
 create mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/EmptyCAutotoolsProject/template.properties
 create mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/EmptyCAutotoolsProject/template.xml
 create mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/EmptyCPPAutotoolsProject/template.properties
 create mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/EmptyCPPAutotoolsProject/template.xml
 delete mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/EmptyCPPProject/template.properties
 delete mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/EmptyCPPProject/template.xml
 delete mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/EmptyCProject/template.properties
 delete mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/EmptyCProject/template.xml
 create mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/Basename.c
 create mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/Basename.desktop.in.src
 create mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/ChangeLog
 create mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/INSTALL
 create mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/Makefile.am.src
 create mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/Makefile.am.top
 create mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/NEWS
 create mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/README
 create mode 100755 plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/autogen.sh
 create mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/configure.ac.top
 create mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/configure.ac.top.old
 create mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/template.properties
 create mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/template.xml
 delete mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKProject/src/Basename.c
 delete mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKProject/src/Basename.desktop.in.src
 delete mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKProject/src/ChangeLog
 delete mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKProject/src/INSTALL
 delete mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKProject/src/Makefile.am.src
 delete mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKProject/src/Makefile.am.top
 delete mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKProject/src/NEWS
 delete mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKProject/src/README
 delete mode 100755 plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKProject/src/autogen.sh
 delete mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKProject/src/configure.ac.top
 delete mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKProject/src/configure.ac.top.old
 delete mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKProject/template.properties
 delete mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKProject/template.xml
plugins/org.yocto.sdk.ide/plugin.xml +3 -3
index 35e34b4..6e378bd 100644
@@ -105,13 +105,13 @@
       <template
             filterPattern=".*gcc"
             id="org.yocto.sdk.ide.template.emptyCProject"
-            location="templates/projecttemplates/EmptyCProject/template.xml"
+            location="templates/projecttemplates/EmptyCAutotoolsProject/template.xml"
             projectType="org.yocto.sdk.ide.projectType">
       </template>
       <template
             filterPattern=".*g\+\+"
             id="org.yocto.sdk.ide.template.emptyCPPProject"
-            location="templates/projecttemplates/EmptyCPPProject/template.xml"
+            location="templates/projecttemplates/EmptyCPPAutotoolsProject/template.xml"
             projectType="org.yocto.sdk.ide.projectType">
       </template>
       <template
@@ -129,7 +129,7 @@
       <template
             filterPattern=".*gcc"
             id="org.yocto.sdk.ide.template.helloWorldCGTKProject"
-            location="templates/projecttemplates/HelloWorldCGTKProject/template.xml"
+            location="templates/projecttemplates/HelloWorldCGTKAutotoolsProject/template.xml"
             projectType="org.yocto.sdk.ide.projectType">
       </template>
    </extension>
plugins/org.yocto.sdk.ide/templates/projecttemplates/EmptyCAutotoolsProject/template.properties new file +14 -0
new file mode 100644
index 0000000..0dfdb74
@@ -0,0 +1,14 @@
+/*******************************************************************************
+ * 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 implementation
+ *******************************************************************************/
+
+#Template Default Values
+EmptyProject.template.label=Empty C Autotools Project
+EmptyProject.template.description=An empty C Yocto Project autotools project template 
plugins/org.yocto.sdk.ide/templates/projecttemplates/EmptyCAutotoolsProject/template.xml new file +17 -0
new file mode 100644
index 0000000..66cb424
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<template type="ProjTempl" version="1.0" supplier="Eclipse.org" revision="1.0" author="Intel Corporation"
+		copyright="Copyright (c) 2007 Intel Corporation and others. 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"
+
+		id="YoctoEmptyCAutotoolsProject" label="%EmptyProject.template.label" description="%EmptyProject.template.description"
+		 help="help.html">
+
+	<process type="org.yocto.sdk.ide.NewYoctoProject">
+		<simple name="name" value="$(projectName)" /> 
+		<simple name="artifactExtension" value="exe" /> 
+		<simple name="isCProject" value="true" /> 
+		<simple name="isEmptyProject" value="true" />
+		<simple name="isAutotoolsProject" value="true" />
+	</process>
+
+</template>
+
plugins/org.yocto.sdk.ide/templates/projecttemplates/EmptyCPPAutotoolsProject/template.properties new file +14 -0
new file mode 100644
index 0000000..621f606
@@ -0,0 +1,14 @@
+/*******************************************************************************
+ * 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 implementation
+ *******************************************************************************/
+
+#Template Default Values
+EmptyProject.template.label=Empty C++ Autotools Project
+EmptyProject.template.description=An empty CPP Yocto Project autotools project template 
plugins/org.yocto.sdk.ide/templates/projecttemplates/EmptyCPPAutotoolsProject/template.xml new file +16 -0
new file mode 100644
index 0000000..186557a
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<template type="ProjTempl" version="1.0" supplier="Eclipse.org" revision="1.0" author="Intel Corporation"
+		copyright="Copyright (c) 2007 Intel Corporation and others. 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"
+		id="YoctoEmptyCppAutotoolsProject" label="%EmptyProject.template.label" description="%EmptyProject.template.description"
+		 help="help.html">
+
+	<process type="org.yocto.sdk.ide.NewYoctoProject">
+		<simple name="name" value="$(projectName)" /> 
+		<simple name="artifactExtension" value="exe" /> 
+		<simple name="isCProject" value="false" /> 
+		<simple name="isEmptyProject" value="true" />
+		<simple name="isAutotoolsProject" value="true" />
+	</process>
+
+</template>
+
plugins/org.yocto.sdk.ide/templates/projecttemplates/EmptyCPPProject/template.properties deleted +0 -14
deleted file mode 100644
index 0eb4e9f..0000000
@@ -1,14 +0,0 @@
-/*******************************************************************************
- * 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 implementation
- *******************************************************************************/
-
-#Template Default Values
-EmptyProject.template.label=Empty Project
-EmptyProject.template.description=An empty CPP Yocto Project autotools project template 
plugins/org.yocto.sdk.ide/templates/projecttemplates/EmptyCPPProject/template.xml deleted +0 -16
deleted file mode 100644
index 0f0a7e8..0000000
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<template type="ProjTempl" version="1.0" supplier="Eclipse.org" revision="1.0" author="Intel Corporation"
-		copyright="Copyright (c) 2007 Intel Corporation and others. 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"
-		id="YoctoEmptyProject" label="%EmptyProject.template.label" description="%EmptyProject.template.description"
-		 help="help.html">
-
-	<process type="org.yocto.sdk.ide.NewYoctoProject">
-		<simple name="name" value="$(projectName)" /> 
-		<simple name="artifactExtension" value="exe" /> 
-		<simple name="isCProject" value="false" /> 
-		<simple name="isEmptyProject" value="true" />
-		<simple name="isAutotoolsProject" value="true" />
-	</process>
-
-</template>
-
plugins/org.yocto.sdk.ide/templates/projecttemplates/EmptyCProject/template.properties deleted +0 -14
deleted file mode 100644
index cba7112..0000000
@@ -1,14 +0,0 @@
-/*******************************************************************************
- * 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 implementation
- *******************************************************************************/
-
-#Template Default Values
-EmptyProject.template.label=Empty Project
-EmptyProject.template.description=An empty C Yocto Project autotools project template 
plugins/org.yocto.sdk.ide/templates/projecttemplates/EmptyCProject/template.xml deleted +0 -17
deleted file mode 100644
index 8f821af..0000000
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<template type="ProjTempl" version="1.0" supplier="Eclipse.org" revision="1.0" author="Intel Corporation"
-		copyright="Copyright (c) 2007 Intel Corporation and others. 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"
-
-		id="YoctoEmptyCProject" label="%EmptyProject.template.label" description="%EmptyProject.template.description"
-		 help="help.html">
-
-	<process type="org.yocto.sdk.ide.NewYoctoProject">
-		<simple name="name" value="$(projectName)" /> 
-		<simple name="artifactExtension" value="exe" /> 
-		<simple name="isCProject" value="true" /> 
-		<simple name="isEmptyProject" value="true" />
-		<simple name="isAutotoolsProject" value="true" />
-	</process>
-
-</template>
-
plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/template.xml +1 -1
index ca58158..7693080 100644
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="ISO-8859-1"?>
 <template type="ProjTempl" version="1.0" supplier="Eclipse.org" revision="1.0" author="Bala Torati (Symbian)"
 		copyright="Copyright (c) 2007,2009 Symbian Software Limited and others. 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 athttp://www.eclipse.org/legal/epl-v10.html"
-		id="HelloWorldCYoctoProject" label="%HelloWorld.CAnsitemplate.label" description="%HelloWorld.CAnsitemplate.description"
+		id="YoctoHelloWorldCAutotoolsProject" label="%HelloWorld.CAnsitemplate.label" description="%HelloWorld.CAnsitemplate.description"
 		help="help.html">
 
 	<property-group id="basics" label="%HelloWorld.basics.label" description="%HelloWorld.basics.description" type="PAGES-ONLY" help="help.html">
plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/Basename.c new file +50 -0

50 lines not on this page · raw message

plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/Basename.desktop.in.src new file +9 -0
new file mode 100644
index 0000000..e96420f
@@ -0,0 +1,9 @@
+[Desktop Entry]
+Version=@VERSION@
+Encoding=UTF-8
+Name=$(projectName)
+Comment=A "$(message)"
+Type=Application
+Categories=Application
+Exec=$(projectName)
+Name[en_US]=$(message)
plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/ChangeLog new file +0 -0
new file mode 100644
index 0000000..e69de29
plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/INSTALL new file +9 -0
new file mode 100644
index 0000000..b8b0535
@@ -0,0 +1,9 @@
+Building:
+  $ ./autogen.sh  [--enable-gtk-doc] [--prefix=/usr]
+  $ make
+
+Installing:
+  $ sudo make install
+
+Running:
+  $ $(projectName)
\ No newline at end of file
plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/Makefile.am.src new file +8 -0
new file mode 100644
index 0000000..fc3bc8c
@@ -0,0 +1,8 @@
+
+bin_PROGRAMS = $(projectName)
+$(projectName)_SOURCES = $(projectName).c
+
+AM_CFLAGS = @$(projectName)_CFLAGS@
+AM_LDFLAGS = @$(projectName)_LIBS@
+
+CLEANFILES = *~ 
plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/Makefile.am.top new file +7 -0
new file mode 100644
index 0000000..7bee2b7
@@ -0,0 +1,7 @@
+SUBDIRS = $(sourceDir)
+
+MAINTAINERCLEANFILES = aclocal.m4 compile config.guess \
+		config.sub configure depcomp install-sh \
+		ltmain.sh Makefile.in missing
+
+
plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/NEWS new file +0 -0
new file mode 100644
index 0000000..e69de29
plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/README new file +25 -0
new file mode 100644
index 0000000..ec15541
@@ -0,0 +1,25 @@
+$(projectName)
+Copyright (C) $(copyright).
+
+Brief description of project....
+
+-----------------------------------------------------------------------------
+ Build
+-----------------------------------------------------------------------------
+$ ./autogen.sh $CONFIGURE_FLAGS
+$ make
+
+-----------------------------------------------------------------------------
+ Build with documentation generated (usually for libraries)
+-----------------------------------------------------------------------------
+$ ./autogen.sh --enable-gtk-doc
+$ make
+
+( If built with the --enable-gtk-doc flag above you can view the index.html
+  file in your web browser. )
+$ firefox ./docs/reference/index.html
+
+-----------------------------------------------------------------------------
+ Install
+-----------------------------------------------------------------------------
+$ sudo make install
plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/autogen.sh new file +10 -0
new file mode 100755
index 0000000..7fd81e2
@@ -0,0 +1,10 @@
+#! /bin/sh
+[ -e config.cache ] && rm -f config.cache
+
+libtoolize --automake
+aclocal ${OECORE_ACLOCAL_OPTS}
+autoconf
+autoheader
+automake -a
+./configure $@
+exit
plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/configure.ac.top new file +49 -0

49 lines not on this page · raw message

plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/configure.ac.top.old new file +37 -0
new file mode 100644
index 0000000..234ab99
@@ -0,0 +1,37 @@
+AC_PREREQ(2.61)
+
+# package version number (not shared library version)
+# odd micro numbers indicate in-progress development
+# even micro numbers indicate released versions
+m4_define($(projectName)_version_major, 0)
+m4_define($(projectName)_version_minor, 1)
+m4_define($(projectName)_version_micro, 0)
+
+m4_define([$(projectName)_version],
+          [$(projectName)_version_major.$(projectName)_version_minor.$(projectName)_version_micro])
+m4_define([$(projectName)_api_version],
+          [$(projectName)_version_major.$(projectName)_version_minor])
+
+AC_INIT($(projectName), $(projectName)_version)
+AM_INIT_AUTOMAKE($(projectName), $(projectName)_version)
+AC_CONFIG_HEADERS(config.h)
+
+# Checks for programs.
+AC_PROG_LIBTOOL
+AM_PROG_CC_C_O
+AC_PROG_INSTALL
+
+AC_SUBST($(projectName)_CFLAGS)
+AC_SUBST($(projectName)_LIBS)
+
+AC_OUTPUT([
+Makefile
+$(sourceDir)/Makefile
+])
+
+echo ""
+echo "   $(projectName) $VERSION"
+echo "   ====================="
+echo ""
+echo "   To build the project, run \"make\""
+echo ""
plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/template.properties new file +28 -0
new file mode 100644
index 0000000..c79e982
@@ -0,0 +1,28 @@
+###############################################################################
+# Copyright (c) 2007, 2009 Symbian Software Private Ltd. and others.
+# 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:
+#     Bala Torati (Symbian) - initial API and implementation
+#     Red Hat Inc - modification to use with Autotools project
+###############################################################################
+
+#Template Default Values
+HelloWorld.CAnsitemplate.label=Hello World GTK C Autotools Project
+HelloWorld.CAnsitemplate.description=A skeletal C GTK Hello World project. Creates a folder for sources and autogen artifacts.
+HelloWorld.basics.label=Basic Settings
+HelloWorld.basics.description=Basic properties of a project
+HelloWorld.author.label=Author
+HelloWorld.author.description=Name of the author
+HelloWorld.copyright.label=Copyright notice
+HelloWorld.copyright.description=The name of the copyright holder (e.g. XYZ Corporation)
+HelloWorld.copyright.default=Your copyright
+HelloWorld.message.default=Hello World
+HelloWorld.message.description=Your hello world greeting message
+HelloWorld.message.label=Hello world greeting
+HelloWorld.sourceDir.label=Source
+HelloWorld.sourceDir.description=Directory for hello world project source files
+HelloWorld.sourceDir.default=src
plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/template.xml new file +142 -0

142 lines not on this page · raw message

plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKProject/src/Basename.c deleted +0 -50

50 lines not on this page · raw message

plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKProject/src/Basename.desktop.in.src deleted +0 -9
deleted file mode 100644
index e96420f..0000000
@@ -1,9 +0,0 @@
-[Desktop Entry]
-Version=@VERSION@
-Encoding=UTF-8
-Name=$(projectName)
-Comment=A "$(message)"
-Type=Application
-Categories=Application
-Exec=$(projectName)
-Name[en_US]=$(message)
plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKProject/src/ChangeLog deleted +0 -0
deleted file mode 100644
index e69de29..0000000
plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKProject/src/INSTALL deleted +0 -9
deleted file mode 100644
index b8b0535..0000000
@@ -1,9 +0,0 @@
-Building:
-  $ ./autogen.sh  [--enable-gtk-doc] [--prefix=/usr]
-  $ make
-
-Installing:
-  $ sudo make install
-
-Running:
-  $ $(projectName)
\ No newline at end of file
plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKProject/src/Makefile.am.src deleted +0 -8
deleted file mode 100644
index fc3bc8c..0000000
@@ -1,8 +0,0 @@
-
-bin_PROGRAMS = $(projectName)
-$(projectName)_SOURCES = $(projectName).c
-
-AM_CFLAGS = @$(projectName)_CFLAGS@
-AM_LDFLAGS = @$(projectName)_LIBS@
-
-CLEANFILES = *~ 
plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKProject/src/Makefile.am.top deleted +0 -7
deleted file mode 100644
index 7bee2b7..0000000
@@ -1,7 +0,0 @@
-SUBDIRS = $(sourceDir)
-
-MAINTAINERCLEANFILES = aclocal.m4 compile config.guess \
-		config.sub configure depcomp install-sh \
-		ltmain.sh Makefile.in missing
-
-
plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKProject/src/NEWS deleted +0 -0
deleted file mode 100644
index e69de29..0000000
plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKProject/src/README deleted +0 -25
deleted file mode 100644
index ec15541..0000000
@@ -1,25 +0,0 @@
-$(projectName)
-Copyright (C) $(copyright).
-
-Brief description of project....
-
------------------------------------------------------------------------------
- Build
------------------------------------------------------------------------------
-$ ./autogen.sh $CONFIGURE_FLAGS
-$ make
-
------------------------------------------------------------------------------
- Build with documentation generated (usually for libraries)
------------------------------------------------------------------------------
-$ ./autogen.sh --enable-gtk-doc
-$ make
-
-( If built with the --enable-gtk-doc flag above you can view the index.html
-  file in your web browser. )
-$ firefox ./docs/reference/index.html
-
------------------------------------------------------------------------------
- Install
------------------------------------------------------------------------------
-$ sudo make install
plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKProject/src/autogen.sh deleted +0 -10
deleted file mode 100755
index 7fd81e2..0000000
@@ -1,10 +0,0 @@
-#! /bin/sh
-[ -e config.cache ] && rm -f config.cache
-
-libtoolize --automake
-aclocal ${OECORE_ACLOCAL_OPTS}
-autoconf
-autoheader
-automake -a
-./configure $@
-exit
plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKProject/src/configure.ac.top deleted +0 -49

49 lines not on this page · raw message

plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKProject/src/configure.ac.top.old deleted +0 -37
deleted file mode 100644
index 234ab99..0000000
@@ -1,37 +0,0 @@
-AC_PREREQ(2.61)
-
-# package version number (not shared library version)
-# odd micro numbers indicate in-progress development
-# even micro numbers indicate released versions
-m4_define($(projectName)_version_major, 0)
-m4_define($(projectName)_version_minor, 1)
-m4_define($(projectName)_version_micro, 0)
-
-m4_define([$(projectName)_version],
-          [$(projectName)_version_major.$(projectName)_version_minor.$(projectName)_version_micro])
-m4_define([$(projectName)_api_version],
-          [$(projectName)_version_major.$(projectName)_version_minor])
-
-AC_INIT($(projectName), $(projectName)_version)
-AM_INIT_AUTOMAKE($(projectName), $(projectName)_version)
-AC_CONFIG_HEADERS(config.h)
-
-# Checks for programs.
-AC_PROG_LIBTOOL
-AM_PROG_CC_C_O
-AC_PROG_INSTALL
-
-AC_SUBST($(projectName)_CFLAGS)
-AC_SUBST($(projectName)_LIBS)
-
-AC_OUTPUT([
-Makefile
-$(sourceDir)/Makefile
-])
-
-echo ""
-echo "   $(projectName) $VERSION"
-echo "   ====================="
-echo ""
-echo "   To build the project, run \"make\""
-echo ""
plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKProject/template.properties deleted +0 -28
deleted file mode 100644
index c79e982..0000000
@@ -1,28 +0,0 @@
-###############################################################################
-# Copyright (c) 2007, 2009 Symbian Software Private Ltd. and others.
-# 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:
-#     Bala Torati (Symbian) - initial API and implementation
-#     Red Hat Inc - modification to use with Autotools project
-###############################################################################
-
-#Template Default Values
-HelloWorld.CAnsitemplate.label=Hello World GTK C Autotools Project
-HelloWorld.CAnsitemplate.description=A skeletal C GTK Hello World project. Creates a folder for sources and autogen artifacts.
-HelloWorld.basics.label=Basic Settings
-HelloWorld.basics.description=Basic properties of a project
-HelloWorld.author.label=Author
-HelloWorld.author.description=Name of the author
-HelloWorld.copyright.label=Copyright notice
-HelloWorld.copyright.description=The name of the copyright holder (e.g. XYZ Corporation)
-HelloWorld.copyright.default=Your copyright
-HelloWorld.message.default=Hello World
-HelloWorld.message.description=Your hello world greeting message
-HelloWorld.message.label=Hello world greeting
-HelloWorld.sourceDir.label=Source
-HelloWorld.sourceDir.description=Directory for hello world project source files
-HelloWorld.sourceDir.default=src
plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKProject/template.xml deleted +0 -142

142 lines not on this page · raw message

plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCPPAutotoolsProject/template.xml +1 -1
index 7ec9e05..83e6fda 100644
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="ISO-8859-1"?>
 <template type="ProjTempl" version="1.0" supplier="Eclipse.org" revision="1.0" author="Bala Torati (Symbian)"
 		copyright="Copyright (c) 2007,2009 Symbian Software Limited and others. 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 athttp://www.eclipse.org/legal/epl-v10.html"
-		id="HelloWorldCPPYoctoProject" label="%HelloWorld.CCtemplate.label" description="%HelloWorld.CCtemplate.description"
+		id="YoctoHelloWorldCPPAutotoolsProject" label="%HelloWorld.CCtemplate.label" description="%HelloWorld.CCtemplate.description"
 		help="help.html">
 
 	<property-group id="basics" label="%HelloWorld.basics.label" description="%HelloWorld.basics.description" type="PAGES-ONLY" help="help.html">
Signature · 1 line
1.7.9.5
#11 lore raw

PATCH v2 7/9 plugins/sdk.ide: Renamed the NewYoctoProjectPostProcess

In reply to Atanas Gegov

From: Atanas Gegov <[email protected]>

Renamed the NewYoctoProjectPostProcess to NewYoctoAutotoolsProjectPostProcess as it is actually relevant for Autotools-based projects. Added a check for the apropriate project nature in the the "process" method of NewYoctoAutotoolsProjectPostProcess.

---
 plugins/org.yocto.sdk.ide/plugin.xml               |    4 +-
 .../org/yocto/sdk/ide/YoctoSDKMessages.properties  |    2 +
 .../NewYoctoAutotoolsProjectPostProcess.java       |   77 ++++++++++++++++++++
 .../sdk/ide/wizard/NewYoctoProjectPostProcess.java |   73 -------------------
 .../HelloWorldCAutotoolsProject/template.xml       |    2 +-
 .../HelloWorldCGTKAutotoolsProject/template.xml    |    2 +-
 .../HelloWorldCPPAutotoolsProject/template.xml     |    2 +-
 7 files changed, 84 insertions(+), 78 deletions(-)
 create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/wizard/NewYoctoAutotoolsProjectPostProcess.java
 delete mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/wizard/NewYoctoProjectPostProcess.java
plugins/org.yocto.sdk.ide/plugin.xml +2 -2
index 6e378bd..1b882a2 100644
@@ -164,8 +164,8 @@
          </simple>
       </processType>
       <processType
-            name="NewYoctoProjectPostProcess"
-            processRunner="org.yocto.sdk.ide.wizard.NewYoctoProjectPostProcess">
+            name="NewYoctoAutotoolsProjectPostProcess"
+            processRunner="org.yocto.sdk.ide.wizard.NewYoctoAutotoolsProjectPostProcess">
          <simple
                name="projectName">
          </simple>
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKMessages.properties +2 -0
index 780bc90..67087f0 100644
@@ -98,3 +98,5 @@ LaunchConfig.BuildScope.Attr = org.eclipse.ui.externaltools.ATTR_LAUNCH_CONFIGUR
 LaunchConfig.BuildScope.Value = ${projects:}
 LaunchConfig.Location.Attr = org.eclipse.ui.externaltools.ATTR_LOCATION
 LaunchConfig.Arguments.Attr = org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS;
+
+AutotoolsProjectPostProcess.WrongProjectNature = {0} is not an Autotools project
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/wizard/NewYoctoAutotoolsProjectPostProcess.java new file +77 -0

77 lines not on this page · raw message

plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/wizard/NewYoctoProjectPostProcess.java deleted +0 -73

73 lines not on this page · raw message

plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/template.xml +1 -1
index 7693080..70c9910 100644
@@ -135,7 +135,7 @@
         </complex-array>
 	</process>
 
-	<process type="org.yocto.sdk.ide.NewYoctoProjectPostProcess">
+	<process type="org.yocto.sdk.ide.NewYoctoAutotoolsProjectPostProcess">
 		<simple name="projectName" value="$(projectName)" /> 
 	</process>
 
plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/template.xml +1 -1
index d55a904..8933add 100644
@@ -135,7 +135,7 @@
         </complex-array>
 	</process>
 
-	<process type="org.yocto.sdk.ide.NewYoctoProjectPostProcess">
+	<process type="org.yocto.sdk.ide.NewYoctoAutotoolsProjectPostProcess">
 		<simple name="projectName" value="$(projectName)" /> 
 	</process>
 </template>
plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCPPAutotoolsProject/template.xml +1 -1
index 83e6fda..9d1914c 100644
@@ -135,7 +135,7 @@
         </complex-array>
 	</process>
 
-	<process type="org.yocto.sdk.ide.NewYoctoProjectPostProcess">
+	<process type="org.yocto.sdk.ide.NewYoctoAutotoolsProjectPostProcess">
 		<simple name="projectName" value="$(projectName)" /> 
 	</process>
 </template>
Signature · 1 line
1.7.9.5
#12 lore raw

PATCH v2 8/9 plugins/sdk.ide: Improved usage of strings in class

In reply to Atanas Gegov

From: Atanas Gegov <[email protected]>

Extracted string constants. Added missing
NON-NLS-1 declarations.

---
 .../NewYoctoAutotoolsProjectPostProcess.java       |   10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/wizard/NewYoctoAutotoolsProjectPostProcess.java +7 -3
index 9bc042a..cb187e9 100644
@@ -11,6 +11,7 @@
 package org.yocto.sdk.ide.wizard;
 
 import java.io.BufferedReader;
+import java.io.File;
 import java.io.InputStream;
 import java.io.InputStreamReader;
 
@@ -28,6 +29,9 @@ import org.yocto.sdk.ide.natures.YoctoSDKAutotoolsProjectNature;
 
 public class NewYoctoAutotoolsProjectPostProcess extends ProcessRunner {
 
+	public static final String CHMOD_COMMAND = "chmod +x "; //$NON-NLS-1$
+	public static final String AUTOGEN_SCRIPT_NAME = "autogen.sh"; //$NON-NLS-1$
+
 	public NewYoctoAutotoolsProjectPostProcess() {}
 
 	public void process(TemplateCore template, ProcessArgument[] args, String processId, IProgressMonitor monitor) throws ProcessFailureException {
@@ -45,7 +49,7 @@ public class NewYoctoAutotoolsProjectPostProcess extends ProcessRunner {
 			} else {
 				IPath path = project.getLocation();
 				String path_str = path.toString();
-				String autogen_cmd = "chmod +x " + path_str + "/autogen.sh";
+				String autogen_cmd = CHMOD_COMMAND + path_str + File.separator + AUTOGEN_SCRIPT_NAME;
 				try {
 					Runtime rt = Runtime.getRuntime();
 					Process proc = rt.exec(autogen_cmd);
@@ -53,7 +57,7 @@ public class NewYoctoAutotoolsProjectPostProcess extends ProcessRunner {
 					InputStreamReader isr = new InputStreamReader(stdin);
 					BufferedReader br = new BufferedReader(isr);
 					String line = null;
-					String error_message = "";
+					String error_message = ""; //$NON-NLS-1$
 
 					while ( (line = br.readLine()) != null) {
 						error_message = error_message + line;
@@ -61,7 +65,7 @@ public class NewYoctoAutotoolsProjectPostProcess extends ProcessRunner {
 
 					int exitVal = proc.waitFor();
 					if (exitVal != 0) {
-						throw new ProcessFailureException("Failed to make autogen.sh executable for project: " + projectName);
+						throw new ProcessFailureException("Failed to make autogen.sh executable for project: " + projectName); //$NON-NLS-1$
 					}
 				} catch (Throwable t) {
 					t.printStackTrace();
Signature · 1 line
1.7.9.5
#13 lore raw

PATCH v2 9/9 plugins/sdk.ide: Extracted error message to YoctoSDKMessages

In reply to Atanas Gegov

From: Atanas Gegov <[email protected]>

Improved the i18n ability.

---
 .../org/yocto/sdk/ide/YoctoSDKMessages.properties  |    1 +
 .../NewYoctoAutotoolsProjectPostProcess.java       |    8 ++++----
 2 files changed, 5 insertions(+), 4 deletions(-)
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKMessages.properties +1 -0
index 67087f0..4ff1574 100644
@@ -100,3 +100,4 @@ LaunchConfig.Location.Attr = org.eclipse.ui.externaltools.ATTR_LOCATION
 LaunchConfig.Arguments.Attr = org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS;
 
 AutotoolsProjectPostProcess.WrongProjectNature = {0} is not an Autotools project
+AutotoolsProjectPostProcess.ChmodFailure = Failed to make autogen.sh executable for project: {0}
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/wizard/NewYoctoAutotoolsProjectPostProcess.java +4 -4
index cb187e9..f467dac 100644
@@ -65,16 +65,16 @@ public class NewYoctoAutotoolsProjectPostProcess extends ProcessRunner {
 
 					int exitVal = proc.waitFor();
 					if (exitVal != 0) {
-						throw new ProcessFailureException("Failed to make autogen.sh executable for project: " + projectName); //$NON-NLS-1$
+						throw new ProcessFailureException(
+								YoctoSDKMessages.getFormattedString("AutotoolsProjectPostProcess.ChmodFailure", //$NON-NLS-1$
+										projectName));
 					}
 				} catch (Throwable t) {
 					t.printStackTrace();
 
 				}
 			}
-		}
-		catch (Exception e)
-		{
+		} catch (Exception e) {
 			throw new ProcessFailureException(Messages.getString("NewManagedProject.3") + e.getMessage(), e); //$NON-NLS-1$
 		}
 	}
Signature · 1 line
1.7.9.5