mirror of
https://github.com/arduino/Arduino.git
synced 2024-12-01 12:24:14 +01:00
Bundled core is again inside the hardware folder.
Fixed a handful of glitches when dealing with multiple installed cores
This commit is contained in:
parent
98f364ea38
commit
29cb42eb50
BIN
app/lib/java-semver-0.8.0.jar
Normal file
BIN
app/lib/java-semver-0.8.0.jar
Normal file
Binary file not shown.
0
app/lib/java-semver.LICENSE.MIT.txt
Normal file
0
app/lib/java-semver.LICENSE.MIT.txt
Normal file
@ -1,17 +0,0 @@
|
|||||||
package cc.arduino.contributions.libraries.filters;
|
|
||||||
|
|
||||||
import cc.arduino.contributions.libraries.ContributedLibrary;
|
|
||||||
import com.google.common.base.Predicate;
|
|
||||||
|
|
||||||
public class BuiltInPredicate implements Predicate<ContributedLibrary> {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(ContributedLibrary input) {
|
|
||||||
return input.isReadOnly();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object obj) {
|
|
||||||
return obj instanceof BuiltInPredicate;
|
|
||||||
}
|
|
||||||
}
|
|
@ -29,15 +29,16 @@
|
|||||||
package cc.arduino.contributions.libraries.ui;
|
package cc.arduino.contributions.libraries.ui;
|
||||||
|
|
||||||
import cc.arduino.contributions.VersionComparator;
|
import cc.arduino.contributions.VersionComparator;
|
||||||
|
import cc.arduino.contributions.VersionHelper;
|
||||||
import cc.arduino.contributions.filters.InstalledPredicate;
|
import cc.arduino.contributions.filters.InstalledPredicate;
|
||||||
import cc.arduino.contributions.libraries.ContributedLibrary;
|
import cc.arduino.contributions.libraries.ContributedLibrary;
|
||||||
import cc.arduino.contributions.libraries.ContributedLibraryComparator;
|
import cc.arduino.contributions.libraries.ContributedLibraryComparator;
|
||||||
import cc.arduino.contributions.libraries.filters.BuiltInPredicate;
|
import cc.arduino.contributions.filters.BuiltInPredicate;
|
||||||
import cc.arduino.contributions.libraries.filters.InstalledLibraryPredicate;
|
|
||||||
import cc.arduino.contributions.libraries.filters.OnlyUpstreamReleasePredicate;
|
import cc.arduino.contributions.libraries.filters.OnlyUpstreamReleasePredicate;
|
||||||
import cc.arduino.contributions.ui.InstallerTableCell;
|
import cc.arduino.contributions.ui.InstallerTableCell;
|
||||||
import cc.arduino.contributions.ui.listeners.DelegatingKeyListener;
|
import cc.arduino.contributions.ui.listeners.DelegatingKeyListener;
|
||||||
import cc.arduino.utils.ReverseComparator;
|
import cc.arduino.utils.ReverseComparator;
|
||||||
|
import com.github.zafarkhaja.semver.Version;
|
||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
||||||
import com.google.common.base.Predicates;
|
import com.google.common.base.Predicates;
|
||||||
import com.google.common.collect.Collections2;
|
import com.google.common.collect.Collections2;
|
||||||
@ -66,7 +67,6 @@ import static processing.app.I18n.format;
|
|||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
public class ContributedLibraryTableCell extends InstallerTableCell {
|
public class ContributedLibraryTableCell extends InstallerTableCell {
|
||||||
|
|
||||||
private final LibraryManagerUI indexer;
|
|
||||||
private JPanel panel;
|
private JPanel panel;
|
||||||
private JButton installButton;
|
private JButton installButton;
|
||||||
private Component installButtonPlaceholder;
|
private Component installButtonPlaceholder;
|
||||||
@ -77,9 +77,7 @@ public class ContributedLibraryTableCell extends InstallerTableCell {
|
|||||||
private JPanel inactiveButtonsPanel;
|
private JPanel inactiveButtonsPanel;
|
||||||
private JLabel statusLabel;
|
private JLabel statusLabel;
|
||||||
|
|
||||||
public ContributedLibraryTableCell(LibraryManagerUI indexer) {
|
public ContributedLibraryTableCell() {
|
||||||
this.indexer = indexer;
|
|
||||||
|
|
||||||
{
|
{
|
||||||
installButton = new JButton(_("Install"));
|
installButton = new JButton(_("Install"));
|
||||||
installButton.addActionListener(new ActionListener() {
|
installButton.addActionListener(new ActionListener() {
|
||||||
@ -359,7 +357,7 @@ public class ContributedLibraryTableCell extends InstallerTableCell {
|
|||||||
|
|
||||||
// ...version.
|
// ...version.
|
||||||
if (installed != null) {
|
if (installed != null) {
|
||||||
String installedVer = installed.getVersion();
|
Version installedVer = VersionHelper.valueOf(installed.getVersion());
|
||||||
if (installedVer == null) {
|
if (installedVer == null) {
|
||||||
desc += " " + _("Version unknown");
|
desc += " " + _("Version unknown");
|
||||||
} else {
|
} else {
|
||||||
|
@ -1,20 +1,20 @@
|
|||||||
package cc.arduino.contributions.libraries.ui;
|
package cc.arduino.contributions.libraries.ui;
|
||||||
|
|
||||||
import cc.arduino.contributions.libraries.ContributedLibrary;
|
import cc.arduino.contributions.filters.BuiltInPredicate;
|
||||||
import cc.arduino.contributions.libraries.filters.BuiltInPredicate;
|
import cc.arduino.contributions.packages.DownloadableContribution;
|
||||||
import cc.arduino.contributions.ui.DropdownItem;
|
import cc.arduino.contributions.ui.DropdownItem;
|
||||||
import com.google.common.base.Predicate;
|
import com.google.common.base.Predicate;
|
||||||
|
|
||||||
import static processing.app.I18n._;
|
import static processing.app.I18n._;
|
||||||
|
|
||||||
public class DropdownBuiltInLibrariesItem implements DropdownItem<ContributedLibrary> {
|
public class DropdownBuiltInLibrariesItem implements DropdownItem<DownloadableContribution> {
|
||||||
|
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return _("Built-in");
|
return _("Built-in");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Predicate<ContributedLibrary> getFilterPredicate() {
|
public Predicate<DownloadableContribution> getFilterPredicate() {
|
||||||
return new BuiltInPredicate();
|
return new BuiltInPredicate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,16 +28,22 @@
|
|||||||
*/
|
*/
|
||||||
package cc.arduino.contributions.libraries.ui;
|
package cc.arduino.contributions.libraries.ui;
|
||||||
|
|
||||||
import cc.arduino.contributions.VersionComparator;
|
import cc.arduino.contributions.DownloadableContributionBuiltInAtTheBottomComparator;
|
||||||
|
import cc.arduino.contributions.VersionHelper;
|
||||||
|
import cc.arduino.contributions.filters.InstalledPredicate;
|
||||||
import cc.arduino.contributions.libraries.ContributedLibrary;
|
import cc.arduino.contributions.libraries.ContributedLibrary;
|
||||||
import cc.arduino.contributions.libraries.LibrariesIndexer;
|
import cc.arduino.contributions.libraries.LibrariesIndexer;
|
||||||
import cc.arduino.contributions.packages.ContributedPlatform;
|
import cc.arduino.contributions.packages.ContributedPlatform;
|
||||||
import cc.arduino.contributions.ui.FilteredAbstractTableModel;
|
import cc.arduino.contributions.ui.FilteredAbstractTableModel;
|
||||||
|
import com.github.zafarkhaja.semver.Version;
|
||||||
import com.google.common.base.Predicate;
|
import com.google.common.base.Predicate;
|
||||||
import com.google.common.base.Predicates;
|
import com.google.common.base.Predicates;
|
||||||
import com.google.common.collect.Collections2;
|
import com.google.common.collect.Collections2;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
public class LibrariesIndexTableModel extends FilteredAbstractTableModel<ContributedLibrary> {
|
public class LibrariesIndexTableModel extends FilteredAbstractTableModel<ContributedLibrary> {
|
||||||
@ -45,13 +51,18 @@ public class LibrariesIndexTableModel extends FilteredAbstractTableModel<Contrib
|
|||||||
public final static int DESCRIPTION_COL = 0;
|
public final static int DESCRIPTION_COL = 0;
|
||||||
|
|
||||||
public static class ContributedLibraryReleases implements Comparable<ContributedLibraryReleases> {
|
public static class ContributedLibraryReleases implements Comparable<ContributedLibraryReleases> {
|
||||||
|
|
||||||
public final String name;
|
public final String name;
|
||||||
public final List<ContributedLibrary> releases = new ArrayList<ContributedLibrary>();
|
public final List<ContributedLibrary> releases;
|
||||||
public final List<String> versions = new ArrayList<String>();
|
public final List<Version> versions;
|
||||||
public ContributedLibrary selected = null;
|
|
||||||
|
public ContributedLibrary selected;
|
||||||
|
|
||||||
public ContributedLibraryReleases(ContributedLibrary library) {
|
public ContributedLibraryReleases(ContributedLibrary library) {
|
||||||
name = library.getName();
|
this.name = library.getName();
|
||||||
|
this.versions = new LinkedList<Version>();
|
||||||
|
this.releases = new LinkedList<ContributedLibrary>();
|
||||||
|
this.selected = null;
|
||||||
add(library);
|
add(library);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,40 +72,28 @@ public class LibrariesIndexTableModel extends FilteredAbstractTableModel<Contrib
|
|||||||
|
|
||||||
public void add(ContributedLibrary library) {
|
public void add(ContributedLibrary library) {
|
||||||
releases.add(library);
|
releases.add(library);
|
||||||
versions.add(library.getVersion());
|
Version version = VersionHelper.valueOf(library.getVersion());
|
||||||
|
if (version != null) {
|
||||||
|
versions.add(version);
|
||||||
|
}
|
||||||
selected = getLatest();
|
selected = getLatest();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ContributedLibrary getInstalled() {
|
public ContributedLibrary getInstalled() {
|
||||||
List<ContributedLibrary> installedReleases = new LinkedList<ContributedLibrary>(Collections2.filter(releases, new Predicate<ContributedLibrary>() {
|
List<ContributedLibrary> installedReleases = new LinkedList<ContributedLibrary>(Collections2.filter(releases, new InstalledPredicate()));
|
||||||
@Override
|
Collections.sort(installedReleases, new DownloadableContributionBuiltInAtTheBottomComparator());
|
||||||
public boolean apply(ContributedLibrary contributedLibrary) {
|
|
||||||
return contributedLibrary.isInstalled();
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
|
|
||||||
return getLatestOf(installedReleases);
|
if (installedReleases.isEmpty()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return installedReleases.get(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ContributedLibrary getLatest() {
|
public ContributedLibrary getLatest() {
|
||||||
return getLatestOf(releases);
|
return getLatestOf(releases);
|
||||||
}
|
}
|
||||||
|
|
||||||
private ContributedLibrary getLatestOf(List<ContributedLibrary> libs) {
|
|
||||||
Collections.sort(new LinkedList<ContributedLibrary>(libs), new Comparator<ContributedLibrary>() {
|
|
||||||
@Override
|
|
||||||
public int compare(ContributedLibrary lib1, ContributedLibrary lib2) {
|
|
||||||
return VersionComparator.VERSION_COMPARATOR.compare(lib1.getVersion(), lib2.getVersion());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
if (libs.isEmpty()) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return libs.get(libs.size() - 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
public ContributedLibrary getSelected() {
|
public ContributedLibrary getSelected() {
|
||||||
return selected;
|
return selected;
|
||||||
}
|
}
|
||||||
@ -223,7 +222,7 @@ public class LibrariesIndexTableModel extends FilteredAbstractTableModel<Contrib
|
|||||||
return col == DESCRIPTION_COL;
|
return col == DESCRIPTION_COL;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getReleasesVersions(int row) {
|
public List<Version> getReleasesVersions(int row) {
|
||||||
return contributions.get(row).versions;
|
return contributions.get(row).versions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,12 +61,12 @@ public class LibraryManagerUI extends InstallerJDialog<ContributedLibrary> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected InstallerTableCell createCellRenderer() {
|
protected InstallerTableCell createCellRenderer() {
|
||||||
return new ContributedLibraryTableCell(this);
|
return new ContributedLibraryTableCell();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected InstallerTableCell createCellEditor() {
|
protected InstallerTableCell createCellEditor() {
|
||||||
return new ContributedLibraryTableCell(this) {
|
return new ContributedLibraryTableCell() {
|
||||||
@Override
|
@Override
|
||||||
protected void onInstall(ContributedLibrary selectedLibrary, ContributedLibrary installedLibrary) {
|
protected void onInstall(ContributedLibrary selectedLibrary, ContributedLibrary installedLibrary) {
|
||||||
if (selectedLibrary.isReadOnly()) {
|
if (selectedLibrary.isReadOnly()) {
|
||||||
|
@ -29,7 +29,9 @@
|
|||||||
package cc.arduino.contributions.packages.ui;
|
package cc.arduino.contributions.packages.ui;
|
||||||
|
|
||||||
import cc.arduino.contributions.VersionComparator;
|
import cc.arduino.contributions.VersionComparator;
|
||||||
|
import cc.arduino.contributions.VersionHelper;
|
||||||
import cc.arduino.contributions.filters.InstalledPredicate;
|
import cc.arduino.contributions.filters.InstalledPredicate;
|
||||||
|
import cc.arduino.contributions.filters.BuiltInPredicate;
|
||||||
import cc.arduino.contributions.packages.ContributedBoard;
|
import cc.arduino.contributions.packages.ContributedBoard;
|
||||||
import cc.arduino.contributions.packages.ContributedPlatform;
|
import cc.arduino.contributions.packages.ContributedPlatform;
|
||||||
import cc.arduino.contributions.packages.ContributedPlatformComparator;
|
import cc.arduino.contributions.packages.ContributedPlatformComparator;
|
||||||
@ -263,7 +265,7 @@ public class ContributedPlatformTableCell extends InstallerTableCell {
|
|||||||
java.util.List<ContributedPlatform> releases = new LinkedList<ContributedPlatform>(editorValue.releases);
|
java.util.List<ContributedPlatform> releases = new LinkedList<ContributedPlatform>(editorValue.releases);
|
||||||
java.util.List<ContributedPlatform> uninstalledReleases = new LinkedList<ContributedPlatform>(Collections2.filter(releases, Predicates.not(new InstalledPredicate())));
|
java.util.List<ContributedPlatform> uninstalledReleases = new LinkedList<ContributedPlatform>(Collections2.filter(releases, Predicates.not(new InstalledPredicate())));
|
||||||
|
|
||||||
java.util.List<ContributedPlatform> installedBuiltIn = new LinkedList<ContributedPlatform>();
|
java.util.List<ContributedPlatform> installedBuiltIn = new LinkedList<ContributedPlatform>(Collections2.filter(releases, Predicates.and(new InstalledPredicate(), new BuiltInPredicate())));
|
||||||
|
|
||||||
if (installed != null && !installedBuiltIn.contains(installed)) {
|
if (installed != null && !installedBuiltIn.contains(installed)) {
|
||||||
uninstalledReleases.addAll(installedBuiltIn);
|
uninstalledReleases.addAll(installedBuiltIn);
|
||||||
@ -330,8 +332,7 @@ public class ContributedPlatformTableCell extends InstallerTableCell {
|
|||||||
upgradable = false;
|
upgradable = false;
|
||||||
} else {
|
} else {
|
||||||
installable = false;
|
installable = false;
|
||||||
//removable = !installed.isReadOnly() && !hasBuiltInRelease;
|
removable = !installed.isReadOnly() && !hasBuiltInRelease;
|
||||||
removable = !hasBuiltInRelease;
|
|
||||||
upgradable = new ContributedPlatformComparator().compare(selected, installed) > 0;
|
upgradable = new ContributedPlatformComparator().compare(selected, installed) > 0;
|
||||||
}
|
}
|
||||||
if (installable) {
|
if (installable) {
|
||||||
@ -352,17 +353,18 @@ public class ContributedPlatformTableCell extends InstallerTableCell {
|
|||||||
if (author != null && !author.isEmpty()) {
|
if (author != null && !author.isEmpty()) {
|
||||||
desc += " " + format("by <b>{0}</b>", author);
|
desc += " " + format("by <b>{0}</b>", author);
|
||||||
}
|
}
|
||||||
if (removable) {
|
if (installed != null) {
|
||||||
desc += " " + format(_("version <b>{0}</b>"), installed.getVersion()) + " <strong><font color=\"#00979D\">INSTALLED</font></strong>";
|
desc += " " + format(_("version <b>{0}</b>"), VersionHelper.valueOf(installed.getVersion())) + " <strong><font color=\"#00979D\">INSTALLED</font></strong>";
|
||||||
}
|
}
|
||||||
desc += "<br />";
|
desc += "<br />";
|
||||||
|
|
||||||
desc += _("Boards included in this package:") + "<br />";
|
desc += _("Boards included in this package:") + "<br />";
|
||||||
for (ContributedBoard board : selected.getBoards())
|
for (ContributedBoard board : selected.getBoards()) {
|
||||||
desc += format("{0}, ", board.getName());
|
desc += board.getName() + ", ";
|
||||||
|
}
|
||||||
desc = desc.substring(0, desc.lastIndexOf(',')) + ".<br />";
|
desc = desc.substring(0, desc.lastIndexOf(',')) + ".<br />";
|
||||||
|
|
||||||
if (author != null && !author.isEmpty()) {
|
if (url != null && !url.isEmpty()) {
|
||||||
desc += " " + format("<a href=\"{0}\">More info</a>", url);
|
desc += " " + format("<a href=\"{0}\">More info</a>", url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,34 +28,40 @@
|
|||||||
*/
|
*/
|
||||||
package cc.arduino.contributions.packages.ui;
|
package cc.arduino.contributions.packages.ui;
|
||||||
|
|
||||||
|
import cc.arduino.contributions.DownloadableContributionBuiltInAtTheBottomComparator;
|
||||||
|
import cc.arduino.contributions.VersionHelper;
|
||||||
|
import cc.arduino.contributions.filters.InstalledPredicate;
|
||||||
import cc.arduino.contributions.packages.ContributedPackage;
|
import cc.arduino.contributions.packages.ContributedPackage;
|
||||||
import cc.arduino.contributions.packages.ContributedPlatform;
|
import cc.arduino.contributions.packages.ContributedPlatform;
|
||||||
import cc.arduino.contributions.packages.ContributionsIndex;
|
import cc.arduino.contributions.packages.ContributionsIndex;
|
||||||
import cc.arduino.contributions.ui.FilteredAbstractTableModel;
|
import cc.arduino.contributions.ui.FilteredAbstractTableModel;
|
||||||
|
import com.github.zafarkhaja.semver.Version;
|
||||||
import com.google.common.base.Predicate;
|
import com.google.common.base.Predicate;
|
||||||
import com.google.common.base.Predicates;
|
import com.google.common.base.Predicates;
|
||||||
|
import com.google.common.collect.Collections2;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static processing.app.I18n._;
|
|
||||||
|
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
public class ContributionIndexTableModel extends FilteredAbstractTableModel<ContributedPlatform> {
|
public class ContributionIndexTableModel extends FilteredAbstractTableModel<ContributedPlatform> {
|
||||||
|
|
||||||
public final static int DESCRIPTION_COL = 0;
|
public final static int DESCRIPTION_COL = 0;
|
||||||
|
|
||||||
public static class ContributedPlatformReleases {
|
public static class ContributedPlatformReleases {
|
||||||
public ContributedPackage packager;
|
public final ContributedPackage packager;
|
||||||
public String arch;
|
public final String arch;
|
||||||
public List<ContributedPlatform> releases = new ArrayList<ContributedPlatform>();
|
public final List<ContributedPlatform> releases;
|
||||||
public List<String> versions = new ArrayList<String>();
|
public final List<Version> versions;
|
||||||
public ContributedPlatform selected = null;
|
public ContributedPlatform selected = null;
|
||||||
|
|
||||||
public ContributedPlatformReleases(ContributedPlatform platform) {
|
public ContributedPlatformReleases(ContributedPlatform platform) {
|
||||||
packager = platform.getParentPackage();
|
this.packager = platform.getParentPackage();
|
||||||
arch = platform.getArchitecture();
|
this.arch = platform.getArchitecture();
|
||||||
|
this.releases = new LinkedList<ContributedPlatform>();
|
||||||
|
this.versions = new LinkedList<Version>();
|
||||||
add(platform);
|
add(platform);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,39 +73,26 @@ public class ContributionIndexTableModel extends FilteredAbstractTableModel<Cont
|
|||||||
|
|
||||||
public void add(ContributedPlatform platform) {
|
public void add(ContributedPlatform platform) {
|
||||||
releases.add(platform);
|
releases.add(platform);
|
||||||
versions.add(platform.getVersion());
|
Version version = VersionHelper.valueOf(platform.getVersion());
|
||||||
|
if (version != null) {
|
||||||
|
versions.add(version);
|
||||||
|
}
|
||||||
selected = getLatest();
|
selected = getLatest();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ContributedPlatform getInstalled() {
|
public ContributedPlatform getInstalled() {
|
||||||
List<ContributedPlatform> installedPlatforms = new LinkedList<ContributedPlatform>();
|
List<ContributedPlatform> installedReleases = new LinkedList<ContributedPlatform>(Collections2.filter(releases, new InstalledPredicate()));
|
||||||
for (ContributedPlatform platform : releases) {
|
Collections.sort(installedReleases, new DownloadableContributionBuiltInAtTheBottomComparator());
|
||||||
if (platform.isInstalled()) {
|
|
||||||
installedPlatforms.add(platform);
|
if (installedReleases.isEmpty()) {
|
||||||
}
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (installedPlatforms.size() > 1) {
|
return installedReleases.get(0);
|
||||||
throw new IllegalStateException(_("More than one platform is currently installed! Only one can be installed at any given time"));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!installedPlatforms.isEmpty()) {
|
|
||||||
return installedPlatforms.get(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ContributedPlatform getLatest() {
|
public ContributedPlatform getLatest() {
|
||||||
ContributedPlatform latest = null;
|
return getLatestOf(releases);
|
||||||
for (ContributedPlatform plat : releases) {
|
|
||||||
if (latest == null)
|
|
||||||
latest = plat;
|
|
||||||
// TODO a better version compare
|
|
||||||
if (plat.getVersion().compareTo(latest.getVersion()) > 0)
|
|
||||||
latest = plat;
|
|
||||||
}
|
|
||||||
return latest;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ContributedPlatform getSelected() {
|
public ContributedPlatform getSelected() {
|
||||||
@ -224,7 +217,7 @@ public class ContributionIndexTableModel extends FilteredAbstractTableModel<Cont
|
|||||||
return col == DESCRIPTION_COL;
|
return col == DESCRIPTION_COL;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getReleasesVersions(int row) {
|
public List<Version> getReleasesVersions(int row) {
|
||||||
return contributions.get(row).versions;
|
return contributions.get(row).versions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,13 +66,17 @@ public class ContributionManagerUI extends InstallerJDialog {
|
|||||||
protected InstallerTableCell createCellEditor() {
|
protected InstallerTableCell createCellEditor() {
|
||||||
return new ContributedPlatformTableCell() {
|
return new ContributedPlatformTableCell() {
|
||||||
@Override
|
@Override
|
||||||
protected void onInstall(ContributedPlatform selectedPlatform, ContributedPlatform installed) {
|
protected void onInstall(ContributedPlatform selected, ContributedPlatform installed) {
|
||||||
onInstallPressed(selectedPlatform, installed);
|
if (selected.isReadOnly()) {
|
||||||
|
onRemovePressed(installed, false);
|
||||||
|
} else {
|
||||||
|
onInstallPressed(selected, installed);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onRemove(ContributedPlatform installedPlatform) {
|
protected void onRemove(ContributedPlatform installedPlatform) {
|
||||||
onRemovePressed(installedPlatform);
|
onRemovePressed(installedPlatform, true);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -157,7 +161,7 @@ public class ContributionManagerUI extends InstallerJDialog {
|
|||||||
try {
|
try {
|
||||||
setProgressVisible(true, _("Installing..."));
|
setProgressVisible(true, _("Installing..."));
|
||||||
installer.install(platformToInstall);
|
installer.install(platformToInstall);
|
||||||
if (platformToRemove != null) {
|
if (platformToRemove != null && !platformToRemove.isReadOnly()) {
|
||||||
installer.remove(platformToRemove);
|
installer.remove(platformToRemove);
|
||||||
}
|
}
|
||||||
onIndexesUpdated();
|
onIndexesUpdated();
|
||||||
@ -172,12 +176,14 @@ public class ContributionManagerUI extends InstallerJDialog {
|
|||||||
installerThread.start();
|
installerThread.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onRemovePressed(final ContributedPlatform platform) {
|
public void onRemovePressed(final ContributedPlatform platform, boolean showWarning) {
|
||||||
clearErrorMessage();
|
clearErrorMessage();
|
||||||
|
|
||||||
int chosenOption = JOptionPane.showConfirmDialog(getParent(), I18n.format(_("Do you want to remove {0}?\nIf you do so you won't be able to use {0} any more."), platform.getName()), _("Please confirm boards deletion"), JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
|
if (showWarning) {
|
||||||
if (chosenOption != JOptionPane.YES_OPTION) {
|
int chosenOption = JOptionPane.showConfirmDialog(getParent(), I18n.format(_("Do you want to remove {0}?\nIf you do so you won't be able to use {0} any more."), platform.getName()), _("Please confirm boards deletion"), JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
|
||||||
return;
|
if (chosenOption != JOptionPane.YES_OPTION) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
installerThread = new Thread(new Runnable() {
|
installerThread = new Thread(new Runnable() {
|
||||||
|
@ -28,12 +28,34 @@
|
|||||||
*/
|
*/
|
||||||
package cc.arduino.contributions.ui;
|
package cc.arduino.contributions.ui;
|
||||||
|
|
||||||
|
import cc.arduino.contributions.VersionComparator;
|
||||||
|
import cc.arduino.contributions.packages.DownloadableContribution;
|
||||||
import com.google.common.base.Predicate;
|
import com.google.common.base.Predicate;
|
||||||
|
|
||||||
import javax.swing.table.AbstractTableModel;
|
import javax.swing.table.AbstractTableModel;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public abstract class FilteredAbstractTableModel<T> extends AbstractTableModel {
|
public abstract class FilteredAbstractTableModel<T> extends AbstractTableModel {
|
||||||
|
|
||||||
abstract public void updateIndexFilter(String[] filters, Predicate<T>... additionalFilters);
|
abstract public void updateIndexFilter(String[] filters, Predicate<T>... additionalFilters);
|
||||||
|
|
||||||
|
protected static <T extends DownloadableContribution> T getLatestOf(List<T> contribs) {
|
||||||
|
contribs = new LinkedList<T>(contribs);
|
||||||
|
Collections.sort(contribs, new Comparator<T>() {
|
||||||
|
@Override
|
||||||
|
public int compare(T contrib1, T contrib2) {
|
||||||
|
return VersionComparator.VERSION_COMPARATOR.compare(contrib1.getVersion(), contrib2.getVersion());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (contribs.isEmpty()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return contribs.get(contribs.size() - 1);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -30,4 +30,9 @@ public class TargetPackageStub implements TargetPackage {
|
|||||||
public TargetPlatform get(String platform) {
|
public TargetPlatform get(String platform) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasPlatform(TargetPlatform platform) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,12 @@ package cc.arduino.packages.contributions;
|
|||||||
import cc.arduino.contributions.packages.HostDependentDownloadableContribution;
|
import cc.arduino.contributions.packages.HostDependentDownloadableContribution;
|
||||||
|
|
||||||
public class HostDependentDownloadableContributionStub extends HostDependentDownloadableContribution {
|
public class HostDependentDownloadableContributionStub extends HostDependentDownloadableContribution {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getVersion() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getHost() {
|
public String getHost() {
|
||||||
return null;
|
return null;
|
||||||
|
@ -0,0 +1,16 @@
|
|||||||
|
package cc.arduino.contributions;
|
||||||
|
|
||||||
|
import cc.arduino.contributions.packages.DownloadableContribution;
|
||||||
|
|
||||||
|
import java.util.Comparator;
|
||||||
|
|
||||||
|
public class DownloadableContributionBuiltInAtTheBottomComparator implements Comparator<DownloadableContribution> {
|
||||||
|
@Override
|
||||||
|
public int compare(DownloadableContribution p1, DownloadableContribution p2) {
|
||||||
|
if (p1.isReadOnly() == p2.isReadOnly()) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return p1.isReadOnly() ? 1 : -1;
|
||||||
|
}
|
||||||
|
}
|
@ -47,8 +47,8 @@ public class VersionComparator implements Comparator<String> {
|
|||||||
if (b == null)
|
if (b == null)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
Version versionA = valueOf(a);
|
Version versionA = VersionHelper.valueOf(a);
|
||||||
Version versionB = valueOf(b);
|
Version versionB = VersionHelper.valueOf(b);
|
||||||
|
|
||||||
return versionA.compareTo(versionB);
|
return versionA.compareTo(versionB);
|
||||||
}
|
}
|
||||||
@ -65,26 +65,10 @@ public class VersionComparator implements Comparator<String> {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Version versionA = valueOf(a);
|
Version versionA = VersionHelper.valueOf(a);
|
||||||
Version versionB = valueOf(b);
|
Version versionB = VersionHelper.valueOf(b);
|
||||||
|
|
||||||
return versionA.greaterThan(versionB);
|
return versionA.greaterThan(versionB);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Version valueOf(String ver) {
|
|
||||||
if (ver.endsWith("b")) {
|
|
||||||
ver = ver.substring(0, ver.lastIndexOf("b")) + ".1";
|
|
||||||
}
|
|
||||||
String[] verParts = ver.split("\\.");
|
|
||||||
if (verParts.length < 3) {
|
|
||||||
if (verParts.length == 2) {
|
|
||||||
return Version.forIntegers(Integer.valueOf(verParts[0]), Integer.valueOf(verParts[1]));
|
|
||||||
} else {
|
|
||||||
return Version.forIntegers(Integer.valueOf(verParts[0]));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return Version.valueOf(ver);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
23
arduino-core/src/cc/arduino/contributions/VersionHelper.java
Normal file
23
arduino-core/src/cc/arduino/contributions/VersionHelper.java
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
package cc.arduino.contributions;
|
||||||
|
|
||||||
|
import com.github.zafarkhaja.semver.Version;
|
||||||
|
|
||||||
|
public class VersionHelper {
|
||||||
|
|
||||||
|
public static Version valueOf(String ver) {
|
||||||
|
if (ver == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
String[] verParts = ver.split("\\.");
|
||||||
|
if (verParts.length < 3) {
|
||||||
|
if (verParts.length == 2) {
|
||||||
|
return Version.forIntegers(Integer.valueOf(verParts[0]), Integer.valueOf(verParts[1]));
|
||||||
|
} else {
|
||||||
|
return Version.forIntegers(Integer.valueOf(verParts[0]));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return Version.valueOf(ver);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
package cc.arduino.contributions.filters;
|
||||||
|
|
||||||
|
import cc.arduino.contributions.packages.DownloadableContribution;
|
||||||
|
import com.google.common.base.Predicate;
|
||||||
|
|
||||||
|
public class BuiltInPredicate implements Predicate<DownloadableContribution> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean apply(DownloadableContribution input) {
|
||||||
|
return input.isReadOnly();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj) {
|
||||||
|
return obj instanceof BuiltInPredicate;
|
||||||
|
}
|
||||||
|
}
|
@ -40,8 +40,6 @@ public abstract class ContributedLibrary extends DownloadableContribution {
|
|||||||
|
|
||||||
public abstract String getName();
|
public abstract String getName();
|
||||||
|
|
||||||
public abstract String getVersion();
|
|
||||||
|
|
||||||
public abstract String getMaintainer();
|
public abstract String getMaintainer();
|
||||||
|
|
||||||
public abstract String getAuthor();
|
public abstract String getAuthor();
|
||||||
@ -64,16 +62,6 @@ public abstract class ContributedLibrary extends DownloadableContribution {
|
|||||||
|
|
||||||
public abstract List<ContributedLibraryReference> getRequires();
|
public abstract List<ContributedLibraryReference> getRequires();
|
||||||
|
|
||||||
private boolean readOnly;
|
|
||||||
|
|
||||||
public boolean isReadOnly() {
|
|
||||||
return readOnly;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setReadOnly(boolean readOnly) {
|
|
||||||
this.readOnly = readOnly;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final Comparator<ContributedLibrary> CASE_INSENSITIVE_ORDER = new Comparator<ContributedLibrary>() {
|
public static final Comparator<ContributedLibrary> CASE_INSENSITIVE_ORDER = new Comparator<ContributedLibrary>() {
|
||||||
@Override
|
@Override
|
||||||
public int compare(ContributedLibrary o1, ContributedLibrary o2) {
|
public int compare(ContributedLibrary o1, ContributedLibrary o2) {
|
||||||
|
@ -37,8 +37,6 @@ public abstract class ContributedPlatform extends DownloadableContribution {
|
|||||||
|
|
||||||
public abstract String getName();
|
public abstract String getName();
|
||||||
|
|
||||||
public abstract String getVersion();
|
|
||||||
|
|
||||||
public abstract String getCategory();
|
public abstract String getCategory();
|
||||||
|
|
||||||
public abstract String getArchitecture();
|
public abstract String getArchitecture();
|
||||||
|
@ -73,6 +73,11 @@ public class ContributedTargetPackage implements TargetPackage {
|
|||||||
return platforms.get(platform);
|
return platforms.get(platform);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasPlatform(TargetPlatform platform) {
|
||||||
|
return platforms.containsKey(platform.getId());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "TargetPackage: " + getId();
|
return "TargetPackage: " + getId();
|
||||||
|
@ -28,21 +28,27 @@
|
|||||||
*/
|
*/
|
||||||
package cc.arduino.contributions.packages;
|
package cc.arduino.contributions.packages;
|
||||||
|
|
||||||
|
import cc.arduino.contributions.DownloadableContributionBuiltInAtTheBottomComparator;
|
||||||
|
import cc.arduino.contributions.filters.BuiltInPredicate;
|
||||||
|
import cc.arduino.contributions.filters.InstalledPredicate;
|
||||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import com.fasterxml.jackson.module.mrbean.MrBeanModule;
|
import com.fasterxml.jackson.module.mrbean.MrBeanModule;
|
||||||
|
import com.google.common.base.Function;
|
||||||
|
import com.google.common.base.Predicates;
|
||||||
|
import com.google.common.collect.Collections2;
|
||||||
|
import com.google.common.collect.ImmutableListMultimap;
|
||||||
|
import com.google.common.collect.Multimaps;
|
||||||
import processing.app.debug.TargetPackage;
|
import processing.app.debug.TargetPackage;
|
||||||
import processing.app.debug.TargetPlatform;
|
import processing.app.debug.TargetPlatform;
|
||||||
import processing.app.debug.TargetPlatformException;
|
import processing.app.debug.TargetPlatformException;
|
||||||
|
import processing.app.helpers.PreferencesMap;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import static processing.app.helpers.filefilters.OnlyDirs.ONLY_DIRS;
|
import static processing.app.helpers.filefilters.OnlyDirs.ONLY_DIRS;
|
||||||
|
|
||||||
@ -102,7 +108,47 @@ public class ContributionsIndexer {
|
|||||||
index = mapper.readValue(indexIn, ContributionsIndex.class);
|
index = mapper.readValue(indexIn, ContributionsIndex.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void syncWithFilesystem() {
|
public void syncWithFilesystem(File hardwareFolder) throws IOException {
|
||||||
|
syncBuiltInHardwareFolder(hardwareFolder);
|
||||||
|
|
||||||
|
syncLocalPackagesFolder();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void syncBuiltInHardwareFolder(File hardwareFolder) throws IOException {
|
||||||
|
for (File folder : hardwareFolder.listFiles(ONLY_DIRS)) {
|
||||||
|
ContributedPackage pack = index.findPackage(folder.getName());
|
||||||
|
if (pack != null) {
|
||||||
|
syncBuiltInPackageWithFilesystem(pack, folder);
|
||||||
|
|
||||||
|
File toolsFolder = new File(hardwareFolder, "tools");
|
||||||
|
if (toolsFolder.isDirectory()) {
|
||||||
|
for (File toolFolder : toolsFolder.listFiles(ONLY_DIRS)) {
|
||||||
|
File builtInToolsMetadata = new File(toolFolder, "builtin_tools_versions.txt");
|
||||||
|
if (builtInToolsMetadata.isFile()) {
|
||||||
|
PreferencesMap toolsMetadata = new PreferencesMap(builtInToolsMetadata).subTree(pack.getName());
|
||||||
|
for (Map.Entry<String, String> toolMetadata : toolsMetadata.entrySet()) {
|
||||||
|
syncToolWithFilesystem(pack, toolFolder, toolMetadata.getKey(), toolMetadata.getValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void syncBuiltInPackageWithFilesystem(ContributedPackage pack, File hardwareFolder) throws IOException {
|
||||||
|
// Scan all hardware folders and mark as installed all the tools found.
|
||||||
|
for (File platformFolder : hardwareFolder.listFiles(ONLY_DIRS)) {
|
||||||
|
File platformTxt = new File(platformFolder, "platform.txt");
|
||||||
|
String version = new PreferencesMap(platformTxt).get("version");
|
||||||
|
ContributedPlatform platform = syncHardwareWithFilesystem(pack, platformFolder, platformFolder.getName(), version);
|
||||||
|
if (platform != null) {
|
||||||
|
platform.setReadOnly(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void syncLocalPackagesFolder() {
|
||||||
if (!packagesFolder.isDirectory())
|
if (!packagesFolder.isDirectory())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -110,8 +156,9 @@ public class ContributionsIndexer {
|
|||||||
// platforms found.
|
// platforms found.
|
||||||
for (File folder : packagesFolder.listFiles(ONLY_DIRS)) {
|
for (File folder : packagesFolder.listFiles(ONLY_DIRS)) {
|
||||||
ContributedPackage pack = index.findPackage(folder.getName());
|
ContributedPackage pack = index.findPackage(folder.getName());
|
||||||
if (pack != null)
|
if (pack != null) {
|
||||||
syncPackageWithFilesystem(pack, folder);
|
syncPackageWithFilesystem(pack, folder);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -120,8 +167,9 @@ public class ContributionsIndexer {
|
|||||||
File hardwareFolder = new File(root, "hardware");
|
File hardwareFolder = new File(root, "hardware");
|
||||||
if (hardwareFolder.isDirectory()) {
|
if (hardwareFolder.isDirectory()) {
|
||||||
for (File platformFolder : hardwareFolder.listFiles(ONLY_DIRS)) {
|
for (File platformFolder : hardwareFolder.listFiles(ONLY_DIRS)) {
|
||||||
for (File versionFolder : platformFolder.listFiles(ONLY_DIRS))
|
for (File versionFolder : platformFolder.listFiles(ONLY_DIRS)) {
|
||||||
syncHardwareWithFilesystem(pack, platformFolder, versionFolder);
|
syncHardwareWithFilesystem(pack, versionFolder, platformFolder.getName(), versionFolder.getName());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -129,39 +177,35 @@ public class ContributionsIndexer {
|
|||||||
File toolsFolder = new File(root, "tools");
|
File toolsFolder = new File(root, "tools");
|
||||||
if (toolsFolder.isDirectory()) {
|
if (toolsFolder.isDirectory()) {
|
||||||
for (File toolFolder : toolsFolder.listFiles(ONLY_DIRS)) {
|
for (File toolFolder : toolsFolder.listFiles(ONLY_DIRS)) {
|
||||||
for (File versionFolder : toolFolder.listFiles(ONLY_DIRS))
|
for (File versionFolder : toolFolder.listFiles(ONLY_DIRS)) {
|
||||||
syncToolWithFilesystem(pack, toolFolder, versionFolder);
|
syncToolWithFilesystem(pack, versionFolder, toolFolder.getName(), versionFolder.getName());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void syncToolWithFilesystem(ContributedPackage pack, File toolFolder,
|
private void syncToolWithFilesystem(ContributedPackage pack, File installationFolder, String toolName, String version) {
|
||||||
File versionFolder) {
|
ContributedTool tool = pack.findTool(toolName, version);
|
||||||
ContributedTool tool = pack.findTool(toolFolder.getName(),
|
if (tool == null) {
|
||||||
versionFolder.getName());
|
|
||||||
if (tool == null)
|
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
DownloadableContribution contrib = tool.getDownloadableContribution();
|
DownloadableContribution contrib = tool.getDownloadableContribution();
|
||||||
if (contrib == null) {
|
if (contrib == null) {
|
||||||
System.err.println(tool +
|
System.err.println(tool + " seems to have no downloadable contributions for your operating system, but it is installed in\n" + installationFolder);
|
||||||
" seems to have no downloadable contributions for your " +
|
|
||||||
"operating system, but it is installed in\n" + versionFolder);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
contrib.setInstalled(true);
|
contrib.setInstalled(true);
|
||||||
contrib.setInstalledFolder(versionFolder);
|
contrib.setInstalledFolder(installationFolder);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void syncHardwareWithFilesystem(ContributedPackage pack,
|
private ContributedPlatform syncHardwareWithFilesystem(ContributedPackage pack, File installationFolder, String architecture, String version) {
|
||||||
File platformFolder,
|
|
||||||
File versionFolder) {
|
|
||||||
String architecture = platformFolder.getName();
|
|
||||||
String version = versionFolder.getName();
|
|
||||||
ContributedPlatform platform = pack.findPlatform(architecture, version);
|
ContributedPlatform platform = pack.findPlatform(architecture, version);
|
||||||
if (platform != null) {
|
if (platform != null) {
|
||||||
platform.setInstalled(true);
|
platform.setInstalled(true);
|
||||||
platform.setInstalledFolder(versionFolder);
|
platform.setReadOnly(false);
|
||||||
|
platform.setInstalledFolder(installationFolder);
|
||||||
}
|
}
|
||||||
|
return platform;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -170,28 +214,29 @@ public class ContributionsIndexer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public List<TargetPackage> createTargetPackages() throws TargetPlatformException {
|
public List<TargetPackage> createTargetPackages() throws TargetPlatformException {
|
||||||
List<TargetPackage> res = new ArrayList<TargetPackage>();
|
List<TargetPackage> packages = new ArrayList<TargetPackage>();
|
||||||
|
|
||||||
for (ContributedPackage pack : index.getPackages()) {
|
for (ContributedPackage aPackage : index.getPackages()) {
|
||||||
ContributedTargetPackage targetPackage;
|
ContributedTargetPackage targetPackage = new ContributedTargetPackage(aPackage.getName());
|
||||||
targetPackage = new ContributedTargetPackage(pack.getName());
|
|
||||||
|
|
||||||
for (ContributedPlatform platform : pack.getPlatforms()) {
|
List<ContributedPlatform> platforms = new LinkedList<ContributedPlatform>(Collections2.filter(aPackage.getPlatforms(), new InstalledPredicate()));
|
||||||
if (!platform.isInstalled())
|
Collections.sort(platforms, new DownloadableContributionBuiltInAtTheBottomComparator());
|
||||||
continue;
|
|
||||||
|
|
||||||
|
for (ContributedPlatform platform : platforms) {
|
||||||
String arch = platform.getArchitecture();
|
String arch = platform.getArchitecture();
|
||||||
File folder = platform.getInstalledFolder();
|
File folder = platform.getInstalledFolder();
|
||||||
|
|
||||||
TargetPlatform targetPlatform;
|
TargetPlatform targetPlatform = new ContributedTargetPlatform(arch, folder, targetPackage, index);
|
||||||
targetPlatform = new ContributedTargetPlatform(arch, folder, targetPackage, index);
|
if (!targetPackage.hasPlatform(targetPlatform)) {
|
||||||
targetPackage.addPlatform(targetPlatform);
|
targetPackage.addPlatform(targetPlatform);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (targetPackage.hasPlatforms())
|
if (targetPackage.hasPlatforms()) {
|
||||||
res.add(targetPackage);
|
packages.add(targetPackage);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return res;
|
return packages;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -217,11 +262,21 @@ public class ContributionsIndexer {
|
|||||||
public Set<ContributedTool> getInstalledTools() {
|
public Set<ContributedTool> getInstalledTools() {
|
||||||
Set<ContributedTool> tools = new HashSet<ContributedTool>();
|
Set<ContributedTool> tools = new HashSet<ContributedTool>();
|
||||||
for (ContributedPackage pack : index.getPackages()) {
|
for (ContributedPackage pack : index.getPackages()) {
|
||||||
for (ContributedPlatform platform : pack.getPlatforms()) {
|
Collection<ContributedPlatform> platforms = Collections2.filter(pack.getPlatforms(), new InstalledPredicate());
|
||||||
if (!platform.isInstalled())
|
ImmutableListMultimap<String, ContributedPlatform> platformsByName = Multimaps.index(platforms, new Function<ContributedPlatform, String>() {
|
||||||
continue;
|
@Override
|
||||||
for (ContributedTool tool : platform.getResolvedTools()) {
|
public String apply(ContributedPlatform contributedPlatform) {
|
||||||
tools.add(tool);
|
return contributedPlatform.getName();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
for (Map.Entry<String, Collection<ContributedPlatform>> entry : platformsByName.asMap().entrySet()) {
|
||||||
|
Collection<ContributedPlatform> platformsWithName = entry.getValue();
|
||||||
|
if (platformsWithName.size() > 1) {
|
||||||
|
platformsWithName = Collections2.filter(platformsWithName, Predicates.not(new BuiltInPredicate()));
|
||||||
|
}
|
||||||
|
for (ContributedPlatform platform : platformsWithName) {
|
||||||
|
tools.addAll(platform.getResolvedTools());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -40,6 +40,8 @@ public abstract class DownloadableContribution {
|
|||||||
|
|
||||||
public abstract String getUrl();
|
public abstract String getUrl();
|
||||||
|
|
||||||
|
public abstract String getVersion();
|
||||||
|
|
||||||
public abstract String getChecksum();
|
public abstract String getChecksum();
|
||||||
|
|
||||||
public abstract long getSize();
|
public abstract long getSize();
|
||||||
@ -78,6 +80,16 @@ public abstract class DownloadableContribution {
|
|||||||
this.installedFolder = installedFolder;
|
this.installedFolder = installedFolder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean readOnly;
|
||||||
|
|
||||||
|
public boolean isReadOnly() {
|
||||||
|
return readOnly;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setReadOnly(boolean readOnly) {
|
||||||
|
this.readOnly = readOnly;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
String res = "";
|
String res = "";
|
||||||
|
@ -578,12 +578,11 @@ public class BaseNoGui {
|
|||||||
static public void initPackages() throws Exception {
|
static public void initPackages() throws Exception {
|
||||||
indexer = new ContributionsIndexer(BaseNoGui.getSettingsFolder());
|
indexer = new ContributionsIndexer(BaseNoGui.getSettingsFolder());
|
||||||
File indexFile = indexer.getIndexFile();
|
File indexFile = indexer.getIndexFile();
|
||||||
File avrCoreFolder = FileUtils.newFile(indexFile.getParentFile(), "packages", "arduino", "hardware", "avr");
|
if (!indexFile.isFile()) {
|
||||||
if (!indexFile.isFile() || !(avrCoreFolder.exists() && avrCoreFolder.isDirectory())) {
|
File defaultPackageJsonFile = new File(getContentFile("dist"), "package_index.json");
|
||||||
File distFile = findDefaultPackageFile();
|
if (defaultPackageJsonFile.isFile()) {
|
||||||
if (distFile != null) {
|
FileUtils.copyFile(defaultPackageJsonFile, indexFile);
|
||||||
new ArchiveExtractor(getPlatform()).extract(distFile, BaseNoGui.getSettingsFolder(), 0, true);
|
} else {
|
||||||
} else if (!indexFile.isFile()) {
|
|
||||||
// Otherwise create an empty packages index
|
// Otherwise create an empty packages index
|
||||||
FileOutputStream out = null;
|
FileOutputStream out = null;
|
||||||
try {
|
try {
|
||||||
@ -598,7 +597,7 @@ public class BaseNoGui {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
indexer.parseIndex();
|
indexer.parseIndex();
|
||||||
indexer.syncWithFilesystem();
|
indexer.syncWithFilesystem(getHardwareFolder());
|
||||||
|
|
||||||
packages = new HashMap<String, TargetPackage>();
|
packages = new HashMap<String, TargetPackage>();
|
||||||
loadHardware(getHardwareFolder());
|
loadHardware(getHardwareFolder());
|
||||||
@ -626,18 +625,6 @@ public class BaseNoGui {
|
|||||||
librariesIndexer.parseIndex();
|
librariesIndexer.parseIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static File findDefaultPackageFile() {
|
|
||||||
File distFolder = getContentFile("dist");
|
|
||||||
if (!distFolder.exists()) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
File[] files = distFolder.listFiles(new OnlyFilesWithExtension("tar.bz2", "zip", "tar.gz", "tar"));
|
|
||||||
if (files.length > 1) {
|
|
||||||
throw new IllegalStateException("More than one file in " + distFolder);
|
|
||||||
}
|
|
||||||
return files[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
static protected void initPlatform() {
|
static protected void initPlatform() {
|
||||||
try {
|
try {
|
||||||
Class<?> platformClass = Class.forName("processing.app.Platform");
|
Class<?> platformClass = Class.forName("processing.app.Platform");
|
||||||
@ -697,7 +684,7 @@ public class BaseNoGui {
|
|||||||
try {
|
try {
|
||||||
packages.put(target, new LegacyTargetPackage(target, subfolder));
|
packages.put(target, new LegacyTargetPackage(target, subfolder));
|
||||||
} catch (TargetPlatformException e) {
|
} catch (TargetPlatformException e) {
|
||||||
System.out.println("WARNING: Error loading hardware folder " + target);
|
System.out.println("WARNING: Error loading hardware folder " + new File(folder, target));
|
||||||
System.out.println(" " + e.getMessage());
|
System.out.println(" " + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -777,12 +764,9 @@ public class BaseNoGui {
|
|||||||
PreferencesData.removeAllKeysWithPrefix(prefix);
|
PreferencesData.removeAllKeysWithPrefix(prefix);
|
||||||
|
|
||||||
for (ContributedTool tool : indexer.getInstalledTools()) {
|
for (ContributedTool tool : indexer.getInstalledTools()) {
|
||||||
String path = tool.getDownloadableContribution().getInstalledFolder()
|
String path = tool.getDownloadableContribution().getInstalledFolder().getAbsolutePath();
|
||||||
.getAbsolutePath();
|
PreferencesData.set(prefix + tool.getName() + ".path", path);
|
||||||
String toolId = tool.getName();
|
PreferencesData.set(prefix + tool.getName() + "-" + tool.getVersion() + ".path", path);
|
||||||
PreferencesData.set(prefix + toolId + ".path", path);
|
|
||||||
toolId += "-" + tool.getVersion();
|
|
||||||
PreferencesData.set(prefix + toolId + ".path", path);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,6 +77,11 @@ public class LegacyTargetPackage implements TargetPackage {
|
|||||||
return platforms.get(platform);
|
return platforms.get(platform);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasPlatform(TargetPlatform platform) {
|
||||||
|
return platforms.containsKey(platform.getId());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getId() {
|
public String getId() {
|
||||||
return id;
|
return id;
|
||||||
|
@ -25,12 +25,13 @@ import java.util.Map;
|
|||||||
|
|
||||||
public interface TargetPackage {
|
public interface TargetPackage {
|
||||||
|
|
||||||
public String getId();
|
String getId();
|
||||||
|
|
||||||
public Map<String, TargetPlatform> getPlatforms();
|
|
||||||
|
|
||||||
public Collection<TargetPlatform> platforms();
|
Map<String, TargetPlatform> getPlatforms();
|
||||||
|
|
||||||
public TargetPlatform get(String platform);
|
Collection<TargetPlatform> platforms();
|
||||||
|
|
||||||
|
TargetPlatform get(String platform);
|
||||||
|
|
||||||
|
boolean hasPlatform(TargetPlatform platform);
|
||||||
}
|
}
|
||||||
|
106
build/build.xml
106
build/build.xml
@ -160,9 +160,10 @@
|
|||||||
|
|
||||||
<!-- copy hardware folder -->
|
<!-- copy hardware folder -->
|
||||||
<target name="assemble-hardware" unless="light_bundle">
|
<target name="assemble-hardware" unless="light_bundle">
|
||||||
<mkdir dir="${staging_folder}/work/dist/bundled_package/packages/arduino/hardware/avr/1.6.3/"/>
|
<copy todir="${target.path}/hardware">
|
||||||
<copy todir="${staging_folder}/work/dist/bundled_package/packages/arduino/hardware/avr/1.6.3/">
|
<fileset dir="../hardware">
|
||||||
<fileset dir="../hardware/arduino/avr/"/>
|
<exclude name="arduino/sam/**"/>
|
||||||
|
</fileset>
|
||||||
</copy>
|
</copy>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
@ -348,8 +349,6 @@
|
|||||||
<param name="target.path" value="${staging_folder}/work/${staging_hardware_folder}/.." />
|
<param name="target.path" value="${staging_folder}/work/${staging_hardware_folder}/.." />
|
||||||
</antcall>
|
</antcall>
|
||||||
|
|
||||||
<antcall target="macosx-assemble-bundled-toolchain"/>
|
|
||||||
|
|
||||||
<antcall target="unzip">
|
<antcall target="unzip">
|
||||||
<param name="archive_file" value="./libastylej-2.05.zip" />
|
<param name="archive_file" value="./libastylej-2.05.zip" />
|
||||||
<param name="archive_url" value="http://arduino.cc/download.php?f=/libastylej-2.05.zip" />
|
<param name="archive_url" value="http://arduino.cc/download.php?f=/libastylej-2.05.zip" />
|
||||||
@ -368,33 +367,17 @@
|
|||||||
<antcall target="avr-toolchain-bundle">
|
<antcall target="avr-toolchain-bundle">
|
||||||
<param name="unpack_target" value="untar"/>
|
<param name="unpack_target" value="untar"/>
|
||||||
<param name="gcc_archive_file" value="avr-gcc-4.8.1-arduino3-i386-apple-darwin11.tar.bz2"/>
|
<param name="gcc_archive_file" value="avr-gcc-4.8.1-arduino3-i386-apple-darwin11.tar.bz2"/>
|
||||||
<param name="gcc_version" value="4.8.1-arduino3/"/>
|
<param name="gcc_version" value="4.8.1-arduino3"/>
|
||||||
<param name="avrdude_archive_file" value="avrdude-6.0.1-arduino3-i386-apple-darwin11.tar.bz2"/>
|
<param name="avrdude_archive_file" value="avrdude-6.0.1-arduino3-i386-apple-darwin11.tar.bz2"/>
|
||||||
<param name="avrdude_version" value="6.0.1-arduino3"/>
|
<param name="avrdude_version" value="6.0.1-arduino3"/>
|
||||||
</antcall>
|
</antcall>
|
||||||
|
|
||||||
<chmod perm="+x">
|
<chmod perm="+x">
|
||||||
<fileset dir="${staging_folder}/work/dist/bundled_package/packages/arduino/tools/" includes="**/bin/*"/>
|
<fileset dir="${staging_folder}/work/${staging_hardware_folder}/tools" includes="**/bin/*"/>
|
||||||
<fileset dir="${staging_folder}/work/dist/bundled_package/packages/arduino/tools/" includes="**/libexec/gcc/avr/4.8.1/*"/>
|
<fileset dir="${staging_folder}/work/${staging_hardware_folder}/tools" includes="**/libexec/gcc/avr/4.8.1/*"/>
|
||||||
</chmod>
|
</chmod>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="macosx-assemble-bundled-toolchain" unless="light_bundle">
|
|
||||||
<exec executable="tar" dir="${staging_folder}/work/dist/bundled_package/">
|
|
||||||
<arg value="-c"/>
|
|
||||||
<arg value="-z"/>
|
|
||||||
<arg value="-f"/>
|
|
||||||
<arg value="../default_package.tar.gz"/>
|
|
||||||
<arg value="./"/>
|
|
||||||
</exec>
|
|
||||||
|
|
||||||
<mkdir dir="macosx/work/${staging_hardware_folder}/../dist"/>
|
|
||||||
<move file="${staging_folder}/work/dist/default_package.tar.gz" todir="macosx/work/${staging_hardware_folder}/../dist"/>
|
|
||||||
<move file="${staging_folder}/work/dist/library_index.json" todir="macosx/work/${staging_hardware_folder}/../dist"/>
|
|
||||||
|
|
||||||
<delete dir="${staging_folder}/work/dist/"/>
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="macosx-old-run" depends="macosx-old-build" description="Run Mac OS X version">
|
<target name="macosx-old-run" depends="macosx-old-build" description="Run Mac OS X version">
|
||||||
<antcall target="macosx-run-common"/>
|
<antcall target="macosx-run-common"/>
|
||||||
</target>
|
</target>
|
||||||
@ -629,40 +612,20 @@
|
|||||||
<antcall target="avr-toolchain-bundle">
|
<antcall target="avr-toolchain-bundle">
|
||||||
<param name="unpack_target" value="untar"/>
|
<param name="unpack_target" value="untar"/>
|
||||||
<param name="gcc_archive_file" value="avr-gcc-4.8.1-arduino3-i686-pc-linux-gnu.tar.bz2"/>
|
<param name="gcc_archive_file" value="avr-gcc-4.8.1-arduino3-i686-pc-linux-gnu.tar.bz2"/>
|
||||||
<param name="gcc_version" value="4.8.1-arduino3/"/>
|
<param name="gcc_version" value="4.8.1-arduino3"/>
|
||||||
<param name="avrdude_archive_file" value="avrdude-6.0.1-arduino3-i686-pc-linux-gnu.tar.bz2"/>
|
<param name="avrdude_archive_file" value="avrdude-6.0.1-arduino3-i686-pc-linux-gnu.tar.bz2"/>
|
||||||
<param name="avrdude_version" value="6.0.1-arduino3"/>
|
<param name="avrdude_version" value="6.0.1-arduino3"/>
|
||||||
</antcall>
|
</antcall>
|
||||||
|
|
||||||
<exec executable="tar" dir="${staging_folder}/work/dist/bundled_package/">
|
|
||||||
<arg value="-c"/>
|
|
||||||
<arg value="-z"/>
|
|
||||||
<arg value="-f"/>
|
|
||||||
<arg value="../default_package.tar.gz"/>
|
|
||||||
<arg value="./"/>
|
|
||||||
</exec>
|
|
||||||
|
|
||||||
<delete dir="${staging_folder}/work/dist/bundled_package/"/>
|
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="linux64-build" depends="linux-build" unless="light_bundle" description="Build linux (64-bit) version">
|
<target name="linux64-build" depends="linux-build" unless="light_bundle" description="Build linux (64-bit) version">
|
||||||
<antcall target="avr-toolchain-bundle">
|
<antcall target="avr-toolchain-bundle">
|
||||||
<param name="unpack_target" value="untar"/>
|
<param name="unpack_target" value="untar"/>
|
||||||
<param name="gcc_archive_file" value="avr-gcc-4.8.1-arduino3-x86_64-pc-linux-gnu.tar.bz2"/>
|
<param name="gcc_archive_file" value="avr-gcc-4.8.1-arduino3-x86_64-pc-linux-gnu.tar.bz2"/>
|
||||||
<param name="gcc_version" value="4.8.1-arduino3/"/>
|
<param name="gcc_version" value="4.8.1-arduino3"/>
|
||||||
<param name="avrdude_archive_file" value="avrdude-6.0.1-arduino3-x86_64-pc-linux-gnu.tar.bz2"/>
|
<param name="avrdude_archive_file" value="avrdude-6.0.1-arduino3-x86_64-pc-linux-gnu.tar.bz2"/>
|
||||||
<param name="avrdude_version" value="6.0.1-arduino3"/>
|
<param name="avrdude_version" value="6.0.1-arduino3"/>
|
||||||
</antcall>
|
</antcall>
|
||||||
|
|
||||||
<exec executable="tar" dir="${staging_folder}/work/dist/bundled_package/">
|
|
||||||
<arg value="-c"/>
|
|
||||||
<arg value="-z"/>
|
|
||||||
<arg value="-f"/>
|
|
||||||
<arg value="../default_package.tar.gz"/>
|
|
||||||
<arg value="./"/>
|
|
||||||
</exec>
|
|
||||||
|
|
||||||
<delete dir="${staging_folder}/work/dist/bundled_package/"/>
|
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="linux32-run" depends="linux32-build" description="Run Linux (32-bit) version">
|
<target name="linux32-run" depends="linux32-build" description="Run Linux (32-bit) version">
|
||||||
@ -875,8 +838,6 @@
|
|||||||
<param name="target.path" value="windows/work" />
|
<param name="target.path" value="windows/work" />
|
||||||
</antcall>
|
</antcall>
|
||||||
|
|
||||||
<antcall target="windows-assemble-bundled-toolchain"/>
|
|
||||||
|
|
||||||
<delete dir="windows/launcher/launch4j"/>
|
<delete dir="windows/launcher/launch4j"/>
|
||||||
<antcall target="download-${launch4j-download-unpack-target-name}" />
|
<antcall target="download-${launch4j-download-unpack-target-name}" />
|
||||||
|
|
||||||
@ -904,20 +865,12 @@
|
|||||||
<antcall target="avr-toolchain-bundle">
|
<antcall target="avr-toolchain-bundle">
|
||||||
<param name="unpack_target" value="unzip"/>
|
<param name="unpack_target" value="unzip"/>
|
||||||
<param name="gcc_archive_file" value="avr-gcc-4.8.1-arduino3-i686-mingw32.zip"/>
|
<param name="gcc_archive_file" value="avr-gcc-4.8.1-arduino3-i686-mingw32.zip"/>
|
||||||
<param name="gcc_version" value="4.8.1-arduino3/"/>
|
<param name="gcc_version" value="4.8.1-arduino3"/>
|
||||||
<param name="avrdude_archive_file" value="avrdude-6.0.1-arduino3-i686-mingw32.zip"/>
|
<param name="avrdude_archive_file" value="avrdude-6.0.1-arduino3-i686-mingw32.zip"/>
|
||||||
<param name="avrdude_version" value="6.0.1-arduino3"/>
|
<param name="avrdude_version" value="6.0.1-arduino3"/>
|
||||||
</antcall>
|
</antcall>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="windows-assemble-bundled-toolchain" unless="light_bundle">
|
|
||||||
<exec executable="zip" dir="${staging_folder}/work/dist/bundled_package/">
|
|
||||||
<arg line="-q -r ../default_package.zip ." />
|
|
||||||
</exec>
|
|
||||||
|
|
||||||
<delete dir="${staging_folder}/work/dist/bundled_package/"/>
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="windows-run" depends="windows-build"
|
<target name="windows-run" depends="windows-build"
|
||||||
description="Run windows version">
|
description="Run windows version">
|
||||||
<exec executable="windows/work/arduino.exe"
|
<exec executable="windows/work/arduino.exe"
|
||||||
@ -991,27 +944,46 @@
|
|||||||
|
|
||||||
<target name="avr-toolchain-bundle" unless="light_bundle">
|
<target name="avr-toolchain-bundle" unless="light_bundle">
|
||||||
<!-- Unzip AVR tools -->
|
<!-- Unzip AVR tools -->
|
||||||
<mkdir dir="${staging_folder}/work/dist/bundled_package/packages/arduino/tools/avr-gcc/"/>
|
<mkdir dir="${staging_folder}/work/${staging_hardware_folder}/tmp/gcc"/>
|
||||||
<mkdir dir="${staging_folder}/work/dist/bundled_package/packages/arduino/tools/avrdude/"/>
|
|
||||||
|
|
||||||
<antcall target="${unpack_target}">
|
<antcall target="${unpack_target}">
|
||||||
<param name="archive_file" value="${staging_folder}/${gcc_archive_file}"/>
|
<param name="archive_file" value="${staging_folder}/${gcc_archive_file}"/>
|
||||||
<param name="archive_url" value="http://arduino.cc/download.php?f=/tools/${gcc_archive_file}"/>
|
<param name="archive_url" value="http://arduino.cc/download.php?f=/tools/${gcc_archive_file}"/>
|
||||||
<param name="final_folder" value="${staging_folder}/work/dist/bundled_package/packages/arduino/tools/avr-gcc/${gcc_version}/"/>
|
<param name="final_folder" value="${staging_folder}/work/${staging_hardware_folder}/tmp/gcc/${gcc_version}/"/>
|
||||||
<param name="dest_folder" value="${staging_folder}/work/dist/bundled_package/packages/arduino/tools/avr-gcc/"/>
|
<param name="dest_folder" value="${staging_folder}/work/${staging_hardware_folder}/tmp/gcc/"/>
|
||||||
</antcall>
|
</antcall>
|
||||||
<move file="${staging_folder}/work/dist/bundled_package/packages/arduino/tools/avr-gcc/avr" tofile="${staging_folder}/work/dist/bundled_package/packages/arduino/tools/avr-gcc/${gcc_version}"/>
|
|
||||||
|
<mkdir dir="${staging_folder}/work/${staging_hardware_folder}/tmp/avrdude"/>
|
||||||
|
|
||||||
<antcall target="${unpack_target}">
|
<antcall target="${unpack_target}">
|
||||||
<param name="archive_file" value="${staging_folder}/${avrdude_archive_file}"/>
|
<param name="archive_file" value="${staging_folder}/${avrdude_archive_file}"/>
|
||||||
<param name="archive_url" value="http://arduino.cc/download.php?f=/tools/${avrdude_archive_file}"/>
|
<param name="archive_url" value="http://arduino.cc/download.php?f=/tools/${avrdude_archive_file}"/>
|
||||||
<param name="final_folder" value="${staging_folder}/work/dist/bundled_package/packages/arduino/tools/avrdude/${avrdude_version}"/>
|
<param name="final_folder" value="${staging_folder}/work/${staging_hardware_folder}/tmp/avrdude/${avrdude_version}"/>
|
||||||
<param name="dest_folder" value="${staging_folder}/work/dist/bundled_package/packages/arduino/tools/avrdude/"/>
|
<param name="dest_folder" value="${staging_folder}/work/${staging_hardware_folder}/tmp/avrdude/"/>
|
||||||
</antcall>
|
</antcall>
|
||||||
<move file="${staging_folder}/work/dist/bundled_package/packages/arduino/tools/avrdude/avrdude-6.0.1" tofile="${staging_folder}/work/dist/bundled_package/packages/arduino/tools/avrdude/${avrdude_version}"/>
|
|
||||||
|
|
||||||
<copy file="shared/bundled_package_index.json" tofile="${staging_folder}/work/dist/bundled_package/package_index.json"/>
|
<move file="${staging_folder}/work/${staging_hardware_folder}/tmp/gcc/avr" tofile="${staging_folder}/work/${staging_hardware_folder}/tools/avr"/>
|
||||||
<copy file="shared/bundled_library_index.json" tofile="${staging_folder}/work/dist/library_index.json"/>
|
<move file="${staging_folder}/work/${staging_hardware_folder}/tmp/avrdude/avrdude-6.0.1" tofile="${staging_folder}/work/${staging_hardware_folder}/tools/avr"/>
|
||||||
|
<antcall target="macosx-fix-bundled-toolchain-missing-symlinks"/>
|
||||||
|
|
||||||
|
<echo append="true" file="${staging_folder}/work/${staging_hardware_folder}/tools/avr/builtin_tools_versions.txt" message="arduino.avrdude=${avrdude_version}${line.separator}"/>
|
||||||
|
<echo append="true" file="${staging_folder}/work/${staging_hardware_folder}/tools/avr/builtin_tools_versions.txt" message="arduino.avr-gcc=${gcc_version}${line.separator}"/>
|
||||||
|
|
||||||
|
<copy file="shared/bundled_package_index.json" tofile="${staging_folder}/work/${staging_hardware_folder}/../dist/package_index.json"/>
|
||||||
|
<copy file="shared/bundled_library_index.json" tofile="${staging_folder}/work/${staging_hardware_folder}/../dist/library_index.json"/>
|
||||||
|
|
||||||
|
<delete dir="${staging_folder}/work/${staging_hardware_folder}/tmp"/>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="macosx-fix-bundled-toolchain-missing-symlinks" if="macosx">
|
||||||
|
<exec executable="mv">
|
||||||
|
<arg value="${staging_folder}/work/${staging_hardware_folder}/tmp/avrdude/avrdude-6.0.1/lib/libusb.dylib"/>
|
||||||
|
<arg value="${staging_folder}/work/${staging_hardware_folder}/tools/avr/lib/"/>
|
||||||
|
</exec>
|
||||||
|
<exec executable="mv">
|
||||||
|
<arg value="${staging_folder}/work/${staging_hardware_folder}/tmp/avrdude/avrdude-6.0.1/lib/libusb-1.0.dylib"/>
|
||||||
|
<arg value="${staging_folder}/work/${staging_hardware_folder}/tools/avr/lib/"/>
|
||||||
|
</exec>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
Loading…
Reference in New Issue
Block a user