Skip to content

modules will use GitHub Actions, not Travis-CI #140

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 31, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 7 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ This is an sbt 1.x plugin for building Scala modules.

## What modules use it?

* [travis-test](https://github.com/lrytz/travis-test) (example project for testing this plugin and tag-driven releases)
* [scala-async](https://github.com/scala/scala-async)
* [scala-collection-compat](https://github.com/scala/scala-collection-compat)
* [scala-collection-contrib](https://github.com/scala/scala-collection-contrib)
Expand All @@ -25,19 +24,17 @@ A major feature of the plugin is automated tag-based publishing using
sbt-ci-release. A release is made by pushing a tag to GitHub.

The plugin also brings in
- sbt-travisci to set the `scalaVersion` and `crossScalaVersions`
- sbt-dynver to set the `version` based on the git history
- sbt-version-policy to check the versioning policy using MiMa
- sbt-header to automate copyright header maintenance
- sbt-mima-plugin to maintain binary compatibility
- sbt-osgi, if enabled with `scalaModuleOsgiSettings`
- sbt-version-policy to check the versioning policy

## Usage

Add the plugin to the `project/plugins.sbt` file:

```
addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "2.2.3")
addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % <version>)
```

Then, in your `build.sbt` add:
Expand All @@ -61,20 +58,17 @@ OsgiKeys.exportPackage := Seq(s"<exported package>;version=${version.value}")
// Other settings
```

Scala versions are defined in `.travis.yml`.

Cross-building with Scala.js and Scala Native is possible, see travis-test, scala-xml or scala-parser-combinators for example.
Cross-building with Scala.js and Scala Native is possible. See scala-xml or scala-parser-combinators for examples.

These additional settings are enabled by `scalaModuleSettings`:
- `scalacOptions in (Compile, compile) ++= Seq("-feature", "-deprecation", "-unchecked", "-Xlint")`
- `Compile / compile / scalacOptions ++= Seq("-feature", "-deprecation", "-unchecked", "-Xlint")`
- A `projectName.properties` file is generated and packaged
- `fork in Test := true` to work around some classpath clashes with scala-xml
- `Test / fork := true` to work around some classpath clashes with scala-xml
- POM metadata

The following settings are also available:
- `enableOptimizer` adds `-opt-inline-from:<sources>` or `-opt:l:project` or `-optimize` to `scalacOptions in (Compile, compile)`,
- `enableOptimizer` adds `-opt-inline-from:<sources>` or `-opt:l:project` or `-optimize` to `Compile / compile / scalacOptions`,
depending on the Scala version
- `disablePublishing` is useful for multi-project builds for projects that should not be published

## Set up tag-based publishing

Expand All @@ -91,7 +85,7 @@ The instructions here are a summary of the readme in https://github.com/olafurpg
- Copy the public key to a key server
- `gpg --armor --export $LONG_ID`
- http://keyserver.ubuntu.com:11371/
- Open the Settings panel on your project's travis, define four secret env vars
- In your repo's Actions settings, define four secret env vars
- `PGP_PASSPHRASE` the passphrase you chose above
- `PGP_SECRET` the secret key in base64
- macOS: `gpg --armor --export-secret-keys $LONG_ID | base64`
Expand Down
3 changes: 1 addition & 2 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,5 @@ developers := List(Developer("", "", "", url("https://scala-lang.org"))

addSbtPlugin("com.typesafe.sbt" % "sbt-osgi" % "0.9.6")
addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.6.0")
addSbtPlugin("com.dwijnand" % "sbt-travisci" % "1.2.0") // set scalaVersion and crossScalaVersions
addSbtPlugin("com.geirsson" % "sbt-ci-release" % "1.5.7") // set version, scmInfo, publishing settings
addSbtPlugin("ch.epfl.scala" % "sbt-version-policy" % "2.0.0")
addSbtPlugin("ch.epfl.scala" % "sbt-version-policy" % "2.0.0") // brings in MiMa
15 changes: 0 additions & 15 deletions src/main/scala/ScalaModulePlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,6 @@ object ScalaModulePlugin extends AutoPlugin {
override def projectSettings: Seq[Setting[_]] = Seq(
// The staging profile is called `org.scala-lang`, the default is `org.scala-lang.modules`
sonatypeProfileName := "org.scala-lang",

// The staging repository name. The default is `[sbt-sonatype] name version`. We include the
// Scala/Scala.js/Scala Native versions and the travis job number to avoid conflicts when
// running the travis jobs. Example: collection-compat has a two 2.12.x jobs, one for the
// compat library, one for the migration rules, and both were writing to the same staging repo.
sonatypeSessionName := {
val sjs = Option(System.getenv("SCALAJS_VERSION")).filter(_.nonEmpty).map(v => s" (js $v)").getOrElse("")
val native = Option(System.getenv("SCALANATIVE_VERSION")).filter(_.nonEmpty).map(v => s" (native $v)").getOrElse("")
val jobNr = Option(System.getenv("TRAVIS_JOB_NUMBER")).filter(_.nonEmpty).map(v => s" (travis #$v)").getOrElse("")
s"${sonatypeSessionName.value} Scala ${scalaVersion.value}$sjs$native$jobNr"
},
)

// Global settings
Expand All @@ -69,10 +58,6 @@ object ScalaModulePlugin extends AutoPlugin {
}
}

lazy val disablePublishing: Seq[Setting[_]] = Seq(
publish / skip := true
)

/**
* To be included in the main sbt project of a Scala module.
*/
Expand Down