Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#637: Option to disable updates #765

Merged
merged 38 commits into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from 36 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
7af9fc5
#765: Fix typos in DoD asciidoc
Oct 2, 2024
aeae1dd
Merge branch 'main' of https://github.com/KianRolf/IDEasy
KianRolf Oct 17, 2024
e520d16
Merge branch 'main' of https://github.com/KianRolf/IDEasy
KianRolf Oct 25, 2024
29403d3
Merge branch 'main' of https://github.com/KianRolf/IDEasy
KianRolf Oct 25, 2024
5bff5eb
Merge branch 'main' of https://github.com/KianRolf/IDEasy
KianRolf Oct 28, 2024
890c107
Merge branch 'main' of https://github.com/KianRolf/IDEasy
KianRolf Oct 29, 2024
c55af62
Merge branch 'main' of https://github.com/KianRolf/IDEasy
KianRolf Oct 31, 2024
5224bf9
Merge branch 'main' of https://github.com/KianRolf/IDEasy
KianRolf Nov 7, 2024
d925977
Merge branch 'main' of https://github.com/KianRolf/IDEasy
KianRolf Nov 8, 2024
4a8f60b
Merge branch 'main' of https://github.com/KianRolf/IDEasy
KianRolf Nov 12, 2024
1a6cdb8
Merge branch 'main' of https://github.com/KianRolf/IDEasy
KianRolf Nov 13, 2024
43c0953
#637: Added option --skipUpdates
KianRolf Nov 14, 2024
f79c030
Merge branch 'main' of https://github.com/KianRolf/IDEasy
KianRolf Nov 14, 2024
6e8cced
Merge branch 'main' into test/no-updates
KianRolf Nov 14, 2024
4df3da6
#637: Changelog
KianRolf Nov 14, 2024
a263f80
Merge branch 'main' into test/no-updates
KianRolf Nov 14, 2024
a5bef25
Merge branch 'main' into test/no-updates
KianRolf Nov 14, 2024
4778abc
#637: fix test
KianRolf Nov 15, 2024
e276dc2
Merge branch 'test/no-updates' of https://github.com/KianRolf/IDEasy …
KianRolf Nov 15, 2024
f30396c
Merge branch 'main' into test/no-updates
KianRolf Nov 15, 2024
3524413
#637: I said fix test
KianRolf Nov 15, 2024
da6e84f
Merge branch 'test/no-updates' of https://github.com/KianRolf/IDEasy …
KianRolf Nov 15, 2024
fc259a0
Update cli/src/test/java/com/devonfw/tools/ide/commandlet/HelpCommand…
KianRolf Nov 18, 2024
f074d00
Update cli/src/main/java/com/devonfw/tools/ide/commandlet/ContextComm…
KianRolf Nov 18, 2024
5e8e203
Update cli/src/main/resources/nls/Help_de.properties
KianRolf Nov 18, 2024
b4a3b8e
Update cli/src/main/resources/nls/Help.properties
KianRolf Nov 18, 2024
c8abea6
Update CHANGELOG.adoc
KianRolf Nov 18, 2024
798709d
#637: fix Test
KianRolf Nov 19, 2024
d12fc22
Update cli/src/main/java/com/devonfw/tools/ide/commandlet/ContextComm…
KianRolf Nov 20, 2024
e0b98d9
Update cli/src/test/java/com/devonfw/tools/ide/commandlet/HelpCommand…
KianRolf Nov 20, 2024
f5d57c2
Update cli/src/test/java/com/devonfw/tools/ide/completion/CompleteTes…
KianRolf Nov 20, 2024
04350bf
Update cli/src/test/java/com/devonfw/tools/ide/completion/CompleteTes…
KianRolf Nov 20, 2024
6199315
Update cli/src/test/java/com/devonfw/tools/ide/completion/CompleteTes…
KianRolf Nov 20, 2024
67c338b
Merge branch 'main' into test/no-updates
KianRolf Nov 20, 2024
45c197c
#637: shift if clause
KianRolf Nov 20, 2024
f24d3e7
#637: fix test
KianRolf Nov 20, 2024
448225d
Merge branch 'main' into test/no-updates
hohwille Nov 22, 2024
e49f7d1
Update cli/src/main/java/com/devonfw/tools/ide/tool/LocalToolCommandl…
KianRolf Nov 22, 2024
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 @@ -6,6 +6,7 @@ This file documents all notable changes to https://github.com/devonfw/IDEasy[IDE

Release with new features and bugfixes:

* https://github.com/devonfw/IDEasy/issues/637[#637]: Added option to disable updates

