-
Notifications
You must be signed in to change notification settings - Fork 17
Cross-build to sbt 2 #219
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Cross-build to sbt 2 #219
Changes from 2 commits
748381f
ec6fe35
d1f035f
afbf558
43e3d0a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,21 +6,29 @@ ThisBuild / organization := Organization.organization | |
| ThisBuild / organizationName := Organization.organizationName | ||
| ThisBuild / organizationHomepage := Organization.organizationHomepage | ||
| val scala212 = "2.12.21" | ||
| val scala3 = "3.8.2" | ||
| ThisBuild / scalaVersion := scala212 | ||
| ThisBuild / crossScalaVersions := Seq(scala212) | ||
| ThisBuild / crossScalaVersions := Seq(scala212, scala3) | ||
| ThisBuild / homepage := Project.homepage | ||
| ThisBuild / developers := Project.developers | ||
| ThisBuild / licenses := Project.licenses | ||
| ThisBuild / scmInfo := Project.scmInfo | ||
| ThisBuild / description := Project.description | ||
|
|
||
| def sbtVersionForPlugin(scalaBinary: String): String = | ||
|
||
| scalaBinary match { | ||
| case "2.12" => "1.10.7" | ||
| case _ => "2.0.0-RC11" | ||
| } | ||
|
|
||
| lazy val root = (project in file(".")) | ||
| .enablePlugins(ScriptedPlugin, BuildInfoPlugin) | ||
| .enablePlugins(SbtPlugin, ScriptedPlugin, BuildInfoPlugin) | ||
| .settings( | ||
| name := "sbt-sbom", | ||
| sbtPlugin := true, | ||
| libraryDependencies ++= Dependencies.library, | ||
| addSbtPlugin("com.github.sbt" % "sbt2-compat" % "0.1.0"), | ||
| buildInfoPackage := "com.github.sbt.sbom", | ||
| (pluginCrossBuild / sbtVersion) := sbtVersionForPlugin(scalaBinaryVersion.value), | ||
| scriptedLaunchOpts := { | ||
| scriptedLaunchOpts.value ++ Seq( | ||
| "-Xmx1024M", | ||
|
|
@@ -29,7 +37,7 @@ lazy val root = (project in file(".")) | |
| ) | ||
| }, | ||
| scriptedBufferLog := false, | ||
| scriptedSbt := "1.6.0", | ||
| scriptedSbt := sbtVersionForPlugin(scalaBinaryVersion.value), | ||
| ) | ||
|
|
||
| ThisBuild / pomIncludeRepository := { _ => | ||
|
|
@@ -65,20 +73,30 @@ ThisBuild / githubWorkflowPublish := Seq( | |
| ThisBuild / githubWorkflowOSes := Seq("ubuntu-latest", "macos-latest", "windows-latest") | ||
|
|
||
| ThisBuild / githubWorkflowJavaVersions := Seq( | ||
| JavaSpec.temurin("8"), | ||
| // Java 17 first: publish job uses the head of this list when downloading staged artifacts; sbt 2 (Scala 3 axis) needs 17+. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. FWIW I'm proposing to make Java 17 the minimum in #205 but haven't dared pull the trigger yet.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the publish job with |
||
| JavaSpec.temurin("17"), | ||
| JavaSpec.temurin("11"), | ||
| JavaSpec.temurin("17") | ||
| JavaSpec.temurin("8") | ||
| ) | ||
|
|
||
| ThisBuild / githubWorkflowBuildMatrixExclusions ++= Seq( | ||
| MatrixExclude(Map("java" -> "temurin@8", "os" -> "macos-latest")), | ||
| MatrixExclude(Map("scala" -> scala3, "java" -> "temurin@8")), | ||
| MatrixExclude(Map("scala" -> scala3, "java" -> "temurin@11")) | ||
| ) | ||
|
|
||
| ThisBuild / githubWorkflowBuildMatrixExclusions += MatrixExclude(Map("java" -> "temurin@8", "os" -> "macos-latest")) | ||
| ThisBuild / githubWorkflowScalaVersions := Seq(scala212, scala3) | ||
|
|
||
| // scalafix specific settings | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess we should remove this comment or move the options elsewhere :) |
||
| inThisBuild( | ||
| List( | ||
| semanticdbEnabled := true, | ||
| semanticdbVersion := scalafixSemanticdb.revision, | ||
| scalacOptions ++= Seq( | ||
| "-Ywarn-unused" | ||
| ) | ||
| scalacOptions ++= { | ||
| scalaBinaryVersion.value match { | ||
| case "2.12" => Seq("-Ywarn-unused") | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. that makes sense to me (and would be good to include in #205 as well, bumping it to 17) |
||
| case _ => Seq("-Wunused:all") | ||
| } | ||
| } | ||
| ) | ||
| ) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| // SPDX-FileCopyrightText: The sbt-sbom team | ||
| // | ||
| // SPDX-License-Identifier: MIT | ||
|
|
||
| package com.github.sbt.sbom | ||
|
|
||
| import sbt.librarymanagement.Configurations | ||
|
|
||
| private[sbt] object PluginCompat { | ||
| val integrationTest: sbt.Configuration = Configurations.IntegrationTest | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| // SPDX-FileCopyrightText: The sbt-sbom team | ||
| // | ||
| // SPDX-License-Identifier: MIT | ||
|
|
||
| package com.github.sbt.sbom | ||
|
|
||
| import sbt.* | ||
|
|
||
| private[sbt] object PluginCompat { | ||
| val integrationTest: Configuration = | ||
| Configuration.of( | ||
| "IntegrationTest", | ||
| "it", | ||
| "Integration tests", | ||
| false, | ||
| Vector(Runtime), | ||
| true | ||
| ) | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
using the cache is an attack vector and this job is also used for releases - does it really make a big difference? Does this come in via
githubWorkflowGenerate? Could we disable it?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This behaviour was already in the build before this PR: see line https://github.com/sbt/sbt-sbom/pull/219/changes#diff-b803fcb7f17ed9235f1e5cb1fcd2f5d3b2838429d4368ae4c57ce4436577f03fR158 which does the same for Scala 2.12.
We could disable this behavior with
ThisBuild / githubWorkflowArtifactUpload := falsewhich would make the publish job run slower but will remove caching. WDYT?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, gotcha. I think that would be good - we're not so active that it matters a lot for us anyway
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed, now the caching is disabled.