From 2f699526a75c8235948fb250c32759b5866f0b2d Mon Sep 17 00:00:00 2001 From: xuwei-k <6b656e6a69@gmail.com> Date: Mon, 18 Aug 2025 09:51:03 +0900 Subject: [PATCH] sbt 2.0.0-RC3 --- build.sbt | 4 ++-- project/build.properties | 2 +- .../sbtlicensereport/SbtLicenseReportCompat.scala | 7 +++++++ .../sbtlicensereport/SbtLicenseReportCompat.scala | 3 +++ .../scala/sbtlicensereport/SbtLicenseReport.scala | 13 +++++++------ 5 files changed, 20 insertions(+), 9 deletions(-) create mode 100644 src/main/scala-2/sbtlicensereport/SbtLicenseReportCompat.scala create mode 100644 src/main/scala-3/sbtlicensereport/SbtLicenseReportCompat.scala diff --git a/build.sbt b/build.sbt index 8ed2812..504f76e 100644 --- a/build.sbt +++ b/build.sbt @@ -2,14 +2,14 @@ lazy val lang3 = "org.apache.commons" % "commons-text" % "1.12.0" lazy val repoSlug = "sbt/sbt-license-report" val scala212 = "2.12.20" -val scala3 = "3.6.2" +val scala3 = "3.7.2" pluginCrossBuild / sbtVersion := { scalaBinaryVersion.value match { case "2.12" => (pluginCrossBuild / sbtVersion).value case _ => - "2.0.0-M3" + "2.0.0-RC3" } } diff --git a/project/build.properties b/project/build.properties index 73df629..489e0a7 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.10.7 +sbt.version=1.11.4 diff --git a/src/main/scala-2/sbtlicensereport/SbtLicenseReportCompat.scala b/src/main/scala-2/sbtlicensereport/SbtLicenseReportCompat.scala new file mode 100644 index 0000000..44543c3 --- /dev/null +++ b/src/main/scala-2/sbtlicensereport/SbtLicenseReportCompat.scala @@ -0,0 +1,7 @@ +package sbtlicensereport + +private[sbtlicensereport] object SbtLicenseReportCompat { + implicit class DefOps(private val self: sbt.Def.type) extends AnyVal { + def uncached[A](a: A): A = a + } +} diff --git a/src/main/scala-3/sbtlicensereport/SbtLicenseReportCompat.scala b/src/main/scala-3/sbtlicensereport/SbtLicenseReportCompat.scala new file mode 100644 index 0000000..d7fae09 --- /dev/null +++ b/src/main/scala-3/sbtlicensereport/SbtLicenseReportCompat.scala @@ -0,0 +1,3 @@ +package sbtlicensereport + +private[sbtlicensereport] object SbtLicenseReportCompat diff --git a/src/main/scala/sbtlicensereport/SbtLicenseReport.scala b/src/main/scala/sbtlicensereport/SbtLicenseReport.scala index 3bdd72b..d2dea57 100644 --- a/src/main/scala/sbtlicensereport/SbtLicenseReport.scala +++ b/src/main/scala/sbtlicensereport/SbtLicenseReport.scala @@ -1,6 +1,7 @@ package sbtlicensereport import sbt._ +import sbtlicensereport.SbtLicenseReportCompat._ import Keys._ import license._ @@ -80,7 +81,7 @@ object SbtLicenseReport extends AutoPlugin { override lazy val projectSettings: Seq[Setting[_]] = Seq( licenseReportTitle := s"${normalizedName.value}-licenses", - updateLicenses := { + updateLicenses := Def.uncached { if (VersionNumber(sbtVersion.value).matchesSemVer(SemanticSelector("<1.10.5"))) throw new sbt.MessageOnlyException("sbt-license-report requires sbt 1.10.5 or greater.") val overrides = licenseOverrides.value.lift @@ -100,7 +101,7 @@ object SbtLicenseReport extends AutoPlugin { licenseReportMakeHeader := (language => language.header1(licenseReportTitle.value)), // TODO - Maybe we need a general purpose reporting directory licenseReportDir := target.value / "license-reports", - licenseReportConfigurations := { + licenseReportConfigurations := Def.uncached { val dir = licenseReportDir.value val styleRules = licenseReportStyleRules.value // TODO - Configurable language (markdown/html/csv) rather than all always @@ -118,28 +119,28 @@ object SbtLicenseReport extends AutoPlugin { ) Seq(config) }, - dumpLicenseReport := { + dumpLicenseReport := Def.uncached { val report = updateLicenses.value val dir = licenseReportDir.value for (config <- licenseReportConfigurations.value) LicenseReport.dumpLicenseReport(report.licenses, config) dir }, - dumpLicenseReportAggregate := { + dumpLicenseReportAggregate := Def.uncached { val reports = aggregateUpdateLicenses.value val dir = licenseReportDir.value for (config <- licenseReportConfigurations.value) LicenseReport.dumpLicenseReport(reports.flatMap(_.licenses), config) dir }, - dumpLicenseReportAnyProject := { + dumpLicenseReportAnyProject := Def.uncached { val reports = anyProjectUpdateLicenses.value val dir = licenseReportDir.value for (config <- licenseReportConfigurations.value) LicenseReport.dumpLicenseReport(reports.flatMap(_.licenses), config) dir }, - licenseCheck := { + licenseCheck := Def.uncached { val log = streams.value.log val report = updateLicenses.value val allowed = licenseCheckAllow.value