-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sc
137 lines (109 loc) · 4.35 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
/*
* Copyright 2020 Tomas Zeman <tomas@functionals.cz>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import mill._
import mill.api.Loose
import mill.define.{Command, Sources, Target}
import mill.modules.Jvm
import mill.scalajslib._
import mill.scalalib._
import mill.scalalib.publish._
object V {
val app = "0.2-SNAPSHOT"
val scalaJs = "0.6.33"
val scala212 = "2.12.12"
object udash {
val core = "0.8.5"
}
}
object D {
object udash {
val core = ivy"io.udash::udash-core::${V.udash.core}"
val css = ivy"io.udash::udash-css::${V.udash.core}"
}
val ammonite = ivy"com.lihaoyi:::ammonite::2.1.4-12-f697522"
}
trait Common extends CrossScalaModule with PublishModule {
override def artifactName: T[String] = "matter"
override def publishVersion: Target[String] = V.app
override def pomSettings: T[PomSettings] = PomSettings(
description = "Scala.js library facade for matter - Material Design Components in Pure CSS",
organization = "cz.functionals",
url = "https://fossil.functionals.cz/udash-matter",
licenses = Seq(License.`Apache-2.0`),
versionControl = VersionControl(developerConnection = Some(
"ssh://tzeman@fossil.functionals.cz/repos/public/udash-matter.fossil")),
developers = Seq(
Developer("tzeman", "Tomas Zeman", "")
)
)
override def scalacOptions = T{Seq(
"-deprecation", // Emit warning and location for usages of deprecated APIs.
"-encoding", "utf-8", // Specify character encoding used by source files.
"-explaintypes", // Explain type errors in more detail.
"-feature", // Emit warning and location for usages of features that should be imported explicitly.
"-language:higherKinds", // Allow higher-kinded types
"-language:implicitConversions", // Allow definition of implicit functions called views
"-language:reflectiveCalls",
"-language:postfixOps",
"-unchecked", // Enable additional warnings where generated code depends on assumptions.
"-Xcheckinit", // Wrap field accessors to throw an exception on uninitialized access.
"-Xfuture", // Turn on future language features.
"-target:jvm-1.8",
)}
override def sources: Sources = T.sources{
super.sources() :+ PathRef(millSourcePath / 'shared)
}
protected def commonDeps = Agg(D.udash.core, D.udash.css)
override def ivyDeps: Target[Loose.Agg[Dep]] = commonDeps
}
trait CommonJs extends Common with ScalaJSModule {
override def scalaJSVersion: T[String] = V.scalaJs
}
class JvmModule(val crossScalaVersion: String) extends Common
class JsModule(val crossScalaVersion: String) extends CommonJs
object jvm extends Cross[JvmModule](V.scala212)
object js extends Cross[JsModule](V.scala212)
def publishLocal(): Command[Unit] = T.command{
jvm(V.scala212).publishLocal()()
js(V.scala212).publishLocal()()
()
}
def publishM2Local(p: os.Path): Command[Unit] = T.command{
jvm(V.scala212).publishM2Local(p.toString)()
js(V.scala212).publishM2Local(p.toString)()
()
}
object example extends Common {
override def crossScalaVersion: String = V.scala212
override def sources = T.sources(millSourcePath / 'example / 'src)
override def moduleDeps = Seq(jvm(crossScalaVersion))
override def ivyDeps: Target[Loose.Agg[Dep]] = commonDeps ++ Agg(D.ammonite)
def run: Target[PathRef] = T{
val d = T.ctx().dest
Jvm.runLocal(mainClass = "example.Runner",
runClasspath().map(_.path),
Seq(d.toString))
PathRef(d)
}
def distPath = T{ millSourcePath / 'www / 'example }
def dist(): Command[Unit] = T.command{
val d = distPath()
os.remove.all(d)
os.copy(run().path, d, replaceExisting = true, createFolders = true)
println(s"Example files copied to $d")
}
}
// vim: et ts=2 sw=2 syn=scala