mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-16 11:21:18 +03:00
AVR bundle: by default the IDE is built bundled with the avr toolchain and cores
By passing -Dlight_bundle=1 to ant, an light/empty IDE is built
This commit is contained in:
@ -30,6 +30,6 @@ package cc.arduino.packages.contributions;
|
||||
|
||||
public interface ContributedBoard {
|
||||
|
||||
public String getName();
|
||||
String getName();
|
||||
|
||||
}
|
||||
|
@ -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());
|
||||
|
@ -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.";
|
||||
|
@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user