Skip to content

Commit 87fb45c

Browse files
committed
Merge pull request #3055 from ffissore/other-packages
Allow listing other boards in boards manager
2 parents d87f0fa + cd49d29 commit 87fb45c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+1522
-518
lines changed

.classpath

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
<classpathentry kind="lib" path="app/lib/jmdns-3.4.1.jar"/>
2121
<classpathentry kind="lib" path="app/lib/jsch-0.1.50.jar"/>
2222
<classpathentry kind="lib" path="app/lib/jssc-2.8.0.jar"/>
23-
<classpathentry kind="lib" path="app/lib/bcpg-jdk15on-149.jar"/>
24-
<classpathentry kind="lib" path="app/lib/bcprov-jdk15on-149.jar"/>
23+
<classpathentry kind="lib" path="app/lib/bcpg-jdk15on-152.jar"/>
24+
<classpathentry kind="lib" path="app/lib/bcprov-jdk15on-152.jar"/>
2525
<classpathentry kind="lib" path="app/lib/jackson-core-2.2.3.jar"/>
2626
<classpathentry kind="lib" path="app/lib/jackson-databind-2.2.3.jar"/>
2727
<classpathentry kind="lib" path="app/lib/jackson-module-mrbean-2.2.3.jar"/>

app/.classpath

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
<classpathentry kind="lib" path="lib/jna.jar"/>
88
<classpathentry kind="lib" path="lib/ecj.jar"/>
99
<classpathentry kind="lib" path="lib/apple.jar"/>
10-
<classpathentry kind="lib" path="lib/bcpg-jdk15on-149.jar"/>
11-
<classpathentry kind="lib" path="lib/bcprov-jdk15on-149.jar"/>
10+
<classpathentry kind="lib" path="lib/bcpg-jdk15on-152.jar"/>
11+
<classpathentry kind="lib" path="lib/bcprov-jdk15on-152.jar"/>
1212
<classpathentry kind="lib" path="lib/commons-codec-1.7.jar"/>
1313
<classpathentry kind="lib" path="lib/commons-compress-1.8.jar"/>
1414
<classpathentry kind="lib" path="lib/commons-exec-1.1.jar"/>

app/build.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@
9999
<fileset dir="test" includes="**/*.txt" />
100100
<fileset dir="test" includes="**/*.properties" />
101101
<fileset dir="test" includes="**/*.ino" />
102+
<fileset dir="test" includes="**/*.json*" />
103+
<fileset dir="test" includes="**/*.key" />
102104
</copy>
103105

104106
<junit printsummary="yes" dir="${work.dir}" fork="true">

app/lib/bcpg-jdk15on-149.jar

-243 KB
Binary file not shown.

app/lib/bcpg-jdk15on-152.jar

268 KB
Binary file not shown.

app/lib/bcprov-jdk15on-149.jar

-2.36 MB
Binary file not shown.

app/lib/bcprov-jdk15on-152.jar

2.77 MB
Binary file not shown.

