Skip to content

Commit 5bf7367

Browse files
author
jantje
committed
merged master
2 parents d49130c + de657c1 commit 5bf7367

File tree

79 files changed

+851
-627
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+851
-627
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
.log
33
**/.settings/
44
**/bin/*
5+
**/target/*
56
/log.txt

.project

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>root</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.m2e.core.maven2Builder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
</buildSpec>
14+
<natures>
15+
<nature>org.eclipse.m2e.core.maven2Nature</nature>
16+
</natures>
17+
</projectDescription>

.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ script:
1111
- sh -c "if $TRAVIS_SECURE_ENV_VARS; then echo Travis SECURE available -- Deploy; else echo Travis SECURE NOT available -- Verify; fi"
1212

1313
#Execute the maven commands depending on SECURE availabilty and print the elapsed time out periodically.
14-
- sh -c "if $TRAVIS_SECURE_ENV_VARS; then ./travis_exec_and_print_time.sh 'mvn deploy -Pall,neon --quiet --settings settings.xml'; else ./travis_exec_and_print_time.sh 'mvn verify -Pall,neon --quiet --settings settings.xml'; fi"
14+
- sh -c "if $TRAVIS_SECURE_ENV_VARS; then ./travis_exec_and_print_time.sh 'mvn deploy -Pall,oxygen -Dtest=RegressionTest --quiet --settings settings.xml'; else ./travis_exec_and_print_time.sh 'mvn verify -Pall,oxygen -Dtest=RegressionTest --quiet --settings settings.xml'; fi"
1515

1616
#Several usernames and passwords/tokens are required for deployment.
1717
#When testing on your local/remote setup then you need to set/export env. variables:

io.sloeber.application/pom.xml

+1-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77
<version>4.1.0-SNAPSHOT</version>
88
<relativePath>../io.sloeber.parent</relativePath>
99
</parent>
10-
<groupId>com.github.brodykenrick.arduino-eclipse-plugin</groupId>
10+
1111
<artifactId>io.sloeber.application</artifactId>
12-
<version>4.1.0-SNAPSHOT</version>
1312
<packaging>eclipse-plugin</packaging>
1413
</project>

io.sloeber.core/.classpath

+14-10
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1-
<?xml version="1.0" encoding="UTF-8"?>
2-
<classpath>
3-
<classpathentry exported="true" kind="lib" path="lib/jssc-2.8.0.jar"/>
4-
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
5-
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
6-
<classpathentry excluding="it/baeyens/arduino/tools/uploaders/arduinoIDEstyle/" kind="src" path="src"/>
7-
<classpathentry exported="true" kind="lib" path="lib/jsch-0.1.50.jar"/>
8-
<classpathentry exported="true" kind="lib" path="lib/jmdns-3.4.1.jar"/>
9-
<classpathentry kind="output" path="bin"/>
10-
</classpath>
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
4+
<attributes>
5+
<attribute name="maven.pomderived" value="true"/>
6+
</attributes>
7+
</classpathentry>
8+
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
9+
<classpathentry kind="src" path="src"/>
10+
<classpathentry exported="true" kind="lib" path="lib/jsch-0.1.50.jar"/>
11+
<classpathentry exported="true" kind="lib" path="lib/jmdns-3.4.1.jar"/>
12+
<classpathentry exported="true" kind="lib" path="lib/jssc-2.8.0.jar"/>
13+
<classpathentry kind="output" path="bin"/>
14+
</classpath>

io.sloeber.core/.project

+6
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,14 @@
2424
<arguments>
2525
</arguments>
2626
</buildCommand>
27+
<buildCommand>
28+
<name>org.eclipse.m2e.core.maven2Builder</name>
29+
<arguments>
30+
</arguments>
31+
</buildCommand>
2732
</buildSpec>
2833
<natures>
34+
<nature>org.eclipse.m2e.core.maven2Nature</nature>
2935
<nature>org.eclipse.pde.PluginNature</nature>
3036
<nature>org.eclipse.jdt.core.javanature</nature>
3137
</natures>

io.sloeber.core/META-INF/MANIFEST.MF

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ Require-Bundle: org.eclipse.cdt.managedbuilder.core,
3333
org.eclipse.ui.ide,
3434
org.eclipse.ui,
3535
org.eclipse.debug.ui,
36-
org.junit,
3736
org.eclipse.ui.console,
38-
org.eclipse.ui.workbench
37+
org.eclipse.ui.workbench,
38+
org.junit;bundle-version="4.12.0"
3939
Export-Package: io.sloeber.core.api,
4040
io.sloeber.core.common

io.sloeber.core/pom.xml

+1-31
Original file line numberDiff line numberDiff line change
@@ -7,37 +7,7 @@
77
<version>4.1.0-SNAPSHOT</version>
88
<relativePath>../io.sloeber.parent</relativePath>
99
</parent>
10-
<groupId>com.github.brodykenrick.arduino-eclipse-plugin</groupId>
10+
1111
<artifactId>io.sloeber.core</artifactId>
1212
<packaging>eclipse-plugin</packaging>
13-
<version>4.1.0-SNAPSHOT</version>
14-
<dependencies>
15-
<dependency>
16-
<groupId>junit</groupId>
17-
<artifactId>junit</artifactId>
18-
<version>4.11</version>
19-
<scope>test</scope>
20-
</dependency>
21-
</dependencies>
22-
<build>
23-
<pluginManagement>
24-
<plugins>
25-
<plugin>
26-
<groupId>org.apache.maven.plugins</groupId>
27-
<artifactId>maven-surefire-plugin</artifactId>
28-
<version>2.20</version>
29-
</plugin>
30-
</plugins>
31-
</pluginManagement>
32-
<plugins>
33-
<plugin>
34-
<groupId>org.apache.maven.plugins</groupId>
35-
<artifactId>maven-surefire-plugin</artifactId>
36-
<configuration>
37-
<testSourceDirectory>${basedir}/src/jUnit/</testSourceDirectory>
38-
<testClassesDirectory>${project.build.directory}/classes/jUnit</testClassesDirectory>
39-
</configuration>
40-
</plugin>
41-
</plugins>
42-
</build>
4313
</project>

io.sloeber.core/src/cc/arduino/packages/discoverers/NetworkDiscovery.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ public static void start() {
107107
}
108108

109109
public static void stop() {
110-
timer.purge();
110+
timer.cancel();
111111
// we don't close each JmDNS instance as it's too slow
112112
}
113113

io.sloeber.core/src/io/sloeber/core/Activator.java

+6-2
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,11 @@ public class Activator extends AbstractUIPlugin {
8282

8383
@Override
8484
public void start(BundleContext context) throws Exception {
85+
IPath installPath = ConfigurationPreferences.getInstallationPath();
86+
installPath.toFile().mkdirs();
87+
IPath downloadPath = ConfigurationPreferences.getInstallationPathDownload();
88+
System.out.println("arduinoPlugin folders created");
89+
downloadPath.toFile().mkdirs();
8590
testKnownIssues();
8691
initializeImportantVariables();
8792
runPluginCoreStartInstantiatorJob();
@@ -207,8 +212,7 @@ private static void runInstallJob() {
207212
@SuppressWarnings("synthetic-access")
208213
@Override
209214
protected IStatus run(IProgressMonitor monitor) {
210-
IPath installPath = ConfigurationPreferences.getInstallationPath();
211-
installPath.toFile().mkdirs();
215+
212216
monitor.beginTask("Sit back, relax and watch us work for a little while ..", IProgressMonitor.UNKNOWN);
213217
addFileAssociations();
214218
makeOurOwnCustomBoards_txt();

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

+71-57
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
import org.eclipse.cdt.core.CCorePlugin;
1515
import org.eclipse.cdt.core.envvar.IContributedEnvironment;
16-
import org.eclipse.cdt.core.envvar.IEnvironmentVariable;
1716
import org.eclipse.cdt.core.envvar.IEnvironmentVariableManager;
1817
import org.eclipse.cdt.core.model.CoreModel;
1918
import org.eclipse.cdt.core.settings.model.CSourceEntry;
@@ -65,7 +64,7 @@ public class BoardDescriptor {
6564
private static final String KEY_LAST_USED_UPLOAD_PROTOCOL = "last Used upload Protocol";
6665
private static final String KEY_LAST_USED_BOARDS_FILE = "Last used Boards file";
6766
private static final String KEY_LAST_USED_BOARD_MENU_OPTIONS = "last used Board custom option selections";
68-
private static final String MENUSELECTION = Const.ENV_KEY_JANTJE_START + "MENU.";
67+
private static final String ENV_KEY_JANTJE_MENU_SELECTION = Const.ENV_KEY_JANTJE_START + "MENU";
6968
private static final String ENV_KEY_JANTJE_UPLOAD_PORT = Const.ENV_KEY_JANTJE_START + "COM_PORT";
7069
private static final String ENV_KEY_JANTJE_BOARD_NAME = Const.ENV_KEY_JANTJE_START + "BOARD_NAME";
7170
private static final String ENV_KEY_JANTJE_PROJECT_NAME = Const.ENV_KEY_JANTJE_START + "PROJECT_NAME";
@@ -161,7 +160,6 @@ public boolean equals(BoardDescriptor otherBoardDescriptor) {
161160
*/
162161
public boolean needsSettingDirty(BoardDescriptor otherBoardDescriptor) {
163162

164-
165163
if (!this.getBoardID().equals(otherBoardDescriptor.getBoardID())) {
166164
return true;
167165
}
@@ -181,8 +179,8 @@ public boolean needsSettingDirty(BoardDescriptor otherBoardDescriptor) {
181179
return true;
182180
}
183181
if (!this.getMyWorkSpaceLocation().equals(otherBoardDescriptor.getMyWorkSpaceLocation())) {
184-
return true;
185-
}
182+
return true;
183+
}
186184
return false;
187185
}
188186

