add Conversion from Project => LocalProject

This commit is contained in:
Eugene Yokota 2022-12-09 02:05:19 -05:00
parent d2c2563d8a
commit d4dc90efd9
4 changed files with 9 additions and 8 deletions

View File

@ -660,10 +660,11 @@ trait ProjectExtra:
def projectToRef(p: Project): ProjectReference = LocalProject(p.id)
implicit def projectToLocalProject(p: Project): LocalProject = LocalProject(p.id)
*/
given projectToLocalProject: Conversion[Project, LocalProject] =
(p: Project) => LocalProject(p.id)
extension [A1](in: Def.Initialize[Task[A1]])
def updateState(f: (State, A1) => State): Def.Initialize[Task[A1]] =
in(t => SessionVar.transform(t, f))

View File

@ -90,7 +90,7 @@ object BuildUtil {
}
def baseImports: Seq[String] =
"import _root_.scala.xml.{TopScope=>$scope}" :: "import _root_.sbt._" :: "import _root_.sbt.Keys._" :: "import _root_.sbt.nio.Keys._" :: Nil
"import _root_.scala.xml.{TopScope=>$scope}" :: "import _root_.sbt.*" :: "import _root_.sbt.given" :: "import _root_.sbt.Keys.*" :: "import _root_.sbt.nio.Keys.*" :: Nil
def getImports(unit: BuildUnit): Seq[String] =
unit.plugins.detected.imports ++ unit.definitions.dslDefinitions.imports

View File

@ -1,7 +1,7 @@
lazy val root = (project in file(".")).
aggregate((if(file("aggregate").exists) Seq(sub: sbt.ProjectReference) else Nil): _*)
lazy val root = (project in file("."))
.aggregate((if(file("aggregate").exists) Seq(sub: sbt.ProjectReference) else Nil): _*)
lazy val sub = (project in file("sub")).
aggregate(sub2)
lazy val sub = (project in file("sub"))
.aggregate(sub2)
lazy val sub2 = (project in file("sub") / "sub")

View File

@ -36,7 +36,7 @@ $ absent sub/ran
$ delete ran
# define in sub project, but shouldn't run without aggregation
> set Mark in sub := mark(sub).value
> set sub / Mark := mark(sub).value
> mark
$ exists ran
$ absent sub/ran