Skip to content

Commit

Permalink
Merge branch 'main' into devonfw#312-enhance-git-syntax-urls
Browse files Browse the repository at this point in the history
  • Loading branch information
alfeilex authored Oct 30, 2024
2 parents 86e85e5 + 071e732 commit 856a3c5
Show file tree
Hide file tree
Showing 8 changed files with 66 additions and 52 deletions.
2 changes: 1 addition & 1 deletion .mvn/maven.config
Original file line number Diff line number Diff line change
@@ -1 +1 @@
-Drevision=2024.10.001-beta-SNAPSHOT
-Drevision=2024.11.001-beta-SNAPSHOT
8 changes: 8 additions & 0 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

This file documents all notable changes to https://github.com/devonfw/IDEasy[IDEasy].

== 2024.11.001

Release with new features and bugfixes:


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

== 2024.10.001

Release with new features and bugfixes:
Expand All @@ -12,6 +19,7 @@ Release with new features and bugfixes:
* https://github.com/devonfw/IDEasy/issues/704[#704]: settings-security.xml not found
* https://github.com/devonfw/IDEasy/issues/302[#302]: Add plugin support for GraalVM
* https://github.com/devonfw/IDEasy/issues/710[#710]: Make IDE workspace configuration robust
* https://github.com/devonfw/IDEasy/issues/673[#673]: Tomcat still not working (JAVA_HOME not set)

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,8 @@ public ValidationResult validate() {

/**
* Provide additional usage help of this {@link Commandlet} to the user.
*
* @param bundle the {@link NlsBundle} to get I18N messages from.
*/
public void printHelp(NlsBundle bundle) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,6 @@ protected UrlDownloadFileMetadata getMetadata(String tool, String edition, Versi
public Collection<ToolDependency> findDependencies(String tool, String edition, VersionIdentifier version) {

UrlDependencyFile dependencyFile = this.context.getUrls().getEdition(tool, edition).getDependencyFile();
return dependencyFile.getDependencies().findDependencies(version);
return dependencyFile.getDependencies().findDependencies(version, this.context);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ public boolean installAsDependency(VersionRange version, EnvironmentContext envi
VersionIdentifier configuredVersion = getConfiguredVersion();
if (version.contains(configuredVersion)) {
// prefer configured version if contained in version range
return install();
return install(false, environmentContext);
} else {
if (isIgnoreSoftwareRepo()) {
throw new IllegalStateException(
Expand All @@ -251,7 +251,11 @@ public boolean installAsDependency(VersionRange version, EnvironmentContext envi

private void installToolDependencies(VersionIdentifier version, String edition, EnvironmentContext environmentContext, ToolRepository toolRepository) {
Collection<ToolDependency> dependencies = toolRepository.findDependencies(this.tool, edition, version);
String toolWithEdition = getToolWithEdition(this.tool, edition);
int size = dependencies.size();
this.context.debug("Tool {} has {} other tool(s) as dependency", toolWithEdition, size);
for (ToolDependency dependency : dependencies) {
this.context.trace("Ensuring dependency {} for tool {}", dependency.tool(), toolWithEdition);
LocalToolCommandlet dependencyTool = this.context.getCommandletManager().getRequiredLocalToolCommandlet(dependency.tool());
dependencyTool.installAsDependency(dependency.versionRange(), environmentContext);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import com.devonfw.tools.ide.context.IdeContext;
import com.devonfw.tools.ide.environment.EnvironmentVariables;
import com.devonfw.tools.ide.environment.EnvironmentVariablesType;
import com.devonfw.tools.ide.process.ProcessContext;
import com.devonfw.tools.ide.process.ProcessErrorHandling;
import com.devonfw.tools.ide.process.ProcessMode;
import com.devonfw.tools.ide.step.Step;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;

import com.devonfw.tools.ide.json.JsonMapping;
import com.devonfw.tools.ide.log.IdeLogger;
import com.devonfw.tools.ide.version.VersionIdentifier;
import com.devonfw.tools.ide.version.VersionRange;
import com.fasterxml.jackson.core.type.TypeReference;
Expand All @@ -23,27 +24,34 @@ public class ToolDependencies {

private static final ObjectMapper MAPPER = JsonMapping.create();

private static final ToolDependencies EMPTY = new ToolDependencies(Collections.emptyMap());
private static final ToolDependencies EMPTY = new ToolDependencies(Collections.emptyMap(), Path.of("empty"));
private final Map<VersionRange, List<ToolDependency>> dependencies;

private ToolDependencies(Map<VersionRange, List<ToolDependency>> dependencies) {
private final Path path;

private ToolDependencies(Map<VersionRange, List<ToolDependency>> dependencies, Path path) {

super();
this.dependencies = dependencies;
this.path = path;
}

/**
* @param version the {@link VersionIdentifier} of the tool to install.
* @return The {@link List} of {@link ToolDependency}s for the given tool version.
*/
public List<ToolDependency> findDependencies(VersionIdentifier version) {
public List<ToolDependency> findDependencies(VersionIdentifier version, IdeLogger logger) {

for (Map.Entry<VersionRange, List<ToolDependency>> map : this.dependencies.entrySet()) {
VersionRange versionRange = map.getKey();
for (Map.Entry<VersionRange, List<ToolDependency>> entry : this.dependencies.entrySet()) {
VersionRange versionRange = entry.getKey();
if (versionRange.contains(version)) {
return map.getValue();
return entry.getValue();
}
}
int size = dependencies.size();
if (size > 0) {
logger.warning("No match for version {} while {} version ranges are configured in {} - configuration error?!", version, size, this.path);
}
return Collections.emptyList();
}

Expand All @@ -55,10 +63,10 @@ public static ToolDependencies of(Path file) {

if (Files.exists(file)) {
try (BufferedReader reader = Files.newBufferedReader(file)) {
TypeReference<HashMap<VersionRange, List<ToolDependency>>> typeRef = new TypeReference<>() {
TypeReference<TreeMap<VersionRange, List<ToolDependency>>> typeRef = new TypeReference<>() {
};
Map<VersionRange, List<ToolDependency>> dependencies = MAPPER.readValue(reader, typeRef);
return new ToolDependencies(dependencies);
return new ToolDependencies(dependencies, file);
} catch (Exception e) {
throw new IllegalStateException("Failed to load " + file, e);
}
Expand Down
71 changes: 32 additions & 39 deletions cli/src/main/package/setup
Original file line number Diff line number Diff line change
@@ -1,46 +1,39 @@
#!/bin/bash

cd "$(dirname "${BASH_SOURCE:-$0}")" || exit 255
echo "Setting up your IDEasy in ${PWD}"

AUTOCOMPLETION="source ${PWD}/completion"

if ! grep -q "${AUTOCOMPLETION}" ~/.bashrc; then
echo -e "${AUTOCOMPLETION}" >> ~/.bashrc
fi
if ! grep -q "alias ide=" ~/.bashrc; then
echo -e "alias ide=\"source ${PWD}/bin/ide\"" >> ~/.bashrc
echo -e "ide" >> ~/.bashrc
fi

if [ "${OSTYPE}" != "cygwin" ] && [ "${OSTYPE}" != "msys" ]; then
if ! grep -q "IDE_ROOT" ~/.bashrc
then
echo -e 'export IDE_ROOT="$(pwd)"' >> ~/.bashrc
fi

if ! grep -q "IDE_ROOT" ~/.zshrc
then
echo -e 'export IDE_ROOT="$(pwd)"' >> ~/.zshrc
function doSetupInConfigFile() {
local cfg=$1
if [ ! -f "${cfg}" ]; then
echo "${cfg} not found - skipping."
return
fi
fi


if [ -f ~/.zshrc ]; then
if ! grep -q "compinit" ~/.zshrc
then
echo -e 'autoload -Uz compinit\ncompinit' >> ~/.zshrc
if [ "${cfg}" = "~/.zshrc" ]; then
if ! grep -q "compinit" "${cfg}"; then
echo -e 'autoload -Uz compinit\ncompinit' >> "${cfg}"
fi
if ! grep -q "bashcompinit" "${cfg}"; then
echo -e 'autoload bashcompinit\nbashcompinit' >> "${cfg}"
fi
fi
if ! grep -q "bashcompinit" ~/.zshrc
then
echo -e 'autoload bashcompinit\nbashcompinit' >> ~/.zshrc
echo "Configuring IDEasy in ${cfg}."
if ! grep -q "${AUTOCOMPLETION}" "${cfg}"; then
echo -e "${AUTOCOMPLETION}" >> "${cfg}"
fi
if ! grep -q "${AUTOCOMPLETION}" ~/.zshrc
then
echo -e "${AUTOCOMPLETION}" >> ~/.zshrc
if ! grep -q "alias ide=" "${cfg}"; then
echo -e "alias ide=\"source ${PWD}/bin/ide\"" >> "${cfg}"
echo -e "ide" >> "${cfg}"
fi
if ! grep -q "alias ide=" ~/.zshrc; then
echo -e "alias ide=\"source ${PWD}/bin/ide\"" >> ~/.zshrc
echo -e "ide" >> ~/.zshrc
if [ "${OSTYPE}" != "cygwin" ] && [ "${OSTYPE}" != "msys" ]; then
if ! grep -q "IDE_ROOT" "${cfg}"
then
echo -e 'export IDE_ROOT="${PWD}"' >> "${cfg}"
fi
fi
fi
}

cd "$(dirname "${BASH_SOURCE:-$0}")" || exit 255
echo "Setting up your IDEasy in ${PWD}"

AUTOCOMPLETION="source ${PWD}/completion"

doSetupInConfigFile ~/.bashrc
doSetupInConfigFile ~/.zshrc

0 comments on commit 856a3c5

Please sign in to comment.