-
Notifications
You must be signed in to change notification settings - Fork 103
Add support for Scala 3 crossbuilds, raise min version to 1.5.8 #256
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
Changes from 8 commits
6379f73
6d5b912
a5dd8f9
8937212
e72135a
930a4a5
f7e9721
3de9c10
f13720e
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 |
|---|---|---|
| @@ -1,8 +1,10 @@ | ||
| *~ | ||
| target/ | ||
| .idea/ | ||
| .bsp/ | ||
| /bin/ | ||
| /.settings/ | ||
| /.cache | ||
| /.classpath | ||
| /.project | ||
| metals.sbt |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,7 +8,10 @@ startYear := Some(2011) | |
| homepage := scmInfo.value map (_.browseUrl) | ||
| scmInfo := Some(ScmInfo(url("https://github.com/sbt/sbt-git"), "scm:git:[email protected]:sbt/sbt-git.git")) | ||
|
|
||
| crossSbtVersions := List("1.3.13") | ||
| lazy val scala212 = "2.12.20" | ||
| lazy val scala3 = "3.3.4" | ||
|
|
||
| crossScalaVersions := Seq(scala212, scala3) | ||
|
|
||
| enablePlugins(GitVersioning, SbtPlugin) | ||
| git.baseVersion := "1.0" | ||
|
|
@@ -19,4 +22,11 @@ libraryDependencies ++= Seq( | |
| "org.scalameta" %% "munit" % "1.0.2" % Test | ||
| ) | ||
|
|
||
| (pluginCrossBuild / sbtVersion) := { | ||
| scalaBinaryVersion.value match { | ||
| case "2.12" => "1.5.8" | ||
| case _ => "2.0.0-M2" | ||
| } | ||
| } | ||
|
|
||
| scriptedLaunchOpts += s"-Dproject.version=${version.value}" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -29,13 +29,13 @@ final class JGit(val repo: Repository) extends GitReadonlyInterface { | |
| def branch: String = repo.getBranch | ||
|
|
||
| private def branchesRef: Seq[Ref] = { | ||
| import collection.JavaConverters._ | ||
| porcelain.branchList.call.asScala | ||
| import scala.jdk.CollectionConverters._ | ||
|
||
| porcelain.branchList.call.asScala.toSeq | ||
| } | ||
|
|
||
| def tags: Seq[Ref] = { | ||
| import collection.JavaConverters._ | ||
| porcelain.tagList.call().asScala | ||
| import scala.jdk.CollectionConverters._ | ||
| porcelain.tagList.call().asScala.toSeq | ||
| } | ||
|
|
||
| def checkoutBranch(branch: String): Unit = { | ||
|
|
@@ -59,7 +59,7 @@ final class JGit(val repo: Repository) extends GitReadonlyInterface { | |
| headCommit map (_.name) | ||
|
|
||
| def currentTags: Seq[String] = { | ||
| import collection.JavaConverters._ | ||
| import scala.jdk.CollectionConverters._ | ||
| for { | ||
| hash <- headCommit.map(_.name).toSeq | ||
| unpeeledTag <- tags | ||
|
|
@@ -96,14 +96,14 @@ final class JGit(val repo: Repository) extends GitReadonlyInterface { | |
| override def branches: Seq[String] = branchesRef.filter(_.getName.startsWith("refs/heads")).map(_.getName.drop(11)) | ||
|
|
||
| override def remoteBranches: Seq[String] = { | ||
| import collection.JavaConverters._ | ||
| import scala.jdk.CollectionConverters._ | ||
| import org.eclipse.jgit.api.ListBranchCommand.ListMode | ||
| porcelain.branchList.setListMode(ListMode.REMOTE).call.asScala.filter(_.getName.startsWith("refs/remotes")).map(_.getName.drop(13)) | ||
| porcelain.branchList.setListMode(ListMode.REMOTE).call.asScala.filter(_.getName.startsWith("refs/remotes")).map(_.getName.drop(13)).toSeq | ||
| } | ||
|
|
||
| override def remoteOrigin: String = { | ||
| // same functionality as Process("git ls-remote --get-url origin").lines_!.head | ||
| import collection.JavaConverters._ | ||
| import scala.jdk.CollectionConverters._ | ||
| porcelain.remoteList().call.asScala | ||
| .filter(_.getName == "origin") | ||
| .flatMap(_.getURIs.asScala) | ||
|
|
||
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.
Terminal.consolecan throw anIllegalStateExceptionhere so it should be wrapped withtry catch.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.
I used monadic
Try, lemme know if you prefertry/catchfor some reason. There's a few other places whereTryis used in the plugin, but it's certainly not uniform.