@@ -8,6 +8,7 @@ import $ivy.`com.github.lolgab::mill-mima::0.1.0`
8
8
9
9
import mill ._ , mill .scalalib ._ , mill .scalanativelib ._ , mill .scalanativelib .api ._
10
10
import mill .scalalib .publish ._
11
+ import mill .util .Jvm
11
12
import com .goyeau .mill .scalafix .ScalafixModule
12
13
import io .kipp .mill .ci .release .CiReleaseModule
13
14
import mill .contrib .buildinfo .BuildInfo
@@ -38,7 +39,10 @@ object Common {
38
39
def scalacOptions = super .scalacOptions() ++
39
40
Seq (" -deprecation" )
40
41
}
41
- trait SharedNative extends Shared with ScalaNativeModule {
42
+ trait Jvm extends Shared {
43
+ def scalaVersion = Versions .scala3
44
+ }
45
+ trait Native extends Jvm with ScalaNativeModule {
42
46
def scalaNativeVersion = versions.Versions .scalaNative
43
47
44
48
def baseTestConfig (binary : os.Path ) = {
@@ -64,17 +68,6 @@ object Common {
64
68
}
65
69
66
70
}
67
-
68
- trait Scala3Only extends SharedNative {
69
- def crossScalaVersion = Versions .scala3
70
- def scalaVersion = crossScalaVersion
71
- }
72
- trait Scala3OnlyJvm extends Shared {
73
- def crossScalaVersion = Versions .scala3
74
- def scalaVersion = crossScalaVersion
75
- }
76
- trait Cross extends CrossScalaModule with SharedNative
77
- trait CrossJvm extends CrossScalaModule with Shared
78
71
}
79
72
80
73
trait Publish extends CiReleaseModule with Mima {
@@ -93,16 +86,14 @@ trait Publish extends CiReleaseModule with Mima {
93
86
// Remove after first release with Scala Native 0.5
94
87
def mimaPreviousArtifacts = Task { Seq .empty }
95
88
}
96
- object snunit extends Cross [SNUnitModule ](scalaVersions)
97
- trait SNUnitModule extends Common .Cross with Publish {
89
+ object snunit extends Common .Native with Publish {
98
90
object test extends ScalaNativeTests with TestModule .Utest {
99
91
def ivyDeps = super .ivyDeps() ++ Agg (utest)
100
92
}
101
93
}
102
94
103
- // object `snunit-async-cats-effect` extends Cross[SNUnitAsyncCatsEffectModule](scalaVersions)
104
- // trait SNUnitAsyncCatsEffectModule extends Common.Cross with Publish {
105
- // def moduleDeps = Seq(snunit())
95
+ // object `snunit-async-cats-effect` extends Common.Native with Publish {
96
+ // def moduleDeps = Seq(snunit)
106
97
107
98
// def ivyDeps =
108
99
// Task {
@@ -112,33 +103,46 @@ trait SNUnitModule extends Common.Cross with Publish {
112
103
// }
113
104
// }
114
105
115
- object `snunit-undertow` extends Cross [SNUnitUndertow ](scalaVersions)
116
- trait SNUnitUndertow extends Common .Cross with Publish {
117
- def moduleDeps = Seq (snunit())
106
+ object `snunit-undertow` extends Common .Native with Publish {
107
+ def moduleDeps = Seq (snunit)
108
+ def ivyDeps = super .ivyDeps() ++ Agg (undertow)
109
+ // Remove class and tasty files
110
+ override def jar = Task {
111
+ Jvm .createJar(
112
+ localClasspath().map(_.path).filter(os.exists),
113
+ manifest(),
114
+ (_, file) =>
115
+ file.ext match {
116
+ case " class" | " tasty" => false
117
+ case _ => true
118
+ }
119
+ )
120
+ }
121
+ // Sometimes it gives problems compiling since our internal API is different
122
+ // than the java API in the class files.
123
+ def zincIncrementalCompilation = false
118
124
}
119
125
120
- object `snunit-tapir` extends Cross [SNUnitTapirModule ](scalaVersions)
121
- trait SNUnitTapirModule extends Common .Cross with Publish {
122
- def moduleDeps = Seq (snunit())
126
+ object `snunit-tapir` extends Common .Native with Publish {
127
+ def moduleDeps = Seq (snunit)
123
128
def ivyDeps = super .ivyDeps() ++ Agg (ivy " com.softwaremill.sttp.tapir::tapir-server:: ${Versions .tapir}" )
124
129
}
125
- // object `snunit-tapir-cats-effect` extends Cross[SNUnitTapirCatsEffect](scalaVersions)
126
- // trait SNUnitTapirCatsEffect extends Common.Cross with Publish {
130
+ // object `snunit-tapir-cats-effect` extends Common.Native with Publish {
127
131
// def moduleDeps = Seq(
128
- // `snunit-tapir`() ,
129
- // `snunit-async-cats-effect`()
132
+ // `snunit-tapir`,
133
+ // `snunit-async-cats-effect`
130
134
// )
131
135
// def ivyDeps = super.ivyDeps() ++ Agg(
132
136
// ivy"com.softwaremill.sttp.tapir::tapir-cats-effect::${Versions.tapir}"
133
137
// )
134
138
// }
135
139
136
- // object `snunit-http4s` extends Cross[SNUnitHttp4s](http4sAndScalaVersions)
137
- // trait SNUnitHttp4s extends Common.Cross with Cross.Module2[String, String] with Publish {
138
- // val http4sVersion = crossValue2
140
+ // object `snunit-http4s` extends Cross[SNUnitHttp4s]
141
+ // trait SNUnitHttp4s extends Common.Native with Cross.Module[ String] with Publish {
142
+ // val http4sVersion = crossValue
139
143
// def moduleDeps = Seq(
140
- // snunit() ,
141
- // `snunit-async-cats-effect`()
144
+ // snunit,
145
+ // `snunit-async-cats-effect`
142
146
// )
143
147
// val http4sBinaryVersion = http4sVersion match {
144
148
// case s"0.23.$_" => "0.23"
@@ -165,14 +169,13 @@ def castorSources = Task {
165
169
.call()
166
170
PathRef (dest)
167
171
}
168
- object `snunit-cask` extends Cross [SNUnitCaskModule ](scalaVersions)
169
- trait SNUnitCaskModule extends Common .Cross with Publish {
172
+ object `snunit-cask` extends Common .Native with Publish {
170
173
override def generatedSources = Task {
171
174
val cask = caskSources().path / " cask"
172
175
val castor = castorSources().path / " castor"
173
176
Seq (cask / " src" , cask / " util" / " src" , cask / " src-3" , castor / " src" , castor / " src-js-native" ).map(PathRef (_))
174
177
}
175
- def moduleDeps = Seq (`snunit-undertow`(crossScalaVersion) )
178
+ def moduleDeps = Seq (`snunit-undertow`)
176
179
def ivyDeps = super .ivyDeps() ++ Agg (
177
180
upickle,
178
181
ivy " io.github.cquiroz::scala-java-time:: ${Versions .scalaJavaTime}" ,
@@ -182,62 +185,61 @@ trait SNUnitCaskModule extends Common.Cross with Publish {
182
185
183
186
object integration extends ScalaModule {
184
187
object tests extends Module {
185
- object `hello-world` extends Cross [HelloWorld ](scalaVersions)
186
- trait HelloWorld extends Common .Cross {
187
- def moduleDeps = Seq (snunit())
188
+ object `hello-world` extends Common .Native {
189
+ def moduleDeps = Seq (snunit)
188
190
}
189
- object `websocket-echo` extends Common .Scala3Only {
190
- def moduleDeps = Seq (snunit(crossScalaVersion) )
191
+ object `websocket-echo` extends Common .Native {
192
+ def moduleDeps = Seq (snunit)
191
193
}
192
- object `multiple-handlers` extends Common .Scala3Only {
193
- def moduleDeps = Seq (snunit(crossScalaVersion) )
194
+ object `multiple-handlers` extends Common .Native {
195
+ def moduleDeps = Seq (snunit)
194
196
}
195
197
object `undertow-helloworld` extends CrossPlatform {
196
- object native extends CrossPlatformScalaModule with Common .Scala3Only {
197
- def moduleDeps = Seq (`snunit-undertow`(crossScalaVersion) )
198
+ object native extends CrossPlatformScalaModule with Common .Native {
199
+ def moduleDeps = Seq (`snunit-undertow`)
198
200
}
199
- object jvm extends CrossPlatformScalaModule with Common .Scala3OnlyJvm {
201
+ object jvm extends CrossPlatformScalaModule with Common .Jvm {
200
202
def ivyDeps = super .ivyDeps() ++ Agg (undertow)
201
203
}
202
204
}
203
205
object `cask-helloworld` extends CrossPlatform {
204
- object jvm extends CrossPlatformScalaModule with Common .Scala3OnlyJvm {
206
+ object jvm extends CrossPlatformScalaModule with Common .Jvm {
205
207
def ivyDeps = super .ivyDeps() ++ Agg (
206
208
ivy " com.lihaoyi::cask: ${Versions .cask}"
207
209
)
208
210
}
209
- object native extends CrossPlatformScalaModule with Common .Scala3Only {
210
- def moduleDeps = Seq (`snunit-cask`(crossScalaVersion) )
211
+ object native extends CrossPlatformScalaModule with Common .Native {
212
+ def moduleDeps = Seq (`snunit-cask`)
211
213
}
212
214
}
213
- object `tapir-helloworld` extends Common .Scala3Only {
214
- override def moduleDeps = Seq (`snunit-tapir`(crossScalaVersion) )
215
+ object `tapir-helloworld` extends Common .Native {
216
+ override def moduleDeps = Seq (`snunit-tapir`)
215
217
}
216
- // object `tapir-app` extends Common.Scala3Only {
217
- // override def moduleDeps = Seq(`snunit-tapir-cats-effect`(crossScalaVersion) )
218
+ // object `tapir-app` extends Common.Native {
219
+ // override def moduleDeps = Seq(`snunit-tapir-cats-effect`)
218
220
// }
219
221
// object `http4s-helloworld` extends Cross[Http4sHelloWorldModule](http4sVersions)
220
- // trait Http4sHelloWorldModule extends Common.Scala3Only with Cross.Module[String] {
222
+ // trait Http4sHelloWorldModule extends Common.Native with Cross.Module[String] {
221
223
// def http4sVersion = crossValue
222
224
// def moduleDeps = Seq(
223
- // `snunit-http4s`(crossScalaVersion, http4sVersion)
225
+ // `snunit-http4s`(http4sVersion)
224
226
// )
225
227
// def ivyDeps = super.ivyDeps() ++ Agg(
226
228
// ivy"org.http4s::http4s-dsl::$http4sVersion"
227
229
// )
228
230
// }
229
- // object `http4s-app` extends Common.Scala3Only {
231
+ // object `http4s-app` extends Common.Native {
230
232
// val http4sVersion = Versions.http4s1
231
233
// def moduleDeps = Seq(
232
- // `snunit-http4s`(crossScalaVersion, http4sVersion)
234
+ // `snunit-http4s`(http4sVersion)
233
235
// )
234
236
// def ivyDeps = super.ivyDeps() ++ Agg(
235
237
// ivy"org.http4s::http4s-dsl::$http4sVersion"
236
238
// )
237
239
// }
238
- // object `tapir-helloworld-cats-effect` extends Common.Scala3Only {
240
+ // object `tapir-helloworld-cats-effect` extends Common.Native {
239
241
// def moduleDeps = Seq(
240
- // `snunit-tapir-cats-effect`(crossScalaVersion)
242
+ // `snunit-tapir-cats-effect`
241
243
// )
242
244
// }
243
245
}
@@ -288,7 +290,7 @@ object `snunit-mill-plugin` extends Common.Shared with Publish with BuildInfo {
288
290
def mainClass = Some (" mill.runner.client.MillClientMain" )
289
291
def resources = Task {
290
292
// make sure snunit is published
291
- snunit(versions. Versions .scala3) .publishLocal()()
293
+ snunit.publishLocal()()
292
294
293
295
val p = Task .dest / " mill/local-test-overrides" / s " com.lihaoyi- ${`snunit-mill-plugin`.artifactId()}"
294
296
os.write(p, `snunit-mill-plugin`.localClasspath().map(_.path).mkString(" \n " ), createFolders = true )
0 commit comments