-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
18 changed files
with
183 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 0 additions & 1 deletion
1
cli/src/main/java/com/devonfw/tools/ide/commandlet/UpdateCommandlet.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
111 changes: 55 additions & 56 deletions
111
cli/src/main/java/com/devonfw/tools/ide/log/IdeSubLogger.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,55 @@ | ||
package com.devonfw.tools.ide.log; | ||
|
||
/** | ||
* Interface for a logger to {@link #log(String) log a message} on a specific {@link #getLevel() log-level}. | ||
*/ | ||
public interface IdeSubLogger { | ||
|
||
/** | ||
* @param message the message to log. | ||
*/ | ||
default void log(String message) { | ||
|
||
log(null, message); | ||
} | ||
|
||
/** | ||
* @param error the {@link Throwable} that was catched and should be logged or {@code null} for no error. | ||
* @param message the message to log. | ||
* @param args the dynamic arguments to fill in. | ||
* @return the message headline that was logged. | ||
*/ | ||
default String log(String message, Object... args) { | ||
|
||
return log(null, message, args); | ||
} | ||
|
||
/** | ||
* @param error the {@link Throwable} that was catched and should be logged or {@code null} for no error. | ||
* @param message the message to log. | ||
* @return the message headline that was logged. | ||
*/ | ||
default String log(Throwable error, String message) { | ||
|
||
return log(error, message, (Object[]) null); | ||
} | ||
|
||
/** | ||
* @param error the {@link Throwable} that was catched and should be logged or {@code null} for no error. | ||
* @param message the message to log. | ||
* @param args the dynamic arguments to fill in. | ||
* @return the message headline that was logged. | ||
*/ | ||
String log(Throwable error, String message, Object... args); | ||
|
||
/** | ||
* @return {@code true} if this logger is enabled, {@code false} otherwise (this logger does nothing and all | ||
* {@link #log(String) logged messages} with be ignored). | ||
*/ | ||
boolean isEnabled(); | ||
|
||
/** | ||
* @return the {@link IdeLogLevel} of this logger. | ||
*/ | ||
IdeLogLevel getLevel(); | ||
|
||
} | ||
package com.devonfw.tools.ide.log; | ||
|
||
/** | ||
* Interface for a logger to {@link #log(String) log a message} on a specific {@link #getLevel() log-level}. | ||
*/ | ||
public interface IdeSubLogger { | ||
|
||
/** | ||
* @param message the message to log. | ||
*/ | ||
default void log(String message) { | ||
|
||
log(null, message); | ||
} | ||
|
||
/** | ||
* @param message the message to log. | ||
* @param args the dynamic arguments to fill in. | ||
* @return the message headline that was logged. | ||
*/ | ||
default String log(String message, Object... args) { | ||
|
||
return log(null, message, args); | ||
} | ||
|
||
/** | ||
* @param error the {@link Throwable} that was catched and should be logged or {@code null} for no error. | ||
* @param message the message to log. | ||
* @return the message headline that was logged. | ||
*/ | ||
default String log(Throwable error, String message) { | ||
|
||
return log(error, message, (Object[]) null); | ||
} | ||
|
||
/** | ||
* @param error the {@link Throwable} that was catched and should be logged or {@code null} for no error. | ||
* @param message the message to log. | ||
* @param args the dynamic arguments to fill in. | ||
* @return the message headline that was logged. | ||
*/ | ||
String log(Throwable error, String message, Object... args); | ||
|
||
/** | ||
* @return {@code true} if this logger is enabled, {@code false} otherwise (this logger does nothing and all {@link #log(String) logged messages} with be | ||
* ignored). | ||
*/ | ||
boolean isEnabled(); | ||
|
||
/** | ||
* @return the {@link IdeLogLevel} of this logger. | ||
*/ | ||
IdeLogLevel getLevel(); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
cli/src/main/java/com/devonfw/tools/ide/tool/graalvm/GraalVm.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package com.devonfw.tools.ide.tool.graalvm; | ||
|
||
import com.devonfw.tools.ide.common.Tag; | ||
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.tool.LocalToolCommandlet; | ||
import com.devonfw.tools.ide.version.VersionIdentifier; | ||
|
||
import java.nio.file.Path; | ||
import java.util.Set; | ||
|
||
/** | ||
* {@link LocalToolCommandlet} for <a href="https://www.graalvm.org/">GraalVM</a>, an advanced JDK with ahead-of-time Native Image compilation. | ||
*/ | ||
public class GraalVm extends LocalToolCommandlet { | ||
|
||
/** | ||
* The constructor. | ||
* | ||
* @param context the {@link IdeContext}. | ||
*/ | ||
public GraalVm(IdeContext context) { | ||
|
||
super(context, "graalvm", Set.of(Tag.JAVA, Tag.RUNTIME)); | ||
} | ||
|
||
@Override | ||
public Path getToolPath() { | ||
|
||
return this.context.getSoftwareExtraPath().resolve(getName()); | ||
} | ||
|
||
@Override | ||
public VersionIdentifier getInstalledVersion() { | ||
|
||
return super.getInstalledVersion(getToolPath()); | ||
} | ||
|
||
@Override | ||
protected String getBinaryName() { | ||
|
||
return getToolPath().resolve(IdeContext.FOLDER_BIN).resolve("java").toString(); | ||
} | ||
|
||
@Override | ||
public void postInstall() { | ||
|
||
EnvironmentVariables envVars = this.context.getVariables().getByType(EnvironmentVariablesType.CONF); | ||
envVars.set("GRAALVM_HOME", getToolPath().toString(), true); | ||
envVars.save(); | ||
super.postInstall(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
cli/src/test/java/com/devonfw/tools/ide/tool/graalvm/GraalVmTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package com.devonfw.tools.ide.tool.graalvm; | ||
|
||
import com.devonfw.tools.ide.context.AbstractIdeContextTest; | ||
import com.devonfw.tools.ide.context.IdeTestContext; | ||
import org.junit.jupiter.api.Test; | ||
|
||
/** | ||
* Integration test of {@link GraalVm}. | ||
*/ | ||
public class GraalVmTest extends AbstractIdeContextTest { | ||
|
||
private static final String PROJECT_GRAALVM = "graalvm"; | ||
|
||
@Test | ||
public void testGraalVmInstallInDirectoryExtra() { | ||
|
||
// arrange | ||
IdeTestContext context = newContext(PROJECT_GRAALVM); | ||
|
||
GraalVm commandlet = new GraalVm(context); | ||
|
||
// act | ||
commandlet.install(); | ||
|
||
// assert | ||
assertThat(context.getSoftwareExtraPath().resolve("graalvm/bin/HelloWorld.txt")).exists(); | ||
assertThat(context.getSoftwareExtraPath().resolve("graalvm/.ide.software.version")).exists().hasContent("22.3.3"); | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
cli/src/test/resources/ide-projects/graalvm/project/conf/ide.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# here the GRAALVM_HOME variable should be added by the test |
1 change: 1 addition & 0 deletions
1
cli/src/test/resources/ide-projects/graalvm/project/settings/ide.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
GRAALVM_VERSION=22.3.3 |
1 change: 1 addition & 0 deletions
1
cli/src/test/resources/ide-projects/graalvm/project/workspaces/readme
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
this is the workspace of graalvm test case |
1 change: 1 addition & 0 deletions
1
...esources/ide-projects/graalvm/repository/graalvm/graalvm/default/linux/bin/HelloWorld.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Hello World! |
1 change: 1 addition & 0 deletions
1
.../resources/ide-projects/graalvm/repository/graalvm/graalvm/default/mac/bin/HelloWorld.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Hello World! |
1 change: 1 addition & 0 deletions
1
...ources/ide-projects/graalvm/repository/graalvm/graalvm/default/windows/bin/HelloWorld.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Hello World! |