Skip to content

Commit 584cd0d

Browse files
authored
Merge pull request #1201 from Sloeber/#1163_create_project_the_cdt_way
#1163 create project the cdt way
2 parents 626e750 + 6bb9f85 commit 584cd0d

File tree

11 files changed

+1294
-1416
lines changed

11 files changed

+1294
-1416
lines changed

io.sloeber.core/plugin.xml

+7-5
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,6 @@
142142
<!-- It is also used for the base of the Debug configuration (for use with a JTAG/DragonAVR etc). -->
143143
<!-- TODO: Consider renaming as base. -->
144144
<configuration
145-
artifactExtension="hex"
146145
cleanCommand="rm -f"
147146
id="io.sloeber.core.configuration.release"
148147
languageSettingsProviders="io.sloeber.languageSettingsProvider"
@@ -400,22 +399,25 @@
400399
command="${JANTJE.SIZE.SWITCH} "
401400
commandLinePattern="${COMMAND}"
402401
id="io.sloeber.tool.size"
402+
isAbstract="false"
403403
name="%tool.printsize.name">
404404
<inputType
405405
buildVariable="HEX"
406406
dependencyExtensions="hex"
407407
id="io.sloeber.tool.size.input"
408408
multipleOfType="true"
409409
primaryInput="true"
410-
sourceContentType="io.sloeber.tool.objcopy.output">
410+
sourceContentType="io.sloeber.tool.objcopy.output"
411+
sources="hex">
411412
</inputType>
412413
<outputType
413414
buildVariable="SIZEDUMMY"
414415
id="io.sloeber.tool.size.output"
415416
multipleOfType="false"
416-
outputNames="sizedummy"
417-
outputs="${project}.size"
418-
primaryOutput="true">
417+
name="size info"
418+
outputNames="${ProjName}.size"
419+
outputs="size"
420+
primaryOutput="false">
419421
</outputType>
420422
</tool>
421423
</toolChain>

io.sloeber.core/src/io/sloeber/core/api/BoardDescriptor.java

+1,012-991
Large diffs are not rendered by default.