app/src/cc/arduino/contributions/packages/ui/ContributionIndexTableModel.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
import cc.arduino.contributions.filters.InstalledPredicate;
3333
import cc.arduino.contributions.packages.ContributedPackage;
3434
import cc.arduino.contributions.packages.ContributedPlatform;
35-
import cc.arduino.contributions.packages.ContributionsIndex;
35+
import cc.arduino.contributions.packages.ContributionsIndexer;
3636
import cc.arduino.contributions.ui.FilteredAbstractTableModel;
3737
import com.google.common.base.Predicate;
3838
import com.google.common.base.Predicates;
@@ -113,16 +113,16 @@ public void select(ContributedPlatform value) {
113113

114114
private Class<?>[] columnTypes = {ContributedPlatform.class};
115115

116-
private ContributionsIndex index;
116+
private ContributionsIndexer indexer;
117117

118-
public void setIndex(ContributionsIndex _index) {
119-
index = _index;
118+
public void setIndexer(ContributionsIndexer indexer) {
119+
this.indexer = indexer;
120120
}
121121

122122
public void updateIndexFilter(String filters[], Predicate<ContributedPlatform>... additionalFilters) {
123123
contributions.clear();
124124
Predicate<ContributedPlatform> filter = Predicates.and(additionalFilters);
125-
for (ContributedPackage pack : index.getPackages()) {
125+
for (ContributedPackage pack : indexer.getPackages()) {
126126
for (ContributedPlatform platform : pack.getPlatforms()) {
127127
if (!filter.apply(platform)) {
128128
continue;

app/src/cc/arduino/contributions/packages/ui/ContributionManagerUI.java

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,11 @@
2828
*/
2929
package cc.arduino.contributions.packages.ui;
3030

31-
import cc.arduino.contributions.ui.InstallerJDialogUncaughtExceptionHandler;
3231
import cc.arduino.contributions.packages.ContributedPlatform;
3332
import cc.arduino.contributions.packages.ContributionInstaller;
3433
import cc.arduino.contributions.packages.ContributionsIndexer;
3534
import cc.arduino.contributions.packages.DownloadableContribution;
36-
import cc.arduino.contributions.ui.DropdownItem;
37-
import cc.arduino.contributions.ui.FilteredAbstractTableModel;
38-
import cc.arduino.contributions.ui.InstallerJDialog;
39-
import cc.arduino.contributions.ui.InstallerTableCell;
35+
import cc.arduino.contributions.ui.*;
4036
import cc.arduino.utils.Progress;
4137
import processing.app.I18n;
4238

@@ -95,7 +91,7 @@ public void setIndexer(ContributionsIndexer indexer) {
9591

9692
categoryChooser.removeActionListener(categoryChooserActionListener);
9793

98-
getContribModel().setIndex(indexer.getIndex());
94+
getContribModel().setIndexer(indexer);
9995

10096
categoryFilter = null;
10197
categoryChooser.removeAllItems();
@@ -106,7 +102,7 @@ public void setIndexer(ContributionsIndexer indexer) {
106102

107103
// Enable categories combo only if there are two or more choices
108104
categoryChooser.addItem(new DropdownAllCoresItem());
109-
Collection<String> categories = indexer.getIndex().getCategories();
105+
Collection<String> categories = indexer.getCategories();
110106
for (String s : categories) {
111107
categoryChooser.addItem(new DropdownCoreOfCategoryItem(s));
112108
}
@@ -152,7 +148,8 @@ public void onUpdatePressed() {
152148
public void run() {
153149
try {
154150
setProgressVisible(true, "");
155-
installer.updateIndex();
151+
List<String> downloadedPackageIndexFiles = installer.updateIndex();
152+
installer.deleteUnknownFiles(downloadedPackageIndexFiles);
156153
onIndexesUpdated();
157154
} catch (Exception e) {
158155
throw new RuntimeException(e);

app/src/processing/app/Base.java

Lines changed: 38 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
package processing.app;
2424

25+
import cc.arduino.DefaultUncaughtExceptionHandler;
2526
import cc.arduino.contributions.DownloadableContributionVersionComparator;
2627
import cc.arduino.contributions.VersionHelper;
2728
import cc.arduino.contributions.libraries.ContributedLibrary;
@@ -321,7 +322,8 @@ protected void onProgress(Progress progress) {
321322
lastStatus = progress.getStatus();
322323
}
323324
};
324-
installer.updateIndex();
325+
List<String> downloadedPackageIndexFiles = installer.updateIndex();
326+
installer.deleteUnknownFiles(downloadedPackageIndexFiles);
325327
indexer.parseIndex();
326328
indexer.syncWithFilesystem(getHardwareFolder());
327329

@@ -342,7 +344,7 @@ protected void onProgress(Progress progress) {
342344
System.exit(1);
343345
}
344346

345-
ContributedPlatform installed = indexer.getIndex().getInstalled(boardToInstallParts[0], boardToInstallParts[1]);
347+
ContributedPlatform installed = indexer.getInstalled(boardToInstallParts[0], boardToInstallParts[1]);
346348

347349
if (!selected.isReadOnly()) {
348350
installer.install(selected);
@@ -2404,14 +2406,6 @@ static public Image getLibImage(String name, Component who) {
24042406
}
24052407

24062408

2407-
/**
2408-
* Return an InputStream for a file inside the Processing lib folder.
2409-
*/
2410-
static public InputStream getLibStream(String filename) throws IOException {
2411-
return BaseNoGui.getLibStream(filename);
2412-
}
2413-
2414-
24152409
// ...................................................................
24162410

24172411

@@ -2429,17 +2423,22 @@ static public int countLines(String what) {
24292423
*/
24302424
static public byte[] loadBytesRaw(File file) throws IOException {
24312425
int size = (int) file.length();
2432-
FileInputStream input = new FileInputStream(file);
2433-
byte buffer[] = new byte[size];
2434-
int offset = 0;
2435-
int bytesRead;
2436-
while ((bytesRead = input.read(buffer, offset, size - offset)) != -1) {
2437-
offset += bytesRead;
2438-
if (bytesRead == 0) break;
2426+
FileInputStream input = null;
2427+
try {
2428+
input = new FileInputStream(file);
2429+
byte buffer[] = new byte[size];
2430+
int offset = 0;
2431+
int bytesRead;
2432+
while ((bytesRead = input.read(buffer, offset, size - offset)) != -1) {
2433+
offset += bytesRead;
2434+
if (bytesRead == 0) break;
2435+
}
2436+
return buffer;
2437+
} finally {
2438+
if (input != null) {
2439+
input.close();
2440+
}
24392441
}
2440-
input.close(); // weren't properly being closed
2441-
input = null;
2442-
return buffer;
24432442
}
24442443

24452444

@@ -2474,20 +2473,25 @@ static public HashMap<String, String> readSettings(File inputFile) {
24742473

24752474
static public void copyFile(File sourceFile,
24762475
File targetFile) throws IOException {
2477-
InputStream from =
2478-
new BufferedInputStream(new FileInputStream(sourceFile));
2479-
OutputStream to =
2480-
new BufferedOutputStream(new FileOutputStream(targetFile));
2481-
byte[] buffer = new byte[16 * 1024];
2482-
int bytesRead;
2483-
while ((bytesRead = from.read(buffer)) != -1) {
2484-
to.write(buffer, 0, bytesRead);
2485-
}
2486-
to.flush();
2487-
from.close(); // ??
2488-
from = null;
2489-
to.close(); // ??
2490-
to = null;
2476+
InputStream from = null;
2477+
OutputStream to = null;
2478+
try {
2479+
from = new BufferedInputStream(new FileInputStream(sourceFile));
2480+
to = new BufferedOutputStream(new FileOutputStream(targetFile));
2481+
byte[] buffer = new byte[16 * 1024];
2482+
int bytesRead;
2483+
while ((bytesRead = from.read(buffer)) != -1) {
2484+
to.write(buffer, 0, bytesRead);
2485+
}
2486+
to.flush();
2487+
} finally {
2488+
if (from != null) {
2489+
from.close(); // ??
2490+
}
2491+
if (to != null) {
2492+
to.close(); // ??
2493+
}
2494+
}
24912495

24922496
targetFile.setLastModified(sourceFile.lastModified());
24932497
}

0 commit comments

Comments
 (0)