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

#659: #664: fix deps #667

Merged
merged 10 commits into from
Oct 1, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,10 @@ 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 (configuredVersion.equals(installedVersion)) { // here we can add https://github.com/devonfw/IDEasy/issues/637
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
Expand Down Expand Up @@ -239,8 +241,9 @@ public boolean installAsDependency(VersionRange version, EnvironmentContext envi
"Cannot satisfy dependency to " + this.tool + " in version " + version + " since it is conflicting with configured version " + configuredVersion
+ " and this tool does not support the software repository.");
}
this.context.info("Configured version is {} but does not match version to install {} - need to use different version from software repository.",
configuredVersion, version);
this.context.info(
"Configured version of tool {} is {} but does not match version to install {} - need to use different version from software repository.",
this.tool, configuredVersion, version);
}
ToolInstallation toolInstallation = installTool(version, environmentContext);
return toolInstallation.newInstallation();
Expand Down
21 changes: 16 additions & 5 deletions cli/src/main/java/com/devonfw/tools/ide/tool/tomcat/Tomcat.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,14 @@ public Tomcat(IdeContext context) {
public ProcessResult runTool(ProcessMode processMode, GenericVersionRange toolVersion, ProcessErrorHandling errorHandling, String... args) {

if (args.length == 0) {
args = new String[] { "start" };
args = new String[] { "run" };
}
boolean startup = args[0].equals("start") || args[0].equals("run");
if (startup) {
processMode = ProcessMode.BACKGROUND;
}
ProcessResult processResult = super.runTool(processMode, toolVersion, errorHandling, args);
if (processResult.isSuccessful() && (args[0].equals("start") || args[0].equals("run"))) {
if (processResult.isSuccessful() && startup) {
printTomcatPort();
}
return processResult;
Expand All @@ -60,9 +64,16 @@ protected void setEnvironment(EnvironmentContext environmentContext, ToolInstall
}

@Override
public String getBinaryName() {

return "catalina.sh";
protected void postExtract(Path extractedDir) {

super.postExtract(extractedDir);
String binaryName;
if (this.context.getSystemInfo().isWindows()) {
binaryName = "catalina.bat";
} else {
binaryName = "catalina.sh";
}
createStartScript(extractedDir, binaryName, false);
}

private void printTomcatPort() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ public void testIntellijRun(String os, WireMockRuntimeInfo wmRuntimeInfo) throws
SystemInfo systemInfo = SystemInfoMock.of(os);
this.context.setSystemInfo(systemInfo);
Intellij commandlet = new Intellij(this.context);
this.context.info("Starting testIntellijRun on {}", os);
hohwille marked this conversation as resolved.
Show resolved Hide resolved

// act
commandlet.run();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,13 @@ public void testTomcat() {
new IdeLogEntry(IdeLogLevel.SUCCESS, "Successfully installed java in version " + javaVersionProject), //
new IdeLogEntry(IdeLogLevel.INFO, "OpenJDK version " + javaVersionProject), //
new IdeLogEntry(IdeLogLevel.INFO,
"Configured version is 8u402b06 but does not match version to install [11,22) - need to use different version from software repository."), //
"Configured version of tool java is 8u402b06 but does not match version to install [11,22) - need to use different version from software repository."),
//
new IdeLogEntry(IdeLogLevel.DEBUG, "Installed java in version " + javaVersionTomcat + " at ", true),
new IdeLogEntry(IdeLogLevel.SUCCESS, "Successfully installed tomcat in version " + tomcatVersion), //
new IdeLogEntry(IdeLogLevel.INFO, "OpenJDK version " + javaVersionTomcat), //
new IdeLogEntry(IdeLogLevel.INFO, "JAVA_HOME=" + javaTomcatPath), //
new IdeLogEntry(IdeLogLevel.INFO, "tomcat start"), //
new IdeLogEntry(IdeLogLevel.INFO, "tomcat run"), //
new IdeLogEntry(IdeLogLevel.INFO, "Tomcat is running at localhost on HTTP port " + tomcatPort + ":"), //
new IdeLogEntry(IdeLogLevel.INFO, "http://localhost:" + tomcatPort) //
);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
https://download.jetbrains.com/idea/ideaC-2023.3.3.win.zip
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
https://adoptium.net/download/dummytest
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/bin/bash
cd "$(dirname "$0")"
echo $PWD
echo "intellij linux $*"
hohwille marked this conversation as resolved.
Show resolved Hide resolved
echo "intellij linux $*" > intellijtest
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
@echo off
if "%1%" == "--version" (
for /f "delims=" %%i in (%~dp0..\.ide.software.version) do @echo OpenJDK version %%i
) else (
echo java %*
)
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
@echo test for windows
@echo off
call java --version
echo JAVA_HOME=%JAVA_HOME%
echo tomcat %*
Empty file.
Loading