Skip to content

Commit 73e857f

Browse files
author
Federico Fissore
committed
Removed some warnings which are emitted from arduino-builder at compile time
Fixes #4177
1 parent 802c745 commit 73e857f

File tree

3 files changed

+14
-45
lines changed

3 files changed

+14
-45
lines changed

arduino-core/src/processing/app/debug/LegacyTargetBoard.java

+5-15
Original file line numberDiff line numberDiff line change
@@ -20,27 +20,21 @@
2020
*/
2121
package processing.app.debug;
2222

23-
import static processing.app.I18n.tr;
24-
import static processing.app.I18n.format;
23+
import processing.app.helpers.PreferencesMap;
2524

2625
import java.util.LinkedHashMap;
2726
import java.util.Map;
2827
import java.util.Set;
2928

30-
import processing.app.helpers.PreferencesMap;
31-
3229
public class LegacyTargetBoard implements TargetBoard {
3330

34-
private String id;
35-
private PreferencesMap prefs;
36-
private Map<String, PreferencesMap> menuOptions = new LinkedHashMap<String, PreferencesMap>();
37-
private TargetPlatform containerPlatform;
31+
private final String id;
32+
private final PreferencesMap prefs;
33+
private Map<String, PreferencesMap> menuOptions = new LinkedHashMap<>();
34+
private final TargetPlatform containerPlatform;
3835

3936
/**
4037
* Create a TargetBoard based on preferences passed as argument.
41-
*
42-
* @param _prefs
43-
* @return
4438
*/
4539
public LegacyTargetBoard(String _id, PreferencesMap _prefs,
4640
TargetPlatform parent) {
@@ -58,10 +52,6 @@ public LegacyTargetBoard(String _id, PreferencesMap _prefs,
5852
String board = containerPlatform.getId() + "_" + id;
5953
board = board.toUpperCase();
6054
prefs.put("build.board", board);
61-
System.err
62-
.println(format(tr("Board {0}:{1}:{2} doesn''t define a ''build.board'' preference. Auto-set to: {3}"),
63-
containerPlatform.getContainerPackage().getId(),
64-
containerPlatform.getId(), id, board));
6555
}
6656
}
6757

arduino-core/src/processing/app/debug/LegacyTargetPlatform.java

+7-15
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
package processing.app.debug;
2222

2323
import processing.app.BaseNoGui;
24-
import processing.app.I18n;
2524
import processing.app.helpers.PreferencesMap;
2625

2726
import java.io.File;
@@ -30,24 +29,24 @@
3029
import java.util.Map;
3130
import java.util.Set;
3231

33-
import static processing.app.I18n.tr;
3432
import static processing.app.I18n.format;
33+
import static processing.app.I18n.tr;
3534

3635
public class LegacyTargetPlatform implements TargetPlatform {
3736

38-
private String id;
39-
private File folder;
37+
private final String id;
38+
private final File folder;
4039

41-
private TargetPackage containerPackage;
42-
protected PreferencesMap preferences = new PreferencesMap();
40+
private final TargetPackage containerPackage;
41+
private final PreferencesMap preferences = new PreferencesMap();
4342

44-
private Map<String, TargetBoard> boards = new LinkedHashMap<String, TargetBoard>();
43+
private final Map<String, TargetBoard> boards = new LinkedHashMap<>();
4544
private TargetBoard defaultBoard;
4645

4746
/**
4847
* Contains preferences for every defined programmer
4948
*/
50-
private Map<String, PreferencesMap> programmers = new LinkedHashMap<String, PreferencesMap>();
49+
private Map<String, PreferencesMap> programmers = new LinkedHashMap<>();
5150

5251
/**
5352
* Contains labels for top level menus
@@ -162,15 +161,9 @@ private void rewriteKeysOfOldPlatformsTxtAndWarnAboutIt() throws IOException {
162161
PreferencesMap oldProps = platformRewriteProps.subTree("old");
163162
PreferencesMap newProps = platformRewriteProps.subTree("new");
164163

165-
String platformName = preferences.get("name");
166-
if (platformName == null) {
167-
platformName = folder.getAbsolutePath();
168-
}
169-
170164
for (Map.Entry<String, String> entry : oldProps.entrySet()) {
171165
String preferencesKey = entry.getKey().substring(entry.getKey().indexOf(".") + 1);
172166
if (preferences.containsKey(preferencesKey) && entry.getValue().equals(preferences.get(preferencesKey))) {
173-
System.err.println(I18n.format(tr("Warning: platform.txt from core '{0}' contains deprecated {1}, automatically converted to {2}. Consider upgrading this core."), platformName, preferencesKey + "=" + entry.getValue(), preferencesKey + "=" + newProps.get(entry.getKey())));
174167
preferences.put(preferencesKey, newProps.get(entry.getKey()));
175168
}
176169
}
@@ -182,7 +175,6 @@ private void rewriteKeysOfOldPlatformsTxtAndWarnAboutIt() throws IOException {
182175
String keyToAddFirstLevel = keyToAddParts[0];
183176
String keyToAddSecondLevel = keyToAddParts[0] + "." + keyToAddParts[1];
184177
if (!preferences.subTree(keyToAddFirstLevel).isEmpty() && !preferences.subTree(keyToAddSecondLevel).isEmpty() && !preferences.containsKey(keyToAdd)) {
185-
System.err.println(I18n.format(tr("Warning: platform.txt from core '{0}' misses property {1}, automatically set to {2}. Consider upgrading this core."), platformName, keyToAdd, entry.getValue()));
186178
preferences.put(keyToAdd, entry.getValue());
187179
}
188180
}

arduino-core/src/processing/app/packages/UserLibrary.java

+2-15
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
import cc.arduino.Constants;
3232
import cc.arduino.contributions.libraries.ContributedLibrary;
3333
import cc.arduino.contributions.libraries.ContributedLibraryReference;
34-
import processing.app.helpers.FileUtils;
3534
import processing.app.helpers.PreferencesMap;
3635

3736
import java.io.File;
@@ -91,11 +90,6 @@ public static UserLibrary create(File libFolder) throws IOException {
9190
if (srcFolder.exists() && srcFolder.isDirectory()) {
9291
// Layout with a single "src" folder and recursive compilation
9392
layout = LibraryLayout.RECURSIVE;
94-
95-
File utilFolder = new File(libFolder, "utility");
96-
if (utilFolder.exists() && utilFolder.isDirectory()) {
97-
throw new IOException("Library can't use both 'src' and 'utility' folders.");
98-
}
9993
} else {
10094
// Layout with source code on library's root and "utility" folders
10195
layout = LibraryLayout.FLAT;
@@ -106,13 +100,6 @@ public static UserLibrary create(File libFolder) throws IOException {
106100
if (files == null) {
107101
throw new IOException("Unable to list files of library in " + libFolder);
108102
}
109-
for (File file : files) {
110-
if (file.isDirectory() && FileUtils.isSCCSOrHiddenFile(file)) {
111-
if (!FileUtils.isSCCSFolder(file) && FileUtils.isHiddenFile(file)) {
112-
System.out.println("WARNING: Spurious " + file.getName() + " folder in '" + properties.get("name") + "' library");
113-
}
114-
}
115-
}
116103

117104
// Extract metadata info
118105
String architectures = properties.get("architectures");
@@ -123,10 +110,10 @@ public static UserLibrary create(File libFolder) throws IOException {
123110
archs.add(arch.trim());
124111

125112
String category = properties.get("category");
126-
if (category == null)
113+
if (category == null) {
127114
category = "Uncategorized";
115+
}
128116
if (!Constants.LIBRARY_CATEGORIES.contains(category)) {
129-
System.out.println("WARNING: Category '" + category + "' in library " + properties.get("name") + " is not valid. Setting to 'Uncategorized'");
130117
category = "Uncategorized";
131118
}
132119

0 commit comments

Comments
 (0)