io.sloeber.core/src/io/sloeber/core/common/Common.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,15 @@ public class Common extends Const {
7171
* filenames containing spaces in Windows, see Note 1 < less than used to
7272
* redirect input, allowed in Unix filenames, see Note 1 > greater than used
7373
* to redirect output, allowed in Unix filenames, see Note 1 . period or dot
74+
*
75+
* # is excluded as it is seen as a special character by make
7476
*
7577
* @param name
7678
* the string that needs to be checked
7779
* @return a name safe to create files or folders
7880
*/
7981
public static String MakeNameCompileSafe(String name) {
80-
char[] badChars = { ' ', '/', '.',':', '\\', '(', ')', '*', '?', '%', '|', '<', '>', ',', '-' };
82+
char[] badChars = { ' ', '/', '.',':', '\\', '(', ')', '*', '?', '%', '|', '<', '>', ',', '-','#' };
8183

8284
String ret = name.trim();
8385
for (char curchar : badChars) {

io.sloeber.core/src/io/sloeber/core/tools/Helpers.java

+11-30
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
import org.eclipse.core.resources.IFile;
3838
import org.eclipse.core.resources.IFolder;
3939
import org.eclipse.core.resources.IProject;
40-
import org.eclipse.core.resources.IProjectDescription;
4140
import org.eclipse.core.resources.IResource;
4241
import org.eclipse.core.resources.ResourcesPlugin;
4342
import org.eclipse.core.runtime.CoreException;
@@ -103,8 +102,10 @@ public class Helpers extends Common {
103102
* @param configurationDescription
104103
* @param IncludePath
105104
*/
106-
public static void addIncludeFolder(ICConfigurationDescription configurationDescription, IPath IncludePath) {
107-
addIncludeFolder(configurationDescription, IncludePath, true);
105+
106+
public static void addIncludeFolder(ICFolderDescription folderDescription, IPath IncludePath)
107+
{
108+
addIncludeFolder( folderDescription, IncludePath,true) ;
108109
}
109110

110111
/**
@@ -116,10 +117,7 @@ public static void addIncludeFolder(ICConfigurationDescription configurationDesc
116117
* @param IncludePath The path to add to the include folders
117118
* @see addLibraryDependency {@link #addLibraryDependency(IProject, IProject)}
118119
*/
119-
public static void addIncludeFolder(ICConfigurationDescription configurationDescription, IPath IncludePath,
120-
boolean isWorkspacePath) {
121-
// find all languages
122-
ICFolderDescription folderDescription = configurationDescription.getRootFolderDescription();
120+
public static void addIncludeFolder(ICFolderDescription folderDescription, IPath IncludePath,boolean isWorkspacePath) {
123121
ICLanguageSetting[] languageSettings = folderDescription.getLanguageSettings();
124122
int pathSetting = ICSettingEntry.VALUE_WORKSPACE_PATH;
125123
if (!isWorkspacePath) {
@@ -247,6 +245,7 @@ public static void LinkFolderToFolder(IProject project, IPath source, IPath targ
247245
public static void addCodeFolder(IProject project, IPath toLinkFolder, String LinkName,
248246
ICConfigurationDescription configurationDescription, boolean forceRoot) throws CoreException {
249247
IFolder link = project.getFolder(LinkName);
248+
ICFolderDescription folderDescription = configurationDescription.getRootFolderDescription();
250249

251250
LinkFolderToFolder(project, toLinkFolder, new Path(LinkName));
252251

@@ -256,27 +255,27 @@ public static void addCodeFolder(IProject project, IPath toLinkFolder, String Li
256255
String possibleIncludeFolder = "utility";
257256
File file = toLinkFolder.append(possibleIncludeFolder).toFile();
258257
if (file.exists()) {
259-
addIncludeFolder(configurationDescription, link.getFullPath().append(possibleIncludeFolder));
258+
addIncludeFolder(folderDescription, link.getFullPath().append(possibleIncludeFolder));
260259
}
261260

262261
if (forceRoot) {
263-
addIncludeFolder(configurationDescription, link.getFullPath());
262+
addIncludeFolder(folderDescription, link.getFullPath());
264263
} else {
265264
// add src or root give priority to src
266265
possibleIncludeFolder = Library.LIBRARY_SOURCE_FODER;
267266
file = toLinkFolder.append(possibleIncludeFolder).toFile();
268267
if (file.exists()) {
269-
addIncludeFolder(configurationDescription, link.getFullPath().append(possibleIncludeFolder));
268+
addIncludeFolder(folderDescription, link.getFullPath().append(possibleIncludeFolder));
270269
} else {
271-
addIncludeFolder(configurationDescription, link.getFullPath());
270+
addIncludeFolder(folderDescription, link.getFullPath());
272271
}
273272
}
274273

275274
possibleIncludeFolder = "arch";
276275
file = toLinkFolder.append(possibleIncludeFolder).toFile();
277276
if (file.exists()) {
278277
InternalBoardDescriptor boardDescriptor = new InternalBoardDescriptor(configurationDescription);
279-
addIncludeFolder(configurationDescription,
278+
addIncludeFolder(folderDescription,
280279
link.getFullPath().append(possibleIncludeFolder).append(boardDescriptor.getArchitecture()));
281280
}
282281
}
@@ -316,24 +315,6 @@ public static void addCodeFolder(IProject project, Path Path, ICConfigurationDes
316315
addCodeFolder(project, Path, NiceName, configurationDescription, forceRoot);
317316
}
318317

319-
/**
320-
* addTheNatures replaces all existing natures by the natures needed for a
321-
* arduino project
322-
*
323-
* @param project The project where the natures need to be added to
324-
* @throws CoreException
325-
*/
326-
public static void addTheNatures(IProjectDescription description) throws CoreException {
327-
328-
String[] newnatures = new String[5];
329-
newnatures[0] = "org.eclipse.cdt.core.cnature";
330-
newnatures[1] = "org.eclipse.cdt.core.ccnature";
331-
newnatures[2] = "org.eclipse.cdt.managedbuilder.core.managedBuildNature";
332-
newnatures[3] = "org.eclipse.cdt.managedbuilder.core.ScannerConfigNature";
333-
newnatures[4] = Const.ARDUINO_NATURE_ID;
334-
description.setNatureIds(newnatures);
335-
336-
}
337318

338319
/**
339320
* This method adds the content of a content stream to a file If the file

io.sloeber.core/src/io/sloeber/core/tools/ShouldHaveBeenInCDT.java

-136
This file was deleted.

io.sloeber.tests/src/io/sloeber/core/CompileAndUpload.java

+1-4
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131

3232
import io.sloeber.core.api.CodeDescriptor;
3333
import io.sloeber.core.api.CompileOptions;
34-
import io.sloeber.core.api.ConfigurationDescriptor;
3534
import io.sloeber.core.api.PackageManager;
3635
import io.sloeber.core.api.Preferences;
3736
import io.sloeber.core.api.Sketch;
@@ -155,9 +154,7 @@ public void Build_Verify_upload(CodeDescriptor codeDescriptor,
155154
try {
156155

157156
theTestProject = this.myBoard.getBoardDescriptor().createProject(
158-
projectName, null,
159-
ConfigurationDescriptor.getDefaultDescriptors(),
160-
codeDescriptor, compileOptions, monitor);
157+
projectName, null, codeDescriptor, compileOptions, monitor);
161158
Shared.waitForAllJobsToFinish(); // for the indexer
162159
} catch (Exception e) {
163160
e.printStackTrace();

0 commit comments

Comments
 (0)