Skip to content

Commit a43d207

Browse files
bitroncmaglie
authored andcommitted
Removed dependency from Base in the uploaders.
1 parent 1bb2da8 commit a43d207

File tree

4 files changed

+19
-15
lines changed

4 files changed

+19
-15
lines changed

app/src/cc/arduino/packages/uploaders/SSHUploader.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
import com.jcraft.jsch.JSch;
3636
import com.jcraft.jsch.JSchException;
3737
import com.jcraft.jsch.Session;
38-
import processing.app.Base;
38+
import processing.app.BaseNoGui;
3939
import processing.app.I18n;
4040
import processing.app.Preferences;
4141
import processing.app.debug.RunnerException;
@@ -117,9 +117,9 @@ public boolean uploadUsingPreferences(File sourcePath, String buildPath, String
117117
}
118118

119119
private boolean runAVRDude(SSH ssh) throws IOException, JSchException {
120-
TargetPlatform targetPlatform = Base.getTargetPlatform();
120+
TargetPlatform targetPlatform = BaseNoGui.getTargetPlatform();
121121
PreferencesMap prefs = Preferences.getMap();
122-
prefs.putAll(Base.getBoardPreferences());
122+
prefs.putAll(BaseNoGui.getBoardPreferences());
123123
prefs.putAll(targetPlatform.getTool(prefs.get("upload.tool")));
124124

125125
String additionalParams = verbose ? prefs.get("upload.params.verbose") : prefs.get("upload.params.quiet");

app/src/cc/arduino/packages/uploaders/SerialUploader.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
import java.util.ArrayList;
3333
import java.util.List;
3434

35-
import processing.app.Base;
35+
import processing.app.BaseNoGui;
3636
import processing.app.I18n;
3737
import processing.app.Preferences;
3838
import processing.app.Serial;
@@ -48,13 +48,13 @@ public class SerialUploader extends Uploader {
4848

4949
public boolean uploadUsingPreferences(File sourcePath, String buildPath, String className, boolean usingProgrammer, List<String> warningsAccumulator) throws Exception {
5050
// FIXME: Preferences should be reorganized
51-
TargetPlatform targetPlatform = Base.getTargetPlatform();
51+
TargetPlatform targetPlatform = BaseNoGui.getTargetPlatform();
5252
PreferencesMap prefs = Preferences.getMap();
53-
prefs.putAll(Base.getBoardPreferences());
53+
prefs.putAll(BaseNoGui.getBoardPreferences());
5454
String tool = prefs.getOrExcept("upload.tool");
5555
if (tool.contains(":")) {
5656
String[] split = tool.split(":", 2);
57-
targetPlatform = Base.getCurrentTargetPlatformFromPackage(split[0]);
57+
targetPlatform = BaseNoGui.getCurrentTargetPlatformFromPackage(split[0]);
5858
tool = split[1];
5959
}
6060
prefs.putAll(targetPlatform.getTool(tool));
@@ -202,16 +202,16 @@ private String waitForUploadPort(String uploadPort, List<String> before) throws
202202

203203
public boolean uploadUsingProgrammer(String buildPath, String className) throws Exception {
204204

205-
TargetPlatform targetPlatform = Base.getTargetPlatform();
205+
TargetPlatform targetPlatform = BaseNoGui.getTargetPlatform();
206206
String programmer = Preferences.get("programmer");
207207
if (programmer.contains(":")) {
208208
String[] split = programmer.split(":", 2);
209-
targetPlatform = Base.getCurrentTargetPlatformFromPackage(split[0]);
209+
targetPlatform = BaseNoGui.getCurrentTargetPlatformFromPackage(split[0]);
210210
programmer = split[1];
211211
}
212212

213213
PreferencesMap prefs = Preferences.getMap();
214-
prefs.putAll(Base.getBoardPreferences());
214+
prefs.putAll(BaseNoGui.getBoardPreferences());
215215
PreferencesMap programmerPrefs = targetPlatform.getProgrammer(programmer);
216216
if (programmerPrefs == null)
217217
throw new RunnerException(
@@ -245,14 +245,14 @@ public boolean uploadUsingProgrammer(String buildPath, String className) throws
245245
}
246246

247247
public boolean burnBootloader() throws Exception {
248-
TargetPlatform targetPlatform = Base.getTargetPlatform();
248+
TargetPlatform targetPlatform = BaseNoGui.getTargetPlatform();
249249

250250
// Find preferences for the selected programmer
251251
PreferencesMap programmerPrefs;
252252
String programmer = Preferences.get("programmer");
253253
if (programmer.contains(":")) {
254254
String[] split = programmer.split(":", 2);
255-
TargetPlatform platform = Base.getCurrentTargetPlatformFromPackage(split[0]);
255+
TargetPlatform platform = BaseNoGui.getCurrentTargetPlatformFromPackage(split[0]);
256256
programmer = split[1];
257257
programmerPrefs = platform.getProgrammer(programmer);
258258
} else {
@@ -264,15 +264,15 @@ public boolean burnBootloader() throws Exception {
264264

265265
// Build configuration for the current programmer
266266
PreferencesMap prefs = Preferences.getMap();
267-
prefs.putAll(Base.getBoardPreferences());
267+
prefs.putAll(BaseNoGui.getBoardPreferences());
268268
prefs.putAll(programmerPrefs);
269269

270270
// Create configuration for bootloader tool
271271
PreferencesMap toolPrefs = new PreferencesMap();
272272
String tool = prefs.getOrExcept("bootloader.tool");
273273
if (tool.contains(":")) {
274274
String[] split = tool.split(":", 2);
275-
TargetPlatform platform = Base.getCurrentTargetPlatformFromPackage(split[0]);
275+
TargetPlatform platform = BaseNoGui.getCurrentTargetPlatformFromPackage(split[0]);
276276
tool = split[1];
277277
toolPrefs.putAll(platform.getTool(tool));
278278
if (toolPrefs.size() == 0)

app/src/processing/app/Base.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2008,7 +2008,7 @@ static public TargetPlatform getTargetPlatform(String packageName,
20082008
}
20092009

20102010
static public TargetPlatform getCurrentTargetPlatformFromPackage(String pack) {
2011-
return getTargetPlatform(pack, Preferences.get("target_platform"));
2011+
return BaseNoGui.getCurrentTargetPlatformFromPackage(pack);
20122012
}
20132013

20142014
static public PreferencesMap getBoardPreferences() {

app/src/processing/app/BaseNoGui.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,10 @@ static public File getContentFile(String name) {
107107
return new File(working, name);
108108
}
109109

110+
static public TargetPlatform getCurrentTargetPlatformFromPackage(String pack) {
111+
return getTargetPlatform(pack, Preferences.get("target_platform"));
112+
}
113+
110114
static public File getHardwareFolder() {
111115
// calculate on the fly because it's needed by Preferences.init() to find
112116
// the boards.txt and programmers.txt preferences files (which happens

0 commit comments

Comments
 (0)