mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-16 11:21:18 +03:00
Boards Manager: platforms listed in non-signed package index files goes under "Contributed" category
This commit is contained in:
@ -39,6 +39,8 @@ public abstract class ContributedPlatform extends DownloadableContribution {
|
|||||||
|
|
||||||
public abstract String getCategory();
|
public abstract String getCategory();
|
||||||
|
|
||||||
|
public abstract void setCategory(String category);
|
||||||
|
|
||||||
public abstract String getArchitecture();
|
public abstract String getArchitecture();
|
||||||
|
|
||||||
public abstract String getChecksum();
|
public abstract String getChecksum();
|
||||||
|
@ -97,13 +97,21 @@ public class ContributionsIndexer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void mergeContributions(ContributionsIndex contributionsIndex, File indexFile) {
|
private void mergeContributions(ContributionsIndex contributionsIndex, File indexFile) {
|
||||||
|
boolean signed = isSigned(indexFile);
|
||||||
|
|
||||||
for (ContributedPackage contributedPackage : contributionsIndex.getPackages()) {
|
for (ContributedPackage contributedPackage : contributionsIndex.getPackages()) {
|
||||||
|
if (!signed) {
|
||||||
|
for (ContributedPlatform contributedPlatform : contributedPackage.getPlatforms()) {
|
||||||
|
contributedPlatform.setCategory("Contributed");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ContributedPackage targetPackage = index.getPackage(contributedPackage.getName());
|
ContributedPackage targetPackage = index.getPackage(contributedPackage.getName());
|
||||||
|
|
||||||
if (targetPackage == null) {
|
if (targetPackage == null) {
|
||||||
index.getPackages().add(contributedPackage);
|
index.getPackages().add(contributedPackage);
|
||||||
} else {
|
} else {
|
||||||
if (mergeAllowed(contributedPackage, indexFile)) {
|
if (signed || !isPackageNameProtected(contributedPackage)) {
|
||||||
List<ContributedPlatform> platforms = contributedPackage.getPlatforms();
|
List<ContributedPlatform> platforms = contributedPackage.getPlatforms();
|
||||||
if (platforms == null) {
|
if (platforms == null) {
|
||||||
platforms = new LinkedList<ContributedPlatform>();
|
platforms = new LinkedList<ContributedPlatform>();
|
||||||
@ -131,8 +139,8 @@ public class ContributionsIndexer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean mergeAllowed(ContributedPackage contributedPackage, File indexFile) {
|
private boolean isPackageNameProtected(ContributedPackage contributedPackage) {
|
||||||
return !Constants.PROTECTED_PACKAGE_NAMES.contains(contributedPackage.getName()) || isSigned(indexFile);
|
return Constants.PROTECTED_PACKAGE_NAMES.contains(contributedPackage.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isSigned(File indexFile) {
|
private boolean isSigned(File indexFile) {
|
||||||
|
Reference in New Issue
Block a user