mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-17 22:23:10 +03:00
Uniformly using versions parsed through semver
This commit is contained in:
@ -98,7 +98,7 @@ public abstract class ContributedLibrary extends DownloadableContribution {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return I18n.format(_("Version {0}"), getVersion());
|
||||
return I18n.format(_("Version {0}"), getParsedVersion());
|
||||
}
|
||||
|
||||
public String info() {
|
||||
@ -106,7 +106,7 @@ public abstract class ContributedLibrary extends DownloadableContribution {
|
||||
res += " ContributedLibrary : " + getName() + "\n";
|
||||
res += " author : " + getAuthor() + "\n";
|
||||
res += " maintainer : " + getMaintainer() + "\n";
|
||||
res += " version : " + getVersion() + "\n";
|
||||
res += " version : " + getParsedVersion() + "\n";
|
||||
res += " website : " + getUrl() + "\n";
|
||||
res += " category : " + getCategory() + "\n";
|
||||
res += " license : " + getLicense() + "\n";
|
||||
@ -138,8 +138,8 @@ public abstract class ContributedLibrary extends DownloadableContribution {
|
||||
return false;
|
||||
}
|
||||
|
||||
String thisVersion = getVersion();
|
||||
String otherVersion = ((ContributedLibrary) obj).getVersion();
|
||||
String thisVersion = getParsedVersion();
|
||||
String otherVersion = ((ContributedLibrary) obj).getParsedVersion();
|
||||
|
||||
boolean versionEquals = thisVersion == null || otherVersion == null || thisVersion.equals(otherVersion);
|
||||
|
||||
|
@ -8,7 +8,7 @@ public class ContributedLibraryComparator implements Comparator<ContributedLibra
|
||||
|
||||
@Override
|
||||
public int compare(ContributedLibrary lib1, ContributedLibrary lib2) {
|
||||
return VersionComparator.VERSION_COMPARATOR.compare(lib1.getVersion(), lib2.getVersion());
|
||||
return VersionComparator.VERSION_COMPARATOR.compare(lib1.getParsedVersion(), lib2.getParsedVersion());
|
||||
}
|
||||
|
||||
|
||||
|
@ -49,7 +49,7 @@ public abstract class LibrariesIndex {
|
||||
|
||||
public ContributedLibrary find(String name, String version) {
|
||||
for (ContributedLibrary lib : find(name)) {
|
||||
if (lib.getVersion().equals(version)) {
|
||||
if (version.equals(lib.getParsedVersion())) {
|
||||
return lib;
|
||||
}
|
||||
}
|
||||
|
@ -157,7 +157,7 @@ public class LibrariesIndexer {
|
||||
|
||||
// Check if we can find the same library in the index
|
||||
// and mark it as installed
|
||||
ContributedLibrary foundLib = index.find(lib.getName(), lib.getVersion());
|
||||
ContributedLibrary foundLib = index.find(lib.getName(), lib.getParsedVersion());
|
||||
if (foundLib != null) {
|
||||
foundLib.setInstalled(true);
|
||||
foundLib.setInstalledFolder(folder);
|
||||
|
@ -48,8 +48,7 @@ public abstract class ContributedPackage {
|
||||
|
||||
public ContributedPlatform findPlatform(String architecture, String version) {
|
||||
for (ContributedPlatform platform : getPlatforms()) {
|
||||
if (platform.getArchitecture().equals(architecture) &&
|
||||
platform.getVersion().equals(version))
|
||||
if (platform.getArchitecture().equals(architecture) && version.equals(platform.getParsedVersion()))
|
||||
return platform;
|
||||
}
|
||||
return null;
|
||||
@ -71,7 +70,7 @@ public abstract class ContributedPackage {
|
||||
found = p;
|
||||
continue;
|
||||
}
|
||||
if (version.compare(p.getVersion(), found.getVersion()) > 0)
|
||||
if (version.compare(p.getParsedVersion(), found.getParsedVersion()) > 0)
|
||||
found = p;
|
||||
}
|
||||
return found;
|
||||
@ -98,7 +97,7 @@ public abstract class ContributedPackage {
|
||||
}
|
||||
res += "\n category : " + plat.getCategory();
|
||||
res += "\n architecture : " +
|
||||
plat.getArchitecture() + " " + plat.getVersion() + "\n";
|
||||
plat.getArchitecture() + " " + plat.getParsedVersion() + "\n";
|
||||
if (plat.getToolsDependencies() != null)
|
||||
for (ContributedToolReference t : plat.getToolsDependencies()) {
|
||||
res += " tool dep : " + t.getName() + " " +
|
||||
|
@ -87,6 +87,6 @@ public abstract class ContributedPlatform extends DownloadableContribution {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getVersion();
|
||||
return getParsedVersion();
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ public class ContributedPlatformComparator implements Comparator<ContributedPlat
|
||||
|
||||
@Override
|
||||
public int compare(ContributedPlatform lib1, ContributedPlatform lib2) {
|
||||
return VersionComparator.VERSION_COMPARATOR.compare(lib1.getVersion(), lib2.getVersion());
|
||||
return VersionComparator.VERSION_COMPARATOR.compare(lib1.getParsedVersion(), lib2.getParsedVersion());
|
||||
}
|
||||
|
||||
|
||||
|
@ -155,7 +155,7 @@ public class ContributionInstaller {
|
||||
progress.setStatus(_("Installing boards..."));
|
||||
onProgress(progress);
|
||||
File platformFolder = new File(packageFolder, "hardware" + File.separator + platform.getArchitecture());
|
||||
File destFolder = new File(platformFolder, platform.getVersion());
|
||||
File destFolder = new File(platformFolder, platform.getParsedVersion());
|
||||
destFolder.mkdirs();
|
||||
new ArchiveExtractor(BaseNoGui.getPlatform()).extract(platform.getDownloadedFile(), destFolder, 1);
|
||||
platform.setInstalled(true);
|
||||
|
@ -28,6 +28,9 @@
|
||||
*/
|
||||
package cc.arduino.contributions.packages;
|
||||
|
||||
import cc.arduino.contributions.VersionHelper;
|
||||
import com.github.zafarkhaja.semver.Version;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public abstract class DownloadableContribution {
|
||||
@ -90,6 +93,14 @@ public abstract class DownloadableContribution {
|
||||
this.readOnly = readOnly;
|
||||
}
|
||||
|
||||
public String getParsedVersion() {
|
||||
Version version = VersionHelper.valueOf(getVersion());
|
||||
if (version == null) {
|
||||
return null;
|
||||
}
|
||||
return version.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
String res = "";
|
||||
|
Reference in New Issue
Block a user