Skip to content
This repository was archived by the owner on Oct 11, 2025. It is now read-only.

Commit 0deb6c6

Browse files
authored
🐛 Fix cross build not actually running with sbt 1.2.8 (#238)
* 🐛 Fix cross build not actually running with sbt 1.2.8 and add test case in CI pipeline * Ignore H2 vulnerabilities, as they are not relevant. H2 will be updated in dc-core v7.0.0
1 parent c4f3360 commit 0deb6c6

File tree

5 files changed

+36
-18
lines changed

5 files changed

+36
-18
lines changed

.github/workflows/ci.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
- java: 11
1919
sbt: "1.2.8"
2020
- java: 11
21-
sbt: "1.5.5"
21+
sbt: "1.6.2"
2222
runs-on: ubuntu-latest
2323
steps:
2424
- name: Checkout
@@ -29,6 +29,18 @@ jobs:
2929
java-version: "adopt@1.${{ matrix.java }}"
3030
- name: Coursier cache
3131
uses: coursier/cache-action@v6
32+
- name: Publish Local
33+
run: sbt -v -Dfile.encoding=UTF-8 "^ publishLocal"
34+
- name: Get plugin version
35+
run: |
36+
PLUGIN_VERSION=$(sbt -Dsbt.ci=true -Dsbt.supershell=false -Dsbt.color=false -Dsbt.log.noformat=true -error "print version")
37+
echo ${PLUGIN_VERSION}
38+
echo "PLUGIN_VERSION=${PLUGIN_VERSION}" >> $GITHUB_ENV
39+
- name: Test example project for current snapshot
40+
run: |
41+
echo "sbt.version=${{ matrix.sbt }}" > ./project/build.properties
42+
sbt -v -Dfile.encoding=UTF-8 -Dplugin.version="${{ env.PLUGIN_VERSION }}" version
43+
working-directory: ./testProject
3244
- name: Build and Test
3345
run: sbt -v -Dfile.encoding=UTF-8 "^^ ${{ matrix.sbt }}" clean test scripted
3446
- name: DependencyCheck

build.sbt

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import sbt.{Project, _}
1+
import sbt.{Global, Project, _}
22
import sbtrelease.ReleasePlugin.autoImport.ReleaseTransformations._
33
import sbtrelease.ReleasePlugin.autoImport._
44
import sbtrelease.ReleaseStateTransformations.setNextVersion
@@ -16,19 +16,18 @@ val sbtDependencyCheck = (project in file("."))
1616
),
1717
sbtPlugin := true,
1818
dependencyUpdatesFilter -= moduleFilter(organization = "org.scala-lang") | moduleFilter(organization = "org.scala-sbt"),
19-
dependencyUpdatesFailBuild := true
19+
dependencyUpdatesFailBuild := true,
20+
crossSbtVersions := Vector("1.2.8"),
21+
scriptedLaunchOpts ++= Seq("-Xmx1024M", "-Dplugin.version=" + version.value),
22+
scriptedBufferLog := false
2023
)
2124

2225

23-
ThisBuild / crossSbtVersions .withRank(KeyRanks.Invisible) := Vector("1.2.8")
24-
2526
ThisBuild / dependencyCheckFailBuildOnCVSS := 11
2627
ThisBuild / dependencyCheckSkipProvidedScope := true
2728
ThisBuild / dependencyCheckFormat := "ALL"
2829
ThisBuild / dependencyCheckSuppressionFiles := Seq(new File("dependency-check-suppressions.xml"))
2930

30-
Global / scriptedLaunchOpts ++= Seq("-Xmx1024M", "-Dplugin.version=" + version.value)
31-
Global / scriptedBufferLog := false
3231

3332
ThisBuild / publishTo := sonatypePublishToBundle.value
3433
ThisBuild / publishMavenStyle .withRank(KeyRanks.Invisible) := true

dependency-check-suppressions.xml

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,13 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<suppressions xmlns="https://jeremylong.github.io/DependencyCheck/dependency-suppression.1.2.xsd">
2+
<suppressions xmlns="https://jeremylong.github.io/DependencyCheck/dependency-suppression.1.3.xsd">
33
<suppress>
44
<notes><![CDATA[
5-
file name: slf4j-simple-1.7.25.jar
5+
file name: h2-1.4.199.jar
66
]]></notes>
7-
<gav regex="true">^org\.slf4j:slf4j-(?:simple|api):.*$</gav>
8-
<cve>CVE-2018-8088</cve>
9-
</suppress>
10-
<suppress>
11-
<notes><![CDATA[
12-
file name: javax.json-1.0.4.jar
13-
]]></notes>
14-
<gav regex="true">^org\.glassfish:javax\.json:.*$</gav>
15-
<cve>CVE-2018-1000840</cve>
7+
<packageUrl regex="true">^pkg:maven/com\.h2database/h2@.*$</packageUrl>
8+
<cve>CVE-2021-23463</cve>
9+
<cve>CVE-2021-42392</cve>
10+
<cve>CVE-2022-23221</cve>
11+
<vulnerabilityName>CWE-94: Improper Control of Generation of Code ('Code Injection')</vulnerabilityName>
1612
</suppress>
1713
</suppressions>

testProject/build.sbt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
version := "0.1"
2+
lazy val root = project in file(".")
3+
scalaVersion := "2.12.15"
4+
5+
resolvers += Resolver.mavenLocal

testProject/project/plugins.sbt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
sys.props.get("plugin.version") match {
2+
case Some(x) => addSbtPlugin("net.vonbuchholtz" % "sbt-dependency-check" % x)
3+
case _ => sys.error(
4+
"""|The system property 'plugin.version' is not defined.
5+
|Specify this property using the sbt parameter -D.""".stripMargin)
6+
}

0 commit comments

Comments
 (0)