Skip to content

Commit

Permalink
Feature/publish release (#33)
Browse files Browse the repository at this point in the history
* prepare to publish a release

* update readme

* fix build for publishing

* reformat
  • Loading branch information
winitzki authored Jul 6, 2024
1 parent 2f8a3ca commit 0b8e75c
Show file tree
Hide file tree
Showing 4 changed files with 114 additions and 51 deletions.
17 changes: 16 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,22 @@ So far, there are some issues with the Unicode characters:
the parser. As a workaround, at the moment, Unicode character `65533` is not allowed in Dhall files and will be
rejected at parsing time.

- Deeply nested expressions cause stack overflow.
- Deeply nested expressions will cause a stack overflow error.

# Release version history

## 0.2.0

- Fixed the regression described in https://github.com/dhall-lang/dhall-haskell/issues/2597
- Support for Yaml and JSON export
- Standalone JAR executable `dhall.jar` with command-line options similar to `dhall-haskell`
- Published to Maven (Scala 2.13 only)

## 0.1 (Not published)

- Full support for Dhall language standard version 23.0.0, submitted corrections to the Dhall standard: https://github.com/dhall-lang/dhall-lang/pull/1362
- Fixing the bug in CBOR library: https://github.com/peteroupc/CBOR-Java/pull/25 and uptaking CBOR-Java 4.5.3 with the fix.
- Some extensions (all backward-compatible, with no changes in normal forms)

# Building a command-line utility

Expand Down
138 changes: 92 additions & 46 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import xerial.sbt.Sonatype.{GitHubHosting, sonatypeCentralHost}

val scala2V = "2.13.13"
val scala212V = "2.12.19"
val scala3V = "3.4.1"
Expand Down Expand Up @@ -35,6 +37,17 @@ val kindProjectorPlugin = compilerPlugin(kindProjector)

def scala_reflect(value: String) = "org.scala-lang" % "scala-reflect" % value % Compile

lazy val publishingOptions = Seq(
organization := "io.chymyst",
version := "0.2.0",
licenses := Seq("Apache License, Version 2.0" -> url("https://www.apache.org/licenses/LICENSE-2.0.txt")),
homepage := Some(url("https://github.com/winitzki/scall")),
description := "Implementation of the Dhall language in Scala, with Scala language bindings",
publishTo := sonatypePublishToBundle.value,
)

lazy val noPublishing = Seq(publishArtifact := false, publishMavenStyle := true, publish := {}, publishLocal := {}, publish / skip := true)

lazy val jdkModuleOptions: Seq[String] = {
val jdkVersion = scala.sys.props.get("JDK_VERSION")
val options = if (jdkVersion exists (_ startsWith "8.")) Seq() else Seq("--add-opens", "java.base/java.util=ALL-UNNAMED")
Expand All @@ -43,10 +56,12 @@ lazy val jdkModuleOptions: Seq[String] = {
}

lazy val root = (project in file("."))
.settings(noPublishing)
.settings(scalaVersion := scalaV, crossScalaVersions := Seq(scalaV), name := "scall-root")
.aggregate(scall_core, scall_testutils, dhall_codec, abnf, scall_macros, scall_typeclasses, scall_cli)

lazy val scall_core = (project in file("scall-core"))
.settings(publishingOptions)
.settings(
scalaVersion := scalaV,
crossScalaVersions := supportedScalaVersions,
Expand Down Expand Up @@ -93,17 +108,20 @@ lazy val scall_core = (project in file("scall-core"))
),
).dependsOn(scall_testutils % "test->compile", scall_typeclasses)

lazy val scall_testutils = (project in file("scall-testutils")).settings(
scalaVersion := scalaV,
crossScalaVersions := supportedScalaVersions,
Test / parallelExecution := true,
Test / fork := true,
testFrameworks += munitFramework,
Test / javaOptions ++= jdkModuleOptions,
libraryDependencies ++= Seq(munitTest, assertVerboseTest, jnr_posix),
)
lazy val scall_testutils = (project in file("scall-testutils"))
.settings(publishingOptions)
.settings(
scalaVersion := scalaV,
crossScalaVersions := supportedScalaVersions,
Test / parallelExecution := true,
Test / fork := true,
testFrameworks += munitFramework,
Test / javaOptions ++= jdkModuleOptions,
libraryDependencies ++= Seq(munitTest, assertVerboseTest, jnr_posix),
)

lazy val dhall_codec = (project in file("dhall-codec"))
.settings(publishingOptions)
.settings(
scalaVersion := scalaV,
crossScalaVersions := supportedScalaVersions,
Expand All @@ -122,9 +140,8 @@ lazy val dhall_codec = (project in file("dhall-codec"))
).dependsOn(scall_core, scall_testutils % "test->compile")

lazy val scall_cli = (project in file("scall-cli"))
.settings(publishingOptions)
.settings(
organization := "io.chymyst",
version := "0.1",
scalaVersion := scalaV,
crossScalaVersions := supportedScalaVersions,
Test / parallelExecution := true,
Expand All @@ -133,46 +150,75 @@ lazy val scall_cli = (project in file("scall-cli"))
Test / javaOptions ++= jdkModuleOptions,
libraryDependencies ++= Seq(munitTest, assertVerboseTest, mainargs),
assembly / mainClass := Some("io.chymyst.dhall.Main"),
assembly / assemblyJarName := "dhall-cli.jar",
assembly / assemblyJarName := "dhall.jar",
assembly / assemblyMergeStrategy ~= (old => {
case PathList("com", "upokecenter", "util", "DataUtilities.class") => MergeStrategy.last
case x => old(x)
}),
).dependsOn(scall_core, scall_testutils % "test->compile")

lazy val abnf = (project in file("abnf")).settings(
name := "scall-abnf",
scalaVersion := scalaV,
crossScalaVersions := supportedScalaVersions,
Test / parallelExecution := true,
testFrameworks += munitFramework,
libraryDependencies ++= Seq(fastparse, munitTest, assertVerboseTest),
)
lazy val abnf = (project in file("abnf"))
.settings(noPublishing)
.settings(
name := "scall-abnf",
scalaVersion := scalaV,
crossScalaVersions := supportedScalaVersions,
Test / parallelExecution := true,
testFrameworks += munitFramework,
libraryDependencies ++= Seq(fastparse, munitTest, assertVerboseTest),
)

lazy val scall_macros = (project in file("scall-macros")).settings(
name := "scall-macros",
scalaVersion := scalaV,
crossScalaVersions := supportedScalaVersions,
Test / parallelExecution := true,
testFrameworks += munitFramework,
libraryDependencies ++= Seq(izumi_reflect, munitTest, assertVerboseTest),
libraryDependencies ++=
(CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, _)) => Seq(scala_reflect(scalaVersion.value), kindProjectorPlugin)
case Some((3, _)) => Seq.empty // No need for scala-reflect with Scala 3.
}),
)
lazy val scall_macros = (project in file("scall-macros"))
.settings(publishingOptions)
.settings(
name := "scall-macros",
scalaVersion := scalaV,
crossScalaVersions := supportedScalaVersions,
Test / parallelExecution := true,
testFrameworks += munitFramework,
libraryDependencies ++= Seq(izumi_reflect, munitTest, assertVerboseTest),
libraryDependencies ++=
(CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, _)) => Seq(scala_reflect(scalaVersion.value), kindProjectorPlugin)
case Some((3, _)) => Seq.empty // No need for scala-reflect with Scala 3.
}),
)

