-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathbuild.mill
More file actions
76 lines (70 loc) · 2.89 KB
/
build.mill
File metadata and controls
76 lines (70 loc) · 2.89 KB
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
//| mill-version: 1.1.5-native
//| mill-jvm-version: 17
//| mvnDeps:
//| - com.goyeau::mill-git::0.3.2
//| - org.typelevel::scalac-options:0.1.8
import com.goyeau.mill.git.{GitVersionModule, GitVersionedPublishModule}
import mill.scalalib.scalafmt.ScalafmtModule
import mill.*
import mill.Task.log
import mill.api.BuildCtx.workspaceRoot
import mill.api.{Cross, Evaluator}
import mill.javalib.publish.*
import mill.scalalib.*
import mill.scalalib.publish.{PomSettings, VersionControl}
import org.typelevel.scalacoptions.ScalacOptions.*
import org.typelevel.scalacoptions.{ScalaVersion, ScalacOptions}
import scala.util.{Failure, Success, Try}
object `package` extends ScalaModule with ScalafmtModule with GitVersionedPublishModule:
def scalaVersion = "3.7.4"
def jvmVersion = "17"
def scalacOptions = super.scalacOptions() ++ ScalacOptions.tokensForVersion(
ScalaVersion.unsafeFromString(scalaVersion()),
ScalacOptions.default + newSyntax + privateExplicitNulls ++ fatalWarningOptions
)
def compileMvnDeps = super.compileMvnDeps() ++ Seq(
mvn"org.apache.spark::spark-sql:3.5.7".withDottyCompat(scalaVersion())
)
def mvnDeps = super.mvnDeps() ++ Seq(
mvn"io.github.vincenzobaz::spark-scala3-encoders:0.3.2".excludeOrg("org.apache.spark"),
mvn"io.github.vincenzobaz::spark-scala3-udf:0.3.2".excludeOrg("org.apache.spark")
)
object test extends ScalaTests with TestModule.Munit with ScalafmtModule:
def scalacOptions = super.scalacOptions().filterNot(opt => fatalWarningOptions.exists(_.option == opt))
def mvnDeps = super.mvnDeps() ++ Seq(
mvn"org.scalameta::munit:1.2.2",
mvn"org.apache.spark::spark-sql:3.5.7".withDottyCompat(this.scalaVersion())
)
def forkArgs = Seq("--add-exports=java.base/sun.nio.ch=ALL-UNNAMED")
end test
def artifactName = "wick"
def publishVersion = GitVersionModule.version(withSnapshotSuffix = true)()
def pomSettings = PomSettings(
description = "A zero cost type safe Apache Spark API",
organization = "com.netflix.wick",
url = "https://github.com/Netflix/wick",
licenses = Seq(License.`Apache-2.0`),
versionControl = VersionControl.github(owner = "Netflix", repo = "wick"),
developers = Seq(Developer(id = "joan38", name = "Joan Goyeau", url = "https://github.com/joan38"))
)
/** Sets up a Git pre-commit hook that formats code before each commit.
*/
def precommitInstall() = Task.Command:
log.info("Installing precommit hook")
os.write.over(
workspaceRoot / ".git/hooks/pre-commit",
s"""#!/bin/sh
|
|if ! git diff --quiet; then
| git stash --keep-index --quiet
| ./mill __.reformat
| git add --update
| git stash pop --quiet
|else
| ./mill __.reformat
| git add --update
|fi""".stripMargin,
perms = "rwxr-xr-x",
createFolders = true
)
log.info("Precommit hook installed")