The full list of changes for this release can be found in https://github.com/devonfw/IDEasy/milestone/16?closed=1[milestone 2024.12.001].

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ public class ContextCommandlet extends Commandlet {

private final FlagProperty offline;

private final FlagProperty skipUpdates;

private final LocaleProperty locale;

private IdeStartContextImpl startContext;
Expand All @@ -41,6 +43,7 @@ public ContextCommandlet() {
this.debug = add(new FlagProperty("--debug", false, "-d"));
this.quiet = add(new FlagProperty("--quiet", false, "-q"));
this.offline = add(new FlagProperty("--offline", false, "-o"));
this.skipUpdates = add(new FlagProperty("--skip-updates", false));
this.locale = add(new LocaleProperty("--locale", false, null));
}

Expand Down Expand Up @@ -71,6 +74,7 @@ public void run() {
this.startContext.setForceMode(this.force.isTrue());
this.startContext.setQuietMode(this.quiet.isTrue());
this.startContext.setOfflineMode(this.offline.isTrue());
this.startContext.setSkipUpdatesMode(this.skipUpdates.isTrue());
this.startContext.setLocale(this.locale.getValue());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,11 @@ public boolean isOfflineMode() {
return this.startContext.isOfflineMode();
}

@Override
public boolean isSkipUpdatesMode() {
return this.startContext.isSkipUpdatesMode();
}

@Override
public boolean isOnline() {

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

/**
* @return {@code true} if quickStart mode is activated (-s/--quickStart), {@code false} otherwise.
*/
boolean isSkipUpdatesMode();

/**
* @return the current {@link Locale}. Either configured via command-line option or {@link Locale#getDefault() default}.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ public class IdeStartContextImpl implements IdeStartContext {

private final IdeSubLogger[] loggers;

private boolean skipUpdatesMode;

private boolean offlineMode;

private boolean forceMode;
Expand Down Expand Up @@ -131,6 +133,20 @@ public void setOfflineMode(boolean offlineMode) {
this.offlineMode = offlineMode;
}

@Override
public boolean isSkipUpdatesMode() {

return this.skipUpdatesMode;
}

/**
* @param skipUpdatesMode new value of {@link #isSkipUpdatesMode()} ()}.
*/
public void setSkipUpdatesMode(boolean skipUpdatesMode) {

this.skipUpdatesMode = skipUpdatesMode;
}

@Override
public Locale getLocale() {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,18 +75,13 @@ public final boolean install(boolean silent, EnvironmentContext environmentConte
VersionIdentifier installedVersion = getInstalledVersion();
Step step = this.context.newStep(silent, "Install " + this.tool, configuredVersion);
try {
// TODO https://github.com/devonfw/IDEasy/issues/664
boolean enableOptimization = false;
// performance: avoid calling installTool if already up-to-date
if (enableOptimization & configuredVersion.equals(installedVersion)) { // here we can add https://github.com/devonfw/IDEasy/issues/637
return toolAlreadyInstalled(silent, installedVersion, step);
}
// install configured version of our tool in the software repository if not already installed
ToolInstallation installation = installTool(configuredVersion, environmentContext);

// check if we already have this version installed (linked) locally in IDE_HOME/software
VersionIdentifier resolvedVersion = installation.resolvedVersion();
if (resolvedVersion.equals(installedVersion) && !installation.newInstallation()) {
if (resolvedVersion.equals(installedVersion) && !installation.newInstallation()
|| configuredVersion.matches(installedVersion) & context.isSkipUpdatesMode()) {
KianRolf marked this conversation as resolved.
Show resolved Hide resolved
return toolAlreadyInstalled(silent, installedVersion, step);
}
if (!isIgnoreSoftwareRepo()) {
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 @@ -117,6 +117,7 @@ opt.--offline=enable offline mode (skip updates or git pull, fail downloads or g
opt.--quiet=disable info logging (only log success, warning or error).
opt.--skip-repositories=skip the setup of repositories.
opt.--skip-tools=skip the installation/update of tools.
opt.--skip-updates=disables tool updates if the configured versions match the installed versions.
opt.--trace=enable trace logging.
opt.--version=Print the IDE version and exit.
options=Options:
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 @@ -117,6 +117,7 @@ opt.--offline=Aktiviert den Offline-Modus (Überspringt Aktualisierungen oder gi
opt.--quiet=Deaktiviert Info Logging ( nur success, warning und error).
opt.--skip-repositories=Überspringt die Einrichtung der Repositories.
opt.--skip-tools=Überspringt die Installation/Aktualisierung der Tools.
opt.--skip-updates=Deaktiviert Aktualisierungen von Tools wenn die installierten Versionen mit den konfigurierten Versionen übereinstimmen.
opt.--trace=Aktiviert Trace-Ausgaben (detaillierte Fehleranalyse).
opt.--version=Zeigt die IDE Version an und beendet das Programm.
options=Optionen:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ private void assertOptionLogMessages(IdeTestContext context) {

assertThat(context).logAtInfo().hasEntries(
"--locale the locale (e.g. '--locale=de' for German language).",
"--skip-updates disables tool updates if the configured versions match the installed versions.",
"-b | --batch enable batch mode (non-interactive).",
"-d | --debug enable debug logging.",
"-f | --force enable force mode.",
Expand Down
Loading