diff --git a/app/src/cc/arduino/packages/contributions/ui/ContributionIndexTableModel.java b/app/src/cc/arduino/packages/contributions/ui/ContributionIndexTableModel.java
index d35f41fb6..6be896173 100644
--- a/app/src/cc/arduino/packages/contributions/ui/ContributionIndexTableModel.java
+++ b/app/src/cc/arduino/packages/contributions/ui/ContributionIndexTableModel.java
@@ -142,7 +142,7 @@ public class ContributionIndexTableModel extends FilteredAbstractTableModel {
for (ContributedPackage pack : index.getPackages()) {
for (ContributedPlatform platform : pack.getPlatforms()) {
if (category != null) {
- if (!platform.getCategory().equals(category))
+ if (!category.equals(platform.getCategory()))
continue;
}
if (!stringContainsAll(platform.getName(), filters))
diff --git a/arduino-core/src/cc/arduino/packages/contributions/ContributedBoard.java b/arduino-core/src/cc/arduino/packages/contributions/ContributedBoard.java
index a9b854e62..5d0d87caf 100644
--- a/arduino-core/src/cc/arduino/packages/contributions/ContributedBoard.java
+++ b/arduino-core/src/cc/arduino/packages/contributions/ContributedBoard.java
@@ -30,6 +30,6 @@ package cc.arduino.packages.contributions;
public interface ContributedBoard {
- public String getName();
+ String getName();
}
diff --git a/arduino-core/src/cc/arduino/packages/contributions/ContributionsIndexer.java b/arduino-core/src/cc/arduino/packages/contributions/ContributionsIndexer.java
index 5073fdd5c..30ea15f29 100644
--- a/arduino-core/src/cc/arduino/packages/contributions/ContributionsIndexer.java
+++ b/arduino-core/src/cc/arduino/packages/contributions/ContributionsIndexer.java
@@ -49,9 +49,9 @@ import static processing.app.helpers.filefilters.OnlyDirs.ONLY_DIRS;
public class ContributionsIndexer {
- private File packagesFolder;
- private File stagingFolder;
- private File indexFile;
+ private final File packagesFolder;
+ private final File stagingFolder;
+ private final File indexFile;
private ContributionsIndex index;
public ContributionsIndexer(File preferencesFolder) {
@@ -75,7 +75,7 @@ public class ContributionsIndexer {
// indexer.syncWithFilesystem();
// }
- public void parseIndex() throws JsonParseException, IOException {
+ public void parseIndex() throws IOException {
// Parse index file
parseIndex(indexFile);
@@ -93,8 +93,7 @@ public class ContributionsIndexer {
index.fillCategories();
}
- private void parseIndex(File indexFile) throws JsonParseException,
- IOException {
+ private void parseIndex(File indexFile) throws IOException {
InputStream indexIn = new FileInputStream(indexFile);
ObjectMapper mapper = new ObjectMapper();
mapper.registerModule(new MrBeanModule());
diff --git a/arduino-core/src/processing/app/BaseNoGui.java b/arduino-core/src/processing/app/BaseNoGui.java
index ba699b809..187e1744a 100644
--- a/arduino-core/src/processing/app/BaseNoGui.java
+++ b/arduino-core/src/processing/app/BaseNoGui.java
@@ -1,45 +1,30 @@
package processing.app;
-import static processing.app.I18n._;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileWriter;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URISyntaxException;
-import java.util.*;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import cc.arduino.DefaultUncaughtExceptionHandler;
-import org.apache.commons.logging.impl.LogFactoryImpl;
-import org.apache.commons.logging.impl.NoOpLog;
-
+import cc.arduino.libraries.contributions.LibrariesIndexer;
import cc.arduino.packages.DiscoveryManager;
import cc.arduino.packages.Uploader;
-import processing.app.debug.Compiler;
-import cc.arduino.libraries.contributions.LibrariesIndexer;
import cc.arduino.packages.contributions.ContributedTool;
import cc.arduino.packages.contributions.ContributionsIndexer;
import cc.arduino.utils.ArchiveExtractor;
-import processing.app.debug.TargetBoard;
-import processing.app.debug.LegacyTargetPackage;
-import processing.app.debug.TargetPackage;
-import processing.app.debug.TargetPlatform;
-import processing.app.debug.TargetPlatformException;
-import processing.app.helpers.BasicUserNotifier;
-import processing.app.helpers.CommandlineParser;
-import processing.app.helpers.OSUtils;
-import processing.app.helpers.PreferencesMap;
-import processing.app.helpers.UserNotifier;
+import org.apache.commons.logging.impl.LogFactoryImpl;
+import org.apache.commons.logging.impl.NoOpLog;
+import processing.app.debug.Compiler;
+import processing.app.debug.*;
+import processing.app.helpers.*;
import processing.app.helpers.filefilters.OnlyDirs;
import processing.app.helpers.filefilters.OnlyFilesWithExtension;
import processing.app.legacy.PApplet;
import processing.app.packages.LibraryList;
import processing.app.packages.UserLibrary;
+import java.io.*;
+import java.net.URISyntaxException;
+import java.util.*;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import static processing.app.I18n._;
+
public class BaseNoGui {
/** Version string to be used for build */
@@ -594,21 +579,24 @@ public class BaseNoGui {
indexer = new ContributionsIndexer(BaseNoGui.getSettingsFolder());
File indexFile = indexer.getIndexFile();
if (!indexFile.isFile()) {
- try {
- File distFile = getContentFile("dist/default_package.tar.bz2");
- if (distFile.isFile()) {
- // If present, unpack distribution file into preferences folder
- ArchiveExtractor.extract(distFile, BaseNoGui.getSettingsFolder(), 1);
+ File distFile = findDefaultPackageFile();
+ if (distFile != null) {
+ // If present, unpack distribution file into preferences folder
+ ArchiveExtractor.extract(distFile, BaseNoGui.getSettingsFolder(), 0);
- // TODO: The first distribution file may be removed after extraction?
- } else {
- // Otherwise create an empty packages index
- FileOutputStream out = new FileOutputStream(indexFile);
+ // TODO: The first distribution file may be removed after extraction?
+ } else {
+ // Otherwise create an empty packages index
+ FileOutputStream out = null;
+ try {
+ out = new FileOutputStream(indexFile);
out.write("{ \"packages\" : [ ] }".getBytes());
out.close();
+ } finally {
+ if (out != null) {
+ out.close();
+ }
}
- } catch (IOException e) {
- e.printStackTrace();
}
}
indexer.parseIndex();
@@ -635,6 +623,23 @@ public class BaseNoGui {
librariesIndexer.parseIndex();
}
+ private static File findDefaultPackageFile() {
+ File distFolder = getContentFile("dist");
+ if (!distFolder.exists()) {
+ return null;
+ }
+ File[] files = distFolder.listFiles();
+ if (files.length > 1) {
+ throw new IllegalStateException("More than one file in " + distFolder);
+ }
+ File file = files[0];
+ if (!file.isFile() || !(file.getName().contains(".tar.") || file.getName().endsWith(".zip"))) {
+ throw new IllegalStateException(file + " must be a valid .tar.* or .zip file");
+ }
+
+ return file;
+ }
+
static protected void initPlatform() {
try {
Class> platformClass = Class.forName("processing.app.Platform");
@@ -771,7 +776,7 @@ public class BaseNoGui {
packages.put(pack.getId(), pack);
}
}
-
+
static private void createToolPreferences(ContributionsIndexer indexer) {
// Remove previous runtime preferences
final String prefix = "runtime.tools.";
diff --git a/arduino-core/src/processing/app/legacy/PApplet.java b/arduino-core/src/processing/app/legacy/PApplet.java
index c444a3b2f..59ca701e3 100644
--- a/arduino-core/src/processing/app/legacy/PApplet.java
+++ b/arduino-core/src/processing/app/legacy/PApplet.java
@@ -1,16 +1,6 @@
package processing.app.legacy;
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.io.PrintWriter;
-import java.io.UnsupportedEncodingException;
+import java.io.*;
import java.text.NumberFormat;
import java.util.ArrayList;
import java.util.StringTokenizer;
@@ -282,9 +272,9 @@ public class PApplet {
}
static public String[] loadStrings(InputStream input) {
+ BufferedReader reader = null;
try {
- BufferedReader reader =
- new BufferedReader(new InputStreamReader(input, "UTF-8"));
+ reader = new BufferedReader(new InputStreamReader(input, "UTF-8"));
String lines[] = new String[100];
int lineCount = 0;
@@ -297,7 +287,6 @@ public class PApplet {
}
lines[lineCount++] = line;
}
- reader.close();
if (lineCount == lines.length) {
return lines;
@@ -311,6 +300,15 @@ public class PApplet {
} catch (IOException e) {
e.printStackTrace();
//throw new RuntimeException("Error inside loadStrings()");
+ } finally {
+ if (reader != null) {
+ try {
+ reader.close();
+ } catch (IOException e) {
+ //ignore
+ }
+ }
+
}
return null;
}
diff --git a/build/build.xml b/build/build.xml
index 8557cbaa9..396148ed5 100644
--- a/build/build.xml
+++ b/build/build.xml
@@ -101,14 +101,15 @@
-
+
+
+
@@ -125,16 +126,24 @@
-
-
+
+
+
+
+
+
+
+
+
+
@@ -229,6 +238,7 @@
+
@@ -237,9 +247,6 @@
-
-
-
+
+
@@ -308,11 +317,17 @@
+
+
+
+
-
+
+
+
@@ -326,6 +341,37 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -485,6 +531,17 @@
+
+
+
+
+
+
+
+
+
+
+
@@ -546,9 +603,43 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -587,7 +678,7 @@
- Unzipping into folder ${dest_folder}
+ Untarring ${archive_file} into folder ${dest_folder}
@@ -596,7 +687,7 @@
- Unzipping into folder ${dest_folder}
+ Unzipping ${archive_file} into folder ${dest_folder}
@@ -737,6 +828,8 @@
+
+
@@ -759,6 +852,8 @@
+
+
@@ -782,6 +877,24 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/build/linux/avr-gcc-4.8.1-arduino-i686-pc-linux-gnu.tar.bz2.sha b/build/linux/avr-gcc-4.8.1-arduino-i686-pc-linux-gnu.tar.bz2.sha
new file mode 100644
index 000000000..98033394a
--- /dev/null
+++ b/build/linux/avr-gcc-4.8.1-arduino-i686-pc-linux-gnu.tar.bz2.sha
@@ -0,0 +1 @@
+204f54ff5ef45a53f35fb9b21fcb8ea8edcb385b
diff --git a/build/linux/avr-gcc-4.8.1-arduino-x86_64-pc-linux-gnu.tar.bz2.sha b/build/linux/avr-gcc-4.8.1-arduino-x86_64-pc-linux-gnu.tar.bz2.sha
new file mode 100644
index 000000000..44d226d35
--- /dev/null
+++ b/build/linux/avr-gcc-4.8.1-arduino-x86_64-pc-linux-gnu.tar.bz2.sha
@@ -0,0 +1 @@
+eb89261725ed45b9bf57d25bd94a302adc6c928d
diff --git a/build/linux/avrdude-6.0.1-arduino-i686-pc-linux-gnu.tar.bz2.sha b/build/linux/avrdude-6.0.1-arduino-i686-pc-linux-gnu.tar.bz2.sha
new file mode 100644
index 000000000..f9b23b14b
--- /dev/null
+++ b/build/linux/avrdude-6.0.1-arduino-i686-pc-linux-gnu.tar.bz2.sha
@@ -0,0 +1 @@
+326899e59dec2751d6c49f96fec9680b7a5afe8a
diff --git a/build/linux/avrdude-6.0.1-arduino-x86_64-pc-linux-gnu.tar.bz2.sha b/build/linux/avrdude-6.0.1-arduino-x86_64-pc-linux-gnu.tar.bz2.sha
new file mode 100644
index 000000000..804f6baca
--- /dev/null
+++ b/build/linux/avrdude-6.0.1-arduino-x86_64-pc-linux-gnu.tar.bz2.sha
@@ -0,0 +1 @@
+cbaa00eb3fadc8cdd86f52d9668825755de11dde
diff --git a/build/macosx/avr-gcc-4.8.1-arduino-i386-apple-darwin11.tar.bz2.sha b/build/macosx/avr-gcc-4.8.1-arduino-i386-apple-darwin11.tar.bz2.sha
new file mode 100644
index 000000000..9ee522767
--- /dev/null
+++ b/build/macosx/avr-gcc-4.8.1-arduino-i386-apple-darwin11.tar.bz2.sha
@@ -0,0 +1 @@
+9302d5e6a27eb194cc74e33d0f61f29b2c8d768e
diff --git a/build/macosx/avrdude-6.0.1-arduino-i386-apple-darwin11.tar.bz2.sha b/build/macosx/avrdude-6.0.1-arduino-i386-apple-darwin11.tar.bz2.sha
new file mode 100644
index 000000000..92d3db319
--- /dev/null
+++ b/build/macosx/avrdude-6.0.1-arduino-i386-apple-darwin11.tar.bz2.sha
@@ -0,0 +1 @@
+b098ac2cefd32cfec3f4ed626ddb3625864fc04f
diff --git a/build/shared/bundled_package_index.json b/build/shared/bundled_package_index.json
new file mode 100644
index 000000000..f3dc46982
--- /dev/null
+++ b/build/shared/bundled_package_index.json
@@ -0,0 +1,125 @@
+{
+ "packages": [
+ {
+ "name": "arduino",
+ "maintainer": "Arduino",
+ "websiteURL": "http://www.arduino.cc/",
+ "email": "packages@arduino.cc",
+ "platforms": [
+ {
+ "name": "Arduino AVR Boards",
+ "architecture": "avr",
+ "version": "1.6.1-beta1",
+ "category": "Arduino",
+ "url": "http://arduino.cc/download.php?f=/cores/avr-1.6.1-beta1.tar.bz2",
+ "archiveFileName": "avr-1.6.1-beta1.tar.bz2",
+ "checksum": "SHA-256:c360a8762a6c44e229b9323a4f3c0157100f842391746f15932cbec42c3f4ee1",
+ "size": "4860386",
+ "boards": [
+ {"name": "Arduino Yún"},
+ {"name": "Arduino Uno"},
+ {"name": "Arduino Diecimila"},
+ {"name": "Arduino Nano"},
+ {"name": "Arduino Mega"},
+ {"name": "Arduino MegaADK"},
+ {"name": "Arduino Leonardo"},
+ {"name": "Arduino Micro"},
+ {"name": "Arduino Esplora"},
+ {"name": "Arduino Mini"},
+ {"name": "Arduino Ethernet"},
+ {"name": "Arduino Fio"},
+ {"name": "Arduino BT"},
+ {"name": "Arduino LilyPadUSB"},
+ {"name": "Arduino Lilypad"},
+ {"name": "Arduino Pro"},
+ {"name": "Arduino ATMegaNG"},
+ {"name": "Arduino Robot Control"},
+ {"name": "Arduino Robot Motor"}
+ ],
+ "toolsDependencies": [
+ {
+ "packager": "arduino",
+ "name": "avr-gcc",
+ "version": "4.8.1-arduino"
+ },
+ {
+ "packager": "arduino",
+ "name": "avrdude",
+ "version": "6.0.1-arduino"
+ }
+ ]
+ }
+ ],
+ "tools": [
+ {
+ "name": "avr-gcc",
+ "version": "4.8.1-arduino",
+ "systems": [
+ {
+ "size": "24443508",
+ "checksum": "SHA-256:1285188c63efdd6de6ededbc327365b7d55466798014e170cc8351d0bbb26561",
+ "host": "i386-apple-darwin11",
+ "archiveFileName": "avr-gcc-4.8.1-arduino-i386-apple-darwin11.tar.bz2",
+ "url": "http://arduino.cc/download.php?f=/tools/avr-gcc-4.8.1-arduino-i386-apple-darwin11.tar.bz2"
+ },
+ {
+ "size": "27152089",
+ "checksum": "SHA-256:a4b1a2fd58c5129539d1ef466c1be6f4fb6dd141eca2f63e0c04aee0afd4d294",
+ "host": "x86_64-linux-gnu",
+ "archiveFileName": "avr-gcc-4.8.1-arduino-x86_64-pc-linux-gnu.tar.bz2",
+ "url": "http://arduino.cc/download.php?f=/tools/avr-gcc-4.8.1-arduino-x86_64-pc-linux-gnu.tar.bz2"
+ },
+ {
+ "size": "25875299",
+ "checksum": "SHA-256:14bc3dc08990ea1aec49335306aad9dbe9bd6751cf84ce51fad3500ec6cfbda8",
+ "host": "i686-linux-gnu",
+ "archiveFileName": "avr-gcc-4.8.1-arduino-i686-pc-linux-gnu.tar.bz2",
+ "url": "http://arduino.cc/download.php?f=/tools/avr-gcc-4.8.1-arduino-i686-pc-linux-gnu.tar.bz2"
+ },
+ {
+ "size": "46816142",
+ "checksum": "SHA-256:25d114605a247fd4d3ad95f73caf1a2d453b5656524c6cafc5b23cae787d104b",
+ "host": "i686-mingw32",
+ "archiveFileName": "avr-gcc-4.8.1-arduino-i686-mingw32.zip",
+ "url": "http://arduino.cc/download.php?f=/tools/avr-gcc-4.8.1-arduino-i686-mingw32.zip"
+ }
+ ]
+ },
+ {
+ "name": "avrdude",
+ "version": "6.0.1-arduino",
+ "systems": [
+ {
+ "size": "264817",
+ "checksum": "SHA-256:310ac863267de23673a9e8164d6058b0d6a33a1e8009bbc2f34c8a09ddefe546",
+ "host": "i386-apple-darwin11",
+ "archiveFileName": "avrdude-6.0.1-arduino-i386-apple-darwin11.tar.bz2",
+ "url": "http://arduino.cc/download.php?f=/tools/avrdude-6.0.1-arduino-i386-apple-darwin11.tar.bz2"
+ },
+ {
+ "size": "292575",
+ "checksum": "SHA-256:914adfb769cf7e99e52601a48dccc9f8806b8768e1ceeba81f9286df13af2342",
+ "host": "x86_64-linux-gnu",
+ "archiveFileName": "avrdude-6.0.1-arduino-x86_64-pc-linux-gnu.tar.bz2",
+ "url": "http://arduino.cc/download.php?f=/tools/avrdude-6.0.1-arduino-x86_64-pc-linux-gnu.tar.bz2"
+ },
+ {
+ "size": "283166",
+ "checksum": "SHA-256:20f278697c1d96b9ae7cf0eecd55d128912244f88fc4e8352bf33b20ac301d4c",
+ "host": "i686-linux-gnu",
+ "archiveFileName": "avrdude-6.0.1-arduino-i686-pc-linux-gnu.tar.bz2",
+ "url": "http://arduino.cc/download.php?f=/tools/avrdude-6.0.1-arduino-i686-pc-linux-gnu.tar.bz2"
+ },
+ {
+ "size": "241621",
+ "checksum": "SHA-256:724c7fcfd456ec94b0041fa4e18c76fad48a57cff60681b946ae76e282583bcc",
+ "host": "i686-mingw32",
+ "archiveFileName": "avrdude-6.0.1-arduino-i686-mingw32.zip",
+ "url": "http://arduino.cc/download.php?f=/tools/avrdude-6.0.1-arduino-i686-mingw32.zip"
+ }
+ ]
+ }
+ ]
+ }
+ ]
+}
diff --git a/build/windows/avr-gcc-4.8.1-arduino-i686-mingw32.zip.sha b/build/windows/avr-gcc-4.8.1-arduino-i686-mingw32.zip.sha
new file mode 100644
index 000000000..b931ef19e
--- /dev/null
+++ b/build/windows/avr-gcc-4.8.1-arduino-i686-mingw32.zip.sha
@@ -0,0 +1 @@
+3df5d4c783f09c34efc5d70dd3376638dca09de2
diff --git a/build/windows/avrdude-6.0.1-arduino-i686-mingw32.zip.sha b/build/windows/avrdude-6.0.1-arduino-i686-mingw32.zip.sha
new file mode 100644
index 000000000..be81ba02f
--- /dev/null
+++ b/build/windows/avrdude-6.0.1-arduino-i686-mingw32.zip.sha
@@ -0,0 +1 @@
+bb7fcc3aae19f73a79b8e96d093902f7188fb57c