@@ -245,14 +243,29 @@ private void ParseSection(Map<String, String> boardInfo) {
245243
upload = uploadOption;
246244
}
247245
}
248-
246+
String architecture = getArchitecture();
249247
if (core != null) {
250248
String valueSplit[] = core.split(":");
251249
if (valueSplit.length == 2) {
252250
String refVendor = valueSplit[0];
253251
String actualValue = valueSplit[1];
254252
this.myBoardsCore = actualValue;
255-
this.myReferencedCorePlatformPath = findReferencedPlatform(refVendor);
253+
this.myReferencedCorePlatformPath = Manager.getPlatformInstallPath(refVendor, architecture);
254+
if (this.myReferencedCorePlatformPath == null) {
255+
Common.log(new Status(IStatus.ERROR, Const.CORE_PLUGIN_ID,
256+
Messages.Helpers_tool_reference_missing.replaceAll(TOOL_KEY, core)
257+
.replaceAll(FILE_KEY, getReferencingBoardsFile().toString())
258+
.replaceAll(BOARD_KEY, getBoardID())));
259+
return;
260+
}
261+
} else if (valueSplit.length == 4) {
262+
String refVendor = valueSplit[0];
263+
String refArchitecture = valueSplit[1];
264+
String refVersion = valueSplit[2];
265+
String actualValue = valueSplit[3];
266+
this.myUploadTool = actualValue;
267+
this.myReferencedCorePlatformPath = Manager.getPlatformInstallPath(refVendor, refArchitecture,
268+
refVersion);
256269
if (this.myReferencedCorePlatformPath == null) {
257270
Common.log(new Status(IStatus.ERROR, Const.CORE_PLUGIN_ID,
258271
Messages.Helpers_tool_reference_missing.replaceAll(TOOL_KEY, core)
@@ -270,7 +283,22 @@ private void ParseSection(Map<String, String> boardInfo) {
270283
String refVendor = valueSplit[0];
271284
String actualValue = valueSplit[1];
272285
this.myBoardsVariant = actualValue;
273-
this.myReferencedBoardVariantPlatformPath = findReferencedPlatform(refVendor);
286+
this.myReferencedBoardVariantPlatformPath = Manager.getPlatformInstallPath(refVendor, architecture);
287+
if (this.myReferencedBoardVariantPlatformPath == null) {
288+
Common.log(new Status(IStatus.ERROR, Const.CORE_PLUGIN_ID,
289+
Messages.Helpers_tool_reference_missing.replaceAll(TOOL_KEY, variant)
290+
.replaceAll(FILE_KEY, getReferencingBoardsFile().toString())
291+
.replaceAll(BOARD_KEY, getBoardID())));
292+
return;
293+
}
294+
} else if (valueSplit.length == 4) {
295+
String refVendor = valueSplit[0];
296+
String refArchitecture = valueSplit[1];
297+
String refVersion = valueSplit[2];
298+
String actualValue = valueSplit[3];
299+
this.myUploadTool = actualValue;
300+
this.myReferencedBoardVariantPlatformPath = Manager.getPlatformInstallPath(refVendor, refArchitecture,
301+
refVersion);
274302
if (this.myReferencedBoardVariantPlatformPath == null) {
275303
Common.log(new Status(IStatus.ERROR, Const.CORE_PLUGIN_ID,
276304
Messages.Helpers_tool_reference_missing.replaceAll(TOOL_KEY, variant)
@@ -288,7 +316,22 @@ private void ParseSection(Map<String, String> boardInfo) {
288316
String refVendor = valueSplit[0];
289317
String actualValue = valueSplit[1];
290318
this.myUploadTool = actualValue;
291-
this.myReferencedUploadToolPlatformPath = findReferencedPlatform(refVendor);
319+
this.myReferencedUploadToolPlatformPath = Manager.getPlatformInstallPath(refVendor, architecture);
320+
if (this.myReferencedUploadToolPlatformPath == null) {
321+
Common.log(new Status(IStatus.ERROR, Const.CORE_PLUGIN_ID,
322+
Messages.Helpers_tool_reference_missing.replaceAll(TOOL_KEY, upload)
323+
.replaceAll(FILE_KEY, getReferencingBoardsFile().toString())
324+
.replaceAll(BOARD_KEY, getBoardID())));
325+
return;
326+
}
327+
} else if (valueSplit.length == 4) {
328+
String refVendor = valueSplit[0];
329+
String refArchitecture = valueSplit[1];
330+
String refVersion = valueSplit[2];
331+
String actualValue = valueSplit[3];
332+
this.myUploadTool = actualValue;
333+
this.myReferencedUploadToolPlatformPath = Manager.getPlatformInstallPath(refVendor, refArchitecture,
334+
refVersion);
292335
if (this.myReferencedUploadToolPlatformPath == null) {
293336
Common.log(new Status(IStatus.ERROR, Const.CORE_PLUGIN_ID,
294337
Messages.Helpers_tool_reference_missing.replaceAll(TOOL_KEY, upload)
@@ -325,16 +368,8 @@ protected BoardDescriptor(ICConfigurationDescription confdesc) {
325368
"");
326369
this.myWorkEclipseLocation = Common.getBuildEnvironmentVariable(confdesc, ENV_KEY_JANTJE_ECLIPSE_LOCATION,
327370
"");
328-
329-
this.myOptions = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
330-
IEnvironmentVariableManager envManager = CCorePlugin.getDefault().getBuildEnvironmentManager();
331-
IContributedEnvironment contribEnv = envManager.getContributedEnvironment();
332-
IEnvironmentVariable[] curVariables = contribEnv.getVariables(confdesc);
333-
for (IEnvironmentVariable curVariable : curVariables) {
334-
if (curVariable.getName().startsWith(MENUSELECTION)) {
335-
this.myOptions.put(curVariable.getName().substring(MENUSELECTION.length()), curVariable.getValue());
336-
}
337-
}
371+
String optinconcat = Common.getBuildEnvironmentVariable(confdesc, ENV_KEY_JANTJE_MENU_SELECTION, "");
372+
this.myOptions = KeyValue.makeMap(optinconcat);
338373
}
339374
calculateDerivedFields();
340375
}
@@ -603,12 +638,9 @@ public boolean saveConfiguration(ICConfigurationDescription confDesc, IContribut
603638
Common.setBuildEnvironmentVariable(contribEnv, confDesc, ENV_KEY_JANTJE_ECLIPSE_LOCATION,
604639
this.myWorkEclipseLocation);
605640
Common.setBuildEnvironmentVariable(confDesc, JANTJE_ACTION_UPLOAD, this.myProgrammer);
606-
if (this.myOptions != null) {
607-
for (Map.Entry<String, String> curoption : this.myOptions.entrySet()) {
608-
Common.setBuildEnvironmentVariable(contribEnv, confDesc, MENUSELECTION + curoption.getKey(),
609-
curoption.getValue());
610-
}
611-
}
641+
String value = KeyValue.makeString(this.myOptions);
642+
Common.setBuildEnvironmentVariable(contribEnv, confDesc, ENV_KEY_JANTJE_MENU_SELECTION, value);
643+
612644
Common.setBuildEnvironmentVariable(contribEnv, confDesc, ENV_KEY_SERIAL_PORT, this.myUploadPort);
613645
Common.setBuildEnvironmentVariable(contribEnv, confDesc, ENV_KEY_SERIAL_PORT_FILE,
614646
this.myUploadPort.replace("/dev/", new String()));
@@ -712,10 +744,9 @@ public String[] getCompatibleBoards() {
712744
}
713745

714746
public String[] getUploadProtocols() {
715-
if (this.myreferencingBoardsFile.exists()) {
716-
return Programmers.getUploadProtocols(this.myreferencingBoardsFile.toString());
717-
}
718-
return new String[0];
747+
748+
return Programmers.getUploadProtocols(this);
749+
719750
}
720751

721752
public String[] getMenuItemNamesFromMenuID(String menuID) {
@@ -781,24 +812,6 @@ public String getProjectName() {
781812
return this.myProjectName;
782813
}
783814

784-
/**
785-
* This method looks for a referenced platform. Ask the boards manager to find
786-
* the latest installed vendor/architecture platform file
787-
*
788-
* If this is not found there is still sme old code that probably can be
789-
* deleted.
790-
*
791-
* @param vendor
792-
* @param architecture
793-
* @return
794-
*/
795-
private IPath findReferencedPlatform(String vendor) {
796-
// ask the boardsmanager for the platform file
797-
IPath ret = Manager.getPlatformInstallPath(vendor, getArchitecture());
798-
return ret;
799-
800-
}
801-
802815
/**
803816
* provide the actual path to the variant. Use this method if you want to know
804817
* where the variant is
@@ -883,24 +896,25 @@ public IPath getReferencingLibraryPath() {
883896

884897
public String getUploadCommand(ICConfigurationDescription confdesc) {
885898
String upLoadTool = getActualUploadTool(confdesc);
886-
String action="UPLOAD";
899+
String action = "UPLOAD";
887900
if (usesProgrammer()) {
888-
action="PROGRAM";
901+
action = "PROGRAM";
889902
}
890-
return Common.getBuildEnvironmentVariable(confdesc, "A.TOOLS." + upLoadTool.toUpperCase() + "."+action+".PATTERN",
891-
upLoadTool.toUpperCase());
903+
return Common.getBuildEnvironmentVariable(confdesc,
904+
"A.TOOLS." + upLoadTool.toUpperCase() + "." + action + ".PATTERN", upLoadTool.toUpperCase());
892905
}
893906

894907
public String getActualUploadTool(ICConfigurationDescription confdesc) {
895-
if(confdesc == null) {
896-
Common.log(new Status(IStatus.ERROR, Const.CORE_PLUGIN_ID,"Confdesc null is not alowed here"));
908+
if (confdesc == null) {
909+
Common.log(new Status(IStatus.ERROR, Const.CORE_PLUGIN_ID, "Confdesc null is not alowed here"));
897910
return this.myUploadTool;
898911
}
899-
if(usesProgrammer()) {
900-
return Common.getBuildEnvironmentVariable(confdesc, "A.PROGRAM.TOOL", "Program tool not properly configured");
912+
if (usesProgrammer()) {
913+
return Common.getBuildEnvironmentVariable(confdesc, "A.PROGRAM.TOOL",
914+
"Program tool not properly configured");
901915
}
902-
if (this.myUploadTool == null ) {
903-
return Common.getBuildEnvironmentVariable(confdesc, "A.UPLOAD.TOOL", "upload tool not properly configured");
916+
if (this.myUploadTool == null) {
917+
return Common.getBuildEnvironmentVariable(confdesc, "A.UPLOAD.TOOL", "upload tool not properly configured");
904918
}
905919
return this.myUploadTool;
906920
}

0 commit comments

Comments
 (0)