-
Notifications
You must be signed in to change notification settings - Fork 44
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
WIP use sbt 2.0.0-M4 & cross-build against it #440
base: main
Are you sure you want to change the base?
Changes from all commits
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 |
---|---|---|
|
@@ -5,65 +5,31 @@ on: | |
- main | ||
pull_request: | ||
jobs: | ||
jdk8: | ||
name: JDK8 tests | ||
ubuntu: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
jvm: ["8", "11", "17", "21", "23"] | ||
scala: ["2.12.x", "3.x"] | ||
name: Ubuntu / JDK${{ matrix.jvm }} / Scala ${{ matrix.scala }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: coursier/setup-action@v1 | ||
with: | ||
apps: sbt | ||
jvm: temurin:8 | ||
- run: rm -rf src/sbt-test/skip-sbt1.4 | ||
- run: sbt test scripted | ||
jdk11: | ||
name: JDK11 tests | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: coursier/setup-action@v1 | ||
with: | ||
apps: sbt | ||
jvm: temurin:11 | ||
- run: rm -rf src/sbt-test/skip-sbt1.4 | ||
- run: sbt test scripted | ||
jdk17: | ||
name: JDK17 tests | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: coursier/setup-action@v1 | ||
with: | ||
apps: sbt | ||
jvm: temurin:17 | ||
- run: rm -rf src/sbt-test/skip-java17+ | ||
- run: rm -rf src/sbt-test/skip-sbt1.4 | ||
- run: sbt test scripted | ||
|
||
jdk21: | ||
name: JDK21 tests | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: coursier/setup-action@v1 | ||
with: | ||
apps: sbt | ||
jvm: temurin:21 | ||
- run: rm -rf src/sbt-test/skip-java17+ | ||
- run: sbt test scripted | ||
jdk23: | ||
name: JDK23 tests | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: coursier/setup-action@v1 | ||
with: | ||
apps: sbt | ||
jvm: temurin:23 | ||
- run: rm -rf src/sbt-test/skip-java17+ | ||
- run: sbt test scripted | ||
jvm: temurin:${{ matrix.jvm }} | ||
- if: matrix.jvm == '8' || matrix.jvm == '11' || matrix.jvm == '17' | ||
run: rm -rf src/sbt-test/skip-sbt1.4 | ||
- if: matrix.jvm == '17' || matrix.jvm == '21' || matrix.jvm == '23' | ||
run: rm -rf src/sbt-test/skip-java17+ | ||
- run: sbt ++${{ matrix.scala }} test scripted | ||
windows: | ||
name: Windows tests | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
scala: ["2.12.x", "3.x"] | ||
name: Windows / Scala ${{ matrix.scala }} | ||
runs-on: windows-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
@@ -72,12 +38,14 @@ jobs: | |
apps: sbt | ||
- run: rm -r -fo src\sbt-test\skip-sbt1.4 | ||
- run: rm -r -fo src\sbt-test\skip-windows | ||
- run: sbt test-skip-windows scripted | ||
shell: bash | ||
checks: | ||
name: Scalafmt | ||
- run: sbt ++${{ matrix.scala }} test-skip-windows scripted | ||
formatting: | ||
name: Scalafmt and Scalafix | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: coursier/setup-action@v1 | ||
with: | ||
apps: sbt | ||
- run: ./bin/scalafmt --test | ||
- run: sbt "scalafixAll --check" | ||
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. enforcing scalafix in this PR mostly for ExplicitResultTypes, to have deterministic types from the beginning for the sbt 2.x artifact |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,19 @@ | ||
rules = [ | ||
DisableSyntax | ||
] | ||
DisableSyntax.keywords = [ | ||
var | ||
null | ||
ExplicitResultTypes, | ||
OrganizeImports, | ||
RemoveUnused | ||
] | ||
|
||
OrganizeImports { | ||
groups = [ | ||
"re:javax?\\." | ||
"scala." | ||
"sbt." | ||
"*" | ||
] | ||
targetDialect = Scala3 | ||
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. Thanks to So we might as well start using OrganizeImports with Scala 3 syntax for all files (not just the Scala 3 ones), as we start enforcing scalafix for ExplicitResultTypes |
||
} | ||
|
||
RemoveUnused { | ||
imports = false | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ object Dependencies { | |
val all = List( | ||
"org.eclipse.jgit" % "org.eclipse.jgit" % "5.13.3.202401111512-r", | ||
"ch.epfl.scala" % "scalafix-interfaces" % scalafixVersion, | ||
"io.get-coursier" % "interface" % "1.0.28" | ||
"io.get-coursier" % "interface" % "1.0.28", | ||
"org.scala-lang.modules" %% "scala-collection-compat" % "2.13.0" | ||
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. helps getting rid of |
||
) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
sbt.version=1.10.7 | ||
sbt.version=2.0.0-M4 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
resolvers ++= Resolver.sonatypeOssRepos("public") | ||
addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.9.2") | ||
//addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.9.2") | ||
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. |
||
|
||
libraryDependencies += "org.scala-sbt" %% "scripted-plugin" % sbtVersion.value | ||
// dogfooding | ||
Compile / unmanagedSourceDirectories ++= { | ||
val root = (ThisBuild / baseDirectory).value.getParentFile / "src" / "main" | ||
List( | ||
root / "scala", | ||
root / "scala-sbt-1.0" | ||
root / "scala-3" | ||
) | ||
} | ||
libraryDependencies ++= Dependencies.all |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package scalafix.internal.sbt | ||
|
||
import java.io.File | ||
import java.nio.file.Path | ||
|
||
import sbt.Attributed | ||
import sbt.Keys | ||
import sbt.ModuleID | ||
|
||
import xsbti.FileConverter | ||
|
||
object Compat { | ||
|
||
def toPath( | ||
attributed: Attributed[File] | ||
)(implicit conv: FileConverter): Path = | ||
toFile(attributed).toPath() | ||
|
||
def toFile( | ||
attributed: Attributed[File] | ||
)(implicit conv: FileConverter): File = { | ||
val _ = conv // avoid unused warning | ||
attributed.data | ||
} | ||
|
||
def extractModuleID( | ||
attributed: Attributed[File] | ||
): Option[ModuleID] = | ||
attributed.get(Keys.moduleID.key) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package scalafix.internal.sbt | ||
|
||
import java.io.File | ||
import java.nio.file.Path | ||
|
||
import sbt.Attributed | ||
import sbt.Classpaths | ||
import sbt.Keys | ||
import sbt.ModuleID | ||
|
||
import xsbti.FileConverter | ||
import xsbti.HashedVirtualFileRef | ||
|
||
object Compat { | ||
|
||
def toPath( | ||
attributed: Attributed[HashedVirtualFileRef] | ||
)(using conv: FileConverter): Path = | ||
conv.toPath(attributed.data) | ||
|
||
def toFile( | ||
attributed: Attributed[HashedVirtualFileRef] | ||
)(using conv: FileConverter): File = | ||
toPath(attributed).toFile() | ||
Comment on lines
+16
to
+24
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. |
||
|
||
def extractModuleID( | ||
attributed: Attributed[HashedVirtualFileRef] | ||
): Option[ModuleID] = | ||
attributed | ||
.get(Keys.moduleIDStr) | ||
.map(Classpaths.moduleIdJsonKeyFormat.read) | ||
Comment on lines
+30
to
+31
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. |
||
} |
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.
The presence of this was triggering sbtn usage, which does not seem to work on any github action
before
after
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.
sbt/sbt#8064