Skip to content

Commit 42ba381

Browse files
committed
Merge remote-tracking branch 'arduino/master'
2 parents 2659ec6 + ece6500 commit 42ba381

File tree

603 files changed

+70854
-242030
lines changed

Some content is hidden

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

603 files changed

+70854
-242030
lines changed

.classpath

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
<classpathentry excluding="processing/app/tools/format/|processing/app/tools/format/src/|processing/app/Trace.java|processing/app/RunnerClassLoader.java" kind="src" path="app/src"/>
44
<classpathentry kind="src" path="app/test"/>
55
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
6-
<classpathentry kind="lib" path="app/lib/antlr.jar"/>
76
<classpathentry kind="lib" path="app/lib/apple.jar"/>
87
<classpathentry kind="lib" path="app/lib/ecj.jar"/>
98
<classpathentry kind="lib" path="app/test-lib/junit-4.11.jar"/>
@@ -16,6 +15,7 @@
1615
<classpathentry kind="lib" path="app/lib/commons-exec-1.1.jar"/>
1716
<classpathentry kind="lib" path="app/lib/commons-httpclient-3.1.jar"/>
1817
<classpathentry kind="lib" path="app/lib/commons-logging-1.0.4.jar"/>
18+
<classpathentry kind="lib" path="app/lib/commons-net-3.3.jar"/>
1919
<classpathentry kind="lib" path="app/lib/jmdns-3.4.1.jar"/>
2020
<classpathentry kind="lib" path="app/lib/jsch-0.1.50.jar"/>
2121
<classpathentry kind="lib" path="app/lib/jssc-2.8.0.jar"/>

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ build/macosx/libastylej*
3333
build/macosx/appbundler*.jar
3434
build/macosx/appbundler*.zip
3535
build/macosx/appbundler
36-
build/macosx/appbundler-1.0ea-arduino3
36+
build/macosx/appbundler-1.0ea-arduino?
3737
build/macosx/appbundler-1.0ea-arduino*.zip
3838
build/macosx/appbundler-1.0ea-upstream*.zip
3939
build/linux/work/

app/.classpath

+1-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
<classpathentry excluding="processing/app/tools/format/" kind="src" path="src"/>
44
<classpathentry kind="src" path="test"/>
55
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
6-
<classpathentry kind="lib" path="lib/antlr.jar"/>
76
<classpathentry kind="lib" path="lib/ecj.jar"/>
87
<classpathentry kind="lib" path="lib/apple.jar"/>
98
<classpathentry kind="lib" path="lib/bcpg-jdk15on-152.jar"/>
@@ -13,6 +12,7 @@
1312
<classpathentry kind="lib" path="lib/commons-exec-1.1.jar"/>
1413
<classpathentry kind="lib" path="lib/commons-httpclient-3.1.jar"/>
1514
<classpathentry kind="lib" path="lib/commons-logging-1.0.4.jar"/>
15+
<classpathentry kind="lib" path="lib/commons-net-3.3.jar"/>
1616
<classpathentry kind="lib" path="lib/jackson-annotations-2.2.3.jar"/>
1717
<classpathentry kind="lib" path="lib/jackson-core-2.2.3.jar"/>
1818
<classpathentry kind="lib" path="lib/jackson-databind-2.2.3.jar"/>
@@ -28,7 +28,6 @@
2828
<classpathentry combineaccessrules="false" kind="src" path="/arduino-core"/>
2929
<classpathentry kind="lib" path="test-lib/jcip-annotations-1.0.jar"/>
3030
<classpathentry kind="lib" path="lib/commons-lang3-3.3.2.jar"/>
31-
<classpathentry kind="lib" path="lib/guava-18.0.jar"/>
3231
<classpathentry kind="lib" path="lib/java-semver-0.8.0.jar"/>
3332
<classpathentry kind="lib" path="lib/rsyntaxtextarea-2.5.7.1+arduino.jar"/>
3433
<classpathentry kind="output" path="bin"/>

app/.classpath_macosx

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
<classpathentry combineaccessrules="false" kind="src" path="/pdf"/>
1414
<classpathentry combineaccessrules="false" kind="src" path="/serial"/>
1515
<classpathentry combineaccessrules="false" kind="src" path="/video"/>
16-
<classpathentry kind="lib" path="lib/antlr.jar"/>
1716
<classpathentry kind="lib" path="lib/ecj.jar"/>
1817
<classpathentry kind="output" path="bin"/>
1918
</classpath>

app/build.xml

