1+ //| mvnDeps:
2+ //| - com.goyeau::mill-git::0.3.2
3+
14/*
25 * Copyright 2025 Salar Rahmanian
36 *
1417 * limitations under the License.
1518 */
1619
17- import mill._
18- import mill.scalalib.api.ZincWorkerUtil
19- import mill.scalalib._
20- import publish._
21-
22- import $ivy.`de.tototec::de.tobiasroeser.mill.vcs.version::0.4.1`
23- import de.tobiasroeser.mill.vcs.version.VcsVersion
20+ import mill.*
21+ import mill.scalalib.*
22+ import mill.scalalib.publish.*
23+ import com.goyeau.mill.git.GitVersionedPublishModule
2424
25- val duckdbVersion = "1.1.3"
26- val munitVersion = "1.1.1"
27- val scalaVersions = Seq("3.3.6", "3.7.0")
25+ val duckdbVersion = "1.4.4.0"
26+ val munitV = "1.2.2"
27+ val catsEffectVersion = "3.6.3"
28+ val fs2Version = "3.11.0"
29+ val munitCEVersion = "2.1.0"
30+ val scalaVersions = Seq("3.3.6", "3.8.2")
2831
2932object duck4s extends Cross[Duck4sModule](scalaVersions)
3033
31- trait Duck4sModule extends ScalaModule with CrossScalaModule with PublishModule {
32- override def publishVersion: T[String] = VcsVersion.vcsState().format()
33-
34+ trait Duck4sModule
35+ extends ScalaModule
36+ with CrossScalaModule
37+ with GitVersionedPublishModule:
3438 def artifactName = "duck4s"
3539
36- override def artifactScalaVersion: T[String] = T {
37- ZincWorkerUtil.scalaBinaryVersion(crossScalaVersion)
40+ override def artifactScalaVersion: T[String] = Task {
41+ val v = crossScalaVersion
42+ if v.startsWith("3.") then "3"
43+ else v.split('.').take(2).mkString(".")
3844 }
3945
40- def ivyDeps = Agg (
41- ivy "org.duckdb:duckdb_jdbc:$duckdbVersion"
46+ def mvnDeps = Seq (
47+ mvn "org.duckdb:duckdb_jdbc:$duckdbVersion"
4248 )
4349
4450 // Enforce Java 17 as minimum version
4551 def javacOptions = Seq("-source", "17", "-target", "17")
4652
4753 // Scaladoc configuration for documentation website generation
48- def scalacOptions = {
54+ def scalacOptions =
4955 val common = Seq("-explain", "-explain-types", "-release", "17")
50- if ( crossScalaVersion.startsWith("3.7")) {
56+ if crossScalaVersion.startsWith("3.8") then
5157 common :+ "-Xkind-projector:underscores"
52- } else {
53- common
54- }
55- }
58+ else common
5659
57- def scalaDocOptions = T {
58- val version = T .env.get("DUCK4S_DOC_VERSION").getOrElse(publishVersion())
60+ def scalaDocOptions = Task {
61+ val version = Task .env.get("DUCK4S_DOC_VERSION").getOrElse(publishVersion())
5962 super.scalaDocOptions() ++ Seq(
60- "-project", "Duck4s",
61- "-project-version", version,
63+ "-project",
64+ "Duck4s",
65+ "-project-version",
66+ version,
6267 "-social-links:github::https://github.com/softinio/duck4s",
6368 "-groups",
6469 "-snippet-compiler:compile",
65- "-external-mappings:" +
66- ".*scala.*::scaladoc3::https://scala-lang.org/api/3.x/," +
67- ".*java.*::javadoc::https://docs.oracle.com/en/java/javase/17/docs/api/"
68- )
70+ "-external-mappings:" +
71+ ".*scala.*::scaladoc3::https://scala-lang.org/api/3.x/," +
72+ ".*java.*::javadoc::https://docs.oracle.com/en/java/javase/17/docs/api/"
73+ )
6974 }
7075
7176 def pomSettings = PomSettings(
@@ -83,9 +88,53 @@ trait Duck4sModule extends ScalaModule with CrossScalaModule with PublishModule
8388 )
8489 )
8590
86- object test extends ScalaTests with TestModule.Munit {
87- def ivyDeps = Agg (
88- ivy "org.scalameta::munit::$munitVersion "
91+ object test extends ScalaTests with TestModule.Munit:
92+ def mvnDeps = Seq (
93+ mvn "org.scalameta::munit::$munitV "
8994 )
95+
96+ object `duck4s-cats-effect` extends Cross[Duck4sCatsEffectModule](scalaVersions)
97+
98+ trait Duck4sCatsEffectModule
99+ extends ScalaModule
100+ with CrossScalaModule
101+ with GitVersionedPublishModule:
102+ def artifactName = "duck4s-cats-effect"
103+
104+ def moduleDeps = Seq(duck4s(crossScalaVersion))
105+
106+ override def artifactScalaVersion: T[String] = Task {
107+ val v = crossScalaVersion
108+ if v.startsWith("3.") then "3"
109+ else v.split('.').take(2).mkString(".")
90110 }
91- }
111+
112+ def mvnDeps = Seq(
113+ mvn"org.typelevel::cats-effect:$catsEffectVersion",
114+ mvn"co.fs2::fs2-core:$fs2Version"
115+ )
116+
117+ def javacOptions = Seq("-source", "17", "-target", "17")
118+
119+ def scalacOptions =
120+ val common = Seq("-explain", "-explain-types", "-release", "17")
121+ if crossScalaVersion.startsWith("3.8") then
122+ common :+ "-Xkind-projector:underscores"
123+ else common
124+
125+ def pomSettings = PomSettings(
126+ description = "Scala 3 cats-effect integration for duck4s DuckDB library",
127+ organization = "com.softinio",
128+ url = "https://www.duck4s.com",
129+ licenses = Seq(License.`Apache-2.0`),
130+ versionControl = VersionControl.github("softinio", "duck4s"),
131+ developers = Seq(
132+ Developer("softinio", "Salar Rahmanian", "https://www.softinio.com")
133+ )
134+ )
135+
136+ object test extends ScalaTests with TestModule.Munit:
137+ def mvnDeps = Seq(
138+ mvn"org.scalameta::munit::$munitV",
139+ mvn"org.typelevel::munit-cats-effect::$munitCEVersion"
140+ )
0 commit comments