summaryrefslogtreecommitdiff
path: root/main/test/resources
diff options
context:
space:
mode:
authorLi Haoyi <haoyi.sg@gmail.com>2018-02-09 00:14:47 -0800
committerLi Haoyi <haoyi.sg@gmail.com>2018-02-09 08:17:47 -0800
commit8ddd2fa054bc8639c28db2e95b7903e2954fdb7d (patch)
treeaa985f1e715f07eb279e6facad61de8a187e316c /main/test/resources
parent90d0a3388d280554eaa51371f666d2f7a965a8af (diff)
downloadmill-8ddd2fa054bc8639c28db2e95b7903e2954fdb7d.tar.gz
mill-8ddd2fa054bc8639c28db2e95b7903e2954fdb7d.tar.bz2
mill-8ddd2fa054bc8639c28db2e95b7903e2954fdb7d.zip
.
Diffstat (limited to 'main/test/resources')
-rw-r--r--main/test/resources/examples/javac/build.sc23
-rw-r--r--main/test/resources/examples/javac/resources/hello.txt1
-rw-r--r--main/test/resources/examples/javac/src/Bar.java4
-rw-r--r--main/test/resources/examples/javac/src/Foo.java7
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