1
- import ScalaModulePlugin ._
2
- import sbtcrossproject .{crossProject , CrossType }
3
1
import _root_ .scalafix .sbt .BuildInfo .{scalafixVersion , scala212 => scalafixScala212 }
4
- import sys .process ._
2
+ import com .lightbend .tools .scalamoduleplugin .ScalaModulePlugin ._
3
+
4
+ import scala .sys .process ._
5
5
6
6
lazy val commonSettings = Seq (
7
7
headerLicense := Some (HeaderLicense .Custom (s """ |Scala (https://www.scala-lang.org)
@@ -14,11 +14,9 @@ lazy val commonSettings = Seq(
14
14
|See the NOTICE file distributed with this work for
15
15
|additional information regarding copyright ownership.
16
16
| """ .stripMargin)),
17
- mimaPreviousVersion := Some (" 2.1.1" ),
17
+ scalaModuleMimaPreviousVersion := Some (" 2.1.1" ),
18
18
)
19
19
20
- version in ThisBuild := " 2.1.3-SNAPSHOT"
21
-
22
20
lazy val root = project
23
21
.in(file(" ." ))
24
22
.settings(commonSettings)
@@ -52,16 +50,6 @@ lazy val scala211 = "2.11.12"
52
50
lazy val scala212 = " 2.12.8"
53
51
lazy val scala213 = " 2.13.0"
54
52
55
- scalaVersionsByJvm in ThisBuild := {
56
- val all = List (scala211, scala212, scala213)
57
- // Map[JvmMajorVersion, List[(ScalaVersion, UseForPublishing)]]
58
- Map (
59
- 8 -> all.map(_ -> true ),
60
- 11 -> all.map(_ -> false ),
61
- 12 -> all.map(_ -> false )
62
- )
63
- }
64
-
65
53
/** Create an OSGi version range for standard Scala versioning
66
54
* schemes that describes binary compatible versions. */
67
55
def osgiVersionRange (version : String , requireMicro : Boolean = false ): String =
@@ -289,54 +277,21 @@ lazy val dontPublish = Seq(
289
277
packagedArtifacts := Map .empty,
290
278
publish := {},
291
279
publishLocal := {},
292
- mimaPreviousVersion := None ,
280
+ scalaModuleMimaPreviousVersion := None ,
293
281
)
294
282
295
- val preRelease = " preRelease"
296
283
val travisScalaVersion = sys.env.get(" TRAVIS_SCALA_VERSION" ).flatMap(Version .parse)
297
284
val releaseVersion = sys.env.get(" TRAVIS_TAG" ).flatMap(Version .parse)
298
285
val isScalaJs = sys.env.get(" SCALAJS_VERSION" ).map(_.nonEmpty).getOrElse(false )
299
286
val isScalaNative = sys.env.get(" SCALANATIVE_VERSION" ).map(_.nonEmpty).getOrElse(false )
300
287
val isScalafix = sys.env.get(" TEST_SCALAFIX" ).nonEmpty
301
288
val isScalafmt = sys.env.get(" TEST_SCALAFMT" ).nonEmpty
302
289
val isBinaryCompat = sys.env.get(" TEST_BINARY_COMPAT" ).nonEmpty
303
- val isRelease = releaseVersion.nonEmpty
304
-
305
- val releaseCredentials =
306
- if (isRelease) {
307
- def env (key : String ): String = Option (System .getenv(key)).getOrElse(" " )
308
-
309
- Seq (
310
- pgpPassphrase := Some (env(" PGP_PASSPHRASE" ).toArray),
311
- pgpPublicRing := file(" admin/pubring.asc" ),
312
- pgpSecretRing := file(" admin/secring.asc" ),
313
- credentials += Credentials (" Sonatype Nexus Repository Manager" ,
314
- " oss.sonatype.org" ,
315
- env(" SONA_USER" ),
316
- env(" SONA_PASS" ))
317
- )
318
- } else {
319
- Seq ()
320
- }
321
-
322
- inThisBuild(releaseCredentials)
290
+ val jdkVersion = sys.env.get(" ADOPTOPENJDK" ).map(_.toInt)
323
291
324
292
// required by sbt-scala-module
325
293
inThisBuild(
326
294
Seq (
327
- commands += Command .command(preRelease) { state =>
328
- // Show Compat version, Scala version, and Java Version
329
- val jvmVersion = Version .parse(sys.props(" java.specification.version" )).get.minor
330
- releaseVersion match {
331
- case Some (tagVersion) =>
332
- println(
333
- s " Releasing $tagVersion with Scala ${travisScalaVersion.get} on Java version $jvmVersion. " )
334
- // Copy pgp stuff
335
- " admin/pre-release.sh" ! state.globalLogging.full
336
- case None =>
337
- }
338
- state
339
- },
340
295
commands += Command .command(" scalafmt-test" ) { state =>
341
296
Seq (" admin/scalafmt.sh" , " --test" ) ! state.globalLogging.full
342
297
state
@@ -388,10 +343,18 @@ inThisBuild(
388
343
releaseVersion.map(" set every version := \" " + _ + " \" " ).toList
389
344
390
345
val publishTask =
391
- if (releaseVersion.nonEmpty && ! isBinaryCompat) {
346
+ if (releaseVersion.nonEmpty && ! isBinaryCompat && jdkVersion == Some (8 )) {
347
+ // we cannot run "ci-release" because that reads the `CI_RELEASE` / `CI_SONATYPE_RELEASE`
348
+ // env vars, which we cannot modify from java (easily). so we inline what this command does.
349
+ CiReleasePlugin .setupGpg()
392
350
List (
393
- preRelease,
394
- s " $projectPrefix/publishSigned "
351
+ // work around https://github.com/olafurpg/sbt-ci-release/issues/64
352
+ " set pgpSecretRing := pgpSecretRing.value" ,
353
+ " set pgpPublicRing := pgpPublicRing.value" ,
354
+ s " $projectPrefix/publishSigned " ,
355
+ " sonatypePrepare" ,
356
+ " sonatypeBundleUpload" ,
357
+ " sonatypeClose" ,
395
358
)
396
359
} else {
397
360
Nil
0 commit comments