@@ -140,26 +140,66 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform)
140
140
)
141
141
.jsEnablePlugins(ScalaJSJUnitPlugin )
142
142
.nativeSettings(
143
- crossScalaVersions := Seq (" 2.13.8" , " 2.12.15" ),
143
+ crossScalaVersions := Seq (" 2.13.8" , " 2.12.15" , " 3.1.0" ),
144
+ mimaPreviousArtifacts := {
145
+ // TODO remove this setting whien 2.0.2 released
146
+ if (scalaBinaryVersion.value == " 3" ) {
147
+ mimaPreviousArtifacts.value.filterNot(_.revision == " 2.0.1" )
148
+ } else {
149
+ mimaPreviousArtifacts.value
150
+ }
151
+ },
144
152
// Scala Native cannot run forked tests
145
153
Test / fork := false ,
146
- libraryDependencies += " org.scala-native" %%% " junit-runtime" % nativeVersion % Test ,
147
- Test / scalacOptions += {
148
- val log = streams.value.log
149
- val retrieveDir = baseDirectory.value / " scala-native-junit-plugin-jars"
150
- val lm = dependencyResolution.value
151
- val cp = lm
152
- .retrieve(
153
- " org.scala-native" % s " junit-plugin_ ${scalaVersion.value}" % nativeVersion,
154
- scalaModuleInfo = None ,
155
- retrieveDir,
156
- log
157
- )
158
- .fold(w => throw w.resolveException, identity(_))
159
- val jarPath = cp
160
- .find(_.toString.contains(" junit-plugin" ))
161
- .getOrElse(throw new Exception (" Can't find Scala Native junit-plugin jar" ))
162
- s " -Xplugin: $jarPath"
154
+ Seq (Compile , Test ).map { s =>
155
+ s / sources := {
156
+ CrossVersion .partialVersion(scalaVersion.value) match {
157
+ case Some ((3 , 0 )) =>
158
+ Nil
159
+ case _ =>
160
+ (s / sources).value
161
+ }
162
+ }
163
+ },
164
+ libraryDependencies := {
165
+ CrossVersion .partialVersion(scalaVersion.value) match {
166
+ case Some ((3 , 0 )) =>
167
+ // scala-native does not support Scala 3.0.x
168
+ Nil
169
+ case _ =>
170
+ libraryDependencies.value ++ Seq (" org.scala-native" %%% " junit-runtime" % nativeVersion % Test )
171
+ }
172
+ },
173
+ Compile / doc / scalacOptions --= {
174
+ // TODO remove this workaround
175
+ // https://github.com/scala-native/scala-native/issues/2503
176
+ if (scalaBinaryVersion.value == " 3" ) {
177
+ (Compile / doc / scalacOptions).value.filter(_.contains(" -Xplugin" ))
178
+ } else {
179
+ Nil
180
+ }
181
+ },
182
+ publish / skip := CrossVersion .partialVersion(scalaVersion.value) == Some ((3 , 0 )),
183
+ Test / scalacOptions ++= {
184
+ if (CrossVersion .partialVersion(scalaVersion.value) != Some ((3 , 0 ))) {
185
+ val log = streams.value.log
186
+ val retrieveDir = baseDirectory.value / " scala-native-junit-plugin-jars"
187
+ val lm = dependencyResolution.value
188
+ val cp = lm
189
+ .retrieve(
190
+ " org.scala-native" % s " junit-plugin_ ${scalaVersion.value}" % nativeVersion,
191
+ scalaModuleInfo = None ,
192
+ retrieveDir,
193
+ log
194
+ )
195
+ .fold(w => throw w.resolveException, identity(_))
196
+ val jarPath = cp
197
+ .find(_.toString.contains(" junit-plugin" ))
198
+ .getOrElse(throw new Exception (" Can't find Scala Native junit-plugin jar" ))
199
+ Seq (s " -Xplugin: $jarPath" )
200
+ } else {
201
+ Nil
202
+ }
163
203
},
164
204
Test / testOptions += Tests .Argument (TestFrameworks .JUnit , " -a" , " -s" , " -v" )
165
205
)
0 commit comments