diff options
Diffstat (limited to 'main/test/resources/examples')
-rw-r--r-- | main/test/resources/examples/javac/build.sc | 23 | ||||
-rw-r--r-- | main/test/resources/examples/javac/resources/hello.txt | 1 | ||||
-rw-r--r-- | main/test/resources/examples/javac/src/Bar.java | 4 | ||||
-rw-r--r-- | main/test/resources/examples/javac/src/Foo.java | 7 |
4 files changed, 35 insertions, 0 deletions
diff --git a/main/test/resources/examples/javac/build.sc b/main/test/resources/examples/javac/build.sc new file mode 100644 index 00000000..0783ac17 --- /dev/null +++ b/main/test/resources/examples/javac/build.sc @@ -0,0 +1,23 @@ +import ammonite.ops._ +import mill.T +import mill.eval.JavaCompileJarTests.compileAll +import mill.eval.PathRef +import mill.modules.Jvm +import mill.util.Loose + +def sourceRootPath = millSourcePath / 'src +def resourceRootPath = millSourcePath / 'resources + +// sourceRoot -> allSources -> classFiles +// | +// v +// resourceRoot ----> jar +def sourceRoot = T.sources{ sourceRootPath } +def resourceRoot = T.sources{ resourceRootPath } +def allSources = T{ sourceRoot().flatMap(p => ls.rec(p.path)).map(PathRef(_)) } +def classFiles = T{ compileAll(allSources()) } +def jar = T{ Jvm.createJar(Loose.Agg(classFiles().path) ++ resourceRoot().map(_.path)) } + +def run(mainClsName: String) = T.command{ + %%('java, "-cp", classFiles().path, mainClsName)(T.ctx().dest) +} diff --git a/main/test/resources/examples/javac/resources/hello.txt b/main/test/resources/examples/javac/resources/hello.txt new file mode 100644 index 00000000..5e1c309d --- /dev/null +++ b/main/test/resources/examples/javac/resources/hello.txt @@ -0,0 +1 @@ +Hello World
\ No newline at end of file diff --git a/main/test/resources/examples/javac/src/Bar.java b/main/test/resources/examples/javac/src/Bar.java new file mode 100644 index 00000000..4e30c89b --- /dev/null +++ b/main/test/resources/examples/javac/src/Bar.java @@ -0,0 +1,4 @@ +package test; +public class Bar{ + static int value = 271828; +}
\ No newline at end of file diff --git a/main/test/resources/examples/javac/src/Foo.java b/main/test/resources/examples/javac/src/Foo.java new file mode 100644 index 00000000..e694f9fa --- /dev/null +++ b/main/test/resources/examples/javac/src/Foo.java @@ -0,0 +1,7 @@ +package test; +public class Foo{ + static int value = 31337; + public static void main(String[] args){ + System.out.println(value + Bar.value); + } +}
\ No newline at end of file |