Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ Release with new features and bugfixes:
* https://github.com/devonfw/IDEasy/issues/1853[#1853]: Add ARM releases for VSCode on Mac
* https://github.com/devonfw/IDEasy/issues/797[#797]: Use system unzip on macOS to preserve symlinks in ZIP extraction
* https://github.com/devonfw/IDEasy/issues/1723[#1723]: Add commandlet for GitHub Copilot CLI
* https://github.com/devonfw/IDEasy/issues/1880[#1880]: Reinstall all plugins for IDE in force mode
* https://github.com/devonfw/IDEasy/issues/861[#861]: Fix install of pgadmin throws IllegalStateException when the install wizard starts
* https://github.com/devonfw/IDEasy/issues/1844[#1844]: VSCode plugin installation progress freezing
* https://github.com/devonfw/IDEasy/issues/1456[#1456]: Uninstall via Windows settings not working
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -799,6 +799,12 @@ public boolean isForcePlugins() {
return this.startContext.isForcePlugins();
}

@Override
public boolean isForcePluginReinstall() {

return this.startContext.isForcePluginReinstall();
}

@Override
public boolean isForceRepositories() {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ public interface IdeStartContext extends ReadOfflineMode {
*/
boolean isForcePlugins();

/**
* @return {@code true} to force plugin reset and reinstallation, {@code false} otherwise.
*/
boolean isForcePluginReinstall();

/**
* @return {@code true} to force repositories (including cloning inactive and pull existing ones), {@code false} otherwise.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ public class IdeStartContextImpl implements IdeStartContext {

private boolean forcePlugins;

private boolean forcePluginReinstall;

private boolean forceRepositories;

private boolean batchMode;
Expand Down Expand Up @@ -238,6 +240,20 @@ public void setForcePlugins(boolean forcePlugins) {
this.forcePlugins = forcePlugins;
}

@Override
public boolean isForcePluginReinstall() {

return this.forcePluginReinstall;
}

/**
* @param forcePluginReinstall new value of {@link #isForcePluginReinstall()}.
*/
public void setForcePluginReinstall(boolean forcePluginReinstall) {

this.forcePluginReinstall = forcePluginReinstall;
}

@Override
public boolean isForceRepositories() {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,13 @@

import com.devonfw.tools.ide.cli.CliException;
import com.devonfw.tools.ide.common.Tag;
import com.devonfw.tools.ide.context.AbstractIdeContext;
import com.devonfw.tools.ide.context.IdeContext;
import com.devonfw.tools.ide.context.IdeStartContextImpl;
import com.devonfw.tools.ide.io.FileAccess;
import com.devonfw.tools.ide.process.ProcessContext;
import com.devonfw.tools.ide.process.ProcessErrorHandling;
import com.devonfw.tools.ide.property.FlagProperty;
import com.devonfw.tools.ide.step.Step;
import com.devonfw.tools.ide.tool.LocalToolCommandlet;
import com.devonfw.tools.ide.tool.ToolInstallRequest;
Expand All @@ -29,6 +32,9 @@ public abstract class PluginBasedCommandlet extends LocalToolCommandlet {

private ToolPlugins plugins;

/** {@link FlagProperty} to force the reset and reinstallation of plugins as configured in the project settings. */
public FlagProperty forcePluginReinstall;

/**
* The constructor.
*
Expand All @@ -41,6 +47,12 @@ public PluginBasedCommandlet(IdeContext context, String tool, Set<Tag> tags) {
super(context, tool, tags);
}

@Override
protected void initProperties() {
this.forcePluginReinstall = add(new FlagProperty("--force-plugin-reinstall"));
super.initProperties();
}

/**
* @return the {@link ToolPlugins} of this {@link PluginBasedCommandlet}.
*/
Expand Down Expand Up @@ -109,20 +121,35 @@ protected void postInstall(ToolInstallRequest request) {
super.postInstall(request);
Path pluginsInstallationPath = getPluginsInstallationPath();
FileAccess fileAccess = this.context.getFileAccess();
if (!request.isAlreadyInstalled()) {
fileAccess.delete(pluginsInstallationPath);
List<Path> markerFiles = fileAccess.listChildren(this.context.getIdeHome().resolve(IdeContext.FOLDER_DOT_IDE), Files::isRegularFile);
for (Path path : markerFiles) {
if (path.getFileName().toString().startsWith("plugin." + getName())) {
LOG.debug("Plugin marker file {} got deleted.", path);
fileAccess.delete(path);
}
}

IdeStartContextImpl startContext = ((AbstractIdeContext) this.context).getStartContext();
startContext.setForcePluginReinstall(this.forcePluginReinstall.isTrue());

if (!request.isAlreadyInstalled() || this.context.isForcePluginReinstall()) {
LOG.info("Resetting all installed plugins...");
deleteAllPlugins(pluginsInstallationPath);
}
fileAccess.mkdirs(pluginsInstallationPath);
installPlugins(request.getProcessContext());
}

/**
* Deletes all installed plugins for this {@link IdeToolCommandlet} by deleting the plugins installation folder and all plugin marker files.
* @param pluginsInstallationPath the {@link Path} to the plugins installation folder.
*/
private void deleteAllPlugins(Path pluginsInstallationPath) {

FileAccess fileAccess = this.context.getFileAccess();
fileAccess.delete(pluginsInstallationPath);
List<Path> markerFiles = fileAccess.listChildren(this.context.getIdeHome().resolve(IdeContext.FOLDER_DOT_IDE), Files::isRegularFile);
for (Path path : markerFiles) {
if (path.getFileName().toString().startsWith("plugin." + getName())) {
fileAccess.delete(path);
LOG.debug("Plugin marker file {} got deleted.", path);
}
}
}

private void installPlugins(ProcessContext pc) {
installPlugins(getPlugins().getPlugins(), pc);
}
Expand Down
1 change: 1 addition & 0 deletions cli/src/main/resources/nls/Help.properties
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ opt.--batch=enable batch mode (non-interactive).
opt.--code=clone given code repository containing a settings folder into workspaces so that settings can be committed alongside code changes.
opt.--debug=enable debug logging.
opt.--force=enable force mode.
opt.--force-plugin-reinstall=resets installed plugins to the project configuration
opt.--force-plugins=force plugin (re)installation.
opt.--force-pull=force pull of settings even for code repository.
opt.--force-repositories=force setup of repositories to even clone inactive and pull existing ones.
Expand Down
1 change: 1 addition & 0 deletions cli/src/main/resources/nls/Help_de.properties
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ opt.--batch=Aktiviert den Batch-Modus (nicht-interaktive Stapelverarbeitung).
opt.--code=Git-Repository sowohl als Code- als auch als Settings-Repository verwenden.
opt.--debug=Aktiviert Debug-Ausgaben (Fehleranalyse).
opt.--force=Aktiviert den Force-Modus (Erzwingen).
opt.--force-plugin-reinstall=Setzt installierte Plugins zurück auf die Projektkonfiguration.
opt.--force-plugins=Erzwingt die (Re)Installation von Plugins.
opt.--force-pull=Erzwingt einen Pull der settings auch im Fall eines Code-Repositories.
opt.--force-repositories=Erzwingt das Setup von Repositories um auch Inaktive zu clonen oder Existierende zu pullen.
Expand Down
9 changes: 9 additions & 0 deletions documentation/plugin.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,12 @@ For `VisualStudio Code`, this is the extension ID you can directly get from the
|`active`|`true`|(optional) `true` to tell IDEasy that this plugin shall be installed automatically for everybody in your team. Default is `false`. If not auto-installed, it can still be installed via `ide install-plugin «ide» «plugin»`.
|`tags`|e.g. `java,spring,ai`|(optional) Tags to classify the plugin. Will be used by the GUI of IDEasy for selection by tag.
|===


== Resetting installed plugins

When first installing an IDE using `ide install «ide»`, IDEasy will automatically install all plugins that are configured in the project settings.
This configuration is intended to serve as a baseline for the entire team.
However, after the initial setup, you can freely change the plugin configuration for your IDE as you see fit.

To revert to the initial plugin configuration, you can run `ide «ide» --force-plugin-reinstall`, which will uninstall all currently installed plugins and reinstall them as configured in the project settings.
Loading