Skip to content

Commit

Permalink
Publish to sonatype upgrade to sbt 1.5.0
Browse files Browse the repository at this point in the history
- Upgrade sbt to 1.5.0
- Update build configs to publish to sonatype / maven central
- Replace sbt-git-versioning with sbt-dynver plugin
- Update Travis build
  - Pre-cache sbt 1.5.0
  - Support Coursier cache
  • Loading branch information
jeffmay committed Apr 13, 2021
1 parent 876496e commit 1deb06f
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 29 deletions.
20 changes: 14 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,31 @@
language: scala
scala:
- 2.13.0
- 2.13.5
jdk:
- openjdk8
- openjdk11

before_script:
# Download sbt because Travis can't find it automatically :(
- mkdir -p $HOME/.sbt/launchers/1.5.0/
- curl -L -o $HOME/.sbt/launchers/1.5.0/sbt-launch.jar https://repo1.maven.org/maven2/org/scala-sbt/sbt-launch/1.5.0/sbt-launch-1.5.0.jar

script:
- sbt scalafmtCheckAll clean coverage test coverageAggregate coverageOff

after_success:
# Upload coverage reports to codecov.io
- bash <(curl -s https://codecov.io/bash)

# Tricks to avoid unnecessary cache updates
- find $HOME/.sbt -name "*.lock" | xargs rm
- find $HOME/.ivy2 -name "ivydata-*.properties" | xargs rm
# Avoid unnecessary cache updates
before_cache:
- rm -fv $HOME/.ivy2/.sbt.ivy.lock
- find $HOME/.ivy2/cache -name "ivydata-*.properties" -print -delete
- find $HOME/.sbt -name "*.lock" -print -delete

# These directories are cached to S3 at the end of the build
cache:
directories:
- $HOME/.m2/repository
- $HOME/.ivy2
- $HOME/.cache/coursier
- $HOME/.ivy2/cache
- $HOME/.sbt
18 changes: 10 additions & 8 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name := "vapors-root"
ThisBuild / organization := "com.rallyhealth"
ThisBuild / organizationName := "Rally Health"

ThisBuild / licenses := Seq("MIT" -> url("http://opensource.org/licenses/MIT"))

ThisBuild / versionScheme := Some("early-semver")
ThisBuild / scalaVersion := Dependencies.Scala_2_13
ThisBuild / licenses := Seq("MIT" -> url("https://opensource.org/licenses/MIT"))

ThisBuild / scalacOptions ++= Seq(
"-deprecation:false",
Expand All @@ -16,19 +16,20 @@ ThisBuild / scalacOptions ++= Seq(
"-Ymacro-annotations",
)

ThisBuild / bintrayOrganization := Some("rallyhealth")
ThisBuild / bintrayRepository := "maven"
// reload sbt when the build files change
Global / onChangedBuildSource := ReloadOnSourceChanges

ThisBuild / resolvers += Resolver.bintrayRepo("rallyhealth", "maven")
//homepage := Some(url("https://(your project url)"))
developers := List(
Developer(id = "jeffmay", name = "Jeff May", email = "[email protected]", url = url("https://github.com/jeffmay")),
)

// ScalaDoc generation is generally broken. It's really mostly useful from within the IDE anyway
// so just disable generation to allow publishing without ScalaDoc errors.
ThisBuild / Compile / packageDoc / publishArtifact := false
ThisBuild / packageDoc / publishArtifact := false

// Disable publishing of the root project
publish := {}
publishLocal := {}
publish / skip := true

def commonProject(dir: String): Project = {
Project(dir, file(dir)).settings(
Expand All @@ -38,5 +39,6 @@ def commonProject(dir: String): Project = {

lazy val core = commonProject("core")
.settings(
resolvers += Resolver.bintrayRepo("rallyhealth", "maven"),
libraryDependencies ++= Dependencies.CoreProject.all(scalaVersion.value),
)
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.3.13
sbt.version=1.5.0
16 changes: 2 additions & 14 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,18 +1,6 @@
resolvers += Classpaths.sbtPluginReleases

resolvers += Resolver.url(
"Rally Plugin Releases",
url("https://dl.bintray.com/rallyhealth/sbt-plugins"),
)(Resolver.ivyStylePatterns)

resolvers += Resolver.url(
"bintray-sbt-plugin-releases",
url("https://dl.bintray.com/content/sbt/sbt-plugin-releases"),
)(Resolver.ivyStylePatterns)

addSbtPlugin("org.foundweekends" % "sbt-bintray" % "0.5.6")
// Not needed for Scala 2.13, but leaving this here for if we want to cross-compile to Scala 2.11
// addSbtPlugin("org.lyranthe.sbt" % "partial-unification" % "1.1.2")
addSbtPlugin("com.rallyhealth.sbt" %% "sbt-git-versioning" % "1.4.0")
addSbtPlugin("com.dwijnand" % "sbt-dynver" % "4.1.1")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.2")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.6.0")
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.7")
22 changes: 22 additions & 0 deletions sonatype.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Your profile name of the sonatype account. The default is the same with the organization value
sonatypeProfileName := "com.rallyhealth"

// To sync with Maven central, you need to supply the following information:
publishMavenStyle := true

// publish to Maven Central
ThisBuild / sonatypeCredentialHost := "s01.oss.sonatype.org"
ThisBuild / publishTo := Some {
if (isSnapshot.value)
Resolver.url("Sonatype", url("https://s01.oss.sonatype.org/content/repositories/snapshots"))
else
Resolver.url("Sonatype", url("https://s01.oss.sonatype.org/content/repositories/releases"))
}

// add SNAPSHOT to non-release versions so they are not published to the main repo
ThisBuild / dynverSonatypeSnapshots := true
// Use '-' instead of '+' for simpler snapshot URLs
ThisBuild / dynverSeparator := "-"

import xerial.sbt.Sonatype.GitHubHosting
sonatypeProjectHosting := Some(GitHubHosting("jeffmay", "vapors", "[email protected]"))

0 comments on commit 1deb06f

Please sign in to comment.