Skip to content

Commit b74567d

Browse files
author
jantje
committed
fix for #337 also multiplatform fix
1 parent 3670cb1 commit b74567d

File tree

5 files changed

+303
-181
lines changed

5 files changed

+303
-181
lines changed

it.baeyens.arduino.common/src/it/baeyens/arduino/common/ArduinoConst.java

Lines changed: 31 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public class ArduinoConst {
7373
public static final String LIBRARY_PATH_SUFFIX = "libraries";//$NON-NLS-1$
7474
public static final String DOWNLOADS_FOLDER = "downloads";//$NON-NLS-1$
7575
public static final String ARDUINO_HARDWARE_FOLDER_NAME = "hardware";//$NON-NLS-1$
76-
public static final String ARDUINO_CODE_FOLDER_NAME = "arduino";//$NON-NLS-1$
76+
public static final String ARDUINO_CODE_FOLDER_NAME = "core";//$NON-NLS-1$
7777
public static final String ARDUINO_CORE_FOLDER_NAME = "cores";//$NON-NLS-1$
7878
public static final String DEFAULT = "Default";//$NON-NLS-1$
7979
public static final String BOARDS_FILE_NAME = "boards.txt";//$NON-NLS-1$
@@ -134,13 +134,15 @@ public class ArduinoConst {
134134
public static final String ENV_KEY_JANTJE_SIZE_SWITCH = ENV_KEY_JANTJE_START + "SIZE.SWITCH";//$NON-NLS-1$
135135
public static final String ENV_KEY_JANTJE_BOARDS_FILE = ENV_KEY_JANTJE_START + "BOARDS_FILE";//$NON-NLS-1$
136136
public static final String ENV_KEY_JANTJE_PLATFORM_FILE = ENV_KEY_JANTJE_START + "PLATFORM_FILE";//$NON-NLS-1$
137-
public static final String ENV_KEY_JANTJE_REFERENCED_PLATFORM_FILE = ENV_KEY_JANTJE_START + "REFERENCED_PLATFORM_FILE";//$NON-NLS-1$
137+
public static final String ENV_KEY_JANTJE_REFERENCED_PLATFORM_FILE = ENV_KEY_JANTJE_START
138+
+ "REFERENCED_PLATFORM_FILE";//$NON-NLS-1$
138139
public static final String ENV_KEY_JANTJE_COM_PORT = ENV_KEY_JANTJE_START + "COM_PORT";//$NON-NLS-1$
139140
public static final String ENV_KEY_JANTJE_BOARD_NAME = ENV_KEY_JANTJE_START + "BOARD_NAME";//$NON-NLS-1$
140141

141142
public static final String ENV_KEY_JANTJE_ADDITIONAL_COMPILE_OPTIONS = ENV_KEY_JANTJE_START + "EXTRA.COMPILE";//$NON-NLS-1$
142143
public static final String ENV_KEY_JANTJE_ADDITIONAL_C_COMPILE_OPTIONS = ENV_KEY_JANTJE_START + "EXTRA.C.COMPILE";//$NON-NLS-1$
143-
public static final String ENV_KEY_JANTJE_ADDITIONAL_CPP_COMPILE_OPTIONS = ENV_KEY_JANTJE_START + "EXTRA.CPP.COMPILE";//$NON-NLS-1$
144+
public static final String ENV_KEY_JANTJE_ADDITIONAL_CPP_COMPILE_OPTIONS = ENV_KEY_JANTJE_START
145+
+ "EXTRA.CPP.COMPILE";//$NON-NLS-1$
144146
public static final String ENV_KEY_JANTJE_PACKAGE_ID = ENV_KEY_JANTJE_START + "PACKAGE_ID";//$NON-NLS-1$
145147
public static final String ENV_KEY_JANTJE_ARCITECTURE_ID = ENV_KEY_JANTJE_START + "ARCHITECTURE_ID";//$NON-NLS-1$
146148
public static final String ENV_KEY_JANTJE_BOARD_ID = ENV_KEY_JANTJE_START + "BOARD_ID";//$NON-NLS-1$
@@ -153,57 +155,74 @@ public class ArduinoConst {
153155
// $NON-NLS-1$
154156
// $NON-NLS-1$
155157
// $NON-NLS-1$
156-
// $NON-NLS-1$ where
157158
// $NON-NLS-1$
158159
// $NON-NLS-1$
160+
//$NON-NLS-1$ where
159161
// $NON-NLS-1$
160162
// $NON-NLS-1$
161163
// $NON-NLS-1$
162-
// $NON-NLS-1$ make
163164
// $NON-NLS-1$
164165
// $NON-NLS-1$
165166
// $NON-NLS-1$
166167
// $NON-NLS-1$
168+
//$NON-NLS-1$ make
167169
// $NON-NLS-1$
168-
// $NON-NLS-1$ is
169170
// $NON-NLS-1$
170171
// $NON-NLS-1$
171172
// $NON-NLS-1$
172173
// $NON-NLS-1$
173174
// $NON-NLS-1$
174-
// $NON-NLS-1$ located
175175
// $NON-NLS-1$
176+
//$NON-NLS-1$ is
176177
// $NON-NLS-1$
177178
// $NON-NLS-1$
178179
// $NON-NLS-1$
179180
// $NON-NLS-1$
180-
// $NON-NLS-1$ only
181181
// $NON-NLS-1$
182182
// $NON-NLS-1$
183183
// $NON-NLS-1$
184+
//$NON-NLS-1$ located
184185
// $NON-NLS-1$
185186
// $NON-NLS-1$
186-
// $NON-NLS-1$ used
187187
// $NON-NLS-1$
188188
// $NON-NLS-1$
189189
// $NON-NLS-1$
190190
// $NON-NLS-1$
191191
// $NON-NLS-1$
192-
// $NON-NLS-1$ in
192+
//$NON-NLS-1$ only
193193
// $NON-NLS-1$
194194
// $NON-NLS-1$
195195
// $NON-NLS-1$
196196
// $NON-NLS-1$
197197
// $NON-NLS-1$
198-
// $NON-NLS-1$ windows
198+
// $NON-NLS-1$
199+
// $NON-NLS-1$
200+
//$NON-NLS-1$ used
201+
// $NON-NLS-1$
202+
// $NON-NLS-1$
203+
// $NON-NLS-1$
204+
// $NON-NLS-1$
205+
// $NON-NLS-1$
206+
// $NON-NLS-1$
207+
// $NON-NLS-1$
208+
//$NON-NLS-1$ in
209+
// $NON-NLS-1$
210+
// $NON-NLS-1$
211+
// $NON-NLS-1$
212+
// $NON-NLS-1$
213+
// $NON-NLS-1$
214+
// $NON-NLS-1$
215+
// $NON-NLS-1$
216+
//$NON-NLS-1$ windows
199217
// public static final String ENV_KEY_JANTJE_PLATFORM_NAME =
200218
// ENV_KEY_JANTJE_START + "PLATFORM.NAME";//$NON-NLS-1$
201219

202220
//
203221
// template Sketch information
204222

205223
public static final String ENV_KEY_JANTJE_SKETCH_TEMPLATE_FOLDER = ENV_KEY_JANTJE_START + "TEMPLATE_FOLDER";//$NON-NLS-1$
206-
public static final String ENV_KEY_JANTJE_SKETCH_TEMPLATE_USE_DEFAULT = ENV_KEY_JANTJE_START + "TEMPLATE_USE_DEFAULT";//$NON-NLS-1$
224+
public static final String ENV_KEY_JANTJE_SKETCH_TEMPLATE_USE_DEFAULT = ENV_KEY_JANTJE_START
225+
+ "TEMPLATE_USE_DEFAULT";//$NON-NLS-1$
207226

208227
public static final String ENV_KEY_WARNING_LEVEL_OFF = " -w ";//$NON-NLS-1$
209228
public static final String ENV_KEY_WARNING_LEVEL_ON = " -Wall ";//$NON-NLS-1$
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
#fix for due, zero, Esplora, Leonardo, Robot Control, Robot Motor, Yun, Micro and LillyPad USB
2-
build.usb_flags.windows=-DUSB_VID={build.vid} -DUSB_PID={build.pid} -DUSB_MANUFACTURER=\"{build.usb_manufacturer}\" -DUSB_PRODUCT=\"{build.usb_product}\"
2+
build.usb_flags.windows=-DUSB_VID={build.vid} -DUSB_PID={build.pid} -DUSBCON -DUSB_MANUFACTURER=\"{build.usb_manufacturer}\" -DUSB_PRODUCT=\"{build.usb_product}\"
3+

it.baeyens.arduino.core/config/pre_processing_platform_default.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ BUILD.VARIANT.PATH={RUNTIME.PLATFORM.PATH}/variants/{BUILD.VARIANT}
66
BUILD.CORE.PATH={RUNTIME.PLATFORM.PATH}/cores/{BUILD.CORE}
77
archive_file_path={build.path}/{archive_file}
88
runtime.IDE.version=10606
9+
build.system.path={RUNTIME.PLATFORM.PATH}/system

it.baeyens.arduino.core/src/it/baeyens/arduino/managers/ArduinoManager.java

Lines changed: 36 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,6 @@ private static void InstallLibraries(IProgressMonitor monitor) {
137137
* @param object
138138
* @return
139139
*/
140-
@SuppressWarnings("resource")
141140
static public IStatus downloadAndInstall(ArduinoPlatform platform, boolean forceDownload,
142141
IProgressMonitor monitor) {
143142

@@ -149,42 +148,10 @@ static public IStatus downloadAndInstall(ArduinoPlatform platform, boolean force
149148
MultiStatus mstatus = new MultiStatus(status.getPlugin(), status.getCode(), status.getMessage(),
150149
status.getException());
151150

152-
List<ToolDependency> tools = platform.getToolsDependencies();
153-
// make a platform_plugin.txt file to store the tool paths
154-
File pluginFile = ConfigurationPreferences.getPlugin_Platform_File();
155-
PrintWriter writer = null;
156-
157-
try {
158-
writer = new PrintWriter(pluginFile, "UTF-8");//$NON-NLS-1$
159-
writer.println("#This is a automatically generated file by the Arduino eclipse plugin"); //$NON-NLS-1$
160-
writer.println("#only edit if you know what you are doing"); //$NON-NLS-1$
161-
writer.println("#Have fun"); //$NON-NLS-1$
162-
writer.println("#Jantje"); //$NON-NLS-1$
163-
writer.println();
164-
} catch (FileNotFoundException | UnsupportedEncodingException e) {
165-
mstatus.add(
166-
new Status(
167-
IStatus.WARNING, Activator.getId(), Messages.ArduinoManager_unable_to_create_file
168-
+ pluginFile + '\n' + platform.getName() + Messages.ArduinoManager_will_not_work,
169-
e));
170-
}
171-
172-
for (ToolDependency tool : tools) {
151+
for (ToolDependency tool : platform.getToolsDependencies()) {
173152
monitor.setTaskName(InstallProgress.getRandomMessage());
174-
status = tool.install(monitor);
175-
if (!status.isOK()) {
176-
mstatus.add(status);
177-
}
178-
if (writer != null) {
179-
writer.println("runtime.tools." + tool.getName() + ".path=" + tool.getTool().getInstallPath());//$NON-NLS-1$ //$NON-NLS-2$
180-
writer.println("runtime.tools." + tool.getName() + tool.getVersion() + ".path=" //$NON-NLS-1$ //$NON-NLS-2$
181-
+ tool.getTool().getInstallPath());
182-
}
183-
}
184-
if (writer != null) {
185-
writer.close();
153+
mstatus.add(tool.install(monitor));
186154
}
187-
188155
// On Windows install make from equations.org
189156
if (Platform.getOS().equals(Platform.OS_WIN32)) {
190157
try {
@@ -203,10 +170,44 @@ static public IStatus downloadAndInstall(ArduinoPlatform platform, boolean force
203170
}
204171
}
205172

173+
mstatus.add(make_eclipse_plugin_txt_file(platform));
206174
return mstatus.getChildren().length == 0 ? Status.OK_STATUS : mstatus;
207175

208176
}
209177

178+
static public IStatus make_eclipse_plugin_txt_file(ArduinoPlatform platform) {
179+
180+
// make a platform_plugin.txt file to store the tool paths
181+
File pluginFile = ConfigurationPreferences.getPlugin_Platform_File();
182+
183+
try (PrintWriter writer = new PrintWriter(pluginFile, "UTF-8");) {
184+
185+
writer.println("#This is a automatically generated file by the Arduino eclipse plugin"); //$NON-NLS-1$
186+
writer.println("#only edit if you know what you are doing"); //$NON-NLS-1$
187+
writer.println("#Have fun"); //$NON-NLS-1$
188+
writer.println("#Jantje"); //$NON-NLS-1$
189+
writer.println();
190+
191+
// TODO there should be a get tools and then loop over the tools as
192+
// this implementation returns the tools several times
193+
for (ArduinoPlatform curplatform : getPlatforms()) {
194+
for (ToolDependency tool : curplatform.getToolsDependencies()) {
195+
if (writer != null) {
196+
writer.println("runtime.tools." + tool.getName() + ".path=" + tool.getTool().getInstallPath());//$NON-NLS-1$ //$NON-NLS-2$
197+
writer.println("runtime.tools." + tool.getName() + tool.getVersion() + ".path=" //$NON-NLS-1$ //$NON-NLS-2$
198+
+ tool.getTool().getInstallPath());
199+
}
200+
}
201+
}
202+
} catch (FileNotFoundException | UnsupportedEncodingException e) {
203+
return new Status(IStatus.WARNING, Activator.getId(), Messages.ArduinoManager_unable_to_create_file
204+
+ pluginFile + '\n' + platform.getName() + Messages.ArduinoManager_will_not_work, e);
205+
}
206+
207+
return Status.OK_STATUS;
208+
209+
}
210+
210211
static public void loadIndices(boolean immediatly) {
211212
if (immediatly) {
212213
internalLoadIndices();

0 commit comments

Comments
 (0)