+1
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@
102102
<fileset dir="test" includes="**/*.json*" />
103103
<fileset dir="test" includes="**/*.key" />
104104
<fileset dir="test" includes="**/*.hex" />
105+
<fileset dir="test" includes="**/*.pac" />
105106
</copy>
106107

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

app/lib/antlr-2.7.7.LICENSE.PUBLIC-DOMAIN.txt

Whitespace-only changes.

app/lib/antlr.jar

-433 KB
Binary file not shown.

app/lib/commons-net-3.3.jar

274 KB
Binary file not shown.

arduino-core/lib/guava-18.0.LICENSE.ASL-2.0.txt renamed to app/lib/commons-net.LICENSE.ASL-2.0.txt

-1
Original file line numberDiff line numberDiff line change
@@ -200,4 +200,3 @@
200200
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201201
See the License for the specific language governing permissions and
202202
limitations under the License.
203-

app/lib/guava-18.0.jar

-2.15 MB
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
/*
2+
* This file is part of Arduino.
3+
*
4+
* Arduino is free software; you can redistribute it and/or modify
5+
* it under the terms of the GNU General Public License as published by
6+
* the Free Software Foundation; either version 2 of the License, or
7+
* (at your option) any later version.
8+
*
9+
* This program is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU General Public License
15+
* along with this program; if not, write to the Free Software
16+
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17+
*
18+
* As a special exception, you may use this file as part of a free software
19+
* library without restriction. Specifically, if other files instantiate
20+
* templates or use macros or inline functions from this file, or you compile
21+
* this file and link it with other files to produce an executable, this
22+
* file does not by itself cause the resulting executable to be covered by
23+
* the GNU General Public License. This exception does not however
24+
* invalidate any other reasons why the executable file might be covered by
25+
* the GNU General Public License.
26+
*
27+
* Copyright 2015 Arduino LLC (http://www.arduino.cc/)
28+
*/
29+
30+
package cc.arduino;
31+
32+
import processing.app.Base;
33+
34+
import javax.swing.event.HyperlinkEvent;
35+
import javax.swing.event.HyperlinkListener;
36+
import java.net.URL;
37+
38+
public class UpdatableBoardsLibsFakeURLsHandler implements HyperlinkListener {
39+
40+
private static final String BOARDSMANAGER = "boardsmanager";
41+
private static final String LIBRARYMANAGER = "librarymanager";
42+
43+
private final Base base;
44+
45+
public UpdatableBoardsLibsFakeURLsHandler(Base base) {
46+
this.base = base;
47+
}
48+
49+
@Override
50+
public void hyperlinkUpdate(HyperlinkEvent event) {
51+
if (event.getEventType() != HyperlinkEvent.EventType.ACTIVATED) {
52+
return;
53+
}
54+
55+
URL url = event.getURL();
56+
57+
if (BOARDSMANAGER.equals(url.getHost())) {
58+
try {
59+
base.openBoardsManager("", "DropdownUpdatableCoresItem");
60+
} catch (Exception e) {
61+
e.printStackTrace();
62+
}
63+
return;
64+
}
65+
66+
if (LIBRARYMANAGER.equals(url.getHost())) {
67+
base.openLibraryManager("DropdownUpdatableLibrariesItem");
68+
return;
69+
}
70+
71+
throw new IllegalArgumentException(url.getHost() + " is invalid");
72+
}
73+
74+
}

app/src/cc/arduino/contributions/BuiltInCoreIsNewerCheck.java

+9-11
Original file line numberDiff line numberDiff line change
@@ -34,21 +34,18 @@
3434
import cc.arduino.contributions.packages.ContributedPackage;
3535
import cc.arduino.contributions.packages.ContributedPlatform;
3636
import cc.arduino.view.Event;
37-
import com.google.common.collect.Collections2;
38-
import com.google.common.collect.Iterables;
39-
import com.google.common.collect.Lists;
4037
import processing.app.Base;
4138
import processing.app.BaseNoGui;
4239
import processing.app.I18n;
4340
import processing.app.PreferencesData;
4441

4542
import javax.swing.*;
4643
import java.awt.event.ActionEvent;
47-
import java.util.LinkedList;
44+
import java.util.Collection;
4845
import java.util.List;
4946
import java.util.stream.Collectors;
5047

51-
import static processing.app.I18n._;
48+
import static processing.app.I18n.tr;
5249

