1
0
mirror of https://github.com/arduino/Arduino.git synced 2025-01-30 19:52:13 +01:00

Removed some warnings which are emitted from arduino-builder at compile time

Fixes #4177
This commit is contained in:
Federico Fissore 2015-11-18 09:39:17 +01:00
parent 802c745690
commit 73e857fda9
3 changed files with 14 additions and 45 deletions

View File

@ -20,27 +20,21 @@
*/ */
package processing.app.debug; package processing.app.debug;
import static processing.app.I18n.tr; import processing.app.helpers.PreferencesMap;
import static processing.app.I18n.format;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import processing.app.helpers.PreferencesMap;
public class LegacyTargetBoard implements TargetBoard { public class LegacyTargetBoard implements TargetBoard {
private String id; private final String id;
private PreferencesMap prefs; private final PreferencesMap prefs;
private Map<String, PreferencesMap> menuOptions = new LinkedHashMap<String, PreferencesMap>(); private Map<String, PreferencesMap> menuOptions = new LinkedHashMap<>();
private TargetPlatform containerPlatform; private final TargetPlatform containerPlatform;
/** /**
* Create a TargetBoard based on preferences passed as argument. * Create a TargetBoard based on preferences passed as argument.
*
* @param _prefs
* @return
*/ */
public LegacyTargetBoard(String _id, PreferencesMap _prefs, public LegacyTargetBoard(String _id, PreferencesMap _prefs,
TargetPlatform parent) { TargetPlatform parent) {
@ -58,10 +52,6 @@ public class LegacyTargetBoard implements TargetBoard {
String board = containerPlatform.getId() + "_" + id; String board = containerPlatform.getId() + "_" + id;
board = board.toUpperCase(); board = board.toUpperCase();
prefs.put("build.board", board); prefs.put("build.board", board);
System.err
.println(format(tr("Board {0}:{1}:{2} doesn''t define a ''build.board'' preference. Auto-set to: {3}"),
containerPlatform.getContainerPackage().getId(),
containerPlatform.getId(), id, board));
} }
} }

View File

@ -21,7 +21,6 @@
package processing.app.debug; package processing.app.debug;
import processing.app.BaseNoGui; import processing.app.BaseNoGui;
import processing.app.I18n;
import processing.app.helpers.PreferencesMap; import processing.app.helpers.PreferencesMap;
import java.io.File; import java.io.File;
@ -30,24 +29,24 @@ import java.util.LinkedHashMap;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import static processing.app.I18n.tr;
import static processing.app.I18n.format; import static processing.app.I18n.format;
import static processing.app.I18n.tr;
public class LegacyTargetPlatform implements TargetPlatform { public class LegacyTargetPlatform implements TargetPlatform {
private String id; private final String id;
private File folder; private final File folder;
private TargetPackage containerPackage; private final TargetPackage containerPackage;
protected PreferencesMap preferences = new PreferencesMap(); private final PreferencesMap preferences = new PreferencesMap();
private Map<String, TargetBoard> boards = new LinkedHashMap<String, TargetBoard>(); private final Map<String, TargetBoard> boards = new LinkedHashMap<>();
private TargetBoard defaultBoard; private TargetBoard defaultBoard;
/** /**
* Contains preferences for every defined programmer * Contains preferences for every defined programmer
*/ */
private Map<String, PreferencesMap> programmers = new LinkedHashMap<String, PreferencesMap>(); private Map<String, PreferencesMap> programmers = new LinkedHashMap<>();
/** /**
* Contains labels for top level menus * Contains labels for top level menus
@ -162,15 +161,9 @@ public class LegacyTargetPlatform implements TargetPlatform {
PreferencesMap oldProps = platformRewriteProps.subTree("old"); PreferencesMap oldProps = platformRewriteProps.subTree("old");
PreferencesMap newProps = platformRewriteProps.subTree("new"); PreferencesMap newProps = platformRewriteProps.subTree("new");
String platformName = preferences.get("name");
if (platformName == null) {
platformName = folder.getAbsolutePath();
}
for (Map.Entry<String, String> entry : oldProps.entrySet()) { for (Map.Entry<String, String> entry : oldProps.entrySet()) {
String preferencesKey = entry.getKey().substring(entry.getKey().indexOf(".") + 1); String preferencesKey = entry.getKey().substring(entry.getKey().indexOf(".") + 1);
if (preferences.containsKey(preferencesKey) && entry.getValue().equals(preferences.get(preferencesKey))) { if (preferences.containsKey(preferencesKey) && entry.getValue().equals(preferences.get(preferencesKey))) {
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())));
preferences.put(preferencesKey, newProps.get(entry.getKey())); preferences.put(preferencesKey, newProps.get(entry.getKey()));
} }
} }
@ -182,7 +175,6 @@ public class LegacyTargetPlatform implements TargetPlatform {
String keyToAddFirstLevel = keyToAddParts[0]; String keyToAddFirstLevel = keyToAddParts[0];
String keyToAddSecondLevel = keyToAddParts[0] + "." + keyToAddParts[1]; String keyToAddSecondLevel = keyToAddParts[0] + "." + keyToAddParts[1];
if (!preferences.subTree(keyToAddFirstLevel).isEmpty() && !preferences.subTree(keyToAddSecondLevel).isEmpty() && !preferences.containsKey(keyToAdd)) { if (!preferences.subTree(keyToAddFirstLevel).isEmpty() && !preferences.subTree(keyToAddSecondLevel).isEmpty() && !preferences.containsKey(keyToAdd)) {
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()));
preferences.put(keyToAdd, entry.getValue()); preferences.put(keyToAdd, entry.getValue());
} }
} }

View File

@ -31,7 +31,6 @@ package processing.app.packages;
import cc.arduino.Constants; import cc.arduino.Constants;
import cc.arduino.contributions.libraries.ContributedLibrary; import cc.arduino.contributions.libraries.ContributedLibrary;
import cc.arduino.contributions.libraries.ContributedLibraryReference; import cc.arduino.contributions.libraries.ContributedLibraryReference;
import processing.app.helpers.FileUtils;
import processing.app.helpers.PreferencesMap; import processing.app.helpers.PreferencesMap;
import java.io.File; import java.io.File;
@ -91,11 +90,6 @@ public class UserLibrary extends ContributedLibrary {
if (srcFolder.exists() && srcFolder.isDirectory()) { if (srcFolder.exists() && srcFolder.isDirectory()) {
// Layout with a single "src" folder and recursive compilation // Layout with a single "src" folder and recursive compilation
layout = LibraryLayout.RECURSIVE; layout = LibraryLayout.RECURSIVE;
File utilFolder = new File(libFolder, "utility");
if (utilFolder.exists() && utilFolder.isDirectory()) {
throw new IOException("Library can't use both 'src' and 'utility' folders.");
}
} else { } else {
// Layout with source code on library's root and "utility" folders // Layout with source code on library's root and "utility" folders
layout = LibraryLayout.FLAT; layout = LibraryLayout.FLAT;
@ -106,13 +100,6 @@ public class UserLibrary extends ContributedLibrary {
if (files == null) { if (files == null) {
throw new IOException("Unable to list files of library in " + libFolder); throw new IOException("Unable to list files of library in " + libFolder);
} }
for (File file : files) {
if (file.isDirectory() && FileUtils.isSCCSOrHiddenFile(file)) {
if (!FileUtils.isSCCSFolder(file) && FileUtils.isHiddenFile(file)) {
System.out.println("WARNING: Spurious " + file.getName() + " folder in '" + properties.get("name") + "' library");
}
}
}
// Extract metadata info // Extract metadata info
String architectures = properties.get("architectures"); String architectures = properties.get("architectures");
@ -123,10 +110,10 @@ public class UserLibrary extends ContributedLibrary {
archs.add(arch.trim()); archs.add(arch.trim());
String category = properties.get("category"); String category = properties.get("category");
if (category == null) if (category == null) {
category = "Uncategorized"; category = "Uncategorized";
}
if (!Constants.LIBRARY_CATEGORIES.contains(category)) { if (!Constants.LIBRARY_CATEGORIES.contains(category)) {
System.out.println("WARNING: Category '" + category + "' in library " + properties.get("name") + " is not valid. Setting to 'Uncategorized'");
category = "Uncategorized"; category = "Uncategorized";
} }