diff --git a/README.md b/README.md index 3c9cb10..aa90b22 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ ![Actions Status](https://github.com/polentino/redacted/workflows/Scala%20CI/badge.svg) -![GitHub Tag](https://img.shields.io/github/v/tag/polentino/redacted?sort=semver&label=Latest%20Tag&color=blue) - +![GitHub Tag](https://img.shields.io/github/v/tag/polentino/redacted?sort=semver&label=Latest%20Tag&color=limegreen) +![Sonatype Nexus (Releases)](https://img.shields.io/nexus/r/io.github.polentino/redacted_3.1.3?server=https%3A%2F%2Fs01.oss.sonatype.org&label=Sonatype%20-%20redacted&color=blue) +![Sonatype Nexus (Releases)](https://img.shields.io/nexus/r/io.github.polentino/redacted-plugin_3.1.3?server=https%3A%2F%2Fs01.oss.sonatype.org&label=Sonatype%20-%20redacted%20plugin&color=blue) # Redacted @@ -49,10 +50,11 @@ it be better if you were simply to say "when I dump **the whole object**, I don' in your `build.sbt` file, add the following lines ```scala 3 -resolvers += "GitHub" at "https://maven.pkg.github.com/polentino/redacted" +val redactedVersion = // use latest version of the library +resolvers += "Sonatype OSS Releases" at "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2" libraryDependencies ++= Seq( - "io.github.polentino" % "redacted" % redactedVersion, - compilerPlugin("io.github.polentino" % "redacted-plugin" % redactedVersion cross CrossVersion.full) + "io.github.polentino" %% "redacted" % redactedVersion cross CrossVersion.full, + compilerPlugin("io.github.polentino" %% "redacted-plugin" % redactedVersion cross CrossVersion.full) ) ``` diff --git a/build.sbt b/build.sbt index 7a17b2c..2a0f1f8 100644 --- a/build.sbt +++ b/build.sbt @@ -1,6 +1,9 @@ -ThisBuild / version := "0.3.1" ThisBuild / scalaVersion := "3.1.3" +val organizeImportVersion = "0.6.0" +val scalaTestVersion = "3.2.17" +val scalaCheckVersion = "3.2.17.0" + // all LTS versions & latest minor ones val supportedScalaVersions = List( "3.1.3", @@ -11,17 +14,6 @@ val supportedScalaVersions = List( "3.4.0" ) -ThisBuild / crossScalaVersions := supportedScalaVersions -ThisBuild / publishMavenStyle := true -ThisBuild / crossPaths := false -ThisBuild / versionScheme := Some("early-semver") -ThisBuild / publishTo := Some("GitHub Package Registry" at "https://maven.pkg.github.com/polentino/redacted") -ThisBuild / credentials += Credentials( - "GitHub Package Registry", - "maven.pkg.github.com", - "polentino", - sys.env.getOrElse("GITHUB_TOKEN", "???")) - inThisBuild( List( organization := "io.github.polentino", @@ -46,12 +38,13 @@ lazy val root = (project in file(".")) .settings( name := "redacted-root", crossScalaVersions := Nil, + test / skip := true, publish / skip := true ) .aggregate(redactedLibrary, redactedCompilerPlugin, redactedTests) val scalafixSettings = Seq( - scalafixDependencies += "com.liancheng" %% "organize-imports" % "0.6.0", + scalafixDependencies += "com.liancheng" %% "organize-imports" % organizeImportVersion, semanticdbEnabled := true, semanticdbVersion := scalafixSemanticdb.revision ) @@ -68,14 +61,9 @@ lazy val redactedLibrary = (project in file("library")) .settings(crossCompileSettings) lazy val redactedCompilerPlugin = (project in file("plugin")) - .dependsOn(redactedLibrary) .settings(name := "redacted-plugin") - .settings(crossCompileSettings) .settings( - assembly / assemblyJarName := { - val assemblyJarFile = (Compile / Keys.`package`).value - assemblyJarFile.getName - }, + crossCompileSettings, libraryDependencies += "org.scala-lang" %% "scala3-compiler" % scalaVersion.value ) @@ -85,19 +73,20 @@ lazy val redactedTests = (project in file("tests")) .settings(scalafixSettings) .settings( publish / skip := true, + crossScalaVersions := supportedScalaVersions, libraryDependencies ++= Seq( - "org.scalatest" %% "scalatest" % "3.2.17" % Test, - "org.scalatestplus" %% "scalacheck-1-17" % "3.2.17.0" % Test + "org.scalatest" %% "scalatest" % scalaTestVersion % Test, + "org.scalatestplus" %% "scalacheck-1-17" % scalaCheckVersion % Test ), - scalacOptions ++= { - val jar = (redactedCompilerPlugin / assembly).value + Test / scalacOptions ++= { + val jar = (redactedCompilerPlugin / Compile / packageBin).value val addPlugin = "-Xplugin:" + jar.getAbsolutePath val dummy = "-Jdummy=" + jar.lastModified Seq(addPlugin, dummy) } ) -addCommandAlias("testAll", "; +test") -addCommandAlias("publishAll", "; +publish") +addCommandAlias("testAll", "; clean; +test") addCommandAlias("fmt", "; scalafix; scalafmtAll; scalafmtSbt") addCommandAlias("fmtCheck", "; scalafmtCheckAll ; scalafmtSbtCheck") +addCommandAlias("crossReleaseAll", "; clean; +publishSigned; sonatypeBundleRelease") diff --git a/plugin/src/main/scala/io/github/polentino/redacted/helpers/AstOps.scala b/plugin/src/main/scala/io/github/polentino/redacted/helpers/AstOps.scala index 704bc62..3e50491 100644 --- a/plugin/src/main/scala/io/github/polentino/redacted/helpers/AstOps.scala +++ b/plugin/src/main/scala/io/github/polentino/redacted/helpers/AstOps.scala @@ -7,10 +7,8 @@ import dotty.tools.dotc.core.Contexts.* import dotty.tools.dotc.core.Symbols.* import dotty.tools.dotc.core.{Flags, Symbols} -import io.github.polentino.redacted.redacted - object AstOps { - private val REDACTED_CLASS: String = classOf[redacted].getCanonicalName + private val REDACTED_CLASS: String = "io.github.polentino.redacted.redacted" def redactedSymbol(using Context): ClassSymbol = Symbols.requiredClass(REDACTED_CLASS) diff --git a/project/plugins.sbt b/project/plugins.sbt index d07e6e7..103e757 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,3 +1,4 @@ -addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.2") -addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.11.1") -addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "2.1.5") +addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.2") +addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.11.1") +addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.21") +addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.2.1") diff --git a/sonatype.sbt b/sonatype.sbt new file mode 100644 index 0000000..7ea1f86 --- /dev/null +++ b/sonatype.sbt @@ -0,0 +1,20 @@ +import xerial.sbt.Sonatype.GitHubHosting + +ThisBuild / scmInfo := Some( + ScmInfo( + url("https://github.com/polentino/redacted"), + "scm:git@github.com:polentino/redacted.git" + ) +) +ThisBuild / publishMavenStyle := true +ThisBuild / publishTo := sonatypePublishToBundle.value +ThisBuild / sonatypeCredentialHost := "s01.oss.sonatype.org" +ThisBuild / licenses := List("WTFPL" -> url("http://www.wtfpl.net/")) +ThisBuild / homepage := Some(url("https://github.com/polentino/redacted")) +ThisBuild / sonatypeRepository := "https://s01.oss.sonatype.org/service/local" +ThisBuild / sonatypeProjectHosting := Some(GitHubHosting("polentino", "redacted", "polentino911@gmail.com")) +ThisBuild / developers := List( + Developer("polentino", "Diego Casella", "polentino911@gmail.com", url("https://linkedin.com/in/diegocasella")) +) + +usePgpKeyHex("8326E86A8331A3C871E392795045B78015B14EE0") diff --git a/version.sbt b/version.sbt new file mode 100644 index 0000000..eae5ef9 --- /dev/null +++ b/version.sbt @@ -0,0 +1 @@ +ThisBuild / version := "0.4.0"