5350
public class BuiltInCoreIsNewerCheck implements Runnable {
5451

@@ -72,7 +69,7 @@ private void builtInPackageIsNewerCheck() throws InterruptedException {
7269
return;
7370
}
7471

75-
LinkedList<ContributedPlatform> contributedPlatforms = Lists.newLinkedList(Iterables.concat(Collections2.transform(BaseNoGui.indexer.getPackages(), ContributedPackage::getPlatforms)));
72+
List<ContributedPlatform> contributedPlatforms = BaseNoGui.indexer.getPackages().stream().map(ContributedPackage::getPlatforms).flatMap(Collection::stream).collect(Collectors.toList());
7673

7774
List<ContributedPlatform> installedBuiltInPlatforms = contributedPlatforms.stream().filter(new InstalledPredicate()).filter(new BuiltInPredicate()).collect(Collectors.toList());
7875
if (installedBuiltInPlatforms.size() != 1) {
@@ -93,12 +90,13 @@ private void builtInPackageIsNewerCheck() throws InterruptedException {
9390
SwingUtilities.invokeLater(() -> {
9491
PreferencesData.setInteger("builtin_platform_is_newer", BaseNoGui.REVISION);
9592
assert base.hasActiveEditor();
96-
int chosenOption = JOptionPane.showConfirmDialog(base.getActiveEditor(), I18n.format(_("The IDE includes an updated {0} package, but you're using an older one.\nDo you want to upgrade {0}?"), installedBuiltIn.getName()), I18n.format(_("A newer {0} package is available"), installedBuiltIn.getName()), JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
93+
int chosenOption = JOptionPane.showConfirmDialog(base.getActiveEditor(), I18n.format(tr("The IDE includes an updated {0} package, but you're using an older one.\nDo you want to upgrade {0}?"), installedBuiltIn.getName()), I18n.format(tr("A newer {0} package is available"), installedBuiltIn.getName()), JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
9794
if (chosenOption == JOptionPane.YES_OPTION) {
98-
Action openBoardsManager = base.getOpenBoardsManager();
99-
Event event = new Event(base.getActiveEditor(), ActionEvent.ACTION_PERFORMED, installedBuiltIn.getName());
100-
event.getPayload().put("filterText", installedBuiltIn.getName());
101-
openBoardsManager.actionPerformed(event);
95+
try {
96+
base.openBoardsManager(installedBuiltIn.getName(), "");
97+
} catch (Exception e) {
98+
e.printStackTrace();
99+
}
102100
}
103101
});
104102
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
/*
2+
* This file is part of Arduino.
3+
*
4+
* Copyright 2015 Arduino LLC (http://www.arduino.cc/)
5+
*
6+
* Arduino is free software; you can redistribute it and/or modify
7+
* it under the terms of the GNU General Public License as published by
8+
* the Free Software Foundation; either version 2 of the License, or
9+
* (at your option) any later version.
10+
*
11+
* This program is distributed in the hope that it will be useful,
12+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
* GNU General Public License for more details.
15+
*
16+
* You should have received a copy of the GNU General Public License
17+
* along with this program; if not, write to the Free Software
18+
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19+
*
20+
* As a special exception, you may use this file as part of a free software
21+
* library without restriction. Specifically, if other files instantiate
22+
* templates or use macros or inline functions from this file, or you compile
23+
* this file and link it with other files to produce an executable, this
24+
* file does not by itself cause the resulting executable to be covered by
25+
* the GNU General Public License. This exception does not however
26+
* invalidate any other reasons why the executable file might be covered by
27+
* the GNU General Public License.
28+
*/
29+
30+
package cc.arduino.contributions;
31+
32+
import cc.arduino.contributions.libraries.LibrariesIndexer;
33+
import cc.arduino.contributions.libraries.LibraryInstaller;
34+
import cc.arduino.contributions.libraries.filters.UpdatableLibraryPredicate;
35+
import cc.arduino.contributions.packages.ContributionInstaller;
36+
import cc.arduino.contributions.packages.ContributionsIndexer;
37+
import cc.arduino.contributions.packages.filters.UpdatablePlatformPredicate;
38+
import cc.arduino.view.NotificationPopup;
39+
import processing.app.Base;
40+
import processing.app.I18n;
41+
42+
import javax.swing.*;
43+
import javax.swing.event.HyperlinkListener;
44+
import java.util.TimerTask;
45+
46+
import static processing.app.I18n.tr;
47+
48+
public class ContributionsSelfCheck extends TimerTask {
49+
50+
private final Base base;
51+
private final HyperlinkListener hyperlinkListener;
52+
private final ContributionsIndexer contributionsIndexer;
53+
private final ContributionInstaller contributionInstaller;
54+
private final LibrariesIndexer librariesIndexer;
55+
private final LibraryInstaller libraryInstaller;
56+
private final ProgressListener progressListener;
57+
58+
private volatile boolean cancelled;
59+
private volatile NotificationPopup notificationPopup;
60+
61+
public ContributionsSelfCheck(Base base, HyperlinkListener hyperlinkListener, ContributionsIndexer contributionsIndexer, ContributionInstaller contributionInstaller, LibrariesIndexer librariesIndexer, LibraryInstaller libraryInstaller) {
62+
this.base = base;
63+
this.hyperlinkListener = hyperlinkListener;
64+
this.contributionsIndexer = contributionsIndexer;
65+
this.contributionInstaller = contributionInstaller;
66+
this.librariesIndexer = librariesIndexer;
67+
this.libraryInstaller = libraryInstaller;
68+
this.progressListener = new NoopProgressListener();
69+
this.cancelled = false;
70+
}
71+
72+
@Override
73+
public void run() {
74+
updateContributionIndex();
75+
updateLibrariesIndex();
76+
77+
long updatablePlatforms = contributionsIndexer.getPackages().stream()
78+
.flatMap(pack -> pack.getPlatforms().stream())
79+
.filter(new UpdatablePlatformPredicate(contributionsIndexer)).count();
80+
81+
long updatableLibraries = librariesIndexer.getInstalledLibraries().stream()
82+
.filter(new UpdatableLibraryPredicate(librariesIndexer))
83+
.count();
84+
85+
if (updatableLibraries <= 0 && updatablePlatforms <= 0) {
86+
return;
87+
}
88+
89+
String text;
90+
if (updatableLibraries > 0 && updatablePlatforms <= 0) {
91+
text = I18n.format(tr("<br/>Update available for some of your {0}libraries{1}"), "<a href=\"http://librarymanager\">", "</a>");
92+
} else if (updatableLibraries <= 0 && updatablePlatforms > 0) {
93+
text = I18n.format(tr("<br/>Update available for some of your {0}boards{1}"), "<a href=\"http://boardsmanager\">", "</a>");
94+
} else {
95+
text = I18n.format(tr("<br/>Update available for some of your {0}boards{1} and {2}libraries{3}"), "<a href=\"http://boardsmanager\">", "</a>", "<a href=\"http://librarymanager\">", "</a>");
96+
}
97+
98+
if (cancelled) {
99+
return;
100+
}
101+
102+
SwingUtilities.invokeLater(() -> {
103+
notificationPopup = new NotificationPopup(base.getActiveEditor(), hyperlinkListener, text);
104+
notificationPopup.setVisible(true);
105+
});
106+
}
107+
108+
@Override
109+
public boolean cancel() {
110+
cancelled = true;
111+
if (notificationPopup != null) {
112+
notificationPopup.close();
113+
}
114+
return super.cancel();
115+
}
116+
117+
private void updateLibrariesIndex() {
118+
if (cancelled) {
119+
return;
120+
}
121+
try {
122+
libraryInstaller.updateIndex(progressListener);
123+
} catch (Exception e) {
124+
// ignore
125+
}
126+
}
127+
128+
private void updateContributionIndex() {
129+
if (cancelled) {
130+
return;
131+
}
132+
try {
133+
contributionInstaller.updateIndex(progressListener);
134+
} catch (Exception e) {
135+
// ignore
136+
}
137+
}
138+
}

app/src/cc/arduino/contributions/libraries/filters/UpdatableLibraryPredicate.java

+29
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,32 @@
1+
/*
2+
* This file is part of Arduino.
3+
*
4+
* Copyright 2015 Arduino LLC (http://www.arduino.cc/)
5+
*
6+
* Arduino is free software; you can redistribute it and/or modify
7+
* it under the terms of the GNU General Public License as published by
8+
* the Free Software Foundation; either version 2 of the License, or
9+
* (at your option) any later version.
10+
*
11+
* This program is distributed in the hope that it will be useful,
12+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
* GNU General Public License for more details.
15+
*
16+
* You should have received a copy of the GNU General Public License
17+
* along with this program; if not, write to the Free Software
18+
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19+
*
20+
* As a special exception, you may use this file as part of a free software
21+
* library without restriction. Specifically, if other files instantiate
22+
* templates or use macros or inline functions from this file, or you compile
23+
* this file and link it with other files to produce an executable, this
24+
* file does not by itself cause the resulting executable to be covered by
25+
* the GNU General Public License. This exception does not however
26+
* invalidate any other reasons why the executable file might be covered by
27+
* the GNU General Public License.
28+
*/
29+
130
package cc.arduino.contributions.libraries.filters;
231

332
import cc.arduino.contributions.VersionComparator;

0 commit comments

Comments
 (0)