-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sc
74 lines (64 loc) · 2.2 KB
/
build.sc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
import mill._
import mill.scalalib._
import mill.scalalib.publish._
trait MyPublishModule extends PublishModule {
override def publishVersion = "0.3.0"
override def pomSettings = PomSettings(
description = "Dockerize java applications on mill builds",
organization = "io.github.atty303",
url = "https://github.com/atty303/mill-jib",
licenses = Seq(License.MIT),
versionControl = VersionControl.github("atty303", "mill-jib"),
developers =
Seq(Developer("atty303", "Koji AGAWA", "https://github.com/atty303"))
)
}
trait MyModule extends MyPublishModule with ScalaModule {
def scalaVersion = "2.13.11"
}
def millVersion = "0.11.1"
object api extends MyModule {
override def artifactName = "mill-jib-api"
override def compileIvyDeps = Agg(
ivy"com.lihaoyi::mill-scalalib:${millVersion}"
)
}
object worker extends MyModule {
override def artifactName = "mill-jib-worker"
override def moduleDeps = Seq(api)
override def compileIvyDeps = Agg(
ivy"com.lihaoyi::mill-scalalib:${millVersion}",
ivy"com.google.cloud.tools:jib-core:0.24.0"
)
}
object jib extends MyModule {
override def artifactName = "mill-jib"
override def moduleDeps = Seq(api)
override def compileIvyDeps = Agg(
ivy"com.lihaoyi::mill-scalalib:${millVersion}"
)
override def generatedSources: T[Seq[PathRef]] = T {
super.generatedSources() ++ {
val dest = T.ctx().dest
val millJibWorkerImplIvyDep =
s"${worker.pomSettings().organization}:${worker.artifactId()}:${worker.publishVersion()}"
val body =
s"""package io.github.atty303.mill.jib
|
|/**
| * Build-time generated versions file.
| */
|object Versions {
| /** The mill-aspectj version. */
| val millAspectjVersion = "${publishVersion()}"
| /** The mill API version used to build mill-jib. */
| val buildTimeMillVersion = "${millVersion}"
| /** The ivy dependency holding the mill jib worker impl. */
| val millJibWorkerImplIvyDep = "${millJibWorkerImplIvyDep}"
|}
|""".stripMargin
os.write(dest / "Versions.scala", body)
Seq(PathRef(dest))
}
}
}