From b245b8664b51284d0df04e32daa61f0aef371fbe Mon Sep 17 00:00:00 2001 From: Christian Stein Date: Thu, 23 May 2024 23:13:38 +0200 Subject: [PATCH] Find and run `junit` tool --- .bach/src/run.bach/run/demo/JResolveDemo.java | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/.bach/src/run.bach/run/demo/JResolveDemo.java b/.bach/src/run.bach/run/demo/JResolveDemo.java index c238c4214..b3f6a26cc 100644 --- a/.bach/src/run.bach/run/demo/JResolveDemo.java +++ b/.bach/src/run.bach/run/demo/JResolveDemo.java @@ -1,16 +1,27 @@ package run.demo; -import run.bach.*; +import java.io.File; +import java.lang.module.ModuleFinder; +import java.nio.file.Path; +import java.util.stream.Stream; +import run.bach.Tool; +import run.bach.ToolFinder; +import run.bach.ToolSpace; public class JResolveDemo { public static void main(String... args) { var runner = new ToolSpace(ToolSpace.Flag.SILENT); - var jresolve = Tool.of("https://github.com/bowbahdoe/jresolve-cli/releases/download/v2024.05.10/jresolve.jar#SIZE=754432"); + var jresolve = + Tool.of( + "https://github.com/bowbahdoe/jresolve-cli/releases/download/v2024.05.10/jresolve.jar#SIZE=754432"); var run = runner.run( jresolve, "pkg:maven/org.junit.jupiter/junit-jupiter-engine@5.10.2", "pkg:maven/org.junit.platform/junit-platform-console@1.10.2"); - System.out.println(run.out()); + + var paths = Stream.of(run.out().split(File.pathSeparator)).map(Path::of).toArray(Path[]::new); + var junit = ToolFinder.of(ModuleFinder.of(paths)).get("junit"); + junit.run("--help"); } }