mirror of
https://github.com/arduino/Arduino.git
synced 2024-12-02 13:24:12 +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;
|
||||
|
||||
import cc.arduino.contributions.VersionComparator;
|
||||
import cc.arduino.contributions.VersionHelper;
|
||||
import cc.arduino.contributions.filters.InstalledPredicate;
|
||||
import cc.arduino.contributions.libraries.ContributedLibrary;
|
||||
import cc.arduino.contributions.libraries.ContributedLibraryComparator;
|
||||
import cc.arduino.contributions.libraries.filters.BuiltInPredicate;
|
||||
import cc.arduino.contributions.libraries.filters.InstalledLibraryPredicate;
|
||||
import cc.arduino.contributions.filters.BuiltInPredicate;
|
||||
import cc.arduino.contributions.libraries.filters.OnlyUpstreamReleasePredicate;
|
||||
import cc.arduino.contributions.ui.InstallerTableCell;
|
||||
import cc.arduino.contributions.ui.listeners.DelegatingKeyListener;
|
||||
import cc.arduino.utils.ReverseComparator;
|
||||
import com.github.zafarkhaja.semver.Version;
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.base.Predicates;
|
||||
import com.google.common.collect.Collections2;
|
||||
@ -66,7 +67,6 @@ import static processing.app.I18n.format;
|
||||
@SuppressWarnings("serial")
|
||||
public class ContributedLibraryTableCell extends InstallerTableCell {
|
||||
|
||||
private final LibraryManagerUI indexer;
|
||||
private JPanel panel;
|
||||
private JButton installButton;
|
||||
private Component installButtonPlaceholder;
|
||||
@ -77,9 +77,7 @@ public class ContributedLibraryTableCell extends InstallerTableCell {
|
||||
private JPanel inactiveButtonsPanel;
|
||||
private JLabel statusLabel;
|
||||
|
||||
public ContributedLibraryTableCell(LibraryManagerUI indexer) {
|
||||
this.indexer = indexer;
|
||||
|
||||
public ContributedLibraryTableCell() {
|
||||
{
|
||||
installButton = new JButton(_("Install"));
|
||||
installButton.addActionListener(new ActionListener() {
|
||||
@ -359,7 +357,7 @@ public class ContributedLibraryTableCell extends InstallerTableCell {
|
||||
|
||||
// ...version.
|
||||
if (installed != null) {
|
||||
String installedVer = installed.getVersion();
|
||||
Version installedVer = VersionHelper.valueOf(installed.getVersion());
|
||||
if (installedVer == null) {
|
||||
desc += " " + _("Version unknown");
|
||||
} else {
|
||||
|
@ -1,20 +1,20 @@
|
||||
package cc.arduino.contributions.libraries.ui;
|
||||
|
||||
import cc.arduino.contributions.libraries.ContributedLibrary;
|
||||
import cc.arduino.contributions.libraries.filters.BuiltInPredicate;
|
||||
import cc.arduino.contributions.filters.BuiltInPredicate;
|
||||
import cc.arduino.contributions.packages.DownloadableContribution;
|
||||
import cc.arduino.contributions.ui.DropdownItem;
|
||||
import com.google.common.base.Predicate;
|
||||
|
||||
import static processing.app.I18n._;
|
||||
|
||||
public class DropdownBuiltInLibrariesItem implements DropdownItem<ContributedLibrary> {
|
||||
public class DropdownBuiltInLibrariesItem implements DropdownItem<DownloadableContribution> {
|
||||
|
||||
public String toString() {
|
||||
return _("Built-in");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Predicate<ContributedLibrary> getFilterPredicate() {
|
||||
public Predicate<DownloadableContribution> getFilterPredicate() {
|
||||
return new BuiltInPredicate();
|
||||
}
|
||||
}
|
||||
|
@ -28,16 +28,22 @@
|
||||
*/
|
||||
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.LibrariesIndexer;
|
||||
import cc.arduino.contributions.packages.ContributedPlatform;
|
||||
import cc.arduino.contributions.ui.FilteredAbstractTableModel;
|
||||
import com.github.zafarkhaja.semver.Version;
|
||||
import com.google.common.base.Predicate;
|
||||
import com.google.common.base.Predicates;
|
||||
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")
|
||||
public class LibrariesIndexTableModel extends FilteredAbstractTableModel<ContributedLibrary> {
|
||||
@ -45,13 +51,18 @@ public class LibrariesIndexTableModel extends FilteredAbstractTableModel<Contrib
|
||||
public final static int DESCRIPTION_COL = 0;
|
||||
|
||||
public static class ContributedLibraryReleases implements Comparable<ContributedLibraryReleases> {
|
||||
|
||||
public final String name;
|
||||
public final List<ContributedLibrary> releases = new ArrayList<ContributedLibrary>();
|
||||
public final List<String> versions = new ArrayList<String>();
|
||||
public ContributedLibrary selected = null;
|
||||
public final List<ContributedLibrary> releases;
|
||||
public final List<Version> versions;
|
||||
|
||||
public ContributedLibrary selected;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@ -61,40 +72,28 @@ public class LibrariesIndexTableModel extends FilteredAbstractTableModel<Contrib
|
||||
|
||||
public void add(ContributedLibrary library) {
|
||||
releases.add(library);
|
||||
versions.add(library.getVersion());
|
||||
Version version = VersionHelper.valueOf(library.getVersion());
|
||||
if (version != null) {
|
||||
versions.add(version);
|
||||
}
|
||||
selected = getLatest();
|
||||
}
|
||||
|
||||
public ContributedLibrary getInstalled() {
|
||||
List<ContributedLibrary> installedReleases = new LinkedList<ContributedLibrary>(Collections2.filter(releases, new Predicate<ContributedLibrary>() {
|
||||
@Override
|
||||
public boolean apply(ContributedLibrary contributedLibrary) {
|
||||
return contributedLibrary.isInstalled();
|
||||
}
|
||||
}));
|
||||
List<ContributedLibrary> installedReleases = new LinkedList<ContributedLibrary>(Collections2.filter(releases, new InstalledPredicate()));
|
||||
Collections.sort(installedReleases, new DownloadableContributionBuiltInAtTheBottomComparator());
|
||||
|
||||
return getLatestOf(installedReleases);
|
||||
if (installedReleases.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return installedReleases.get(0);
|
||||
}
|
||||
|
||||
public ContributedLibrary getLatest() {
|
||||
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() {
|
||||
return selected;
|
||||
}
|
||||
@ -223,7 +222,7 @@ public class LibrariesIndexTableModel extends FilteredAbstractTableModel<Contrib
|
||||
return col == DESCRIPTION_COL;
|
||||
}
|
||||
|
||||
public List<String> getReleasesVersions(int row) {
|
||||
public List<Version> getReleasesVersions(int row) {
|
||||
return contributions.get(row).versions;
|
||||
}
|
||||
|
||||
|
@ -61,12 +61,12 @@ public class LibraryManagerUI extends InstallerJDialog<ContributedLibrary> {
|
||||
|
||||
@Override
|
||||
protected InstallerTableCell createCellRenderer() {
|
||||
return new ContributedLibraryTableCell(this);
|
||||
return new ContributedLibraryTableCell();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected InstallerTableCell createCellEditor() {
|
||||
return new ContributedLibraryTableCell(this) {
|
||||
return new ContributedLibraryTableCell() {
|
||||
@Override
|
||||
protected void onInstall(ContributedLibrary selectedLibrary, ContributedLibrary installedLibrary) {
|
||||
if (selectedLibrary.isReadOnly()) {
|
||||
|
@ -29,7 +29,9 @@
|
||||
package cc.arduino.contributions.packages.ui;
|
||||
|
||||
import cc.arduino.contributions.VersionComparator;
|
||||
import cc.arduino.contributions.VersionHelper;
|
||||
import cc.arduino.contributions.filters.InstalledPredicate;
|
||||
import cc.arduino.contributions.filters.BuiltInPredicate;
|
||||
import cc.arduino.contributions.packages.ContributedBoard;
|
||||
import cc.arduino.contributions.packages.ContributedPlatform;
|
||||
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> 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)) {
|
||||
uninstalledReleases.addAll(installedBuiltIn);
|
||||
@ -330,8 +332,7 @@ public class ContributedPlatformTableCell extends InstallerTableCell {
|
||||
upgradable = false;
|
||||
} else {
|
||||
installable = false;
|
||||
//removable = !installed.isReadOnly() && !hasBuiltInRelease;
|
||||
removable = !hasBuiltInRelease;
|
||||
removable = !installed.isReadOnly() && !hasBuiltInRelease;
|
||||
upgradable = new ContributedPlatformComparator().compare(selected, installed) > 0;
|
||||
}
|
||||
if (installable) {
|
||||
@ -352,17 +353,18 @@ public class ContributedPlatformTableCell extends InstallerTableCell {
|
||||
if (author != null && !author.isEmpty()) {
|
||||
desc += " " + format("by <b>{0}</b>", author);
|
||||
}
|
||||
if (removable) {
|
||||
desc += " " + format(_("version <b>{0}</b>"), installed.getVersion()) + " <strong><font color=\"#00979D\">INSTALLED</font></strong>";
|
||||
if (installed != null) {
|
||||
desc += " " + format(_("version <b>{0}</b>"), VersionHelper.valueOf(installed.getVersion())) + " <strong><font color=\"#00979D\">INSTALLED</font></strong>";
|
||||
}
|
||||
desc += "<br />";
|
||||
|
||||
desc += _("Boards included in this package:") + "<br />";
|
||||
for (ContributedBoard board : selected.getBoards())
|
||||
desc += format("{0}, ", board.getName());
|
||||
for (ContributedBoard board : selected.getBoards()) {
|
||||
desc += board.getName() + ", ";
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -28,34 +28,40 @@
|
||||
*/
|
||||
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.ContributedPlatform;
|
||||
import cc.arduino.contributions.packages.ContributionsIndex;
|
||||
import cc.arduino.contributions.ui.FilteredAbstractTableModel;
|
||||
import com.github.zafarkhaja.semver.Version;
|
||||
import com.google.common.base.Predicate;
|
||||
import com.google.common.base.Predicates;
|
||||
import com.google.common.collect.Collections2;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import static processing.app.I18n._;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class ContributionIndexTableModel extends FilteredAbstractTableModel<ContributedPlatform> {
|
||||
|
||||
public final static int DESCRIPTION_COL = 0;
|
||||
|
||||
public static class ContributedPlatformReleases {
|
||||
public ContributedPackage packager;
|
||||
public String arch;
|
||||
public List<ContributedPlatform> releases = new ArrayList<ContributedPlatform>();
|
||||
public List<String> versions = new ArrayList<String>();
|
||||
public final ContributedPackage packager;
|
||||
public final String arch;
|
||||
public final List<ContributedPlatform> releases;
|
||||
public final List<Version> versions;
|
||||
public ContributedPlatform selected = null;
|
||||
|
||||
public ContributedPlatformReleases(ContributedPlatform platform) {
|
||||
packager = platform.getParentPackage();
|
||||
arch = platform.getArchitecture();
|
||||
this.packager = platform.getParentPackage();
|
||||
this.arch = platform.getArchitecture();
|
||||
this.releases = new LinkedList<ContributedPlatform>();
|
||||
this.versions = new LinkedList<Version>();
|
||||
add(platform);
|
||||
}
|
||||
|
||||
@ -67,39 +73,26 @@ public class ContributionIndexTableModel extends FilteredAbstractTableModel<Cont
|
||||
|
||||
public void add(ContributedPlatform platform) {
|
||||
releases.add(platform);
|
||||
versions.add(platform.getVersion());
|
||||
Version version = VersionHelper.valueOf(platform.getVersion());
|
||||
if (version != null) {
|
||||
versions.add(version);
|
||||
}
|
||||
selected = getLatest();
|
||||
}
|
||||
|
||||
public ContributedPlatform getInstalled() {
|
||||
List<ContributedPlatform> installedPlatforms = new LinkedList<ContributedPlatform>();
|
||||
for (ContributedPlatform platform : releases) {
|
||||
if (platform.isInstalled()) {
|
||||
installedPlatforms.add(platform);
|
||||
}
|
||||
List<ContributedPlatform> installedReleases = new LinkedList<ContributedPlatform>(Collections2.filter(releases, new InstalledPredicate()));
|
||||
Collections.sort(installedReleases, new DownloadableContributionBuiltInAtTheBottomComparator());
|
||||
|
||||
if (installedReleases.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (installedPlatforms.size() > 1) {
|
||||
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;
|
||||
return installedReleases.get(0);
|
||||
}
|
||||
|
||||
public ContributedPlatform getLatest() {
|
||||
ContributedPlatform latest = null;
|
||||
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;
|
||||
return getLatestOf(releases);
|
||||
}
|
||||
|
||||
public ContributedPlatform getSelected() {
|
||||
@ -224,7 +217,7 @@ public class ContributionIndexTableModel extends FilteredAbstractTableModel<Cont
|
||||
return col == DESCRIPTION_COL;
|
||||
}
|
||||
|
||||
public List<String> getReleasesVersions(int row) {
|
||||
public List<Version> getReleasesVersions(int row) {
|
||||
return contributions.get(row).versions;
|
||||
}
|
||||
|
||||
|
@ -66,13 +66,17 @@ public class ContributionManagerUI extends InstallerJDialog {
|
||||
protected InstallerTableCell createCellEditor() {
|
||||
return new ContributedPlatformTableCell() {
|
||||
@Override
|
||||
protected void onInstall(ContributedPlatform selectedPlatform, ContributedPlatform installed) {
|
||||
onInstallPressed(selectedPlatform, installed);
|
||||
protected void onInstall(ContributedPlatform selected, ContributedPlatform installed) {
|
||||
if (selected.isReadOnly()) {
|
||||
onRemovePressed(installed, false);
|
||||
} else {
|
||||
onInstallPressed(selected, installed);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onRemove(ContributedPlatform installedPlatform) {
|
||||
onRemovePressed(installedPlatform);
|
||||
onRemovePressed(installedPlatform, true);
|
||||
}
|
||||
};
|
||||
}
|
||||
@ -157,7 +161,7 @@ public class ContributionManagerUI extends InstallerJDialog {
|
||||
try {
|
||||
setProgressVisible(true, _("Installing..."));
|
||||
installer.install(platformToInstall);
|
||||
if (platformToRemove != null) {
|
||||
if (platformToRemove != null && !platformToRemove.isReadOnly()) {
|
||||
installer.remove(platformToRemove);
|
||||
}
|
||||
onIndexesUpdated();
|
||||
@ -172,12 +176,14 @@ public class ContributionManagerUI extends InstallerJDialog {
|
||||
installerThread.start();
|
||||
}
|
||||
|
||||
public void onRemovePressed(final ContributedPlatform platform) {
|
||||
public void onRemovePressed(final ContributedPlatform platform, boolean showWarning) {
|
||||
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 (chosenOption != JOptionPane.YES_OPTION) {
|
||||
return;
|
||||
if (showWarning) {
|
||||
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 (chosenOption != JOptionPane.YES_OPTION) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
installerThread = new Thread(new Runnable() {
|
||||
|
@ -28,12 +28,34 @@
|
||||
*/
|
||||
package cc.arduino.contributions.ui;
|
||||
|
||||
import cc.arduino.contributions.VersionComparator;
|
||||
import cc.arduino.contributions.packages.DownloadableContribution;
|
||||
import com.google.common.base.Predicate;
|
||||
|
||||
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 {
|
||||
|
||||
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) {
|
||||
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;
|
||||
|
||||
public class HostDependentDownloadableContributionStub extends HostDependentDownloadableContribution {
|
||||
|
||||
@Override
|
||||
public String getVersion() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHost() {
|
||||
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)
|
||||
return 1;
|
||||
|
||||
Version versionA = valueOf(a);
|
||||
Version versionB = valueOf(b);
|
||||
Version versionA = VersionHelper.valueOf(a);
|
||||
Version versionB = VersionHelper.valueOf(b);
|
||||
|
||||
return versionA.compareTo(versionB);
|
||||
}
|
||||
@ -65,26 +65,10 @@ public class VersionComparator implements Comparator<String> {
|
||||
return true;
|
||||
}
|
||||
|
||||
Version versionA = valueOf(a);
|
||||
Version versionB = valueOf(b);
|
||||
Version versionA = VersionHelper.valueOf(a);
|
||||
Version versionB = VersionHelper.valueOf(b);
|
||||
|
||||
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 getVersion();
|
||||
|
||||
public abstract String getMaintainer();
|
||||
|
||||
public abstract String getAuthor();
|
||||
@ -64,16 +62,6 @@ public abstract class ContributedLibrary extends DownloadableContribution {
|
||||
|
||||
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>() {
|
||||
@Override
|
||||
public int compare(ContributedLibrary o1, ContributedLibrary o2) {
|
||||
|
@ -37,8 +37,6 @@ public abstract class ContributedPlatform extends DownloadableContribution {
|
||||
|
||||
public abstract String getName();
|
||||
|
||||
public abstract String getVersion();
|
||||
|
||||
public abstract String getCategory();
|
||||
|
||||
public abstract String getArchitecture();
|
||||
|
@ -73,6 +73,11 @@ public class ContributedTargetPackage implements TargetPackage {
|
||||
return platforms.get(platform);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPlatform(TargetPlatform platform) {
|
||||
return platforms.containsKey(platform.getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "TargetPackage: " + getId();
|
||||
|
@ -28,21 +28,27 @@
|
||||
*/
|
||||
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.ObjectMapper;
|
||||
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.TargetPlatform;
|
||||
import processing.app.debug.TargetPlatformException;
|
||||
import processing.app.helpers.PreferencesMap;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
|
||||
import static processing.app.helpers.filefilters.OnlyDirs.ONLY_DIRS;
|
||||
|
||||
@ -102,7 +108,47 @@ public class ContributionsIndexer {
|
||||
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())
|
||||
return;
|
||||
|
||||
@ -110,8 +156,9 @@ public class ContributionsIndexer {
|
||||
// platforms found.
|
||||
for (File folder : packagesFolder.listFiles(ONLY_DIRS)) {
|
||||
ContributedPackage pack = index.findPackage(folder.getName());
|
||||
if (pack != null)
|
||||
if (pack != null) {
|
||||
syncPackageWithFilesystem(pack, folder);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -120,8 +167,9 @@ public class ContributionsIndexer {
|
||||
File hardwareFolder = new File(root, "hardware");
|
||||
if (hardwareFolder.isDirectory()) {
|
||||
for (File platformFolder : hardwareFolder.listFiles(ONLY_DIRS)) {
|
||||
for (File versionFolder : platformFolder.listFiles(ONLY_DIRS))
|
||||
syncHardwareWithFilesystem(pack, platformFolder, versionFolder);
|
||||
for (File versionFolder : platformFolder.listFiles(ONLY_DIRS)) {
|
||||
syncHardwareWithFilesystem(pack, versionFolder, platformFolder.getName(), versionFolder.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -129,39 +177,35 @@ public class ContributionsIndexer {
|
||||
File toolsFolder = new File(root, "tools");
|
||||
if (toolsFolder.isDirectory()) {
|
||||
for (File toolFolder : toolsFolder.listFiles(ONLY_DIRS)) {
|
||||
for (File versionFolder : toolFolder.listFiles(ONLY_DIRS))
|
||||
syncToolWithFilesystem(pack, toolFolder, versionFolder);
|
||||
for (File versionFolder : toolFolder.listFiles(ONLY_DIRS)) {
|
||||
syncToolWithFilesystem(pack, versionFolder, toolFolder.getName(), versionFolder.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void syncToolWithFilesystem(ContributedPackage pack, File toolFolder,
|
||||
File versionFolder) {
|
||||
ContributedTool tool = pack.findTool(toolFolder.getName(),
|
||||
versionFolder.getName());
|
||||
if (tool == null)
|
||||
private void syncToolWithFilesystem(ContributedPackage pack, File installationFolder, String toolName, String version) {
|
||||
ContributedTool tool = pack.findTool(toolName, version);
|
||||
if (tool == null) {
|
||||
return;
|
||||
}
|
||||
DownloadableContribution contrib = tool.getDownloadableContribution();
|
||||
if (contrib == null) {
|
||||
System.err.println(tool +
|
||||
" seems to have no downloadable contributions for your " +
|
||||
"operating system, but it is installed in\n" + versionFolder);
|
||||
System.err.println(tool + " seems to have no downloadable contributions for your operating system, but it is installed in\n" + installationFolder);
|
||||
return;
|
||||
}
|
||||
contrib.setInstalled(true);
|
||||
contrib.setInstalledFolder(versionFolder);
|
||||
contrib.setInstalledFolder(installationFolder);
|
||||
}
|
||||
|
||||
private void syncHardwareWithFilesystem(ContributedPackage pack,
|
||||
File platformFolder,
|
||||
File versionFolder) {
|
||||
String architecture = platformFolder.getName();
|
||||
String version = versionFolder.getName();
|
||||
private ContributedPlatform syncHardwareWithFilesystem(ContributedPackage pack, File installationFolder, String architecture, String version) {
|
||||
ContributedPlatform platform = pack.findPlatform(architecture, version);
|
||||
if (platform != null) {
|
||||
platform.setInstalled(true);
|
||||
platform.setInstalledFolder(versionFolder);
|
||||
platform.setReadOnly(false);
|
||||
platform.setInstalledFolder(installationFolder);
|
||||
}
|
||||
return platform;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -170,28 +214,29 @@ public class ContributionsIndexer {
|
||||
}
|
||||
|
||||
public List<TargetPackage> createTargetPackages() throws TargetPlatformException {
|
||||
List<TargetPackage> res = new ArrayList<TargetPackage>();
|
||||
List<TargetPackage> packages = new ArrayList<TargetPackage>();
|
||||
|
||||
for (ContributedPackage pack : index.getPackages()) {
|
||||
ContributedTargetPackage targetPackage;
|
||||
targetPackage = new ContributedTargetPackage(pack.getName());
|
||||
for (ContributedPackage aPackage : index.getPackages()) {
|
||||
ContributedTargetPackage targetPackage = new ContributedTargetPackage(aPackage.getName());
|
||||
|
||||
for (ContributedPlatform platform : pack.getPlatforms()) {
|
||||
if (!platform.isInstalled())
|
||||
continue;
|
||||
List<ContributedPlatform> platforms = new LinkedList<ContributedPlatform>(Collections2.filter(aPackage.getPlatforms(), new InstalledPredicate()));
|
||||
Collections.sort(platforms, new DownloadableContributionBuiltInAtTheBottomComparator());
|
||||
|
||||
for (ContributedPlatform platform : platforms) {
|
||||
String arch = platform.getArchitecture();
|
||||
File folder = platform.getInstalledFolder();
|
||||
|
||||
TargetPlatform targetPlatform;
|
||||
targetPlatform = new ContributedTargetPlatform(arch, folder, targetPackage, index);
|
||||
targetPackage.addPlatform(targetPlatform);
|
||||
TargetPlatform targetPlatform = new ContributedTargetPlatform(arch, folder, targetPackage, index);
|
||||
if (!targetPackage.hasPlatform(targetPlatform)) {
|
||||
targetPackage.addPlatform(targetPlatform);
|
||||
}
|
||||
}
|
||||
|
||||
if (targetPackage.hasPlatforms())
|
||||
res.add(targetPackage);
|
||||
if (targetPackage.hasPlatforms()) {
|
||||
packages.add(targetPackage);
|
||||
}
|
||||
}
|
||||
return res;
|
||||
return packages;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -217,11 +262,21 @@ public class ContributionsIndexer {
|
||||
public Set<ContributedTool> getInstalledTools() {
|
||||
Set<ContributedTool> tools = new HashSet<ContributedTool>();
|
||||
for (ContributedPackage pack : index.getPackages()) {
|
||||
for (ContributedPlatform platform : pack.getPlatforms()) {
|
||||
if (!platform.isInstalled())
|
||||
continue;
|
||||
for (ContributedTool tool : platform.getResolvedTools()) {
|
||||
tools.add(tool);
|
||||
Collection<ContributedPlatform> platforms = Collections2.filter(pack.getPlatforms(), new InstalledPredicate());
|
||||
ImmutableListMultimap<String, ContributedPlatform> platformsByName = Multimaps.index(platforms, new Function<ContributedPlatform, String>() {
|
||||
@Override
|
||||
public String apply(ContributedPlatform contributedPlatform) {
|
||||
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 getVersion();
|
||||
|
||||
public abstract String getChecksum();
|
||||
|
||||
public abstract long getSize();
|
||||
@ -78,6 +80,16 @@ public abstract class DownloadableContribution {
|
||||
this.installedFolder = installedFolder;
|
||||
}
|
||||
|
||||
private boolean readOnly;
|
||||
|
||||
public boolean isReadOnly() {
|
||||
return readOnly;
|
||||
}
|
||||
|
||||
public void setReadOnly(boolean readOnly) {
|
||||
this.readOnly = readOnly;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
String res = "";
|
||||
|
@ -578,12 +578,11 @@ public class BaseNoGui {
|
||||
static public void initPackages() throws Exception {
|
||||
indexer = new ContributionsIndexer(BaseNoGui.getSettingsFolder());
|
||||
File indexFile = indexer.getIndexFile();
|
||||
File avrCoreFolder = FileUtils.newFile(indexFile.getParentFile(), "packages", "arduino", "hardware", "avr");
|
||||
if (!indexFile.isFile() || !(avrCoreFolder.exists() && avrCoreFolder.isDirectory())) {
|
||||
File distFile = findDefaultPackageFile();
|
||||
if (distFile != null) {
|
||||
new ArchiveExtractor(getPlatform()).extract(distFile, BaseNoGui.getSettingsFolder(), 0, true);
|
||||
} else if (!indexFile.isFile()) {
|
||||
if (!indexFile.isFile()) {
|
||||
File defaultPackageJsonFile = new File(getContentFile("dist"), "package_index.json");
|
||||
if (defaultPackageJsonFile.isFile()) {
|
||||
FileUtils.copyFile(defaultPackageJsonFile, indexFile);
|
||||
} else {
|
||||
// Otherwise create an empty packages index
|
||||
FileOutputStream out = null;
|
||||
try {
|
||||
@ -598,7 +597,7 @@ public class BaseNoGui {
|
||||
}
|
||||
}
|
||||
indexer.parseIndex();
|
||||
indexer.syncWithFilesystem();
|
||||
indexer.syncWithFilesystem(getHardwareFolder());
|
||||
|
||||
packages = new HashMap<String, TargetPackage>();
|
||||
loadHardware(getHardwareFolder());
|
||||
@ -626,18 +625,6 @@ public class BaseNoGui {
|
||||
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() {
|
||||
try {
|
||||
Class<?> platformClass = Class.forName("processing.app.Platform");
|
||||
@ -697,7 +684,7 @@ public class BaseNoGui {
|
||||
try {
|
||||
packages.put(target, new LegacyTargetPackage(target, subfolder));
|
||||
} 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());
|
||||
}
|
||||
}
|
||||
@ -777,12 +764,9 @@ public class BaseNoGui {
|
||||
PreferencesData.removeAllKeysWithPrefix(prefix);
|
||||
|
||||
for (ContributedTool tool : indexer.getInstalledTools()) {
|
||||
String path = tool.getDownloadableContribution().getInstalledFolder()
|
||||
.getAbsolutePath();
|
||||
String toolId = tool.getName();
|
||||
PreferencesData.set(prefix + toolId + ".path", path);
|
||||
toolId += "-" + tool.getVersion();
|
||||
PreferencesData.set(prefix + toolId + ".path", path);
|
||||
String path = tool.getDownloadableContribution().getInstalledFolder().getAbsolutePath();
|
||||
PreferencesData.set(prefix + tool.getName() + ".path", path);
|
||||
PreferencesData.set(prefix + tool.getName() + "-" + tool.getVersion() + ".path", path);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -77,6 +77,11 @@ public class LegacyTargetPackage implements TargetPackage {
|
||||
return platforms.get(platform);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPlatform(TargetPlatform platform) {
|
||||
return platforms.containsKey(platform.getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getId() {
|
||||
return id;
|
||||
|
@ -25,12 +25,13 @@ import java.util.Map;
|
||||
|
||||
public interface TargetPackage {
|
||||
|
||||
public String getId();
|
||||
|
||||
public Map<String, TargetPlatform> getPlatforms();
|
||||
String getId();
|
||||
|
||||
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 -->
|
||||
<target name="assemble-hardware" unless="light_bundle">
|
||||
<mkdir dir="${staging_folder}/work/dist/bundled_package/packages/arduino/hardware/avr/1.6.3/"/>
|
||||
<copy todir="${staging_folder}/work/dist/bundled_package/packages/arduino/hardware/avr/1.6.3/">
|
||||
<fileset dir="../hardware/arduino/avr/"/>
|
||||
<copy todir="${target.path}/hardware">
|
||||
<fileset dir="../hardware">
|
||||
<exclude name="arduino/sam/**"/>
|
||||
</fileset>
|
||||
</copy>
|
||||
</target>
|
||||
|
||||
@ -348,8 +349,6 @@
|
||||
<param name="target.path" value="${staging_folder}/work/${staging_hardware_folder}/.." />
|
||||
</antcall>
|
||||
|
||||
<antcall target="macosx-assemble-bundled-toolchain"/>
|
||||
|
||||
<antcall target="unzip">
|
||||
<param name="archive_file" value="./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">
|
||||
<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_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_version" value="6.0.1-arduino3"/>
|
||||
</antcall>
|
||||
|
||||
<chmod perm="+x">
|
||||
<fileset dir="${staging_folder}/work/dist/bundled_package/packages/arduino/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="**/bin/*"/>
|
||||
<fileset dir="${staging_folder}/work/${staging_hardware_folder}/tools" includes="**/libexec/gcc/avr/4.8.1/*"/>
|
||||
</chmod>
|
||||
</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">
|
||||
<antcall target="macosx-run-common"/>
|
||||
</target>
|
||||
@ -629,40 +612,20 @@
|
||||
<antcall target="avr-toolchain-bundle">
|
||||
<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_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_version" value="6.0.1-arduino3"/>
|
||||
</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 name="linux64-build" depends="linux-build" unless="light_bundle" description="Build linux (64-bit) version">
|
||||
<antcall target="avr-toolchain-bundle">
|
||||
<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_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_version" value="6.0.1-arduino3"/>
|
||||
</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 name="linux32-run" depends="linux32-build" description="Run Linux (32-bit) version">
|
||||
@ -875,8 +838,6 @@
|
||||
<param name="target.path" value="windows/work" />
|
||||
</antcall>
|
||||
|
||||
<antcall target="windows-assemble-bundled-toolchain"/>
|
||||
|
||||
<delete dir="windows/launcher/launch4j"/>
|
||||
<antcall target="download-${launch4j-download-unpack-target-name}" />
|
||||
|
||||
@ -904,20 +865,12 @@
|
||||
<antcall target="avr-toolchain-bundle">
|
||||
<param name="unpack_target" value="unzip"/>
|
||||
<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_version" value="6.0.1-arduino3"/>
|
||||
</antcall>
|
||||
</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"
|
||||
description="Run windows version">
|
||||
<exec executable="windows/work/arduino.exe"
|
||||
@ -991,27 +944,46 @@
|
||||
|
||||
<target name="avr-toolchain-bundle" unless="light_bundle">
|
||||
<!-- Unzip AVR tools -->
|
||||
<mkdir dir="${staging_folder}/work/dist/bundled_package/packages/arduino/tools/avr-gcc/"/>
|
||||
<mkdir dir="${staging_folder}/work/dist/bundled_package/packages/arduino/tools/avrdude/"/>
|
||||
<mkdir dir="${staging_folder}/work/${staging_hardware_folder}/tmp/gcc"/>
|
||||
|
||||
<antcall target="${unpack_target}">
|
||||
<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="final_folder" value="${staging_folder}/work/dist/bundled_package/packages/arduino/tools/avr-gcc/${gcc_version}/"/>
|
||||
<param name="dest_folder" value="${staging_folder}/work/dist/bundled_package/packages/arduino/tools/avr-gcc/"/>
|
||||
<param name="final_folder" value="${staging_folder}/work/${staging_hardware_folder}/tmp/gcc/${gcc_version}/"/>
|
||||
<param name="dest_folder" value="${staging_folder}/work/${staging_hardware_folder}/tmp/gcc/"/>
|
||||
</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}">
|
||||
<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="final_folder" value="${staging_folder}/work/dist/bundled_package/packages/arduino/tools/avrdude/${avrdude_version}"/>
|
||||
<param name="dest_folder" value="${staging_folder}/work/dist/bundled_package/packages/arduino/tools/avrdude/"/>
|
||||
<param name="final_folder" value="${staging_folder}/work/${staging_hardware_folder}/tmp/avrdude/${avrdude_version}"/>
|
||||
<param name="dest_folder" value="${staging_folder}/work/${staging_hardware_folder}/tmp/avrdude/"/>
|
||||
</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"/>
|
||||
<copy file="shared/bundled_library_index.json" tofile="${staging_folder}/work/dist/library_index.json"/>
|
||||
<move file="${staging_folder}/work/${staging_hardware_folder}/tmp/gcc/avr" tofile="${staging_folder}/work/${staging_hardware_folder}/tools/avr"/>
|
||||
<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>
|
||||
|
||||
</project>
|
||||
|
Loading…
Reference in New Issue
Block a user