summaryrefslogtreecommitdiff
path: root/core/test/resources/examples/javac/build.sc
blob: 8f2500140b05147857803fbffdae0e195617b83c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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.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)
}