Skip to content

Commit

Permalink
Further gha-scala-library-release-workflow tweaks
Browse files Browse the repository at this point in the history
Further to #102 (comment),
these are a few more tweaks:

* Delete the entire `sonatype.sbt` file that was providing these keys that
  `gha-scala-library-release-workflow` now takes care of for us:
  * `sonatypeProfileName` - see https://github.com/guardian/gha-scala-library-release-workflow/blob/7d278d4d44e30b4b4c0f6791053bdeb40b8159cb/.github/workflows/reusable-release.yml#L258
  * `publishTo` - see guardian/facia-scala-client#299 (comment)
  * `scmInfo` & `pomExtra` - see guardian/facia-scala-client#299 (review)
  * `homepage` - https://github.com/xerial/sbt-sonatype/blob/da75ed2efe29e7d674a6d6af5103b4aa1cecefb8/src/main/scala/xerial/sbt/Sonatype.scala#L368
* Specify Java 11-compatible bytecode - see https://github.com/guardian/facia-scala-client/pull/299/files#r1425630691

As part of some of these changes, I've also removed the vestiges of the build-configuration that
adapted the build for Scala 2.11 & 2.12 (eg the `versionDependent()` helper method) - these are
no longer need since #78 removed support for Scala 2.12
in January 2023.
  • Loading branch information
rtyley committed Dec 15, 2023
1 parent 9be3aec commit d26aa63
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 47 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Marley [![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.gu/marley_2.12/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.gu/marley_2.12)
Marley [![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.gu/marley_2.12/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.gu/marley_2.12) [![Release](https://github.com/guardian/marley/actions/workflows/release.yml/badge.svg)](https://github.com/guardian/marley/actions/workflows/release.yml)
======

Marley is a library for serialising [Scrooge](https://twitter.github.io/scrooge/) generated classes representing
Expand Down Expand Up @@ -30,7 +30,8 @@ val readStructs: Iterable[ExampleStruct] = AvroFile.read[ExampleStruct](file)
Is this usable in production?
-----------------------------

Marley has been extracted from a project where it's been running successfully for a number of months.
Marley has been used successfully in the Guardian's realtime analytics system
Ophan for many years.

Marley is macro based and doesn't perform any runtime reflection. I haven't
done any micro-benchmarking, but it's currently serialising more than 5000
Expand Down
36 changes: 12 additions & 24 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,31 +1,21 @@
import sbtversionpolicy.withsbtrelease.ReleaseVersion.fromAggregatedAssessedCompatibilityWithLatestRelease

ThisBuild/scalaVersion := "2.13.12"

ThisBuild/crossScalaVersions := Seq(scalaVersion.value)
ThisBuild / scalaVersion := "2.13.12"

val commonSettings = Seq(
organization := "com.gu",
homepage := Some(url("https://github.com/guardian/marley")),
licenses := Seq("Apache V2" -> url("http://www.apache.org/licenses/LICENSE-2.0.html")),
releaseVersion := fromAggregatedAssessedCompatibilityWithLatestRelease().value,
licenses := Seq("Apache V2" -> url("https://www.apache.org/licenses/LICENSE-2.0.html")),
libraryDependencies ++= Seq(
"org.scala-lang" % "scala-reflect" % scalaVersion.value,
"com.twitter" %% "scrooge-core" % "22.12.0",
"org.apache.thrift" % "libthrift" % "0.17.0"
)
)

def versionDependent[T](scalaV: String, handlesAnnotations: Boolean, value: T):Option[T] = {
val preMacroAnnotationsScalaVersions = Set("2.11", "2.12")
Some(value).filter(_ => handlesAnnotations != preMacroAnnotationsScalaVersions.contains(scalaV))
}

lazy val core = project.settings(
name := "marley",
Compile / scalacOptions += versionDependent(scalaBinaryVersion.value, handlesAnnotations=true, "-Ymacro-annotations"),
libraryDependencies ++= versionDependent(scalaBinaryVersion.value, handlesAnnotations=false,
compilerPlugin("org.scalamacros" % "paradise" % "2.1.1" cross CrossVersion.full)).toSeq ++ Seq(
Compile / scalacOptions ++= Seq("-release:11", "-Ymacro-annotations"),
libraryDependencies ++= Seq(
"org.apache.avro" % "avro" % "1.11.1",
"org.xerial.snappy" % "snappy-java" % "1.1.10.5",
"org.parboiled" %% "parboiled" % "2.5.0",
Expand All @@ -37,22 +27,20 @@ lazy val core = project.settings(
TestFrameworks.ScalaTest,
"-u", s"test-results/scala-${scalaVersion.value}"
)
).settings(commonSettings: _*).dependsOn(thriftExample % "test->test")
).settings(commonSettings).dependsOn(thriftExample % "test->test")

lazy val thriftExample = project.settings(commonSettings: _*)

Test/publishArtifact := false
lazy val thriftExample = project.settings(commonSettings).settings(
publish / skip := true,
)

lazy val root = (project in file(".")).aggregate(core).settings(
update/aggregate := false,
publish/skip := true,
update / aggregate := false,
publish / skip := true,
)

import ReleaseTransformations._
import sbt.Keys.scalaBinaryVersion

releaseCrossBuild := true // true if you cross-build the project for multiple Scala versions
import ReleaseTransformations.*

releaseVersion := fromAggregatedAssessedCompatibilityWithLatestRelease().value
releaseProcess := Seq[ReleaseStep](
checkSnapshotDependencies,
inquireVersions,
Expand Down
21 changes: 0 additions & 21 deletions sonatype.sbt

This file was deleted.

0 comments on commit d26aa63

Please sign in to comment.