From bc777b3c4e83149f45df7edda245868e22495eb3 Mon Sep 17 00:00:00 2001 From: Li Haoyi Date: Sun, 28 Jan 2018 22:43:40 -0800 Subject: Extract out `ScriptTestSuite` from `IntegrationTestSuite` and use it to create a version of `JavaCompilerJarTests` that runs through our main method & script runner. This should let us catch a lot of bugs with `MainRunner` and friends quickly, without needing to run the slow integration tests --- core/test/resources/examples/javac/build.sc | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 core/test/resources/examples/javac/build.sc (limited to 'core/test/resources/examples') diff --git a/core/test/resources/examples/javac/build.sc b/core/test/resources/examples/javac/build.sc new file mode 100644 index 00000000..4a0882c6 --- /dev/null +++ b/core/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 = basePath / 'src +def resourceRootPath = basePath / 'resources + +// sourceRoot -> allSources -> classFiles +// | +// v +// resourceRoot ----> jar +def sourceRoot = T.source{ sourceRootPath } +def resourceRoot = T.source{ resourceRootPath } +def allSources = T{ ls.rec(sourceRoot().path).map(PathRef(_)) } +def classFiles = T{ compileAll(allSources()) } +def jar = T{ Jvm.createJar(Loose.Agg(resourceRoot().path, classFiles().path)) } + +def run(mainClsName: String) = T.command{ + %%('java, "-cp", classFiles().path, mainClsName)(T.ctx().dest) +} -- cgit v1.2.3