Skip to content

Commit 4b59ff1

Browse files
author
jan
committed
Convert to sloeber assumed existing configurations #1733
If no configurations exists the conversion failed. This commit modified the code to assume a configuration named Release exists if no configurations exists
1 parent d17ae32 commit 4b59ff1

File tree

5 files changed

+15
-6
lines changed

5 files changed

+15
-6
lines changed

io.sloeber.autoBuild/src/io/sloeber/autoBuild/helpers/api/AutoBuildConstants.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ public class AutoBuildConstants {
3232
public static final String TARGET_OBJECTS = "objects";
3333
public static final String TARGET_ALL = "all";
3434
public static final String TARGET_CLEAN = "clean";
35+
public static final String RELEASE = "Release";
3536
public static final String DEFAULT_AUTO_MAKE_TARGET = TARGET_OBJECTS;
3637
public static final String DEFAULT_INCREMENTAL_MAKE_TARGET = TARGET_ALL;
3738
public static final String DEFAULT_CLEAN_MAKE_TARGET = TARGET_CLEAN;

io.sloeber.autoBuild/src/io/sloeber/autoBuild/integration/AutoBuildProjectGenerator.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11

22
package io.sloeber.autoBuild.integration;
33

4+
import static io.sloeber.autoBuild.helpers.api.AutoBuildConstants.*;
45
import java.net.URI;
56
import java.util.HashSet;
67
import java.util.List;
@@ -80,8 +81,12 @@ public void run(IProgressMonitor internalMonitor) throws CoreException {
8081
if (myProject.exists()) {
8182
// Update the existing configurations
8283
ICProjectDescription orgdesc = mngr.getProjectDescription(myProject, false);
83-
for (ICConfigurationDescription curConfig : orgdesc.getConfigurations()) {
84-
configNames.add(curConfig.getName());
84+
if (orgdesc == null) {
85+
configNames.add(RELEASE);
86+
} else {
87+
for (ICConfigurationDescription curConfig : orgdesc.getConfigurations()) {
88+
configNames.add(curConfig.getName());
89+
}
8590
}
8691
myLocationURI=myProject.getLocationURI();
8792
//CDT reads the .cproject file when setting the configuration for making the delta

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,6 @@ public class Const extends AutoBuildConstants {
201201
public static final String KEY_JSON_URL="URL";//$NON-NLS-1$
202202

203203

204-
public static final String RELEASE = "Release";
205204
public static final String ARDUINO_SIZE = "arduino-size.cmd";
206205

207206
public static final short PLOTTER_START_DATA = (short) 0xCDAB;// This is the

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,12 @@ public void run(IProgressMonitor internalMonitor) throws CoreException {
111111
CCorePlugin cCorePlugin = CCorePlugin.getDefault();
112112
ICProjectDescription oldPrjCDesc = cCorePlugin.getProjectDescription(project, false);
113113
Set <String>cfgNames=new HashSet<>();
114-
for (ICConfigurationDescription curConfig : oldPrjCDesc.getConfigurations()) {
115-
cfgNames.add( curConfig.getName());
114+
if (oldPrjCDesc == null) {
115+
cfgNames.add(RELEASE);
116+
} else {
117+
for (ICConfigurationDescription curConfig : oldPrjCDesc.getConfigurations()) {
118+
cfgNames.add(curConfig.getName());
119+
}
116120
}
117121

118122

io.sloeber.core/src/io/sloeber/core/internal/SloeberConfiguration.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ private static IPath getLocation(ICSourceEntry entry) {
327327
IResource rc = ResourcesPlugin.getWorkspace().getRoot().findMember(path);
328328
if (rc != null)
329329
return rc.getLocation();
330-
return null;
330+
return entry.getLocation();
331331
}
332332

333333
/**

0 commit comments

Comments
 (0)