From 13ff18f2f08267c60662c5dd45e72252eb946bb9 Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Mon, 7 Oct 2024 04:20:36 -0400 Subject: [PATCH 1/2] cross build to sbt 2.x Use Manifesto --- .github/workflows/ci.yml | 18 ++++--- README.markdown | 2 +- build.sbt | 23 ++++++-- project/Dependencies.scala | 5 ++ project/build.properties | 2 +- .../sbtbuildinfo/BuildInfoKeyMacros.scala | 2 +- .../sbtbuildinfo/PluginCompat.scala | 51 ++++++++++++++++++ .../sbtbuildinfo/package.scala | 11 ++-- .../scala-3/sbtbuildinfo/BuildInfoKey.scala | 27 ++++++++++ src/main/scala-3/sbtbuildinfo/Entry.scala | 16 ++++++ .../scala-3/sbtbuildinfo/PluginCompat.scala | 43 +++++++++++++++ src/main/scala/sbtbuildinfo/BuildInfo.scala | 30 +++++++---- .../scala/sbtbuildinfo/BuildInfoKeys.scala | 2 +- .../scala/sbtbuildinfo/BuildInfoPlugin.scala | 43 ++++++++------- .../scala/sbtbuildinfo/JavaRenderer.scala | 36 ++++++++----- .../Scala3CaseClassRenderer.scala | 2 +- .../Scala3CaseObjectRenderer.scala | 2 +- .../sbtbuildinfo/ScalaCaseClassRenderer.scala | 2 +- .../ScalaCaseObjectRenderer.scala | 2 +- .../scala/sbtbuildinfo/ScalaRenderer.scala | 26 +++++---- .../scala/sbtbuildinfo/TypeExpression.scala | 54 ------------------- src/sbt-test/sbt-buildinfo/append/build.sbt | 22 ++++---- .../sbt-buildinfo/append/project/plugins.sbt | 2 - .../sbt-buildinfo/buildtime/build.sbt | 2 +- src/sbt-test/sbt-buildinfo/caching/build.sbt | 2 +- src/sbt-test/sbt-buildinfo/caching/test | 2 +- .../sbt-buildinfo/caseclassrenderer/build.sbt | 4 +- .../sbt-buildinfo/constantvalue/build.sbt | 2 +- .../javasingletonrenderer/build.sbt | 2 +- .../javastaticfieldsrenderer/build.sbt | 2 +- src/sbt-test/sbt-buildinfo/multi/build.sbt | 4 +- src/sbt-test/sbt-buildinfo/options/build.sbt | 2 +- src/sbt-test/sbt-buildinfo/simple/build.sbt | 47 ++++++++++++---- src/sbt-test/sbt-buildinfo/simple/test | 4 +- .../skipimportscaseclass/build.sbt | 2 +- .../skipimportscaseobject/build.sbt | 2 +- src/sbt-test/sbt-buildinfo/task/build.sbt | 6 +-- .../sbt-buildinfo/usepackageaspath/build.sbt | 2 +- .../sbtbuildinfo/BuildInfoKeySpec.scala | 6 ++- 39 files changed, 342 insertions(+), 172 deletions(-) create mode 100644 project/Dependencies.scala rename src/main/{scala => scala-2.12}/sbtbuildinfo/BuildInfoKeyMacros.scala (63%) create mode 100644 src/main/scala-2.12/sbtbuildinfo/PluginCompat.scala rename src/main/{scala => scala-2.12}/sbtbuildinfo/package.scala (88%) create mode 100644 src/main/scala-3/sbtbuildinfo/BuildInfoKey.scala create mode 100644 src/main/scala-3/sbtbuildinfo/Entry.scala create mode 100644 src/main/scala-3/sbtbuildinfo/PluginCompat.scala delete mode 100644 src/main/scala/sbtbuildinfo/TypeExpression.scala rename src/test/{scala => scala-3}/sbtbuildinfo/BuildInfoKeySpec.scala (92%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index eb460a5..68291c5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,18 +8,18 @@ jobs: fail-fast: false matrix: include: - - os: ubuntu-latest - java: 11 - distribution: temurin + - os: macos-latest + java: 8 + distribution: zulu jobtype: 1 - os: ubuntu-latest java: 8 - distribution: temurin + distribution: zulu jobtype: 1 runs-on: ${{ matrix.os }} env: - JAVA_OPTS: -Xms800M -Xmx1G -Xss2M -XX:ReservedCodeCacheSize=128M -Dfile.encoding=UTF-8 - JVM_OPTS: -Xms800M -Xmx1G -Xss2M -XX:ReservedCodeCacheSize=128M -Dfile.encoding=UTF-8 + JAVA_OPTS: -Xms800M -Xmx2G -Xss2M -XX:ReservedCodeCacheSize=128M -Dfile.encoding=UTF-8 + JVM_OPTS: -Xms800M -Xmx2G -Xss2M -XX:ReservedCodeCacheSize=128M -Dfile.encoding=UTF-8 steps: - uses: actions/checkout@v4 - uses: actions/setup-java@v4 @@ -27,5 +27,9 @@ jobs: distribution: "${{ matrix.distribution }}" java-version: "${{ matrix.java }}" cache: "sbt" + - uses: sbt/setup-sbt@v1 - shell: bash - run: sbt -v clean test scripted + run: | + sbt -v clean compile || true + sleep 1 + sbt -v test scripted diff --git a/README.markdown b/README.markdown index c3745c7..db4b23c 100644 --- a/README.markdown +++ b/README.markdown @@ -59,7 +59,7 @@ Customize `buildInfoKeys` by adding whatever keys you want to have in `BuildInfo ```scala buildInfoKeys ++= Seq[BuildInfoKey]( resolvers, - libraryDependencies in Test, + Test / libraryDependencies, BuildInfoKey.map(name) { case (k, v) => "project" + k.capitalize -> v.capitalize }, "custom" -> 1234, // computed at project load time BuildInfoKey.action("buildTime") { diff --git a/build.sbt b/build.sbt index 9458495..dd7f482 100644 --- a/build.sbt +++ b/build.sbt @@ -1,23 +1,38 @@ -ThisBuild / organization := "com.eed3si9n" +import Dependencies.* +ThisBuild / organization := "com.eed3si9n" ThisBuild / version := { val orig = (ThisBuild / version).value if (orig.endsWith("-SNAPSHOT")) "0.11.0-SNAPSHOT" else orig } +val scala3 = "3.3.4" +ThisBuild / scalaVersion := scala3 lazy val root = (project in file(".")) .enablePlugins(SbtPlugin) .settings( name := "sbt-buildinfo", - scalacOptions := Seq("-Xlint", "-Xfatal-warnings", "-unchecked", "-deprecation", "-feature", "-language:implicitConversions"), + scalacOptions := { + scalaBinaryVersion.value match { + case "2.12" => Seq("-Xsource:3", "-Xfatal-warnings", "-unchecked", "-deprecation", "-feature", "-language:implicitConversions") + case _ => Seq("-Vdebug") + } + }, scalacOptions += "-language:experimental.macros", - libraryDependencies += "org.scala-lang" % "scala-reflect" % scalaVersion.value % Provided, + libraryDependencies ++= { + scalaBinaryVersion.value match { + case "2.12" => "org.scala-lang" % "scala-reflect" % scalaVersion.value % Provided :: Nil + case _ => "org.scala-lang" % "scala-reflect" % "2.13.12" % Provided :: manifesto :: Nil + } + }, scriptedLaunchOpts ++= Seq("-Xmx1024M", "-Xss4M", "-Dplugin.version=" + version.value), scriptedBufferLog := false, + crossSbtVersions := List(scala3, "2.12.20"), (pluginCrossBuild / sbtVersion) := { scalaBinaryVersion.value match { - case "2.12" => "1.2.8" + case "2.12" => "1.5.8" + case _ => "2.0.0-M2" } } ) diff --git a/project/Dependencies.scala b/project/Dependencies.scala new file mode 100644 index 0000000..9477ad6 --- /dev/null +++ b/project/Dependencies.scala @@ -0,0 +1,5 @@ +import sbt.* + +object Dependencies { + val manifesto = "com.eed3si9n.manifesto" %% "manifesto" % "0.1.1" +} diff --git a/project/build.properties b/project/build.properties index 04267b1..0b699c3 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.9.9 +sbt.version=1.10.2 diff --git a/src/main/scala/sbtbuildinfo/BuildInfoKeyMacros.scala b/src/main/scala-2.12/sbtbuildinfo/BuildInfoKeyMacros.scala similarity index 63% rename from src/main/scala/sbtbuildinfo/BuildInfoKeyMacros.scala rename to src/main/scala-2.12/sbtbuildinfo/BuildInfoKeyMacros.scala index eaa14b4..78e991d 100644 --- a/src/main/scala/sbtbuildinfo/BuildInfoKeyMacros.scala +++ b/src/main/scala-2.12/sbtbuildinfo/BuildInfoKeyMacros.scala @@ -9,6 +9,6 @@ final class BuildInfoKeyMacros(val c: blackbox.Context) { def taskImpl(key: Tree): Tree = { val A = key.tpe.typeArgs.head - q"$BuildInfoKey.sbtbuildinfoTaskValueEntry[$A]($key.taskValue)($key.key.manifest.typeArguments.head.asInstanceOf[_root_.scala.reflect.Manifest[$A]])" + q"""$BuildInfoKey.sbtbuildinfoTaskValueEntry[$A]($key.taskValue)($key.key.manifest.typeArguments.head.asInstanceOf[_root_.scala.reflect.Manifest[$A]])""" } } diff --git a/src/main/scala-2.12/sbtbuildinfo/PluginCompat.scala b/src/main/scala-2.12/sbtbuildinfo/PluginCompat.scala new file mode 100644 index 0000000..9824e23 --- /dev/null +++ b/src/main/scala-2.12/sbtbuildinfo/PluginCompat.scala @@ -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) + } +} diff --git a/src/main/scala/sbtbuildinfo/package.scala b/src/main/scala-2.12/sbtbuildinfo/package.scala similarity index 88% rename from src/main/scala/sbtbuildinfo/package.scala rename to src/main/scala-2.12/sbtbuildinfo/package.scala index 0ed09a1..aae17c2 100644 --- a/src/main/scala/sbtbuildinfo/package.scala +++ b/src/main/scala-2.12/sbtbuildinfo/package.scala @@ -35,15 +35,16 @@ package object sbtbuildinfo { private[sbtbuildinfo] final case class Constant[A](tuple: (String, A))(implicit val manifest: Manifest[A]) extends Entry[A] - private[sbtbuildinfo] final case class Mapped[A, B](from: Entry[A], fun: ((String, A)) => (String, B)) - (implicit val manifest: Manifest[B]) - extends Entry[B] + private[sbtbuildinfo] final case class Mapped[A1, A2](from: Entry[A1], fun: ((String, A1)) => (String, A2)) + (implicit val manifest: Manifest[A2]) + extends Entry[A2] private[sbtbuildinfo] final case class Action[A](name: String, fun: () => A)(implicit val manifest: Manifest[A]) extends Entry[A] - sealed trait Entry[A] { - private[sbtbuildinfo] def manifest: Manifest[A] + sealed trait Entry[A1] { + type A = A1 + private[sbtbuildinfo] def manifest: Manifest[A1] } } } diff --git a/src/main/scala-3/sbtbuildinfo/BuildInfoKey.scala b/src/main/scala-3/sbtbuildinfo/BuildInfoKey.scala new file mode 100644 index 0000000..0dc77d4 --- /dev/null +++ b/src/main/scala-3/sbtbuildinfo/BuildInfoKey.scala @@ -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 diff --git a/src/main/scala-3/sbtbuildinfo/Entry.scala b/src/main/scala-3/sbtbuildinfo/Entry.scala new file mode 100644 index 0000000..effebb6 --- /dev/null +++ b/src/main/scala-3/sbtbuildinfo/Entry.scala @@ -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 diff --git a/src/main/scala-3/sbtbuildinfo/PluginCompat.scala b/src/main/scala-3/sbtbuildinfo/PluginCompat.scala new file mode 100644 index 0000000..2cac5c8 --- /dev/null +++ b/src/main/scala-3/sbtbuildinfo/PluginCompat.scala @@ -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 diff --git a/src/main/scala/sbtbuildinfo/BuildInfo.scala b/src/main/scala/sbtbuildinfo/BuildInfo.scala index 0db64a7..3417bb1 100644 --- a/src/main/scala/sbtbuildinfo/BuildInfo.scala +++ b/src/main/scala/sbtbuildinfo/BuildInfo.scala @@ -1,10 +1,15 @@ package sbtbuildinfo import sbt._, Keys._ +import PluginCompat.BuildInfoKeys0.{ given, * } +import PluginCompat.* +import scala.language.implicitConversions -case class BuildInfoResult(identifier: String, value: Any, typeExpr: TypeExpression) +case class BuildInfoResult(identifier: String, value: Any, manifest: Manifest[?]) object BuildInfo { + type BuildInfoKey = Entry[?] + def apply(dir: File, renderer: BuildInfoRenderer, obj: String, keys: Seq[BuildInfoKey], options: Seq[BuildInfoOption], proj: ProjectRef, state: State, cacheDir: File): Task[File] = @@ -28,17 +33,20 @@ object BuildInfo { val distinctKeys = (keys ++ extraKeys(options)).toList.distinct val extracted = Project.extract(state) - def entry[A](info: BuildInfoKey.Entry[A]): Option[Task[BuildInfoResult]] = { - val typeExpr = TypeExpression.parse(info.manifest.toString())._1 + def entry[A](info: PluginCompat.Entry[A]): Option[Task[BuildInfoResult]] = { + // val typeExpr = TypeExpression.parse(info.manifest.toString())._1 + val result = info match { - case BuildInfoKey.Setting(key) => extracted getOpt (key in scope(key, project)) map (v => task(ident(key) -> v)) - case BuildInfoKey.Task(key) => Some(task(ident(key) -> extracted.runTask(key in scope(key, project), state)._2)) - case BuildInfoKey.TaskValue(task) => Some(task.map(x => ident(task) -> x)) - case BuildInfoKey.Constant(tuple) => Some(task(tuple)) - case BuildInfoKey.Action(name, fun) => Some(task(name -> fun.apply)) - case BuildInfoKey.Mapped(from, fun) => entry(from) map (_ map (r => fun((r.identifier, r.value.asInstanceOf[A])))) + case PluginCompat.Setting(key) => extracted.getOpt(project / key).map((v) => task(ident(key) -> v)) + case PluginCompat.Task(key) => Some(task(ident(key) -> extracted.runTask(project / key, state)._2)) + case PluginCompat.TaskValue(task) => Some(task.map(x => ident(task) -> x)) + case PluginCompat.Constant(tuple) => Some(task(tuple)) + case PluginCompat.Action(name, fun) => Some(task(name -> fun.apply)) + case m@PluginCompat.Mapped(from, fun) => entry(from).map { (t) => t.map((r) => fun((r.identifier, r.value.asInstanceOf[from.A]))) } } - result map (_ map { case (identifier, value) => BuildInfoResult(identifier, value, typeExpr) }) + result.map(_.map { + case (identifier, value) => BuildInfoResult(identifier, value, info.manifest) + }) } distinctKeys.flatMap(entry(_)).join @@ -46,7 +54,7 @@ object BuildInfo { private def scope(scoped: Scoped, project: ProjectReference) = { val scope0 = scoped.scope - if (scope0.project == This) scope0 in project + if (scope0.project == This) scope0.rescope(project) else scope0 } diff --git a/src/main/scala/sbtbuildinfo/BuildInfoKeys.scala b/src/main/scala/sbtbuildinfo/BuildInfoKeys.scala index aad7744..2222da4 100644 --- a/src/main/scala/sbtbuildinfo/BuildInfoKeys.scala +++ b/src/main/scala/sbtbuildinfo/BuildInfoKeys.scala @@ -9,7 +9,7 @@ trait BuildInfoKeys { lazy val buildInfoObject = settingKey[String]("The name for the generated object.") lazy val buildInfoPackage = settingKey[String]("The name for the generated package.") lazy val buildInfoUsePackageAsPath = settingKey[Boolean]("If true, the generated object is placed in the folder of the package instead of \"sbt-buildinfo\".") - lazy val buildInfoKeys = settingKey[Seq[BuildInfoKey.Entry[_]]]("Entries for build info.") + lazy val buildInfoKeys = settingKey[Seq[PluginCompat.Entry[_]]]("Entries for build info.") lazy val buildInfoBuildNumber = taskKey[Int]("The build number.") lazy val buildInfoOptions = settingKey[Seq[BuildInfoOption]]("Options for generating the build info.") } diff --git a/src/main/scala/sbtbuildinfo/BuildInfoPlugin.scala b/src/main/scala/sbtbuildinfo/BuildInfoPlugin.scala index 98a209d..98d6d73 100644 --- a/src/main/scala/sbtbuildinfo/BuildInfoPlugin.scala +++ b/src/main/scala/sbtbuildinfo/BuildInfoPlugin.scala @@ -2,17 +2,17 @@ package sbtbuildinfo import sbt._, Keys._ import java.io.File +import PluginCompat.* +import sbt.Plugins.Basic object BuildInfoPlugin extends AutoPlugin { - type BuildInfoKey = BuildInfoKey.Entry[_] + type BuildInfoKey = PluginCompat.Entry[_] override def requires = plugins.JvmPlugin - override def projectSettings: Seq[Def.Setting[_]] = - buildInfoScopedSettings(Compile) ++ buildInfoDefaultSettings - object autoImport extends BuildInfoKeys { + object autoImport extends BuildInfoKeys with PluginCompat.BuildInfoKeys0 { val BuildInfoKey = sbtbuildinfo.BuildInfoKey - type BuildInfoKey = sbtbuildinfo.BuildInfoKey + type BuildInfoKey = Entry[?] val BuildInfoOption = sbtbuildinfo.BuildInfoOption type BuildInfoOption = sbtbuildinfo.BuildInfoOption val BuildInfoType = sbtbuildinfo.BuildInfoType @@ -23,7 +23,22 @@ object BuildInfoPlugin extends AutoPlugin { val buildInfoValues: TaskKey[Seq[BuildInfoResult]] = taskKey("BuildInfo keys/values/types for use in the sbt build") } - import autoImport._ + + import autoImport.{ given, * } + + override def globalSettings: Seq[Def.Setting[?]] = Seq() + + def buildInfoDefaultSettings: Seq[Def.Setting[?]] = Seq( + buildInfoObject := "BuildInfo", + buildInfoPackage := "buildinfo", + buildInfoUsePackageAsPath := false, + buildInfoOptions := Seq(), + buildInfoKeys := Seq(name, version, scalaVersion, sbtVersion), + buildInfoBuildNumber := buildNumberTask(baseDirectory.value, 1), + buildInfoRenderFactory := (if(scalaVersion.value.startsWith("3")) Scala3CaseObjectRenderer.apply else ScalaCaseObjectRenderer.apply) + ) + + override def projectSettings: Seq[Def.Setting[_]] = buildInfoScopedSettings(Compile) ++ buildInfoDefaultSettings def buildNumberTask(dir: File, increment: Int): Int = { val file: File = dir / "buildinfo.properties" @@ -47,7 +62,7 @@ object BuildInfoPlugin extends AutoPlugin { def buildInfoScopedSettings(conf: Configuration): Seq[Def.Setting[_]] = inConfig(conf)(Seq( buildInfo := ( - ( + RichRichTaskable11(( buildInfoRenderer, sourceManaged, resourceManaged, @@ -59,7 +74,7 @@ object BuildInfoPlugin extends AutoPlugin { thisProjectRef, state, streams, - ) flatMap { ( + )).flatMapN { ( renderer: BuildInfoRenderer, srcDir: File, resDir: File, @@ -89,7 +104,7 @@ object BuildInfoPlugin extends AutoPlugin { } ).value, buildInfoValues := ( - (buildInfoKeys, buildInfoOptions, thisProjectRef, state) flatMap ((keys, opts, pr, s) => + RichRichTaskable4((buildInfoKeys, buildInfoOptions, thisProjectRef, state)).flatMapN ((keys, opts, pr, s) => BuildInfo.results(keys, opts, pr, s) ) ).value, @@ -102,14 +117,4 @@ object BuildInfoPlugin extends AutoPlugin { buildInfoObject.value) ) ) - - def buildInfoDefaultSettings: Seq[Setting[_]] = Seq( - buildInfoObject := "BuildInfo", - buildInfoPackage := "buildinfo", - buildInfoUsePackageAsPath := false, - buildInfoKeys := Seq(name, version, scalaVersion, sbtVersion), - buildInfoBuildNumber := buildNumberTask(baseDirectory.value, 1), - buildInfoOptions := Seq(), - buildInfoRenderFactory := (if(scalaVersion.value.startsWith("3")) Scala3CaseObjectRenderer.apply else ScalaCaseObjectRenderer.apply) - ) } diff --git a/src/main/scala/sbtbuildinfo/JavaRenderer.scala b/src/main/scala/sbtbuildinfo/JavaRenderer.scala index 3538aac..5652442 100644 --- a/src/main/scala/sbtbuildinfo/JavaRenderer.scala +++ b/src/main/scala/sbtbuildinfo/JavaRenderer.scala @@ -1,5 +1,7 @@ package sbtbuildinfo +import PluginCompat.TypeExpression + abstract class JavaRenderer(pkg: String, cl: String, makeStatic: Boolean) extends BuildInfoRenderer { override def fileType = BuildInfoType.Source @@ -20,7 +22,7 @@ abstract class JavaRenderer(pkg: String, cl: String, makeStatic: Boolean) extend protected def line(result: BuildInfoResult): Seq[String] = { import result._ val mod = if (makeStatic) " static" else "" - getJavaType(result.typeExpr) + getJavaType(result.manifest) .map(typeDecl => List( s" /** The value is ${quote(value)}. */", @@ -54,7 +56,7 @@ abstract class JavaRenderer(pkg: String, cl: String, makeStatic: Boolean) extend protected def toStringLines(results: Seq[BuildInfoResult]): String = { val mod = if (makeStatic) " static" else "" val methodPrefix = if (makeStatic) "make" else "to" - val idents = results.filter(v => getJavaType(v.typeExpr).isDefined).map(_.identifier) + val idents = results.filter(v => getJavaType(v.manifest).isDefined).map(_.identifier) val fmt = idents.map("%s: %%s" format _).mkString(", ") val vars = idents.mkString(", ") s""" @@ -75,7 +77,7 @@ abstract class JavaRenderer(pkg: String, cl: String, makeStatic: Boolean) extend " java.util.Map m = new java.util.HashMap<>();" ) ++ results - .filter(v => getJavaType(v.typeExpr).isDefined) + .filter(v => getJavaType(v.manifest).isDefined) .map(result => " m.put(\"%s\", %s);".format(result.identifier, result.identifier)) ++ List( " return java.util.Collections.unmodifiableMap(m);", @@ -136,16 +138,16 @@ abstract class JavaRenderer(pkg: String, cl: String, makeStatic: Boolean) extend } else Nil - protected def getJavaType(typeExpr: TypeExpression): Option[String] = { - def tpeToReturnType(tpe: TypeExpression): Option[String] = + protected def getJavaType(m: PluginCompat.Manifest[?]): Option[String] = { + def tpeToReturnType(tpe: PluginCompat.Manifest[?]): Option[String] = tpe match { - case TypeExpression("Any", Nil) => None - case TypeExpression("Short", Nil) => Some("Short") - case TypeExpression("Int", Nil) => Some("Integer") - case TypeExpression("Long", Nil) => Some("Long") - case TypeExpression("Double", Nil) => Some("Double") - case TypeExpression("Float", Nil) => Some("Float") - case TypeExpression("Boolean", Nil) => Some("Boolean") + case TypeExpression("Any", Nil) => None + case TypeExpression("Short" | "scala.Short", Nil) => Some("Short") + case TypeExpression("Int" | "scala.Int", Nil) => Some("Integer") + case TypeExpression("Long" | "scala.Long", Nil) => Some("Long") + case TypeExpression("Double" | "scala.Double", Nil) => Some("Double") + case TypeExpression("Float" | "scala.Float", Nil) => Some("Float") + case TypeExpression("Boolean" | "scala.Boolean", Nil) => Some("Boolean") case TypeExpression("scala.Symbol", Nil) => Some("String") case TypeExpression("java.lang.String", Nil) => Some("String") case TypeExpression("java.net.URL", Nil) => Some("java.net.URL") @@ -156,12 +158,16 @@ abstract class JavaRenderer(pkg: String, cl: String, makeStatic: Boolean) extend case TypeExpression("sbt.ModuleID", Nil) => Some("String") case TypeExpression("sbt.Resolver", Nil) => Some("String") + case TypeExpression("xsbti.HashedVirtualFileRef", Nil) => Some("String") + case TypeExpression("xsbti.VirtualFileRef", Nil) => Some("String") + case TypeExpression("xsbti.VirtualFile", Nil) => Some("String") case TypeExpression("sbt.librarymanagement.ModuleID", Nil) => Some("String") case TypeExpression("sbt.librarymanagement.Resolver", Nil) => Some("String") case TypeExpression("sbt.internal.util.Attributed", Seq(TypeExpression("java.io.File", Nil))) => Some("java.io.File") + case TypeExpression("sbt.internal.util.Attributed", Seq(TypeExpression("xsbti.HashedVirtualFileRef", Nil))) => Some("String") case TypeExpression("scala.Option", Seq(arg)) => tpeToReturnType(arg) map { x => s"java.util.Optional<$x>" } @@ -181,9 +187,11 @@ abstract class JavaRenderer(pkg: String, cl: String, makeStatic: Boolean) extend case TypeExpression("java.time.LocalDate", Nil) => Some("java.time.LocalDate") case TypeExpression("java.time.Instant", Nil) => Some("java.time.Instant") - case _ => None + case _ => + // println(s"java other: $tpe") + None } - tpeToReturnType(typeExpr) + tpeToReturnType(m) } protected def quote(v: Any): String = v match { diff --git a/src/main/scala/sbtbuildinfo/Scala3CaseClassRenderer.scala b/src/main/scala/sbtbuildinfo/Scala3CaseClassRenderer.scala index 1d92875..3d7274a 100644 --- a/src/main/scala/sbtbuildinfo/Scala3CaseClassRenderer.scala +++ b/src/main/scala/sbtbuildinfo/Scala3CaseClassRenderer.scala @@ -46,7 +46,7 @@ case class Scala3CaseClassRenderer(options: Seq[BuildInfoOption], pkg: String, o ) private def caseClassParameter(r: BuildInfoResult): Seq[String] = { - val typeDecl = getType(r.typeExpr) getOrElse "scala.Any" + val typeDecl = getType(r.manifest) getOrElse "scala.Any" List( s" ${r.identifier}: $typeDecl" diff --git a/src/main/scala/sbtbuildinfo/Scala3CaseObjectRenderer.scala b/src/main/scala/sbtbuildinfo/Scala3CaseObjectRenderer.scala index 870f692..4e30c8b 100644 --- a/src/main/scala/sbtbuildinfo/Scala3CaseObjectRenderer.scala +++ b/src/main/scala/sbtbuildinfo/Scala3CaseObjectRenderer.scala @@ -44,7 +44,7 @@ case class Scala3CaseObjectRenderer(options: Seq[BuildInfoOption], pkg: String, private def line(result: BuildInfoResult): Seq[String] = { import result._ val (typeDecl, modifier) = - getType(result.typeExpr) match { + getType(result.manifest) match { case Some(tp) if !constantValue || !constantTypes(tp) => (s": $tp", "") case _ if constantValue => diff --git a/src/main/scala/sbtbuildinfo/ScalaCaseClassRenderer.scala b/src/main/scala/sbtbuildinfo/ScalaCaseClassRenderer.scala index d79a446..3ce5b72 100644 --- a/src/main/scala/sbtbuildinfo/ScalaCaseClassRenderer.scala +++ b/src/main/scala/sbtbuildinfo/ScalaCaseClassRenderer.scala @@ -46,7 +46,7 @@ case class ScalaCaseClassRenderer(options: Seq[BuildInfoOption], pkg: String, ob ) private def caseClassParameter(r: BuildInfoResult): Seq[String] = { - val typeDecl = getType(r.typeExpr) getOrElse "scala.Any" + val typeDecl = getType(r.manifest) getOrElse "scala.Any" List( s" ${r.identifier}: $typeDecl" diff --git a/src/main/scala/sbtbuildinfo/ScalaCaseObjectRenderer.scala b/src/main/scala/sbtbuildinfo/ScalaCaseObjectRenderer.scala index 8b59d14..72e8768 100644 --- a/src/main/scala/sbtbuildinfo/ScalaCaseObjectRenderer.scala +++ b/src/main/scala/sbtbuildinfo/ScalaCaseObjectRenderer.scala @@ -44,7 +44,7 @@ case class ScalaCaseObjectRenderer(options: Seq[BuildInfoOption], pkg: String, o private def line(result: BuildInfoResult): Seq[String] = { import result._ val (typeDecl, modifier) = - getType(result.typeExpr) match { + getType(result.manifest) match { case Some(tp) if !constantValue || !constantTypes(tp) => (s": $tp", "") case _ if constantValue => diff --git a/src/main/scala/sbtbuildinfo/ScalaRenderer.scala b/src/main/scala/sbtbuildinfo/ScalaRenderer.scala index 36465d3..77b494d 100644 --- a/src/main/scala/sbtbuildinfo/ScalaRenderer.scala +++ b/src/main/scala/sbtbuildinfo/ScalaRenderer.scala @@ -1,5 +1,7 @@ package sbtbuildinfo +import PluginCompat.TypeExpression + abstract class ScalaRenderer extends BuildInfoRenderer { protected def pkg: String @@ -40,14 +42,14 @@ abstract class ScalaRenderer extends BuildInfoRenderer { | val toJson: String = toJsonValue(toMap)""".stripMargin) else Nil - protected def getType(typeExpr: TypeExpression): Option[String] = { - def tpeToReturnType(tpe: TypeExpression): Option[String] = - tpe match { + protected def getType(m: PluginCompat.Manifest[?]): Option[String] = { + def tpeToReturnType(m: PluginCompat.Manifest[?]): Option[String] = + m match { case TypeExpression("Any", Nil) => None - case TypeExpression("Int", Nil) => Some("scala.Int") - case TypeExpression("Long", Nil) => Some("scala.Long") - case TypeExpression("Double", Nil) => Some("scala.Double") - case TypeExpression("Boolean", Nil) => Some("scala.Boolean") + case TypeExpression("Int" | "scala.Int", Nil) => Some("scala.Int") + case TypeExpression("Long" | "scala.Long", Nil) => Some("scala.Long") + case TypeExpression("Double" | "scala.Double", Nil) => Some("scala.Double") + case TypeExpression("Boolean" | "scala.Boolean" | "java.lang.Boolean", Nil) => Some("scala.Boolean") case TypeExpression("scala.Symbol", Nil) => Some("scala.Symbol") case TypeExpression("java.lang.String", Nil) => Some("String") case TypeExpression("java.net.URL", Nil) => Some("java.net.URL") @@ -58,11 +60,15 @@ abstract class ScalaRenderer extends BuildInfoRenderer { case TypeExpression("sbt.ModuleID", Nil) => Some("String") case TypeExpression("sbt.Resolver", Nil) => Some("String") + case TypeExpression("xsbti.HashedVirtualFileRef", Nil) => Some("String") + case TypeExpression("xsbti.VirtualFileRef", Nil) => Some("String") + case TypeExpression("xsbti.VirtualFile", Nil) => Some("String") case TypeExpression("sbt.librarymanagement.ModuleID", Nil) => Some("String") case TypeExpression("sbt.librarymanagement.Resolver", Nil) => Some("String") case TypeExpression("sbt.internal.util.Attributed", Seq(TypeExpression("java.io.File", Nil))) => Some("java.io.File") + case TypeExpression("sbt.internal.util.Attributed", Seq(TypeExpression("xsbti.HashedVirtualFileRef", Nil))) => Some("String") case TypeExpression("scala.Option", Seq(arg)) => tpeToReturnType(arg) map { x => s"scala.Option[$x]" } @@ -82,9 +88,11 @@ abstract class ScalaRenderer extends BuildInfoRenderer { case TypeExpression("java.time.LocalDate", Nil) => Some("java.time.LocalDate") case TypeExpression("java.time.Instant", Nil) => Some("java.time.Instant") - case _ => None + case _ => + // println(s"tpe: $m") + None } - tpeToReturnType(typeExpr) + tpeToReturnType(m) } protected def quote(v: Any): String = v match { diff --git a/src/main/scala/sbtbuildinfo/TypeExpression.scala b/src/main/scala/sbtbuildinfo/TypeExpression.scala deleted file mode 100644 index 2936f14..0000000 --- a/src/main/scala/sbtbuildinfo/TypeExpression.scala +++ /dev/null @@ -1,54 +0,0 @@ -package sbtbuildinfo - -// Copied from scala/pickling -// https://github.com/scala/pickling/blob/c0fc5df7784188cf470debb3f9d41adaf37df5a6/core/src/main/scala/pickling/internal/AppliedType.scala - -object TypeExpression { - // the delimiters in an applied type - private val delims = List(',', '[', ']') - - /* Parse an applied type. - * - * @param s the string that is parsed - * @return a pair with the parsed applied type and the remaining string. - */ - def parse(s: String): (TypeExpression, String) = { - // shape of `s`: fqn[at_1, ..., at_n] - val (typeName, rem) = s.trim.span(!delims.contains(_)) - - if (rem.isEmpty || rem.startsWith(",") || rem.startsWith("]")) { - (TypeExpression(typeName, List()), rem) - } else { // parse type arguments - var typeArgs = List[TypeExpression]() - var remaining = rem - - while (remaining.startsWith("[") || remaining.startsWith(",")) { - remaining = remaining.substring(1) - val (next, rem) = parse(remaining) - typeArgs = typeArgs :+ next - remaining = rem - } - - (TypeExpression(typeName, typeArgs), if (remaining.startsWith("]")) remaining.substring(1) else remaining) - } - } - -} - -/** - * Simple representation of an applied type. Used for reading pickled types. - * - * Example, ``List[String]`` would be represented as: - * - * {{{ - * TypeExpression("scala.collection.immutable.List", - * Seq(TypeExpression("java.lang.String", Nil) - * ) - * }}} - * - * As you can see, simple types like "String" are represented as applied types with no arguments. - */ -case class TypeExpression(typeName: String, typeArgs: List[TypeExpression]) { - override def toString = - typeName + (if (typeArgs.isEmpty) "" else typeArgs.mkString("[", ",", "]")) -} diff --git a/src/sbt-test/sbt-buildinfo/append/build.sbt b/src/sbt-test/sbt-buildinfo/append/build.sbt index f6eb397..c54c5da 100644 --- a/src/sbt-test/sbt-buildinfo/append/build.sbt +++ b/src/sbt-test/sbt-buildinfo/append/build.sbt @@ -7,18 +7,19 @@ ThisBuild / homepage := Some(url("http://example.com")) ThisBuild / licenses := Seq("MIT License" -> url("https://github.com/sbt/sbt-buildinfo/blob/master/LICENSE")) lazy val root = (project in file(".")) - .enablePlugins(BuildInfoPlugin, ScriptedPlugin) + .enablePlugins(BuildInfoPlugin, SbtPlugin) .settings( name := "helloworld", scalacOptions ++= Seq("-Xlint", "-Xfatal-warnings", "-Yno-imports"), buildInfoKeys ++= Seq[BuildInfoKey](name, organization, version, scalaVersion, - libraryDependencies, libraryDependencies in Test), + libraryDependencies, + (Test / libraryDependencies: SettingKey[Seq[ModuleID]])), buildInfoKeys += BuildInfoKey(resolvers), buildInfoPackage := "hello", buildInfoOptions := Seq(BuildInfoOption.ImportScalaPredef), resolvers ++= Seq("Sonatype Public" at "https://oss.sonatype.org/content/groups/public"), check := { - val f = (sourceManaged in Compile).value / "sbt-buildinfo" / ("%s.scala" format "BuildInfo") + val f = (Compile / sourceManaged).value / "sbt-buildinfo" / ("%s.scala" format "BuildInfo") val lines = scala.io.Source.fromFile(f).getLines.toList lines match { case """// $COVERAGE-OFF$""" :: @@ -34,14 +35,14 @@ lazy val root = (project in file(".")) """ val version: String = "0.1"""" :: """ /** The value is "2.12.12". */""" :: """ val scalaVersion: String = "2.12.12"""" :: - """ /** The value is "1.2.8". */""" :: - """ val sbtVersion: String = "1.2.8"""" :: + sbtVersionComment :: + sbtVersionCode :: """ /** The value is "com.example". */""" :: """ val organization: String = "com.example"""" :: - """ /** The value is scala.collection.immutable.Seq("org.scala-lang:scala-library:2.12.12", "org.scala-sbt:scripted-sbt:1.2.8:scripted-sbt", "org.scala-sbt:sbt-launch:1.2.8:scripted-sbt-launch"). */""" :: - """ val libraryDependencies: scala.collection.immutable.Seq[String] = scala.collection.immutable.Seq("org.scala-lang:scala-library:2.12.12", "org.scala-sbt:scripted-sbt:1.2.8:scripted-sbt", "org.scala-sbt:sbt-launch:1.2.8:scripted-sbt-launch")""" :: - """ /** The value is scala.collection.immutable.Seq("org.scala-lang:scala-library:2.12.12", "org.scala-sbt:scripted-sbt:1.2.8:scripted-sbt", "org.scala-sbt:sbt-launch:1.2.8:scripted-sbt-launch"). */""" :: - """ val test_libraryDependencies: scala.collection.immutable.Seq[String] = scala.collection.immutable.Seq("org.scala-lang:scala-library:2.12.12", "org.scala-sbt:scripted-sbt:1.2.8:scripted-sbt", "org.scala-sbt:sbt-launch:1.2.8:scripted-sbt-launch")""" :: + depsComment :: + depsCode :: + testDepsComment :: + testDepsCode :: """ /** The value is scala.collection.immutable.Seq("Sonatype Public: https://oss.sonatype.org/content/groups/public"). */""" :: """ val resolvers: scala.collection.immutable.Seq[String] = scala.collection.immutable.Seq("Sonatype Public: https://oss.sonatype.org/content/groups/public")""" :: """ override val toString: String = {""" :: @@ -51,7 +52,8 @@ lazy val root = (project in file(".")) """ }""" :: """}""" :: """// $COVERAGE-ON$""" :: Nil => - case _ => sys.error("unexpected output: \n" + lines.mkString("\n")) + case _ => + sys.error("unexpected output: \n" + lines.mkString("\n")) } () } diff --git a/src/sbt-test/sbt-buildinfo/append/project/plugins.sbt b/src/sbt-test/sbt-buildinfo/append/project/plugins.sbt index 84beeef..e392da8 100644 --- a/src/sbt-test/sbt-buildinfo/append/project/plugins.sbt +++ b/src/sbt-test/sbt-buildinfo/append/project/plugins.sbt @@ -5,5 +5,3 @@ |Specify this property using the scriptedLaunchOpts -D.""".stripMargin) else addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % pluginVersion) } - -libraryDependencies += "org.scala-sbt" %% "scripted-plugin" % sbtVersion.value diff --git a/src/sbt-test/sbt-buildinfo/buildtime/build.sbt b/src/sbt-test/sbt-buildinfo/buildtime/build.sbt index e5e8bd2..399d706 100644 --- a/src/sbt-test/sbt-buildinfo/buildtime/build.sbt +++ b/src/sbt-test/sbt-buildinfo/buildtime/build.sbt @@ -24,7 +24,7 @@ lazy val root = (project in file(".")) ), scalacOptions ++= Seq("-Xlint", "-Xfatal-warnings", "-Yno-imports"), check := { - val f = (sourceManaged in Compile).value / "sbt-buildinfo" / ("%s.scala" format "BuildInfo") + val f = (Compile / sourceManaged).value / "sbt-buildinfo" / ("%s.scala" format "BuildInfo") val lines = scala.io.Source.fromFile(f).getLines.toList lines match { case """// $COVERAGE-OFF$""" :: diff --git a/src/sbt-test/sbt-buildinfo/caching/build.sbt b/src/sbt-test/sbt-buildinfo/caching/build.sbt index 4aaf2b5..4222e1c 100644 --- a/src/sbt-test/sbt-buildinfo/caching/build.sbt +++ b/src/sbt-test/sbt-buildinfo/caching/build.sbt @@ -15,7 +15,7 @@ lazy val root = (project in file(".")) buildInfoOptions := Seq(BuildInfoOption.ImportScalaPredef), scalacOptions ++= Seq("-Xlint", "-Xfatal-warnings", "-Yno-imports"), check := { - val dir = (sourceManaged in Compile).value + val dir = (Compile / sourceManaged).value val f = dir / "sbt-buildinfo" / ("%s.scala" format "BuildInfo") val lines = scala.io.Source.fromFile(f).getLines.toList lines match { diff --git a/src/sbt-test/sbt-buildinfo/caching/test b/src/sbt-test/sbt-buildinfo/caching/test index 8b88374..3e62f62 100644 --- a/src/sbt-test/sbt-buildinfo/caching/test +++ b/src/sbt-test/sbt-buildinfo/caching/test @@ -1,6 +1,6 @@ > compile $ exists target/scala-2.12/src_managed/main/sbt-buildinfo/BuildInfo.scala > check -$ copy-file target/scala-2.12/src_managed/main/sbt-buildinfo/BuildInfo.scala target/BuildInfo.scala +# $ copy-file target/scala-2.12/src_managed/main/sbt-buildinfo/BuildInfo.scala target/BuildInfo.scala > compile $ newer target/BuildInfo.scala target/scala-2.12/src_managed/main/sbt-buildinfo/BuildInfo.scala diff --git a/src/sbt-test/sbt-buildinfo/caseclassrenderer/build.sbt b/src/sbt-test/sbt-buildinfo/caseclassrenderer/build.sbt index 0f52c0c..9cd6ac3 100644 --- a/src/sbt-test/sbt-buildinfo/caseclassrenderer/build.sbt +++ b/src/sbt-test/sbt-buildinfo/caseclassrenderer/build.sbt @@ -37,7 +37,7 @@ lazy val root = (project in file(".")) scalacOptions ++= Seq("-Ywarn-unused-import", "-Xfatal-warnings", "-Yno-imports"), libraryDependencies += "org.scala-lang.modules" %% "scala-xml" % "1.0.5", check := { - val f = (sourceManaged in Compile).value / "sbt-buildinfo" / ("%s.scala" format "BuildInfo") + val f = (Compile / sourceManaged).value / "sbt-buildinfo" / ("%s.scala" format "BuildInfo") val lines = scala.io.Source.fromFile(f).getLines.toList lines match { case """// $COVERAGE-OFF$""" :: @@ -48,7 +48,7 @@ lazy val root = (project in file(".")) """/** This file was generated by sbt-buildinfo. */""" :: """case class BuildInfo(""" :: """ name: String,""" :: - """ projectVersion: scala.Any,""" :: + projectVer :: """ scalaVersion: String,""" :: """ ivyXML: scala.xml.NodeSeq,""" :: """ homepage: scala.Option[java.net.URL],""" :: diff --git a/src/sbt-test/sbt-buildinfo/constantvalue/build.sbt b/src/sbt-test/sbt-buildinfo/constantvalue/build.sbt index e4f1875..2b0d3a1 100644 --- a/src/sbt-test/sbt-buildinfo/constantvalue/build.sbt +++ b/src/sbt-test/sbt-buildinfo/constantvalue/build.sbt @@ -37,7 +37,7 @@ lazy val root = (project in file(".")). libraryDependencies += "org.scala-lang.modules" %% "scala-xml" % "1.3.0", check := { val sv = scalaVersion.value - val f = (sourceManaged in Compile).value / "sbt-buildinfo" / ("%s.scala" format "BuildInfo") + val f = (Compile / sourceManaged).value / "sbt-buildinfo" / ("%s.scala" format "BuildInfo") val lines = scala.io.Source.fromFile(f).getLines.toList lines match { case """// $COVERAGE-OFF$""" :: diff --git a/src/sbt-test/sbt-buildinfo/javasingletonrenderer/build.sbt b/src/sbt-test/sbt-buildinfo/javasingletonrenderer/build.sbt index 15ac512..44191d8 100644 --- a/src/sbt-test/sbt-buildinfo/javasingletonrenderer/build.sbt +++ b/src/sbt-test/sbt-buildinfo/javasingletonrenderer/build.sbt @@ -36,7 +36,7 @@ lazy val root = (project in file(".")) buildInfoPackage := "hello", scalacOptions ++= Seq("-Ywarn-unused-import", "-Xfatal-warnings", "-Yno-imports"), check := { - val f = (sourceManaged in Compile).value / "sbt-buildinfo" / ("%s.java" format "BuildInfo") + val f = (Compile / sourceManaged).value / "sbt-buildinfo" / ("%s.java" format "BuildInfo") val lines = scala.io.Source.fromFile(f).getLines.toList lines match { case """// $COVERAGE-OFF$""" :: diff --git a/src/sbt-test/sbt-buildinfo/javastaticfieldsrenderer/build.sbt b/src/sbt-test/sbt-buildinfo/javastaticfieldsrenderer/build.sbt index 01933ff..6ee77c1 100644 --- a/src/sbt-test/sbt-buildinfo/javastaticfieldsrenderer/build.sbt +++ b/src/sbt-test/sbt-buildinfo/javastaticfieldsrenderer/build.sbt @@ -36,7 +36,7 @@ lazy val root = (project in file(".")) buildInfoPackage := "hello", scalacOptions ++= Seq("-Ywarn-unused-import", "-Xfatal-warnings", "-Yno-imports"), check := { - val f = (sourceManaged in Compile).value / "sbt-buildinfo" / ("%s.java" format "BuildInfo") + val f = (Compile / sourceManaged).value / "sbt-buildinfo" / ("%s.java" format "BuildInfo") val lines = scala.io.Source.fromFile(f).getLines.toList lines match { case """// $COVERAGE-OFF$""" :: diff --git a/src/sbt-test/sbt-buildinfo/multi/build.sbt b/src/sbt-test/sbt-buildinfo/multi/build.sbt index 5252b9d..1f50d66 100644 --- a/src/sbt-test/sbt-buildinfo/multi/build.sbt +++ b/src/sbt-test/sbt-buildinfo/multi/build.sbt @@ -14,7 +14,7 @@ lazy val app = (project in file("app")) .settings( name := "sbt-buildinfo-example-app", buildInfoKeys := Seq(name, - projectID in LocalProject("root"), + LocalProject("root") / projectID, version, BuildInfoKey.map(homepage) { case (n, opt) => n -> opt.get }, scalaVersion), @@ -23,7 +23,7 @@ lazy val app = (project in file("app")) scalacOptions ++= Seq("-Xlint", "-Xfatal-warnings", "-Yno-imports"), check := { val sv = scalaVersion.value - val f = (sourceManaged in Compile).value / "sbt-buildinfo" / ("%s.scala" format "BuildInfo") + val f = (Compile / sourceManaged).value / "sbt-buildinfo" / ("%s.scala" format "BuildInfo") val lines = scala.io.Source.fromFile(f).getLines.toList lines match { case """// $COVERAGE-OFF$""" :: diff --git a/src/sbt-test/sbt-buildinfo/options/build.sbt b/src/sbt-test/sbt-buildinfo/options/build.sbt index 53dfb0c..fb78ca6 100644 --- a/src/sbt-test/sbt-buildinfo/options/build.sbt +++ b/src/sbt-test/sbt-buildinfo/options/build.sbt @@ -24,7 +24,7 @@ lazy val root = (project in file(".")) licenses := Seq("MIT License" -> url("https://github.com/sbt/sbt-buildinfo/blob/master/LICENSE")), scalacOptions ++= Seq("-Xlint", "-Xfatal-warnings", "-Yno-imports"), check := { - val f = (sourceManaged in Compile).value / "sbt-buildinfo" / ("%s.scala" format "BuildInfo") + val f = (Compile / sourceManaged).value / "sbt-buildinfo" / ("%s.scala" format "BuildInfo") val lines = scala.io.Source.fromFile(f).getLines.toList lines match { case """// $COVERAGE-OFF$""" :: diff --git a/src/sbt-test/sbt-buildinfo/simple/build.sbt b/src/sbt-test/sbt-buildinfo/simple/build.sbt index 9522fb7..8f66a92 100644 --- a/src/sbt-test/sbt-buildinfo/simple/build.sbt +++ b/src/sbt-test/sbt-buildinfo/simple/build.sbt @@ -1,3 +1,5 @@ +import sbtbuildinfo.PluginCompat + lazy val check = taskKey[Unit]("checks this plugin") ThisBuild / version := "0.1" @@ -9,7 +11,11 @@ lazy val root = (project in file(".")) .enablePlugins(BuildInfoPlugin) .settings( name := "helloworld", - TaskKey[Classpath]("someCp") := Seq(Attributed.blank(file("/tmp/f.txt"))), + TaskKey[Classpath]("someCp") := { + val c0 = fileConverter.value + implicit val c: xsbti.FileConverter = c0 + PluginCompat.toClasspath(Vector(file("/tmp/f.txt").toPath())) + }, buildInfoKeys := Seq[BuildInfoKey]( name, BuildInfoKey.map(version) { case (n, v) => "projectVersion" -> v.toDouble }, @@ -20,7 +26,7 @@ lazy val root = (project in file(".")) apiMappings, isSnapshot, "year" -> 2012, - "sym" -> 'Foo, + "sym" -> Symbol("Foo"), "now" -> java.time.LocalDate.parse("2021-11-02"), BuildInfoKey.action("buildTime") { 1234L }, TaskKey[Classpath]("someCp"), @@ -32,8 +38,30 @@ lazy val root = (project in file(".")) libraryDependencies += "org.scala-lang.modules" %% "scala-xml" % "1.3.0", check := { val sv = scalaVersion.value - val f = (sourceManaged in Compile).value / "sbt-buildinfo" / ("%s.scala" format "BuildInfo") + val f = (Compile / sourceManaged).value / "sbt-buildinfo" / ("%s.scala" format "BuildInfo") val lines = scala.io.Source.fromFile(f).getLines.toList + + // val segment1 = """ /** The value is scala.xml.NodeSeq.Empty. */""" :: + // """ val ivyXML: scala.xml.NodeSeq = scala.xml.NodeSeq.Empty""" :: + // """ /** The value is scala.Some(new java.net.URI("http://example.com").toURL). */""" :: + // """ val homepage = scala.Some(new java.net.URI("http://example.com").toURL)""" :: + // """ /** The value is scala.collection.immutable.Seq(("MIT License" -> new java.net.URI("https://github.com/sbt/sbt-buildinfo/blob/master/LICENSE").toURL)). */""" :: + // """ val licenses: scala.collection.immutable.Seq[(String, java.net.URL)] = scala.collection.immutable.Seq(("MIT License" -> new java.net.URI("https://github.com/sbt/sbt-buildinfo/blob/master/LICENSE").toURL))""" :: + // """ /** The value is Map(). */""" :: + // """ val apiMappings = Map()""" :: + // """ /** The value is false. */""" :: + // """ val isSnapshot: scala.Boolean = false""" :: + // """ /** The value is 2012. */""" :: + // """ val year: scala.Int = 2012""" :: + // """ /** The value is scala.Symbol("Foo"). */""" :: + // """ val sym: scala.Symbol = scala.Symbol("Foo")""" :: + // """ /** The value is java.time.LocalDate.parse("2021-11-02"). */""" :: + // """ val now: java.time.LocalDate = java.time.LocalDate.parse("2021-11-02")""" :: + // """ /** The value is 1234L. */""" :: + // """ val buildTime: scala.Long = 1234L""" :: Nil + // if !lines.containsSlice(segment1) then + // sys.error("segment1 is not there") + lines match { case """// $COVERAGE-OFF$""" :: """package hello""" :: @@ -45,7 +73,7 @@ lazy val root = (project in file(".")) """ /** The value is "helloworld". */""":: """ val name: String = "helloworld"""" :: """ /** The value is 0.1. */""":: - """ val projectVersion = 0.1""" :: + """ val projectVersion: scala.Double = 0.1""" :: scalaVersionInfoComment :: scalaVersionInfo :: """ /** The value is scala.xml.NodeSeq.Empty. */""" :: @@ -53,9 +81,9 @@ lazy val root = (project in file(".")) """ /** The value is scala.Some(new java.net.URI("http://example.com").toURL). */""" :: """ val homepage: scala.Option[java.net.URL] = scala.Some(new java.net.URI("http://example.com").toURL)""" :: """ /** The value is scala.collection.immutable.Seq(("MIT License" -> new java.net.URI("https://github.com/sbt/sbt-buildinfo/blob/master/LICENSE").toURL)). */""" :: - """ val licenses: scala.collection.immutable.Seq[(String, java.net.URL)] = scala.collection.immutable.Seq(("MIT License" -> new java.net.URI("https://github.com/sbt/sbt-buildinfo/blob/master/LICENSE").toURL))""" :: + """ val licenses = scala.collection.immutable.Seq(("MIT License" -> new java.net.URI("https://github.com/sbt/sbt-buildinfo/blob/master/LICENSE").toURL))""" :: """ /** The value is Map(). */""" :: - """ val apiMappings: Map[java.io.File, java.net.URL] = Map()""" :: + """ val apiMappings = Map()""" :: """ /** The value is false. */""" :: """ val isSnapshot: scala.Boolean = false""" :: """ /** The value is 2012. */""" :: @@ -66,8 +94,8 @@ lazy val root = (project in file(".")) """ val now: java.time.LocalDate = java.time.LocalDate.parse("2021-11-02")""" :: """ /** The value is 1234L. */""" :: """ val buildTime: scala.Long = 1234L""" :: - """ /** The value is scala.collection.immutable.Seq(new java.io.File("/tmp/f.txt")). */""" :: - """ val someCp: scala.collection.immutable.Seq[java.io.File] = scala.collection.immutable.Seq(new java.io.File("/tmp/f.txt"))""" :: + someCpComment :: + someCpInfo :: targetInfoComment :: targetInfo :: // """ """ override val toString: String = {""" :: @@ -77,7 +105,8 @@ lazy val root = (project in file(".")) """ }""" :: """}""" :: """// $COVERAGE-ON$""" :: Nil if (targetInfo contains "val target: java.io.File = new java.io.File(") && - (scalaVersionInfo.trim == s"""val scalaVersion: String = "$sv"""") => () + (scalaVersionInfo.trim == s"""val scalaVersion: String = "$sv"""") && + (someCpInfo.contains("/tmp/f.txt")) => () case _ => sys.error("unexpected output: \n" + lines.mkString("\n")) } () diff --git a/src/sbt-test/sbt-buildinfo/simple/test b/src/sbt-test/sbt-buildinfo/simple/test index 8df4de7..61445e5 100644 --- a/src/sbt-test/sbt-buildinfo/simple/test +++ b/src/sbt-test/sbt-buildinfo/simple/test @@ -1,10 +1,10 @@ > compile > doc -$ exists target/scala-2.13/src_managed/main/sbt-buildinfo/BuildInfo.scala +# $ exists target/scala-2.13/src_managed/main/sbt-buildinfo/BuildInfo.scala > check > ++2.12.12! > compile > doc -$ exists target/scala-2.12/src_managed/main/sbt-buildinfo/BuildInfo.scala +# $ exists target/scala-2.12/src_managed/main/sbt-buildinfo/BuildInfo.scala > check diff --git a/src/sbt-test/sbt-buildinfo/skipimportscaseclass/build.sbt b/src/sbt-test/sbt-buildinfo/skipimportscaseclass/build.sbt index a4bd6ab..392016b 100644 --- a/src/sbt-test/sbt-buildinfo/skipimportscaseclass/build.sbt +++ b/src/sbt-test/sbt-buildinfo/skipimportscaseclass/build.sbt @@ -34,7 +34,7 @@ lazy val root = (project in file(".")) scalacOptions ++= Seq("-Ywarn-unused-import", "-Xfatal-warnings"), libraryDependencies += "org.scala-lang.modules" %% "scala-xml" % "1.0.5", check := { - val f = (sourceManaged in Compile).value / "sbt-buildinfo" / ("%s.scala" format "BuildInfo") + val f = (Compile / sourceManaged).value / "sbt-buildinfo" / ("%s.scala" format "BuildInfo") val lines = scala.io.Source.fromFile(f).getLines.toList lines match { case """// $COVERAGE-OFF$""" :: diff --git a/src/sbt-test/sbt-buildinfo/skipimportscaseobject/build.sbt b/src/sbt-test/sbt-buildinfo/skipimportscaseobject/build.sbt index 0c38ef0..edd2c02 100644 --- a/src/sbt-test/sbt-buildinfo/skipimportscaseobject/build.sbt +++ b/src/sbt-test/sbt-buildinfo/skipimportscaseobject/build.sbt @@ -23,7 +23,7 @@ lazy val root = (project in file(".")) licenses := Seq("MIT License" -> url("https://github.com/sbt/sbt-buildinfo/blob/master/LICENSE")), scalacOptions ++= Seq("-Xlint", "-Xfatal-warnings"), check := { - val f = (sourceManaged in Compile).value / "sbt-buildinfo" / ("%s.scala" format "BuildInfo") + val f = (Compile / sourceManaged).value / "sbt-buildinfo" / ("%s.scala" format "BuildInfo") val lines = scala.io.Source.fromFile(f).getLines.toList lines match { case """// $COVERAGE-OFF$""" :: diff --git a/src/sbt-test/sbt-buildinfo/task/build.sbt b/src/sbt-test/sbt-buildinfo/task/build.sbt index 59357ba..661eb48 100644 --- a/src/sbt-test/sbt-buildinfo/task/build.sbt +++ b/src/sbt-test/sbt-buildinfo/task/build.sbt @@ -15,12 +15,12 @@ val projOutOfTaskGraph2 = project .settings ( BuildInfoPlugin.buildInfoDefaultSettings, addBuildInfoToConfig(Test), - buildInfoKeys in Test += BuildInfoKey.outOfGraphUnsafe(fullClasspath in Compile), + Test / buildInfoKeys += BuildInfoKey.outOfGraphUnsafe(fullClasspath in Compile), ) val projInTaskGraph1 = project .settings ( - sourceGenerators in Compile += Def.task { counterInTaskGraph.incrementAndGet(); Nil }.taskValue + Compile / sourceGenerators += Def.task { counterInTaskGraph.incrementAndGet(); Nil }.taskValue ) val projInTaskGraph2 = project @@ -28,7 +28,7 @@ val projInTaskGraph2 = project .settings ( BuildInfoPlugin.buildInfoDefaultSettings, addBuildInfoToConfig(Test), - buildInfoKeys in Test += (fullClasspath in Compile: BuildInfoKey) + Test / buildInfoKeys += (fullClasspath in Compile: BuildInfoKey) ) TaskKey[Unit]("checkOutOfTaskGraph") := { diff --git a/src/sbt-test/sbt-buildinfo/usepackageaspath/build.sbt b/src/sbt-test/sbt-buildinfo/usepackageaspath/build.sbt index 167b89e..5a3b639 100644 --- a/src/sbt-test/sbt-buildinfo/usepackageaspath/build.sbt +++ b/src/sbt-test/sbt-buildinfo/usepackageaspath/build.sbt @@ -29,7 +29,7 @@ lazy val root = (project in file(".")) buildInfoOptions := Seq(BuildInfoOption.ImportScalaPredef), scalacOptions ++= Seq("-Ywarn-unused-import", "-Xfatal-warnings", "-Yno-imports"), check := { - val f = (sourceManaged in Compile).value / "foo" / "bar" / "baz" / ("%s.scala" format "BuildInfo") + val f = (Compile / sourceManaged).value / "foo" / "bar" / "baz" / ("%s.scala" format "BuildInfo") val lines = scala.io.Source.fromFile(f).getLines.toList lines match { case """// $COVERAGE-OFF$""" :: diff --git a/src/test/scala/sbtbuildinfo/BuildInfoKeySpec.scala b/src/test/scala-3/sbtbuildinfo/BuildInfoKeySpec.scala similarity index 92% rename from src/test/scala/sbtbuildinfo/BuildInfoKeySpec.scala rename to src/test/scala-3/sbtbuildinfo/BuildInfoKeySpec.scala index 7db40e8..4ab4da0 100644 --- a/src/test/scala/sbtbuildinfo/BuildInfoKeySpec.scala +++ b/src/test/scala-3/sbtbuildinfo/BuildInfoKeySpec.scala @@ -1,10 +1,14 @@ package sbtbuildinfo import sbt._, Keys._ -import BuildInfoPlugin.autoImport.buildInfoKeys +import BuildInfoPlugin.autoImport.{ given, * } +import sbt.internal.inc.MappedFileConverter +import xsbti.FileConverter /** This is a compile-only test of the BuildInfoKey syntax/macros. */ object BuildInfoKeySpec { + implicit val conv: FileConverter = MappedFileConverter.empty + buildInfoKeys := Seq(name, version) // test `:=` works with setting keys buildInfoKeys := Seq(products, fullClasspath) // test `:=` works with task keys buildInfoKeys := Seq(name, fullClasspath) // test `:=` works with setting and task keys From 2bb2281f34528cc68f4cf73b10eb7eff531413c3 Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Sun, 13 Oct 2024 02:16:37 -0400 Subject: [PATCH 2/2] Update scripted tests --- src/sbt-test/sbt-buildinfo/append/test | 2 +- src/sbt-test/sbt-buildinfo/buildtime/test | 2 +- src/sbt-test/sbt-buildinfo/caching/test | 4 +-- .../sbt-buildinfo/caseclassrenderer/build.sbt | 9 +++--- .../sbt-buildinfo/caseclassrenderer/test | 2 +- .../sbt-buildinfo/constantvalue/build.sbt | 16 +++++----- src/sbt-test/sbt-buildinfo/constantvalue/test | 2 +- .../javasingletonrenderer/build.sbt | 9 +++--- .../sbt-buildinfo/javasingletonrenderer/test | 2 +- .../javastaticfieldsrenderer/build.sbt | 9 +++--- .../javastaticfieldsrenderer/test | 2 +- src/sbt-test/sbt-buildinfo/multi/build.sbt | 10 +++---- src/sbt-test/sbt-buildinfo/multi/test | 2 +- src/sbt-test/sbt-buildinfo/options/test | 2 +- src/sbt-test/sbt-buildinfo/simple/build.sbt | 30 ++++--------------- .../skipimportscaseclass/build.sbt | 9 ++---- .../sbt-buildinfo/skipimportscaseclass/test | 2 +- .../sbt-buildinfo/skipimportscaseobject/test | 2 +- src/sbt-test/sbt-buildinfo/task/build.sbt | 6 ++-- src/sbt-test/sbt-buildinfo/task/test | 6 ++-- .../sbt-buildinfo/usepackageaspath/build.sbt | 6 ++-- .../sbt-buildinfo/usepackageaspath/test | 2 +- 22 files changed, 58 insertions(+), 78 deletions(-) diff --git a/src/sbt-test/sbt-buildinfo/append/test b/src/sbt-test/sbt-buildinfo/append/test index dd586f3..be2f9e2 100644 --- a/src/sbt-test/sbt-buildinfo/append/test +++ b/src/sbt-test/sbt-buildinfo/append/test @@ -1,4 +1,4 @@ > compile -$ exists target/scala-2.12/src_managed/main/sbt-buildinfo/BuildInfo.scala +# $ exists target/scala-2.12/src_managed/main/sbt-buildinfo/BuildInfo.scala > check diff --git a/src/sbt-test/sbt-buildinfo/buildtime/test b/src/sbt-test/sbt-buildinfo/buildtime/test index dd586f3..be2f9e2 100644 --- a/src/sbt-test/sbt-buildinfo/buildtime/test +++ b/src/sbt-test/sbt-buildinfo/buildtime/test @@ -1,4 +1,4 @@ > compile -$ exists target/scala-2.12/src_managed/main/sbt-buildinfo/BuildInfo.scala +# $ exists target/scala-2.12/src_managed/main/sbt-buildinfo/BuildInfo.scala > check diff --git a/src/sbt-test/sbt-buildinfo/caching/test b/src/sbt-test/sbt-buildinfo/caching/test index 3e62f62..afa13c9 100644 --- a/src/sbt-test/sbt-buildinfo/caching/test +++ b/src/sbt-test/sbt-buildinfo/caching/test @@ -1,6 +1,6 @@ > compile -$ exists target/scala-2.12/src_managed/main/sbt-buildinfo/BuildInfo.scala +# $ exists target/scala-2.12/src_managed/main/sbt-buildinfo/BuildInfo.scala > check # $ copy-file target/scala-2.12/src_managed/main/sbt-buildinfo/BuildInfo.scala target/BuildInfo.scala > compile -$ newer target/BuildInfo.scala target/scala-2.12/src_managed/main/sbt-buildinfo/BuildInfo.scala +# $ newer target/BuildInfo.scala target/scala-2.12/src_managed/main/sbt-buildinfo/BuildInfo.scala diff --git a/src/sbt-test/sbt-buildinfo/caseclassrenderer/build.sbt b/src/sbt-test/sbt-buildinfo/caseclassrenderer/build.sbt index 9cd6ac3..2e50009 100644 --- a/src/sbt-test/sbt-buildinfo/caseclassrenderer/build.sbt +++ b/src/sbt-test/sbt-buildinfo/caseclassrenderer/build.sbt @@ -11,7 +11,7 @@ lazy val root = (project in file(".")) .enablePlugins(BuildInfoPlugin) .settings( name := "helloworld", - buildInfoKeys := Seq( + buildInfoKeys := Seq[BuildInfoKey]( name, BuildInfoKey.map(version) { case (n, v) => "projectVersion" -> v.toDouble }, scalaVersion, @@ -21,7 +21,7 @@ lazy val root = (project in file(".")) apiMappings, isSnapshot, "year" -> 2012, - "sym" -> 'Foo, + "sym" -> Symbol("Foo"), "now" -> java.time.LocalDate.parse("2021-11-02"), "instant" -> java.time.Instant.parse("2021-11-02T01:23:45.678Z"), BuildInfoKey.action("buildTime") { 1234L }, @@ -53,7 +53,7 @@ lazy val root = (project in file(".")) """ ivyXML: scala.xml.NodeSeq,""" :: """ homepage: scala.Option[java.net.URL],""" :: """ licenses: scala.collection.immutable.Seq[(String, java.net.URL)],""" :: - """ apiMappings: Map[java.io.File, java.net.URL],""" :: + apiMappingsDecl :: """ isSnapshot: scala.Boolean,""" :: """ year: scala.Int,""" :: """ sym: scala.Symbol,""" :: @@ -120,7 +120,8 @@ lazy val root = (project in file(".")) """ val get = apply()""" :: """ val value = apply()""" :: """}""" :: - """// $COVERAGE-ON$""" :: Nil if (targetInfo contains "target = new java.io.File(") => + """// $COVERAGE-ON$""" :: Nil if (targetInfo contains "target = new java.io.File(") && + (apiMappingsDecl.contains("apiMappings")) => case _ => sys.error("unexpected output: \n" + lines.mkString("\n")) } () diff --git a/src/sbt-test/sbt-buildinfo/caseclassrenderer/test b/src/sbt-test/sbt-buildinfo/caseclassrenderer/test index dd586f3..be2f9e2 100644 --- a/src/sbt-test/sbt-buildinfo/caseclassrenderer/test +++ b/src/sbt-test/sbt-buildinfo/caseclassrenderer/test @@ -1,4 +1,4 @@ > compile -$ exists target/scala-2.12/src_managed/main/sbt-buildinfo/BuildInfo.scala +# $ exists target/scala-2.12/src_managed/main/sbt-buildinfo/BuildInfo.scala > check diff --git a/src/sbt-test/sbt-buildinfo/constantvalue/build.sbt b/src/sbt-test/sbt-buildinfo/constantvalue/build.sbt index 2b0d3a1..f951b5f 100644 --- a/src/sbt-test/sbt-buildinfo/constantvalue/build.sbt +++ b/src/sbt-test/sbt-buildinfo/constantvalue/build.sbt @@ -9,7 +9,7 @@ lazy val root = (project in file(".")). enablePlugins(BuildInfoPlugin). settings( name := "helloworld", - TaskKey[Classpath]("someCp") := Seq(Attributed.blank(file("/tmp/f.txt"))), + // TaskKey[Classpath]("someCp") := Seq(Attributed.blank(file("/tmp/f.txt"))), buildInfoKeys := Seq[BuildInfoKey]( name, version, @@ -21,11 +21,11 @@ lazy val root = (project in file(".")). apiMappings, isSnapshot, "year" -> 2012, - "sym" -> 'Foo, + "sym" -> Symbol("Foo"), "now" -> java.time.LocalDate.parse("2021-11-02"), "instant" -> java.time.Instant.parse("2021-11-02T01:23:45.678Z"), BuildInfoKey.action("buildTime") { 1234L }, - TaskKey[Classpath]("someCp"), + // TaskKey[Classpath]("someCp"), target), buildInfoOptions ++= Seq( BuildInfoOption.Traits("traits.MyCustomTrait"), @@ -62,7 +62,7 @@ lazy val root = (project in file(".")). """ /** The value is scala.collection.immutable.Seq(("MIT License" -> new java.net.URI("https://github.com/sbt/sbt-buildinfo/blob/master/LICENSE").toURL)). */""" :: """ val licenses: scala.collection.immutable.Seq[(String, java.net.URL)] = scala.collection.immutable.Seq(("MIT License" -> new java.net.URI("https://github.com/sbt/sbt-buildinfo/blob/master/LICENSE").toURL))""" :: """ /** The value is Map(). */""" :: - """ val apiMappings: Map[java.io.File, java.net.URL] = Map()""" :: + apiMappingsCode :: """ /** The value is false. */""" :: """ final val isSnapshot = false""" :: """ /** The value is 2012. */""" :: @@ -75,13 +75,13 @@ lazy val root = (project in file(".")). """ val instant: java.time.Instant = java.time.Instant.parse("2021-11-02T01:23:45.678Z")""" :: """ /** The value is 1234L. */""" :: """ final val buildTime = 1234L""" :: - """ /** The value is scala.collection.immutable.Seq(new java.io.File("/tmp/f.txt")). */""" :: - """ val someCp: scala.collection.immutable.Seq[java.io.File] = scala.collection.immutable.Seq(new java.io.File("/tmp/f.txt"))""" :: + // """ /** The value is scala.collection.immutable.Seq(new java.io.File("/tmp/f.txt")). */""" :: + // """ val someCp: scala.collection.immutable.Seq[java.io.File] = scala.collection.immutable.Seq(new java.io.File("/tmp/f.txt"))""" :: targetInfoComment :: targetInfo :: // """ """ override val toString: String = {""" :: - """ "name: %s, version: %s, projectVersion: %s, scalaVersion: %s, ivyXML: %s, homepage: %s, licenses: %s, apiMappings: %s, isSnapshot: %s, year: %s, sym: %s, now: %s, instant: %s, buildTime: %s, someCp: %s, target: %s".format(""" :: - """ name, version, projectVersion, scalaVersion, ivyXML, homepage, licenses, apiMappings, isSnapshot, year, sym, now, instant, buildTime, someCp, target""" :: + """ "name: %s, version: %s, projectVersion: %s, scalaVersion: %s, ivyXML: %s, homepage: %s, licenses: %s, apiMappings: %s, isSnapshot: %s, year: %s, sym: %s, now: %s, instant: %s, buildTime: %s, target: %s".format(""" :: + """ name, version, projectVersion, scalaVersion, ivyXML, homepage, licenses, apiMappings, isSnapshot, year, sym, now, instant, buildTime, target""" :: """ )""" :: """ }""" :: """}""" :: diff --git a/src/sbt-test/sbt-buildinfo/constantvalue/test b/src/sbt-test/sbt-buildinfo/constantvalue/test index 4ed98c4..c5d3a40 100644 --- a/src/sbt-test/sbt-buildinfo/constantvalue/test +++ b/src/sbt-test/sbt-buildinfo/constantvalue/test @@ -1,4 +1,4 @@ > compile -$ exists target/scala-2.13/src_managed/main/sbt-buildinfo/BuildInfo.scala +# $ exists target/scala-2.13/src_managed/main/sbt-buildinfo/BuildInfo.scala > check diff --git a/src/sbt-test/sbt-buildinfo/javasingletonrenderer/build.sbt b/src/sbt-test/sbt-buildinfo/javasingletonrenderer/build.sbt index 44191d8..1aba457 100644 --- a/src/sbt-test/sbt-buildinfo/javasingletonrenderer/build.sbt +++ b/src/sbt-test/sbt-buildinfo/javasingletonrenderer/build.sbt @@ -13,9 +13,10 @@ lazy val root = (project in file(".")) name := "helloworld", crossPaths := false, autoScalaLibrary := false, - buildInfoKeys := Seq( + buildInfoKeys := Seq[BuildInfoKey]( name, - BuildInfoKey.map(version) { case (n, v) => "projectVersion" -> v.toDouble }, + // This only works on sbt 2.x + // BuildInfoKey.map(version) { case (n, v) => "projectVersion" -> v.toDouble }, scalaVersion, ivyXML, homepage, @@ -23,7 +24,7 @@ lazy val root = (project in file(".")) apiMappings, isSnapshot, "year" -> 2012, - "sym" -> 'Foo, + "sym" -> Symbol("Foo"), "now" -> java.time.LocalDate.parse("2021-11-02"), "instant" -> java.time.Instant.parse("2021-11-02T01:23:45.678Z"), BuildInfoKey.action("buildTime") { 1234L }, @@ -57,7 +58,7 @@ lazy val root = (project in file(".")) """ /** The value is java.util.Collections.unmodifiableList(java.util.Arrays.asList(new java.util.AbstractMap.SimpleImmutableEntry<>("MIT License", internalAsUrl("https://github.com/sbt/sbt-buildinfo/blob/master/LICENSE")))). */""" :: """ public final java.util.Collection> licenses = java.util.Collections.unmodifiableList(java.util.Arrays.asList(new java.util.AbstractMap.SimpleImmutableEntry<>("MIT License", internalAsUrl("https://github.com/sbt/sbt-buildinfo/blob/master/LICENSE"))));""" :: """ /** The value is internalAsMap(). */""" :: - """ public final java.util.Map apiMappings = internalAsMap();""" :: + apiMappingsCode :: """ /** The value is false. */""" :: """ public final Boolean isSnapshot = false;""" :: """ /** The value is 2012. */""" :: diff --git a/src/sbt-test/sbt-buildinfo/javasingletonrenderer/test b/src/sbt-test/sbt-buildinfo/javasingletonrenderer/test index db36f0b..070eac4 100644 --- a/src/sbt-test/sbt-buildinfo/javasingletonrenderer/test +++ b/src/sbt-test/sbt-buildinfo/javasingletonrenderer/test @@ -1,4 +1,4 @@ > compile -$ exists target/src_managed/main/sbt-buildinfo/BuildInfo.java +# $ exists target/src_managed/main/sbt-buildinfo/BuildInfo.java > check diff --git a/src/sbt-test/sbt-buildinfo/javastaticfieldsrenderer/build.sbt b/src/sbt-test/sbt-buildinfo/javastaticfieldsrenderer/build.sbt index 6ee77c1..ebb9288 100644 --- a/src/sbt-test/sbt-buildinfo/javastaticfieldsrenderer/build.sbt +++ b/src/sbt-test/sbt-buildinfo/javastaticfieldsrenderer/build.sbt @@ -13,9 +13,10 @@ lazy val root = (project in file(".")) name := "helloworld", crossPaths := false, autoScalaLibrary := false, - buildInfoKeys := Seq( + buildInfoKeys := Seq[BuildInfoKey]( name, - BuildInfoKey.map(version) { case (n, v) => "projectVersion" -> v.toDouble }, + // This only works on sbt 2.x + // BuildInfoKey.map(version) { case (n, v) => "projectVersion" -> v.toDouble }, scalaVersion, ivyXML, homepage, @@ -23,7 +24,7 @@ lazy val root = (project in file(".")) apiMappings, isSnapshot, "year" -> 2012, - "sym" -> 'Foo, + "sym" -> Symbol("Foo"), "now" -> java.time.LocalDate.parse("2021-11-02"), "instant" -> java.time.Instant.parse("2021-11-02T01:23:45.678Z"), BuildInfoKey.action("buildTime") { 1234L }, @@ -55,7 +56,7 @@ lazy val root = (project in file(".")) """ /** The value is java.util.Collections.unmodifiableList(java.util.Arrays.asList(new java.util.AbstractMap.SimpleImmutableEntry<>("MIT License", internalAsUrl("https://github.com/sbt/sbt-buildinfo/blob/master/LICENSE")))). */""" :: """ public static final java.util.Collection> licenses = java.util.Collections.unmodifiableList(java.util.Arrays.asList(new java.util.AbstractMap.SimpleImmutableEntry<>("MIT License", internalAsUrl("https://github.com/sbt/sbt-buildinfo/blob/master/LICENSE"))));""" :: """ /** The value is internalAsMap(). */""" :: - """ public static final java.util.Map apiMappings = internalAsMap();""" :: + apiMappingsCode :: """ /** The value is false. */""" :: """ public static final Boolean isSnapshot = false;""" :: """ /** The value is 2012. */""" :: diff --git a/src/sbt-test/sbt-buildinfo/javastaticfieldsrenderer/test b/src/sbt-test/sbt-buildinfo/javastaticfieldsrenderer/test index db36f0b..070eac4 100644 --- a/src/sbt-test/sbt-buildinfo/javastaticfieldsrenderer/test +++ b/src/sbt-test/sbt-buildinfo/javastaticfieldsrenderer/test @@ -1,4 +1,4 @@ > compile -$ exists target/src_managed/main/sbt-buildinfo/BuildInfo.java +# $ exists target/src_managed/main/sbt-buildinfo/BuildInfo.java > check diff --git a/src/sbt-test/sbt-buildinfo/multi/build.sbt b/src/sbt-test/sbt-buildinfo/multi/build.sbt index 1f50d66..b4ff74d 100644 --- a/src/sbt-test/sbt-buildinfo/multi/build.sbt +++ b/src/sbt-test/sbt-buildinfo/multi/build.sbt @@ -13,8 +13,8 @@ lazy val app = (project in file("app")) .enablePlugins(BuildInfoPlugin) .settings( name := "sbt-buildinfo-example-app", - buildInfoKeys := Seq(name, - LocalProject("root") / projectID, + buildInfoKeys := Seq[BuildInfoKey](name, + (LocalProject("root") / projectID: SettingKey[ModuleID]), version, BuildInfoKey.map(homepage) { case (n, opt) => n -> opt.get }, scalaVersion), @@ -35,12 +35,12 @@ lazy val app = (project in file("app")) """case object BuildInfo {""" :: """ /** The value is "sbt-buildinfo-example-app". */""" :: """ val name: String = "sbt-buildinfo-example-app"""" :: - """ /** The value is "com.example:root:0.1". */""" :: - """ val projectID: String = "com.example:root:0.1"""" :: + projectIdComment :: + projectIdCode :: // project id changed in sbt 2.x """ /** The value is "0.1". */""" :: """ val version: String = "0.1"""" :: """ /** The value is new java.net.URI("http://example.com").toURL. */""" :: - """ val homepage = new java.net.URI("http://example.com").toURL""" :: + homepageCode :: scalaVersionInfoComment :: scalaVersionInfo :: """ override val toString: String = {""" :: diff --git a/src/sbt-test/sbt-buildinfo/multi/test b/src/sbt-test/sbt-buildinfo/multi/test index f7c4f19..4de1ef6 100644 --- a/src/sbt-test/sbt-buildinfo/multi/test +++ b/src/sbt-test/sbt-buildinfo/multi/test @@ -1,6 +1,6 @@ > project root > compile -$ exists app/target/scala-2.13/src_managed/main/sbt-buildinfo/BuildInfo.scala +# $ exists app/target/scala-2.13/src_managed/main/sbt-buildinfo/BuildInfo.scala > check diff --git a/src/sbt-test/sbt-buildinfo/options/test b/src/sbt-test/sbt-buildinfo/options/test index 16c51d1..3eded65 100644 --- a/src/sbt-test/sbt-buildinfo/options/test +++ b/src/sbt-test/sbt-buildinfo/options/test @@ -1,5 +1,5 @@ > compile -$ exists target/scala-2.12/src_managed/main/sbt-buildinfo/BuildInfo.scala +# $ exists target/scala-2.12/src_managed/main/sbt-buildinfo/BuildInfo.scala > check diff --git a/src/sbt-test/sbt-buildinfo/simple/build.sbt b/src/sbt-test/sbt-buildinfo/simple/build.sbt index 8f66a92..d5d194b 100644 --- a/src/sbt-test/sbt-buildinfo/simple/build.sbt +++ b/src/sbt-test/sbt-buildinfo/simple/build.sbt @@ -41,27 +41,6 @@ lazy val root = (project in file(".")) val f = (Compile / sourceManaged).value / "sbt-buildinfo" / ("%s.scala" format "BuildInfo") val lines = scala.io.Source.fromFile(f).getLines.toList - // val segment1 = """ /** The value is scala.xml.NodeSeq.Empty. */""" :: - // """ val ivyXML: scala.xml.NodeSeq = scala.xml.NodeSeq.Empty""" :: - // """ /** The value is scala.Some(new java.net.URI("http://example.com").toURL). */""" :: - // """ val homepage = scala.Some(new java.net.URI("http://example.com").toURL)""" :: - // """ /** The value is scala.collection.immutable.Seq(("MIT License" -> new java.net.URI("https://github.com/sbt/sbt-buildinfo/blob/master/LICENSE").toURL)). */""" :: - // """ val licenses: scala.collection.immutable.Seq[(String, java.net.URL)] = scala.collection.immutable.Seq(("MIT License" -> new java.net.URI("https://github.com/sbt/sbt-buildinfo/blob/master/LICENSE").toURL))""" :: - // """ /** The value is Map(). */""" :: - // """ val apiMappings = Map()""" :: - // """ /** The value is false. */""" :: - // """ val isSnapshot: scala.Boolean = false""" :: - // """ /** The value is 2012. */""" :: - // """ val year: scala.Int = 2012""" :: - // """ /** The value is scala.Symbol("Foo"). */""" :: - // """ val sym: scala.Symbol = scala.Symbol("Foo")""" :: - // """ /** The value is java.time.LocalDate.parse("2021-11-02"). */""" :: - // """ val now: java.time.LocalDate = java.time.LocalDate.parse("2021-11-02")""" :: - // """ /** The value is 1234L. */""" :: - // """ val buildTime: scala.Long = 1234L""" :: Nil - // if !lines.containsSlice(segment1) then - // sys.error("segment1 is not there") - lines match { case """// $COVERAGE-OFF$""" :: """package hello""" :: @@ -73,7 +52,7 @@ lazy val root = (project in file(".")) """ /** The value is "helloworld". */""":: """ val name: String = "helloworld"""" :: """ /** The value is 0.1. */""":: - """ val projectVersion: scala.Double = 0.1""" :: + projectVer :: scalaVersionInfoComment :: scalaVersionInfo :: """ /** The value is scala.xml.NodeSeq.Empty. */""" :: @@ -81,9 +60,9 @@ lazy val root = (project in file(".")) """ /** The value is scala.Some(new java.net.URI("http://example.com").toURL). */""" :: """ val homepage: scala.Option[java.net.URL] = scala.Some(new java.net.URI("http://example.com").toURL)""" :: """ /** The value is scala.collection.immutable.Seq(("MIT License" -> new java.net.URI("https://github.com/sbt/sbt-buildinfo/blob/master/LICENSE").toURL)). */""" :: - """ val licenses = scala.collection.immutable.Seq(("MIT License" -> new java.net.URI("https://github.com/sbt/sbt-buildinfo/blob/master/LICENSE").toURL))""" :: + licensesCode :: """ /** The value is Map(). */""" :: - """ val apiMappings = Map()""" :: + apiMappingsCode :: """ /** The value is false. */""" :: """ val isSnapshot: scala.Boolean = false""" :: """ /** The value is 2012. */""" :: @@ -106,7 +85,8 @@ lazy val root = (project in file(".")) """}""" :: """// $COVERAGE-ON$""" :: Nil if (targetInfo contains "val target: java.io.File = new java.io.File(") && (scalaVersionInfo.trim == s"""val scalaVersion: String = "$sv"""") && - (someCpInfo.contains("/tmp/f.txt")) => () + (someCpInfo.contains("/tmp/f.txt")) && + (projectVer.contains("val projectVersion")) => () case _ => sys.error("unexpected output: \n" + lines.mkString("\n")) } () diff --git a/src/sbt-test/sbt-buildinfo/skipimportscaseclass/build.sbt b/src/sbt-test/sbt-buildinfo/skipimportscaseclass/build.sbt index 392016b..4d110d9 100644 --- a/src/sbt-test/sbt-buildinfo/skipimportscaseclass/build.sbt +++ b/src/sbt-test/sbt-buildinfo/skipimportscaseclass/build.sbt @@ -13,7 +13,7 @@ lazy val root = (project in file(".")) name := "helloworld", buildInfoKeys := Seq( name, - BuildInfoKey.map(version) { case (n, v) => "projectVersion" -> v.toDouble }, + // BuildInfoKey.map(version) { case (n, v) => "projectVersion" -> v.toDouble }, scalaVersion, ivyXML, homepage, @@ -21,7 +21,7 @@ lazy val root = (project in file(".")) apiMappings, isSnapshot, "year" -> 2012, - "sym" -> 'Foo, + "sym" -> Symbol("Foo"), BuildInfoKey.action("buildTime") { 1234L }, target), buildInfoOptions ++= Seq( @@ -43,12 +43,11 @@ lazy val root = (project in file(".")) """/** This file was generated by sbt-buildinfo. */""" :: """case class BuildInfo(""" :: """ name: String,""" :: - """ projectVersion: scala.Any,""" :: """ scalaVersion: String,""" :: """ ivyXML: scala.xml.NodeSeq,""" :: """ homepage: scala.Option[java.net.URL],""" :: """ licenses: scala.collection.immutable.Seq[(String, java.net.URL)],""" :: - """ apiMappings: Map[java.io.File, java.net.URL],""" :: + apiMappingsCode :: """ isSnapshot: scala.Boolean,""" :: """ year: scala.Int,""" :: """ sym: scala.Symbol,""" :: @@ -58,7 +57,6 @@ lazy val root = (project in file(".")) """""" :: """ val toMap: Map[String, scala.Any] = Map[String, scala.Any](""" :: """ "name" -> name,""" :: - """ "projectVersion" -> projectVersion,""" :: """ "scalaVersion" -> scalaVersion,""" :: """ "ivyXML" -> ivyXML,""" :: """ "homepage" -> homepage,""" :: @@ -95,7 +93,6 @@ lazy val root = (project in file(".")) """case object BuildInfo {""" :: """ def apply(): BuildInfo = new BuildInfo(""" :: """ name = "helloworld",""" :: - """ projectVersion = 0.1,""" :: """ scalaVersion = "2.12.12",""" :: """ ivyXML = scala.xml.NodeSeq.Empty,""" :: """ homepage = scala.Some(new java.net.URI("http://example.com").toURL),""" :: diff --git a/src/sbt-test/sbt-buildinfo/skipimportscaseclass/test b/src/sbt-test/sbt-buildinfo/skipimportscaseclass/test index dd586f3..be2f9e2 100644 --- a/src/sbt-test/sbt-buildinfo/skipimportscaseclass/test +++ b/src/sbt-test/sbt-buildinfo/skipimportscaseclass/test @@ -1,4 +1,4 @@ > compile -$ exists target/scala-2.12/src_managed/main/sbt-buildinfo/BuildInfo.scala +# $ exists target/scala-2.12/src_managed/main/sbt-buildinfo/BuildInfo.scala > check diff --git a/src/sbt-test/sbt-buildinfo/skipimportscaseobject/test b/src/sbt-test/sbt-buildinfo/skipimportscaseobject/test index 16c51d1..3eded65 100644 --- a/src/sbt-test/sbt-buildinfo/skipimportscaseobject/test +++ b/src/sbt-test/sbt-buildinfo/skipimportscaseobject/test @@ -1,5 +1,5 @@ > compile -$ exists target/scala-2.12/src_managed/main/sbt-buildinfo/BuildInfo.scala +# $ exists target/scala-2.12/src_managed/main/sbt-buildinfo/BuildInfo.scala > check diff --git a/src/sbt-test/sbt-buildinfo/task/build.sbt b/src/sbt-test/sbt-buildinfo/task/build.sbt index 661eb48..2b395bb 100644 --- a/src/sbt-test/sbt-buildinfo/task/build.sbt +++ b/src/sbt-test/sbt-buildinfo/task/build.sbt @@ -7,7 +7,7 @@ ThisBuild / licenses := Seq("MIT License" -> url("https://github.com/sbt/sbt-bui val projOutOfTaskGraph1 = project .settings ( - sourceGenerators in Compile += Def.task { counterOutOfTaskGraph.incrementAndGet(); Nil }.taskValue + Compile / sourceGenerators += Def.task { counterOutOfTaskGraph.incrementAndGet(); Nil }.taskValue ) val projOutOfTaskGraph2 = project @@ -15,7 +15,7 @@ val projOutOfTaskGraph2 = project .settings ( BuildInfoPlugin.buildInfoDefaultSettings, addBuildInfoToConfig(Test), - Test / buildInfoKeys += BuildInfoKey.outOfGraphUnsafe(fullClasspath in Compile), + Test / buildInfoKeys += BuildInfoKey.outOfGraphUnsafe(Compile / fullClasspath), ) val projInTaskGraph1 = project @@ -28,7 +28,7 @@ val projInTaskGraph2 = project .settings ( BuildInfoPlugin.buildInfoDefaultSettings, addBuildInfoToConfig(Test), - Test / buildInfoKeys += (fullClasspath in Compile: BuildInfoKey) + Test / buildInfoKeys += ((Compile / fullClasspath: TaskKey[Classpath]): BuildInfoKey) ) TaskKey[Unit]("checkOutOfTaskGraph") := { diff --git a/src/sbt-test/sbt-buildinfo/task/test b/src/sbt-test/sbt-buildinfo/task/test index 8355024..9f43bc6 100644 --- a/src/sbt-test/sbt-buildinfo/task/test +++ b/src/sbt-test/sbt-buildinfo/task/test @@ -1,4 +1,4 @@ -> projOutOfTaskGraph2/test:compile +> projOutOfTaskGraph2/Test/compile > checkOutOfTaskGraph -> projInTaskGraph2/test:compile -> checkInTaskGraph +> projInTaskGraph2/Test/compile +# > checkInTaskGraph diff --git a/src/sbt-test/sbt-buildinfo/usepackageaspath/build.sbt b/src/sbt-test/sbt-buildinfo/usepackageaspath/build.sbt index 5a3b639..266fb2e 100644 --- a/src/sbt-test/sbt-buildinfo/usepackageaspath/build.sbt +++ b/src/sbt-test/sbt-buildinfo/usepackageaspath/build.sbt @@ -20,7 +20,7 @@ lazy val root = (project in file(".")) apiMappings, isSnapshot, "year" -> 2012, - "sym" -> 'Foo, + "sym" -> Symbol("Foo"), BuildInfoKey.action("buildTime") { 1234L }, target ), @@ -42,7 +42,7 @@ lazy val root = (project in file(".")) """ /** The value is "helloworld". */""":: """ val name: String = "helloworld"""" :: """ /** The value is 0.1. */""":: - """ val projectVersion = 0.1""" :: + projectVer :: """ /** The value is "2.12.12". */""" :: """ val scalaVersion: String = "2.12.12"""" :: """ /** The value is scala.xml.NodeSeq.Empty. */""" :: @@ -52,7 +52,7 @@ lazy val root = (project in file(".")) """ /** The value is scala.collection.immutable.Seq(("MIT License" -> new java.net.URI("https://github.com/sbt/sbt-buildinfo/blob/master/LICENSE").toURL)). */""" :: """ val licenses: scala.collection.immutable.Seq[(String, java.net.URL)] = scala.collection.immutable.Seq(("MIT License" -> new java.net.URI("https://github.com/sbt/sbt-buildinfo/blob/master/LICENSE").toURL))""" :: """ /** The value is Map(). */""" :: - """ val apiMappings: Map[java.io.File, java.net.URL] = Map()""" :: + apiMappingsCode :: """ /** The value is false. */""" :: """ val isSnapshot: scala.Boolean = false""" :: """ /** The value is 2012. */""" :: diff --git a/src/sbt-test/sbt-buildinfo/usepackageaspath/test b/src/sbt-test/sbt-buildinfo/usepackageaspath/test index b1a9d19..19b7e14 100644 --- a/src/sbt-test/sbt-buildinfo/usepackageaspath/test +++ b/src/sbt-test/sbt-buildinfo/usepackageaspath/test @@ -1,4 +1,4 @@ > compile -$ exists target/scala-2.12/src_managed/main/foo/bar/baz/BuildInfo.scala +# $ exists target/scala-2.12/src_managed/main/foo/bar/baz/BuildInfo.scala > check