-
Notifications
You must be signed in to change notification settings - Fork 89
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 #208 from sbt/wip/cross
Cross build to sbt 2.x
- Loading branch information
Showing
51 changed files
with
372 additions
and
222 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
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,5 @@ | ||
import sbt.* | ||
|
||
object Dependencies { | ||
val manifesto = "com.eed3si9n.manifesto" %% "manifesto" % "0.1.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 |
---|---|---|
@@ -1 +1 @@ | ||
sbt.version=1.9.9 | ||
sbt.version=1.10.2 |
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,51 @@ | ||
package sbtbuildinfo | ||
|
||
import java.nio.file.{ Path => NioPath } | ||
import sbt.* | ||
import scala.language.higherKinds | ||
import scala.annotation.nowarn | ||
|
||
object PluginCompat { | ||
type FileRef = java.io.File | ||
type Out = java.io.File | ||
type Entry[A1] = sbtbuildinfo.BuildInfoKey.Entry[A1] | ||
type Manifest[A1] = scala.reflect.Manifest[A1] | ||
val Manifest = scala.reflect.Manifest | ||
|
||
val Setting = BuildInfoKey.Setting | ||
val Task = BuildInfoKey.Task | ||
val TaskValue = BuildInfoKey.TaskValue | ||
val Constant = BuildInfoKey.Constant | ||
val Mapped = BuildInfoKey.Mapped | ||
val Action = BuildInfoKey.Action | ||
|
||
object TypeExpression { | ||
def unapply(m: Manifest[?]): Option[(String, List[Manifest[?]])] = | ||
Some(({ | ||
val s = m.toString() | ||
if (s.contains("[")) s.split("""\[""").head | ||
else s | ||
}, m.typeArguments)) | ||
} | ||
|
||
trait BuildInfoKeys0 | ||
object BuildInfoKeys0 extends BuildInfoKeys0 | ||
|
||
def toClasspath(cp: Vector[NioPath]): Seq[Attributed[File]] = | ||
cp.map((x) => Attributed.blank(x.toFile())) | ||
|
||
implicit class RichScope(scope: Scope) { | ||
@nowarn | ||
def rescope(ref: Reference): Scope = scope.in(ref) | ||
} | ||
implicit class RichRichTaskable4[A1, A2, A3, A4]( | ||
val taskable: Scoped.RichTaskable4[A1, A2, A3, A4]) { | ||
def flatMapN[R](f: (A1, A2, A3, A4) => Task[R]) = | ||
taskable.flatMap(f) | ||
} | ||
implicit class RichRichTaskable11[A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11]( | ||
val taskable: Scoped.RichTaskable11[A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11]) { | ||
def flatMapN[R](f: (A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11) => Task[R]) = | ||
taskable.flatMap(f) | ||
} | ||
} |
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,27 @@ | ||
package sbtbuildinfo | ||
|
||
import sbt.* | ||
import scala.reflect.ClassTag | ||
import scala.quoted.* | ||
|
||
object BuildInfoKey: | ||
import Entry.* | ||
|
||
def apply[A1: PluginCompat.Manifest](key: SettingKey[A1]): Entry[A1] = | ||
Entry.Setting(key) | ||
|
||
def apply[A1: PluginCompat.Manifest](key: TaskKey[A1]): Entry[A1] = | ||
Entry.Task(key) | ||
|
||
def apply[A1: PluginCompat.Manifest](tuple: (String, A1)): Entry[A1] = | ||
Entry.Constant(tuple) | ||
|
||
def map[A1, A2: PluginCompat.Manifest](from: Entry[A1])(fun: ((String, A1)) => (String, A2)): Entry[A2] = | ||
Entry.Mapped(from, fun) | ||
|
||
def action[A1: PluginCompat.Manifest](name: String)(fun: => A1): Entry[A1] = | ||
Entry.Action(name, () => fun) | ||
|
||
def outOfGraphUnsafe[A1: PluginCompat.Manifest](key: TaskKey[A1]): Entry[A1] = | ||
Entry.Task(key) | ||
end BuildInfoKey |
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,16 @@ | ||
package sbtbuildinfo | ||
|
||
import sbt.* | ||
import PluginCompat.Manifest | ||
|
||
enum Entry[A1: Manifest]: | ||
type A = A1 | ||
def manifest: Manifest[A1] = Manifest[A1] | ||
|
||
case Setting[A1: Manifest](scoped: SettingKey[A1]) extends Entry[A1] | ||
case Task[A1: Manifest](scoped: TaskKey[A1]) extends Entry[A1] | ||
case TaskValue[A1: Manifest](task: sbt.Task[A1]) extends Entry[A1] | ||
case Constant[A1: Manifest](tuple: (String, A1)) extends Entry[A1] | ||
case Mapped[A1, A2: Manifest](from: Entry[A1], fun: ((String, A1)) => (String, A2)) extends Entry[A2] | ||
case Action[A1: Manifest](name: String, fun: () => A1) extends Entry[A1] | ||
end Entry |
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,43 @@ | ||
package sbtbuildinfo | ||
|
||
import com.eed3si9n.manifesto.Manifesto | ||
import java.nio.file.{ Path => NioPath } | ||
import sbt.* | ||
import scala.annotation.nowarn | ||
import xsbti.{ FileConverter, HashedVirtualFileRef, VirtualFile } | ||
|
||
object PluginCompat: | ||
type FileRef = HashedVirtualFileRef | ||
type Out = VirtualFile | ||
type Entry[A1] = sbtbuildinfo.Entry[A1] | ||
type Manifest[A1] = Manifesto[A1] | ||
val Manifest = Manifesto | ||
|
||
val Setting = Entry.Setting | ||
val Task = Entry.Task | ||
val TaskValue = Entry.TaskValue | ||
val Constant = Entry.Constant | ||
val Action = Entry.Action | ||
val Mapped = Entry.Mapped | ||
|
||
def toClasspath(cp: Vector[NioPath])(using conv: FileConverter): Seq[Attributed[HashedVirtualFileRef]] = | ||
cp.map((x) => Attributed.blank(conv.toVirtualFile(x))) | ||
|
||
trait BuildInfoKeys0: | ||
@nowarn inline given [A1]: Conversion[SettingKey[A1], Entry[A1]] = BuildInfoKey(_) | ||
@nowarn inline given [A1]: Conversion[TaskKey[A1], Entry[A1]] = BuildInfoKey(_) | ||
@nowarn inline given [A1]: Conversion[sbt.Task[A1], Entry[A1]] = Entry.TaskValue[A1](_) | ||
@nowarn inline given [A1]: Conversion[(String, A1), Entry[A1]] = BuildInfoKey(_) | ||
end BuildInfoKeys0 | ||
|
||
object TypeExpression: | ||
def unapply(m: Manifest[?]): (String, List[Manifest[?]]) = | ||
(m.typeCon, m.typeArguments) | ||
end TypeExpression | ||
|
||
object BuildInfoKeys0 extends BuildInfoKeys0 | ||
|
||
inline def RichRichTaskable4[A1, A2, A3, A4](tuple: (A1, A2, A3, A4)) = tuple | ||
inline def RichRichTaskable11[A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11](tuple: (A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11)) = | ||
tuple | ||
end PluginCompat |
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
Oops, something went wrong.