lazy val scall_typeclasses = (project in file("scall-typeclasses")).settings(
name := "scall-typeclasses",
scalaVersion := scalaV,
crossScalaVersions := supportedScalaVersions,
Test / parallelExecution := true,
testFrameworks += munitFramework,
libraryDependencies ++= Seq(munitTest, assertVerboseTest),
libraryDependencies ++=
(CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, _)) => Seq(kindProjectorPlugin)
case Some((3, _)) => Seq.empty
}),
)
lazy val scall_typeclasses = (project in file("scall-typeclasses"))
.settings(publishingOptions)
.settings(
name := "scall-typeclasses",
scalaVersion := scalaV,
crossScalaVersions := supportedScalaVersions,
Test / parallelExecution := true,
testFrameworks += munitFramework,
libraryDependencies ++= Seq(munitTest, assertVerboseTest),
libraryDependencies ++=
(CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, _)) => Seq(kindProjectorPlugin)
case Some((3, _)) => Seq.empty
}),
)

/////////////////////////////////////////////////////////////////////////////////////////////////////
// Publishing to Sonatype Maven repository
publishMavenStyle := true
publishTo := sonatypePublishToBundle.value
sonatypeProfileName := "io.chymyst"
ThisBuild / sonatypeCredentialHost := sonatypeCentralHost

sonatypeProjectHosting := Some(GitHubHosting("winitzki", "scall", "winitzki@gmail.com"))
homepage := Some(url("https://github.com/winitzki/scall"))
scmInfo := Some(ScmInfo(url("https://github.com/winitzki/scall"), "scm:git@github.com:winitzki/scall.git"))
developers := List(Developer(id = "winitzki", name = "Sergei Winitzki", email = "winitzki@gmail.com", url = url("https://sites.google.com/site/winitzki")))
/*{
val nexus = "https://oss.sonatype.org/"
if (isSnapshot.value)
Some("snapshots" at nexus + "content/repositories/snapshots")
else
Some("releases" at nexus + "service/local/staging/deploy/maven2")
}*/
//
Test / publishArtifact := false
//
/////////////////////////////////////////////////////////////////////////////////////////////////////
2 changes: 1 addition & 1 deletion make_jar.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
sbt scall_cli/assembly
rm -f dhall.jar
cp scall-cli/target/scala-*/dhall-cli.jar dhall.jar
cp scall-cli/target/scala-*/dhall.jar dhall.jar
java -jar dhall.jar --help
8 changes: 5 additions & 3 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
addDependencyTreePlugin
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.6")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.0.11") // 2.0.11 is the last version for Scala 2.13.
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "2.2.0")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.6")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.0.11") // 2.0.11 is the last version for Scala 2.13.
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "2.2.0")
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.11.0")
addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.2.1")

0 comments on commit 0b8e75c

Please sign in to comment.