-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbuild.mill
111 lines (87 loc) · 3.38 KB
/
build.mill
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
import $ivy.`com.github.lolgab::mill-crossplatform::0.2.4`
import $ivy.`io.github.quafadas:millSite_mill0.12_2.13:0.0.38`
import $ivy.`de.tototec::de.tobiasroeser.mill.vcs.version::0.4.0`
import $ivy.`com.lihaoyi::mill-contrib-buildinfo:`
import mill.contrib.buildinfo.BuildInfo
import de.tobiasroeser.mill.vcs.version._
import com.github.lolgab.mill.crossplatform._
import mill._, mill.scalalib._, mill.scalajslib._, mill.scalanativelib._
import io.github.quafadas.millSite.SiteModule
import io.github.quafadas.millSite.QuickChange
import mill._, scalalib._, publish._
import mill.api.Result
trait Common extends ScalaModule with PublishModule {
def scalaVersion = "3.6.2"
override def ivyDeps = super.ivyDeps() ++ Agg(
ivy"com.lihaoyi::scalatags::0.13.1",
ivy"com.lihaoyi::os-lib:0.11.3",
ivy"com.lihaoyi::fansi::0.5.0"
)
override def scalacOptions: T[Seq[String]] = super.scalacOptions() ++ Seq("-experimental", "-language:experimental.namedTuples", "-Xmax-inlines", "128")
def publishVersion = VcsVersion.vcsState().format()
override def pomSettings = T {
PomSettings(
description = "Automatically generate html tables from scala case classes",
organization = "io.github.quafadas",
url = "https://github.com/Quafadas/scautable",
licenses = Seq(License.`Apache-2.0`),
versionControl = VersionControl.github("quafadas", "scautable"),
developers = Seq(
Developer("quafadas", "Simon Parten", "https://github.com/quafadas")
)
)
}
}
trait CommonJS extends ScalaJSModule {
def scalaJSVersion = "1.17.0"
def ivyDeps = super.ivyDeps() ++ Agg(
ivy"com.raquo::laminar::17.2.0"
)
}
trait CommonTests extends TestModule.Munit {
def ivyDeps = super.ivyDeps() ++ Agg(
ivy"org.scalameta::munit::1.0.3"
)
}
object scautable extends CrossPlatform {
trait Shared extends CrossPlatformScalaModule with Common {
// common `core` settings here
trait SharedTests extends CommonTests {
// common `core` test settings here
}
}
object jvm extends Shared {
override def ivyDeps: Target[Agg[Dep]] = super.ivyDeps() ++ Agg(
ivy"org.apache.poi:poi:5.4.0",
ivy"org.apache.poi:poi-ooxml:5.4.0",
)
// jvm specific settings here
object test extends ScalaTests with SharedTests with BuildInfo {
def buildInfoPackageName: String = "io.github.quafadas.scautable"
override def generatedSources: T[Seq[PathRef]] = T{
val resourceDir = resources().map(_.path).zipWithIndex.map{case (str, i) => s"""final val resourceDir$i = \"\"\"$str${java.io.File.separator}\"\"\"""" }.mkString("\n\t")
val fileName = "BuildInfo.scala"
val code = s"""
package io.github.quafadas.scautable
/**
Resources are not available at compile time. This is a workaround to get the path to the resource directory, (allowing unit testing of a macro based on a local file).
*/
object Generated {$resourceDir
}
"""
val dest = T.ctx().dest / "BuildInfo.scala"
os.write(dest , code)
Seq(PathRef(dest))
}
}
}
object js extends Shared with CommonJS {
// js specific settings here
object test extends ScalaJSTests with SharedTests
}
}
object site extends SiteModule {
def scalaVersion = scautable.jvm.scalaVersion
override def scalacOptions: T[Seq[String]] = super.scalacOptions() ++ scautable.jvm.scalacOptions()
override def moduleDeps = Seq(scautable.jvm)
}