-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Kotlin upgraded to v1.9.10 * Fixed unit tests for kotlin and java engines * Fix unit tests on windows * Fix surefire plugin socket factory for unit tests
- Loading branch information
Showing
12 changed files
with
263 additions
and
177 deletions.
There are no files selected for viewing
59 changes: 59 additions & 0 deletions
59
blaze-core/src/main/java/com/fizzed/blaze/util/BlazeRunner.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,59 @@ | ||
package com.fizzed.blaze.util; | ||
|
||
import org.zeroturnaround.exec.ProcessExecutor; | ||
import org.zeroturnaround.exec.ProcessResult; | ||
|
||
import java.io.File; | ||
import java.io.IOException; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.concurrent.TimeUnit; | ||
import java.util.concurrent.TimeoutException; | ||
|
||
public class BlazeRunner { | ||
|
||
static public ProcessResult invokeWithCurrentJvmHome(File blazeScriptFile, List<String> blazeArgs, List<String> scriptArgs) throws IOException, InterruptedException, TimeoutException { | ||
return invokeWithCurrentJvmHome(blazeScriptFile, blazeArgs, scriptArgs, null); | ||
} | ||
|
||
static public ProcessResult invokeWithCurrentJvmHome(File blazeScriptFile, List<String> blazeArgs, List<String> scriptArgs, File workingDirectory) throws IOException, InterruptedException, TimeoutException { | ||
// get current classpath | ||
String classpath = System.getProperty("java.class.path"); | ||
|
||
// build a temporary home directory (that classes will be compiled to) | ||
//Path tempHomeDir = Paths.get(System.getProperty("java.io.tmpdir")).resolve("blaze-test-"+ UUID.randomUUID()); | ||
//Files.createDirectories(tempHomeDir); | ||
try { | ||
final List<String> commands = new ArrayList<>(); | ||
|
||
commands.add("java"); | ||
commands.add("-cp"); | ||
commands.add(classpath); | ||
commands.add(com.fizzed.blaze.cli.Bootstrap.class.getCanonicalName()); | ||
|
||
if (blazeArgs != null) { | ||
commands.addAll(blazeArgs); | ||
} | ||
|
||
if (blazeScriptFile != null) { | ||
commands.add(blazeScriptFile.getAbsolutePath()); | ||
} | ||
|
||
if (scriptArgs != null) { | ||
commands.addAll(scriptArgs); | ||
} | ||
|
||
return new ProcessExecutor() | ||
.command(commands) | ||
.redirectOutput(System.out) | ||
.readOutput(true) | ||
.directory(workingDirectory) | ||
//.environment("HOME", tempHomeDir.toAbsolutePath().toString()) | ||
.timeout(10, TimeUnit.SECONDS) | ||
.execute(); | ||
} finally { | ||
//Systems.remove(tempHomeDir).recursive().force().run(); | ||
} | ||
} | ||
|
||
} |
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
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
Oops, something went wrong.