Skip to content

Commit

Permalink
Merge pull request apache#6477 from matthiasblaesing/plugin_manager_a…
Browse files Browse the repository at this point in the history
…rchitecture_dependency

Autoupdate system must check org.openide.modules.arch as org.openide.modules.os is already handled
  • Loading branch information
matthiasblaesing authored Sep 27, 2023
2 parents a867eb8 + e46b0ea commit 0216ca4
Showing 1 changed file with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -217,13 +217,14 @@ private void addElement (Map<String, UpdateUnit> impls, UpdateElement element, U

// XXX: it's should be moved in UI what should filter all elements w/ broken dependencies
// #101515: Plugin Manager must filter updates by platform dependency
boolean passed = false;
UpdateElementImpl elImpl = Trampoline.API.impl (element);
if (elImpl instanceof ModuleUpdateElementImpl && elImpl.getModuleInfos () != null && elImpl.getModuleInfos ().size() == 1) {
for (Dependency d : elImpl.getModuleInfos ().get (0).getDependencies ()) {
if (Dependency.TYPE_REQUIRES == d.getType ()) {
//log.log (Level.FINEST, "Dependency: NAME: " + d.getName () + ", TYPE: " + d.getType () + ": " + d.toString ());
if (d.getName ().startsWith ("org.openide.modules.os")) { // NOI18N
// Filter OS specific dependencies
boolean passed = false;
for (ModuleInfo info : InstalledModuleProvider.getInstalledModules ().values ()) {
if (Arrays.asList (info.getProvides ()).contains (d.getName ())) {
log.log (Level.FINEST, element + " which requires OS " + d + " succeed.");
Expand All @@ -235,6 +236,20 @@ private void addElement (Map<String, UpdateUnit> impls, UpdateElement element, U
log.log (Level.FINE, element + " which requires OS " + d + " fails.");
return ;
}
} else if (d.getName ().startsWith ("org.openide.modules.arch")) { // NOI18N
// Filter architecture specific dependencies
boolean passed = false;
for (ModuleInfo info : InstalledModuleProvider.getInstalledModules ().values ()) {
if (Arrays.asList (info.getProvides ()).contains (d.getName ())) {
log.log (Level.FINEST, element + " which requires architecture " + d + " succeed.");
passed = true;
break;
}
}
if (! passed) {
log.log (Level.FINE, element + " which requires architecture " + d + " fails.");
return ;
}
}
}
}
Expand Down

0 comments on commit 0216ca4

Please sign in to comment.