Created
August 12, 2021 07:38
-
-
Save sormuras/2faa19ce09825f9bb6ba45aca6c17079 to your computer and use it in GitHub Desktop.
Bach's (almost 17-M1) API
This file contains hidden or 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
class build { | |
public static void main(String... args) { | |
var classes = Path.of(".bach/workspace/classes"); | |
var modules = Path.of(".bach/workspace/modules"); | |
try (var bach = Bach.of(args)) { | |
Call.tool("javac") | |
.with("--module", "com.greetings,org.astro") | |
.with("--module-source-path", ".") | |
.with("-d", classes) | |
.run(bach, Run::requireSuccessful); | |
Call.tool("directories", "clean", modules).run(bach, Run::requireSuccessful); | |
Stream.of( | |
Call.tool("jar") | |
.with("--create") | |
.with("--file", modules.resolve("[email protected]")) | |
.with("--module-version", "99") | |
.with("--main-class", "com.greetings.Main") | |
.with("-C", classes.resolve("com.greetings"), "."), | |
Call.tool("jar") | |
.with("--create") | |
.with("--file", modules.resolve("[email protected]")) | |
.with("--module-version", "99") | |
.with("-C", classes.resolve("org.astro"), ".")) | |
.parallel() | |
.map(bach::run) | |
.forEach(Run::requireSuccessful); | |
Call.module(ModuleFinder.of(modules), "com.greetings") | |
.run( | |
bach, | |
run -> run.output().lines().forEach(System.out::println), | |
Run::requireSuccessful); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment