This is an automated email from the ASF dual-hosted git repository.
sdedic pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/netbeans.git
The following commit(s) were added to refs/heads/master by this push:
new 770e6179b8 Implemnted --direct-disable module option.
new f6af4cb594 Merge pull request #4301 from
sdedic/platform/direct-disable-option
770e6179b8 is described below
commit 770e6179b816716132a4c2089299f138beab1c45
Author: Svata Dedic <[email protected]>
AuthorDate: Thu Jun 30 11:34:43 2022 +0200
Implemnted --direct-disable module option.
---
.../netbeans/modules/autoupdate/cli/Bundle.properties | 2 +-
.../modules/autoupdate/cli/ModuleOptions.java | 19 ++++++++++++++-----
.../o.n.bootstrap/src/org/netbeans/ModuleManager.java | 9 +++++++++
3 files changed, 24 insertions(+), 6 deletions(-)
diff --git
a/platform/autoupdate.cli/src/org/netbeans/modules/autoupdate/cli/Bundle.properties
b/platform/autoupdate.cli/src/org/netbeans/modules/autoupdate/cli/Bundle.properties
index 7f71404b71..70b792c215 100644
---
a/platform/autoupdate.cli/src/org/netbeans/modules/autoupdate/cli/Bundle.properties
+++
b/platform/autoupdate.cli/src/org/netbeans/modules/autoupdate/cli/Bundle.properties
@@ -49,4 +49,4 @@ MSG_ListModules=Prints the list of all modules, their
versions and enablement st
MSG_InstallModules=Installs provided JAR files as modules
MSG_DisableModules=Disable modules for specified codebase names
MSG_EnableModules=Enable modules for specified codebase names
-
+MSG_DirectDisableModule=Disable module immediately
\ No newline at end of file
diff --git
a/platform/autoupdate.cli/src/org/netbeans/modules/autoupdate/cli/ModuleOptions.java
b/platform/autoupdate.cli/src/org/netbeans/modules/autoupdate/cli/ModuleOptions.java
index 6666b28678..3664cb26e0 100644
---
a/platform/autoupdate.cli/src/org/netbeans/modules/autoupdate/cli/ModuleOptions.java
+++
b/platform/autoupdate.cli/src/org/netbeans/modules/autoupdate/cli/ModuleOptions.java
@@ -69,6 +69,7 @@ public class ModuleOptions extends OptionProcessor {
private Option updateAll;
private Option both;
private Option extraUC;
+ private Option directDisable;
private final Collection<UpdateUnitProvider> ownUUP = new HashSet<> ();
/** Creates a new instance of ModuleOptions */
@@ -103,8 +104,10 @@ public class ModuleOptions extends OptionProcessor {
Option.withoutArgument(Option.NO_SHORT_NAME, "update-all"), b,
"MSG_UpdateAll"); // NOI18N
extraUC = Option.shortDescription(
Option.requiredArgument(Option.NO_SHORT_NAME, "extra-uc"), b,
"MSG_ExtraUC"); // NOI18N
+ directDisable = Option.shortDescription(
+ Option.additionalArguments(Option.NO_SHORT_NAME,
"direct-disable"), b, "MSG_DirectDisableModule"); // NOI18N
- Option oper = OptionGroups.someOf(refresh, list, install, disable,
enable, update, updateAll, extraUC);
+ Option oper = OptionGroups.someOf(refresh, list, install, disable,
enable, update, updateAll, extraUC, directDisable);
Option modules = Option.withoutArgument(Option.NO_SHORT_NAME,
"modules");
both = OptionGroups.allOf(modules, oper);
return both;
@@ -175,11 +178,15 @@ public class ModuleOptions extends OptionProcessor {
}
if (optionValues.containsKey(disable)) {
- changeModuleState(env, optionValues.get(disable), false);
+ changeModuleState(env, optionValues.get(disable), false,
false);
}
if (optionValues.containsKey(enable)) {
- changeModuleState(env, optionValues.get(enable), true);
+ changeModuleState(env, optionValues.get(enable), true,
false);
+ }
+
+ if (optionValues.containsKey(directDisable)) {
+ changeModuleState(env, optionValues.get(directDisable),
false, true);
}
} catch (InterruptedException | IOException | OperationException
ex) {
throw initCause(new CommandException(4), ex);
@@ -205,11 +212,13 @@ public class ModuleOptions extends OptionProcessor {
"# {0} - requested patterns",
"MSG_CannotFindAnyPattern=Cannot find any module matching {0}\n"
})
- private void changeModuleState(Env env, String[] cnbs, boolean enable)
throws IOException, CommandException, InterruptedException, OperationException {
+ private void changeModuleState(Env env, String[] cnbs, boolean enable,
boolean direct) throws IOException, CommandException, InterruptedException,
OperationException {
CodeNameMatcher cnm = CodeNameMatcher.create(env, cnbs);
List<UpdateUnit> units = UpdateManager.getDefault().getUpdateUnits();
- OperationContainer<OperationSupport> operate = enable ?
OperationContainer.createForEnable() : OperationContainer.createForDisable();
+ OperationContainer<OperationSupport> operate =
+ enable ? OperationContainer.createForEnable() :
+ (direct ? OperationContainer.createForDirectDisable() :
OperationContainer.createForDisable());
StringBuilder sb = new StringBuilder();
boolean found = false;
for (UpdateUnit updateUnit : units) {
diff --git a/platform/o.n.bootstrap/src/org/netbeans/ModuleManager.java
b/platform/o.n.bootstrap/src/org/netbeans/ModuleManager.java
index 8e8836a187..d41a16871d 100644
--- a/platform/o.n.bootstrap/src/org/netbeans/ModuleManager.java
+++ b/platform/o.n.bootstrap/src/org/netbeans/ModuleManager.java
@@ -1982,6 +1982,15 @@ public final class ModuleManager extends Modules {
FIND_AUTOLOADS:
while (it.hasNext()) {
Module m = it.next();
+ String host = m.getFragmentHostCodeName();
+ if (host != null) {
+ Module theHost = modulesByName.get(host);
+ if (theHost != null && theHost.isEnabled()) {
+ // will not disable fragment module, as it is merged to an
+ // enabled host.
+ continue;
+ }
+ }
if (m.isAutoload()) {
for (Module other: stillEnabled) {
Dependency[] dependencies = other.getDependenciesArray();
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists