diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..120c689 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,6 @@ +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" \ No newline at end of file diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml new file mode 100644 index 0000000..7e2bf44 --- /dev/null +++ b/.github/release-drafter.yml @@ -0,0 +1,19 @@ +name-template: 'v$NEXT_PATCH_VERSION' +tag-template: 'v$NEXT_PATCH_VERSION' +categories: + - title: '🚀 Features' + labels: + - 'feature' + - title: '🐛 Bug Fixes' + labels: + - 'bug' + - title: '🧰 Maintenance' + labels: + - 'build' + - title: '🌱 Dependency Updates' + labels: + - 'dependency-update' +change-template: '- $TITLE @$AUTHOR (#$NUMBER)' +template: | + ## Changes + $CHANGES diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3a8cf2e..e550cb5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,14 +14,12 @@ jobs: include: - java: 8 - java: 11 + - java: 17 steps: - uses: actions/checkout@v2.3.4 - - uses: olafurpg/setup-scala@v10 + - uses: actions/setup-java@v3 with: - java-version: "adopt@1.${{ matrix.java }}" - - uses: coursier/cache-action@v5 + distribution: temurin + java-version: ${{ matrix.java }} + cache: sbt - run: sbt -v test scripted - - run: - rm -rf "$HOME/.ivy2/local" || true - find "$HOME/.ivy2/cache" -name "ivydata-*.properties" -print -delete - find "$HOME/.sbt" -name "*.lock" -print -delete diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml new file mode 100644 index 0000000..58bddce --- /dev/null +++ b/.github/workflows/release-drafter.yml @@ -0,0 +1,13 @@ +name: Release Drafter + +on: + push: + branches: ['master'] + +jobs: + update_release_draft: + runs-on: ubuntu-20.04 + steps: + - uses: release-drafter/release-drafter@v5 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/scala-steward.yml b/.github/workflows/scala-steward.yml new file mode 100644 index 0000000..df5038c --- /dev/null +++ b/.github/workflows/scala-steward.yml @@ -0,0 +1,16 @@ +name: Scala Steward + +# This workflow will launch every day at 00:00 +on: + schedule: + - cron: '0 0 * * *' + workflow_dispatch: {} + +jobs: + scala-steward: + timeout-minutes: 45 + runs-on: ubuntu-latest + name: Scala Steward + steps: + - name: Scala Steward + uses: scala-steward-org/scala-steward-action@v2.54.0 diff --git a/build.sbt b/build.sbt index eebbdbd..6dcba52 100644 --- a/build.sbt +++ b/build.sbt @@ -11,7 +11,7 @@ val jmhVersion = { val commonSettings = Seq( organization := "pl.project13.scala", - publishTo := Some(if (isSnapshot.value) Opts.resolver.sonatypeSnapshots else Opts.resolver.sonatypeStaging), + publishTo := Some(if (isSnapshot.value) Opts.resolver.sonatypeOssSnapshots.last else Opts.resolver.sonatypeStaging), startYear := Some(2014), licenses += ("Apache-2.0", url("http://www.apache.org/licenses/LICENSE-2.0.html")), homepage := Some(url("https://github.com/ktoso/sbt-jmh")), diff --git a/plugin/src/main/scala/pl/project13/scala/sbt/JmhPlugin.scala b/plugin/src/main/scala/pl/project13/scala/sbt/JmhPlugin.scala index e9a041a..1821e4b 100644 --- a/plugin/src/main/scala/pl/project13/scala/sbt/JmhPlugin.scala +++ b/plugin/src/main/scala/pl/project13/scala/sbt/JmhPlugin.scala @@ -16,15 +16,10 @@ package pl.project13.scala.sbt -import java.util.Properties - -import sbt._ -import sbt.Keys._ -import org.openjdk.jmh.annotations.Benchmark -import org.openjdk.jmh.generators.bytecode.JmhBytecodeGenerator -import sbt.KeyRanks.AMinusSetting +import sbt.* +import sbt.Keys.* -import scala.tools.nsc.util.ScalaClassLoader.URLClassLoader +import java.util.Properties object JmhPlugin extends AutoPlugin { @@ -33,7 +28,7 @@ object JmhPlugin extends AutoPlugin { val generatorType = settingKey[String]("Benchmark code generator type. Available: `default`, `reflection` or `asm`.") } - import JmhKeys._ + import JmhKeys.* val autoImport = JmhKeys @@ -52,17 +47,17 @@ object JmhPlugin extends AutoPlugin { version := jmhVersionFromProps(), generatorType := "default", - mainClass in run := Some("org.openjdk.jmh.Main"), - fork in run := true, // makes sure that sbt manages classpath for JMH when forking + run / mainClass := Some("org.openjdk.jmh.Main"), + run / fork := true, // makes sure that sbt manages classpath for JMH when forking // allow users to configure another classesDirectory like e.g. test:classDirectory - classDirectory := (classDirectory in Compile).value, - dependencyClasspath := (dependencyClasspath in Compile).value, + classDirectory := (Compile / classDirectory).value, + dependencyClasspath := (Compile / dependencyClasspath).value, - resourceDirectory := (resourceDirectory in Compile).value, + resourceDirectory := (Compile / resourceDirectory).value, sourceGenerators := Seq(Def.task { generateJmhSourcesAndResources.value._1 }.taskValue), resourceGenerators := Seq(Def.task { generateJmhSourcesAndResources.value._2 }.taskValue), - generateJmhSourcesAndResources := generateBenchmarkSourcesAndResources(streams.value, crossTarget.value / "jmh-cache", (classDirectory in Jmh).value, sourceManaged.value, resourceManaged.value, generatorType.value, (dependencyClasspath in Jmh).value, new Run(scalaInstance.value, true, taskTemporaryDirectory.value)), - generateJmhSourcesAndResources := (generateJmhSourcesAndResources dependsOn(compile in Compile)).value, + generateJmhSourcesAndResources := generateBenchmarkSourcesAndResources(streams.value, crossTarget.value / "jmh-cache", (Jmh / classDirectory).value, sourceManaged.value, resourceManaged.value, generatorType.value, (Jmh / dependencyClasspath).value, new Run(scalaInstance.value, true, taskTemporaryDirectory.value)), + generateJmhSourcesAndResources := (generateJmhSourcesAndResources dependsOn(Compile / compile)).value, // local copy of https://github.com/sbt/sbt/blob/e4231ac03903e174bc9975ee00d34064a1d1f373/main/src/main/scala/sbt/Keys.scala#L400 // so that it does not break on sbt version below 1.4.0 @@ -72,13 +67,13 @@ object JmhPlugin extends AutoPlugin { // includes the asm jar only if needed libraryDependencies ++= { - val jmhV = (version in Jmh).value + val jmhV = (Jmh / version).value Seq( "org.openjdk.jmh" % "jmh-core" % jmhV, // GPLv2 "org.openjdk.jmh" % "jmh-generator-bytecode" % jmhV, // GPLv2 "org.openjdk.jmh" % "jmh-generator-reflection" % jmhV // GPLv2 - ) ++ ((generatorType in Jmh).value match { + ) ++ ((Jmh / generatorType).value match { case "default" | "reflection" => Nil // default == reflection (0.9) case "asm" => Seq("org.openjdk.jmh" % "jmh-generator-asm" % jmhV) // GPLv2 case unknown => throw new IllegalArgumentException(s"Unknown benchmark generator type: $unknown, please use one of the supported generators!") diff --git a/project/build.properties b/project/build.properties index 0837f7a..40b3b8e 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.3.13 +sbt.version=1.9.0 diff --git a/project/plugins.sbt b/project/plugins.sbt index 1c184b3..71f2277 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,2 +1,2 @@ -addSbtPlugin("com.jsuereth" % "sbt-pgp" % "2.0.1") -addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.6.0") \ No newline at end of file +addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.2.1") +addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.9.0") \ No newline at end of file diff --git a/version.sbt b/version.sbt index d3a524b..33eaf85 100644 --- a/version.sbt +++ b/version.sbt @@ -1 +1 @@ -version in ThisBuild := "0.4.4" +ThisBuild / version := "0.4.4"