|
| 1 | +val previousVersion: Option[String] = Some("1.1.0") |
| 2 | +val newScalaBinaryVersionsInThisRelease: Set[String] = Set() |
| 3 | + |
| 4 | +inThisBuild(Def.settings( |
| 5 | + version := "1.1.1-SNAPSHOT", |
| 6 | + organization := "org.scala-js", |
| 7 | + scalaVersion := "2.12.11", |
| 8 | + crossScalaVersions := Seq("2.11.12", "2.12.11", "2.13.2"), |
| 9 | + scalacOptions ++= Seq( |
| 10 | + "-deprecation", |
| 11 | + "-feature", |
| 12 | + "-Xfatal-warnings", |
| 13 | + "-encoding", "utf-8", |
| 14 | + ), |
| 15 | + |
| 16 | + // Licensing |
| 17 | + homepage := Some(url("https://github.com/scala-js/scala-js-js-envs")), |
| 18 | + startYear := Some(2013), |
| 19 | + licenses += (("Apache-2.0", url("https://www.apache.org/licenses/LICENSE-2.0"))), |
| 20 | + scmInfo := Some(ScmInfo( |
| 21 | + url("https://github.com/scala-js/scala-js-js-envs"), |
| 22 | + "scm:git:[email protected]:scala-js/scala-js-js-envs.git", |
| 23 | + Some( "scm:git:[email protected]:scala-js/scala-js-js-envs.git"))), |
| 24 | + |
| 25 | + // Publishing |
| 26 | + publishMavenStyle := true, |
| 27 | + publishTo := { |
| 28 | + val nexus = "https://oss.sonatype.org/" |
| 29 | + if (version.value.endsWith("-SNAPSHOT")) |
| 30 | + Some("snapshots" at nexus + "content/repositories/snapshots") |
| 31 | + else |
| 32 | + Some("releases" at nexus + "service/local/staging/deploy/maven2") |
| 33 | + }, |
| 34 | + pomExtra := ( |
| 35 | + <developers> |
| 36 | + <developer> |
| 37 | + <id>sjrd</id> |
| 38 | + <name>Sébastien Doeraene</name> |
| 39 | + <url>https://github.com/sjrd/</url> |
| 40 | + </developer> |
| 41 | + <developer> |
| 42 | + <id>gzm0</id> |
| 43 | + <name>Tobias Schlatter</name> |
| 44 | + <url>https://github.com/gzm0/</url> |
| 45 | + </developer> |
| 46 | + <developer> |
| 47 | + <id>nicolasstucki</id> |
| 48 | + <name>Nicolas Stucki</name> |
| 49 | + <url>https://github.com/nicolasstucki/</url> |
| 50 | + </developer> |
| 51 | + </developers> |
| 52 | + ), |
| 53 | + pomIncludeRepository := { _ => false }, |
| 54 | +)) |
| 55 | + |
| 56 | +val commonSettings = Def.settings( |
| 57 | + // Links to the JavaDoc do not work |
| 58 | + Compile / doc / scalacOptions -= "-Xfatal-warnings", |
| 59 | + |
| 60 | + // Scaladoc linking |
| 61 | + apiURL := { |
| 62 | + val name = moduleName.value |
| 63 | + val scalaBinVer = scalaBinaryVersion.value |
| 64 | + val ver = version.value |
| 65 | + Some(url(s"https://javadoc.io/doc/org.scala-js/${name}_$scalaBinVer/$ver/")) |
| 66 | + }, |
| 67 | + autoAPIMappings := true, |
| 68 | + |
| 69 | + // sbt-header configuration |
| 70 | + headerLicense := Some(HeaderLicense.Custom( |
| 71 | + s"""Scala.js JS Envs (${homepage.value.get}) |
| 72 | + | |
| 73 | + |Copyright EPFL. |
| 74 | + | |
| 75 | + |Licensed under Apache License 2.0 |
| 76 | + |(https://www.apache.org/licenses/LICENSE-2.0). |
| 77 | + | |
| 78 | + |See the NOTICE file distributed with this work for |
| 79 | + |additional information regarding copyright ownership. |
| 80 | + |""".stripMargin |
| 81 | + )), |
| 82 | + |
| 83 | + // MiMa auto-configuration |
| 84 | + mimaPreviousArtifacts ++= { |
| 85 | + val scalaV = scalaVersion.value |
| 86 | + val scalaBinaryV = scalaBinaryVersion.value |
| 87 | + val thisProjectID = projectID.value |
| 88 | + previousVersion match { |
| 89 | + case None => |
| 90 | + Set.empty |
| 91 | + case _ if newScalaBinaryVersionsInThisRelease.contains(scalaBinaryV) => |
| 92 | + // New in this release, no binary compatibility to comply to |
| 93 | + Set.empty |
| 94 | + case Some(prevVersion) => |
| 95 | + /* Filter out e:info.apiURL as it expects 1.1.1-SNAPSHOT, whereas the |
| 96 | + * artifact we're looking for has 1.1.0 (for example). |
| 97 | + */ |
| 98 | + val prevExtraAttributes = |
| 99 | + thisProjectID.extraAttributes.filterKeys(_ != "e:info.apiURL") |
| 100 | + val prevProjectID = |
| 101 | + (thisProjectID.organization % thisProjectID.name % prevVersion) |
| 102 | + .cross(thisProjectID.crossVersion) |
| 103 | + .extra(prevExtraAttributes.toSeq: _*) |
| 104 | + Set(prevProjectID) |
| 105 | + } |
| 106 | + }, |
| 107 | +) |
| 108 | + |
| 109 | +lazy val root = project |
| 110 | + .in(file(".")) |
| 111 | + |
| 112 | +lazy val `scalajs-js-envs` = project |
| 113 | + .in(file("js-envs")) |
| 114 | + .settings( |
| 115 | + commonSettings, |
| 116 | + libraryDependencies ++= Seq( |
| 117 | + "org.scala-js" %% "scalajs-logging" % "1.1.1", |
| 118 | + "com.novocode" % "junit-interface" % "0.11" % "test", |
| 119 | + ), |
| 120 | + ) |
| 121 | + |
| 122 | +lazy val `scalajs-js-envs-test-kit` = project |
| 123 | + .in(file("js-envs-test-kit")) |
| 124 | + .settings( |
| 125 | + commonSettings, |
| 126 | + libraryDependencies ++= Seq( |
| 127 | + "com.google.jimfs" % "jimfs" % "1.1", |
| 128 | + "junit" % "junit" % "4.12", |
| 129 | + "com.novocode" % "junit-interface" % "0.11" % "test" |
| 130 | + ), |
| 131 | + ) |
| 132 | + .dependsOn(`scalajs-js-envs`) |
| 133 | + |
| 134 | +lazy val `scalajs-env-nodejs` = project |
| 135 | + .in(file("nodejs-env")) |
| 136 | + .settings( |
| 137 | + commonSettings, |
| 138 | + libraryDependencies ++= Seq( |
| 139 | + "com.google.jimfs" % "jimfs" % "1.1", |
| 140 | + "com.novocode" % "junit-interface" % "0.11" % "test" |
| 141 | + ), |
| 142 | + ) |
| 143 | + .dependsOn(`scalajs-js-envs`, `scalajs-js-envs-test-kit` % "test") |
0 commit comments