Skip to content

Commit

Permalink
add sbt 2.x cross build setting
Browse files Browse the repository at this point in the history
  • Loading branch information
xuwei-k committed Oct 14, 2024
1 parent 6ccd597 commit 72a3f89
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 7 deletions.
14 changes: 12 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
scala: [2.12.19]
scala: [2.12.19, 3.3.3]
java: [temurin@8, temurin@11, temurin@17, temurin@21]
exclude:
- java: temurin@8
Expand Down Expand Up @@ -88,7 +88,7 @@ jobs:
run: sbt '++ ${{ matrix.scala }}' githubWorkflowCheck

- shell: bash
run: sbt '++ ${{ matrix.scala }}' test scripted
run: sbt '++ ${{ matrix.scala }}' testAll

- name: Compress target directories
shell: bash
Expand Down Expand Up @@ -173,6 +173,16 @@ jobs:
tar xf targets.tar
rm targets.tar
- name: Download target directories (3.3.3)
uses: actions/download-artifact@v4
with:
name: target-${{ matrix.os }}-3.3.3-${{ matrix.java }}

- name: Inflate target directories (3.3.3)
run: |
tar xf targets.tar
rm targets.tar
- name: Publish project
env:
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
Expand Down
35 changes: 33 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,46 @@ lazy val lang3 = "org.apache.commons" % "commons-text" % "1.12.0"
lazy val repoSlug = "sbt/sbt-license-report"

val scala212 = "2.12.19"
val scala3 = "3.3.3"

pluginCrossBuild / sbtVersion := {
scalaBinaryVersion.value match {
case "2.12" =>
(pluginCrossBuild / sbtVersion).value
case _ =>
"2.0.0-M2"
}
}

ThisBuild / scalaVersion := scala212
ThisBuild / crossScalaVersions := Seq(scala212)
ThisBuild / crossScalaVersions := Seq(scala212, scala3)
organization := "com.github.sbt"
name := "sbt-license-report"
enablePlugins(SbtPlugin)
libraryDependencies += lang3
scriptedLaunchOpts += s"-Dplugin.version=${version.value}"

TaskKey[Unit]("testAll") := {
if (scalaBinaryVersion.value == "3") {
Def
.sequential(
Test / test,
Def.task(
// TODO enable test
streams.value.log.warn("skip sbt 2.x scripted tests")
)
)
.value
} else {
Def
.sequential(
Test / test,
scripted.toTask("")
)
.value
}
}

// publishing info
licenses := Seq("Apache-2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0.html"))
scmInfo := Some(
Expand Down Expand Up @@ -54,7 +85,7 @@ scalacOptions ++= {
} else Nil
}

ThisBuild / githubWorkflowBuild := Seq(WorkflowStep.Sbt(List("test", "scripted")))
ThisBuild / githubWorkflowBuild := Seq(WorkflowStep.Sbt(List("testAll")))

ThisBuild / githubWorkflowTargetTags ++= Seq("v*")
ThisBuild / githubWorkflowPublishTargetBranches :=
Expand Down
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.10.1
sbt.version=1.10.2
2 changes: 1 addition & 1 deletion src/main/scala/sbtlicensereport/SbtLicenseReport.scala
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ object SbtLicenseReport extends AutoPlugin {
licenseReportNotes := PartialFunction.empty,
licenseOverrides := PartialFunction.empty,
licenseDepExclusions := PartialFunction.empty,
licenseFilter := TypeFunctions.const(true),
licenseFilter := Function.const(true),
licenseReportStyleRules := None,
licenseReportTypes := Seq(MarkDown, Html, Csv),
licenseReportColumns := Seq(Column.Category, Column.License, Column.Dependency),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ object LicenseReport {
print(language.tableRow(notes, rest: _*))
}
print(language.tableEnd)
print(language.documentEnd)
print(language.documentEnd())
}
}
}
Expand Down

0 comments on commit 72a3f89

Please sign in to comment.