-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #259 from BillyAutrey/scala-3-compat-fixes
Scala 3/sbt 2 prep
- Loading branch information
Showing
22 changed files
with
218 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,3 +24,8 @@ align.tokens."+" = [ | |
] | ||
} | ||
] | ||
fileOverride { | ||
"glob:**/scala-3/**" { | ||
runner.dialect = scala3 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package com.typesafe.sbt | ||
|
||
import sbt.* | ||
import sbt.Keys.Classpath | ||
import xsbti.FileConverter | ||
|
||
import java.nio.file.{ Path => NioPath } | ||
|
||
private[sbt] object PluginCompat { | ||
type FileRef = java.io.File | ||
type Out = java.io.File | ||
|
||
def toNioPath(a: Attributed[File])(implicit conv: FileConverter): NioPath = | ||
a.data.toPath | ||
def toFile(a: Attributed[File])(implicit conv: FileConverter): File = | ||
a.data | ||
def toNioPaths(cp: Seq[Attributed[File]])(implicit conv: FileConverter): Vector[NioPath] = | ||
cp.map(_.data.toPath()).toVector | ||
def toFiles(cp: Seq[Attributed[File]])(implicit conv: FileConverter): Vector[File] = | ||
cp.map(_.data).toVector | ||
def toSet[A](iterable: Iterable[A]): Set[A] = iterable.to[Set] | ||
def classpathToFiles(classpath: Classpath)(implicit conv: FileConverter): Seq[FileRef] = | ||
classpath.files | ||
def toKey(settingKey: SettingKey[String]): AttributeKey[String] = settingKey.key | ||
def toNioPath(f: File)(implicit conv: FileConverter): NioPath = | ||
f.toPath | ||
def toFile(f: File)(implicit conv: FileConverter): File = f | ||
def toFileRef(f: File)(implicit conv: FileConverter): FileRef = f | ||
def selectFirstPredicate: Seq[FileRef] => Boolean = files => | ||
files.forall(_.isFile) && files.map(_.hashString).distinct.size == 1 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package com.typesafe.sbt | ||
|
||
import java.nio.file.{ Path => NioPath } | ||
import java.io.{ File => IoFile } | ||
import sbt.* | ||
import sbt.Keys.Classpath | ||
import xsbti.{ FileConverter, HashedVirtualFileRef, VirtualFile } | ||
|
||
private[sbt] object PluginCompat: | ||
type FileRef = HashedVirtualFileRef | ||
type Out = VirtualFile | ||
|
||
def toNioPath(a: Attributed[HashedVirtualFileRef])(using conv: FileConverter): NioPath = | ||
conv.toPath(a.data) | ||
inline def toFile(a: Attributed[HashedVirtualFileRef])(using conv: FileConverter): File = | ||
toNioPath(a).toFile | ||
def toNioPaths(cp: Seq[Attributed[HashedVirtualFileRef]])(using conv: FileConverter): Vector[NioPath] = | ||
cp.map(toNioPath).toVector | ||
inline def toFiles(cp: Seq[Attributed[HashedVirtualFileRef]])(using conv: FileConverter): Vector[File] = | ||
toNioPaths(cp).map(_.toFile) | ||
def toSet[A](iterable: Iterable[A]): Set[A] = iterable.to(Set) | ||
inline def classpathToFiles(classpath: Classpath)(using conv: FileConverter): Seq[File] = | ||
toFiles(classpath.to(Seq)) | ||
inline def toKey(settingKey: SettingKey[String]): StringAttributeKey = StringAttributeKey(settingKey.key.label) | ||
def toNioPath(hvf: HashedVirtualFileRef)(using conv: FileConverter): NioPath = | ||
conv.toPath(hvf) | ||
def toFile(hvf: HashedVirtualFileRef)(using conv: FileConverter): File = | ||
toNioPath(hvf).toFile | ||
inline def toFileRef(file: File)(using conv: FileConverter): FileRef = | ||
conv.toVirtualFile(file.toPath) | ||
inline def selectFirstPredicate(using conv: FileConverter): Seq[FileRef] => Boolean = files => | ||
files.forall(toFile(_).isFile) && files.map(_.contentHashStr).distinct.size == 1 | ||
end PluginCompat |
Oops, something went wrong.