diff --git a/.scalafmt.conf b/.scalafmt.conf
index 84293359d..0662a5b12 100644
--- a/.scalafmt.conf
+++ b/.scalafmt.conf
@@ -13,3 +13,4 @@ project.excludePaths = [
# WixHelper.scala:105: error: Unable to format file due to bug in scalafmt
"glob:**/src/main/scala/com/typesafe/sbt/packager/windows/WixHelper.scala"
]
+project.layout = StandardConvention
diff --git a/appveyor.yml b/appveyor.yml
index eb5f4300c..d2e9797df 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -2,15 +2,16 @@ version: '{build}'
os: Windows Server 2012
install:
- cmd: choco install zulu8 -ia "INSTALLDIR=""C:\zulu"""
- - cmd: SET JAVA_HOME="C:\zulu"
+ - cmd: SET JAVA_HOME=C:\zulu
- cmd: choco install sbt -ia "INSTALLDIR=""C:\sbt"""
- cmd: SET PATH=C:\sbt\bin;%JAVA_HOME%\bin;%PATH%
- cmd: java -version
- cmd: SET SBT_OPTS=-Xms4g -Xmx4g
+ - cmd: mkdir C:\temp
build_script:
- - sbt clean compile
+ - sbt -Djava.io.tmpdir=C:\temp clean ++2.12.x compile
test_script:
- - sbt validateWindows
+ - sbt -Djava.io.tmpdir=C:\temp ++2.12.x validateWindows
cache:
- C:\Users\appveyor\.sbt
- C:\Users\appveyor\.m2
diff --git a/build.sbt b/build.sbt
index c73717455..ef03420c6 100644
--- a/build.sbt
+++ b/build.sbt
@@ -3,19 +3,22 @@ organization := "com.github.sbt"
homepage := Some(url("https://github.com/sbt/sbt-native-packager"))
Global / onChangedBuildSource := ReloadOnSourceChanges
-Global / scalaVersion := "2.12.20"
// crossBuildingSettings
+lazy val scala212 = "2.12.20"
+lazy val scala3 = "3.6.2"
+Global / scalaVersion := scala3
+crossScalaVersions := Seq(scala3, scala212)
(pluginCrossBuild / sbtVersion) := {
scalaBinaryVersion.value match {
- case "2.12" => "1.1.6"
- case _ => "2.0.0-M2"
+ case "2.12" => "1.5.8"
+ case _ => "2.0.0-M3"
}
}
scriptedSbt := {
scalaBinaryVersion.value match {
- case "2.12" => "1.10.5"
- case _ => "2.0.0-M2"
+ case "2.12" => "1.10.7"
+ case _ => "2.0.0-M3"
}
}
@@ -48,8 +51,7 @@ libraryDependencies ++= {
// scala version depended libraries
libraryDependencies ++= {
scalaBinaryVersion.value match {
- case "2.10" => Nil
- case _ =>
+ case "2.12" =>
Seq(
// Do NOT upgrade these dependencies to 2.x or newer! sbt-native-packager is a sbt-plugin
// and gets published with Scala 2.12, therefore we need to stay at the same major version
@@ -58,6 +60,8 @@ libraryDependencies ++= {
"org.scala-lang.modules" %% "scala-parser-combinators" % "1.1.2", // Do not upgrade beyond 1.x
"org.scala-lang.modules" %% "scala-xml" % "2.2.0"
)
+ case _ =>
+ Nil
}
}
@@ -79,11 +83,11 @@ mimaPreviousArtifacts := {
val m = "com.typesafe.sbt" %% moduleName.value % "1.3.15"
val sbtBinV = (pluginCrossBuild / sbtBinaryVersion).value
val scalaBinV = (update / scalaBinaryVersion).value
- if (scalaBinV == "2.10") {
- println(s"Skip MiMa check for SBT binary version ${sbtBinV} as scala ${scalaBinV} is not supported")
- Set.empty
- } else
- Set(Defaults.sbtPluginExtra(m cross CrossVersion.disabled, sbtBinV, scalaBinV))
+ scalaBinV match {
+ case "2.12" =>
+ Set(Defaults.sbtPluginExtra(m cross CrossVersion.disabled, sbtBinV, scalaBinV))
+ case _ => Set.empty
+ }
}
// Release configuration
@@ -108,7 +112,8 @@ developers := List(
addCommandAlias("scalafmtFormatAll", "; ^scalafmtAll ; scalafmtSbt")
// ci commands
addCommandAlias("validateFormatting", "; scalafmtCheckAll ; scalafmtSbtCheck")
-addCommandAlias("validate", "; clean ; update ; validateFormatting ; test ; mimaReportBinaryIssues")
+// Ignore mimaReportBinaryIssues
+addCommandAlias("validate", "; clean ; update ; validateFormatting ; test")
// List all scripted test separately to schedule them in different travis-ci jobs.
// Travis-CI has hard timeouts for jobs, so we run them in smaller jobs as the scripted
@@ -136,3 +141,19 @@ addCommandAlias("validateWindows", "; testOnly * -- -n windows ; scripted univer
addCommandAlias("validateJlink", "scripted jlink/*")
addCommandAlias("ci-release", "release with-defaults")
+
+// So that publishLocal doesn't continuously create new versions
+def versionFmt(out: sbtdynver.GitDescribeOutput): String = {
+ val snapshotSuffix =
+ if (out.isSnapshot()) "-SNAPSHOT"
+ else ""
+ out.ref.dropPrefix + snapshotSuffix
+}
+
+def fallbackVersion(d: java.util.Date): String = s"HEAD-${sbtdynver.DynVer timestamp d}"
+
+ThisBuild / version := dynverGitDescribeOutput.value.mkVersion(versionFmt, fallbackVersion(dynverCurrentDate.value))
+ThisBuild / dynver := {
+ val d = new java.util.Date
+ sbtdynver.DynVer.getGitDescribeOutput(d).mkVersion(versionFmt, fallbackVersion(d))
+}
diff --git a/project/build.properties b/project/build.properties
index 0b699c305..73df629ac 100644
--- a/project/build.properties
+++ b/project/build.properties
@@ -1 +1 @@
-sbt.version=1.10.2
+sbt.version=1.10.7
diff --git a/src/main/scala-sbt-1.0/com/typesafe/sbt/packager/Compat.scala b/src/main/scala-2.12/com/typesafe/sbt/packager/Compat.scala
similarity index 100%
rename from src/main/scala-sbt-1.0/com/typesafe/sbt/packager/Compat.scala
rename to src/main/scala-2.12/com/typesafe/sbt/packager/Compat.scala
diff --git a/src/main/scala-2.12/com/typesafe/sbt/packager/PluginCompat.scala b/src/main/scala-2.12/com/typesafe/sbt/packager/PluginCompat.scala
new file mode 100644
index 000000000..e8f25475e
--- /dev/null
+++ b/src/main/scala-2.12/com/typesafe/sbt/packager/PluginCompat.scala
@@ -0,0 +1,46 @@
+package com.typesafe.sbt.packager
+
+import java.nio.file.{Path => NioPath}
+import java.util.jar.Attributes
+import sbt.*
+import xsbti.FileConverter
+
+object PluginCompat {
+ type FileRef = java.io.File
+ type ArtifactPath = java.io.File
+ type Out = java.io.File
+ type IncludeArtifact = Artifact => Boolean
+
+ val artifactStr = sbt.Keys.artifact.key
+ val moduleIDStr = sbt.Keys.moduleID.key
+ def parseModuleIDStrAttribute(m: ModuleID): ModuleID = m
+ def moduleIDToStr(m: ModuleID): ModuleID = m
+ def parseArtifactStrAttribute(a: Artifact): Artifact = a
+ def artifactToStr(art: Artifact): Artifact = art
+
+ def toNioPath(a: Attributed[File])(implicit conv: FileConverter): NioPath =
+ a.data.toPath()
+ def toNioPath(ref: File)(implicit conv: FileConverter): NioPath =
+ ref.toPath()
+ def toFile(a: Attributed[File])(implicit conv: FileConverter): File =
+ a.data
+ def toFile(ref: File)(implicit conv: FileConverter): File =
+ ref
+ def artifactPathToFile(ref: File)(implicit conv: FileConverter): File =
+ ref
+ def toArtifactPath(f: File)(implicit conv: FileConverter): ArtifactPath = f
+ 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 toFileRefsMapping(mappings: Seq[(File, String)])(implicit conv: FileConverter): Seq[(FileRef, String)] =
+ mappings
+ def toFileRef(x: File)(implicit conv: FileConverter): FileRef =
+ x
+ def getName(ref: File): String =
+ ref.getName()
+ def getArtifactPathName(ref: File): String =
+ ref.getName()
+ def classpathAttr = Attributes.Name.CLASS_PATH
+ def mainclassAttr = Attributes.Name.MAIN_CLASS
+}
diff --git a/src/main/scala-3/com/typesafe/sbt/packager/Compat.scala b/src/main/scala-3/com/typesafe/sbt/packager/Compat.scala
new file mode 100644
index 000000000..9c148f0b4
--- /dev/null
+++ b/src/main/scala-3/com/typesafe/sbt/packager/Compat.scala
@@ -0,0 +1,3 @@
+package com.typesafe.sbt.packager
+
+object Compat {}
diff --git a/src/main/scala-3/com/typesafe/sbt/packager/PluginCompat.scala b/src/main/scala-3/com/typesafe/sbt/packager/PluginCompat.scala
new file mode 100644
index 000000000..b7599f34d
--- /dev/null
+++ b/src/main/scala-3/com/typesafe/sbt/packager/PluginCompat.scala
@@ -0,0 +1,58 @@
+package com.typesafe.sbt.packager
+
+import java.io.File
+import java.nio.file.{Path => NioPath}
+import java.util.jar.Attributes
+import sbt.*
+import xsbti.{FileConverter, HashedVirtualFileRef, VirtualFile, VirtualFileRef}
+import sbt.internal.RemoteCache
+
+object PluginCompat:
+ type FileRef = HashedVirtualFileRef
+ type ArtifactPath = VirtualFileRef
+ type Out = VirtualFile
+ type IncludeArtifact = Any => Boolean
+
+ val artifactStr = Keys.artifactStr
+ val moduleIDStr = Keys.moduleIDStr
+ def parseModuleIDStrAttribute(str: String): ModuleID =
+ Classpaths.moduleIdJsonKeyFormat.read(str)
+ def moduleIDToStr(m: ModuleID): String =
+ Classpaths.moduleIdJsonKeyFormat.write(m)
+
+ def parseArtifactStrAttribute(str: String): Artifact =
+ import sbt.librarymanagement.LibraryManagementCodec.ArtifactFormat
+ import sjsonnew.support.scalajson.unsafe.*
+ Converter.fromJsonUnsafe[Artifact](Parser.parseUnsafe(str))
+ def artifactToStr(art: Artifact): String =
+ import sbt.librarymanagement.LibraryManagementCodec.ArtifactFormat
+ import sjsonnew.support.scalajson.unsafe.*
+ CompactPrinter(Converter.toJsonUnsafe(art))
+
+ def toNioPath(a: Attributed[HashedVirtualFileRef])(using conv: FileConverter): NioPath =
+ conv.toPath(a.data)
+ def toNioPath(ref: HashedVirtualFileRef)(using conv: FileConverter): NioPath =
+ conv.toPath(ref)
+ inline def toFile(a: Attributed[HashedVirtualFileRef])(using conv: FileConverter): File =
+ toNioPath(a).toFile()
+ inline def toFile(ref: HashedVirtualFileRef)(using conv: FileConverter): File =
+ toNioPath(ref).toFile()
+ def artifactPathToFile(ref: VirtualFileRef)(using conv: FileConverter): File =
+ conv.toPath(ref).toFile()
+ def toArtifactPath(f: File)(using conv: FileConverter): ArtifactPath =
+ conv.toVirtualFile(f.toPath())
+ 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 toFileRefsMapping(mappings: Seq[(File, String)])(using conv: FileConverter): Seq[(FileRef, String)] =
+ mappings.map { case (f, name) => toFileRef(f) -> name }
+ def toFileRef(x: File)(using conv: FileConverter): FileRef =
+ conv.toVirtualFile(x.toPath())
+ def getName(ref: FileRef): String =
+ ref.name()
+ def getArtifactPathName(ref: ArtifactPath): String =
+ ref.name()
+ def classpathAttr: String = Attributes.Name.CLASS_PATH.toString()
+ def mainclassAttr: String = Attributes.Name.MAIN_CLASS.toString()
+end PluginCompat
diff --git a/src/main/scala-sbt-0.13/com/typesafe/sbt/packager/Compat.scala b/src/main/scala-sbt-0.13/com/typesafe/sbt/packager/Compat.scala
deleted file mode 100644
index 2f1cab8de..000000000
--- a/src/main/scala-sbt-0.13/com/typesafe/sbt/packager/Compat.scala
+++ /dev/null
@@ -1,50 +0,0 @@
-package com.typesafe.sbt.packager
-
-import sbt.{Artifact, BufferedLogger, FullLogger, Logger}
-
-import scala.sys.process.ProcessLogger
-
-object Compat {
-
- /**
- * Used in:
- *
- * - [[com.typesafe.sbt.packager.windows.WindowsPlugin]]
- * - [[com.typesafe.sbt.packager.rpm.RpmHelper]]
- * - [[com.typesafe.sbt.packager.docker.DockerPlugin]]
- * - [[com.typesafe.sbt.packager.debian.DebianNativePackaging]]
- * - [[com.typesafe.sbt.packager.rpm.RpmPlugin]]
- *
- * @param log
- * @return
- * turns a Logger into a ProcessLogger
- */
- implicit def log2ProcessLogger(log: Logger): sys.process.ProcessLogger =
- new BufferedLogger(new FullLogger(log)) with sys.process.ProcessLogger {
- def err(s: => String): Unit = error(s)
- def out(s: => String): Unit = info(s)
- }
-
- /**
- * Used in
- *
- * - [[com.typesafe.sbt.packager.docker.DockerPlugin]]
- *
- * @param logger
- * The sbt.ProcessLogger that should be wrapped
- * @return
- * A scala ProcessLogger
- */
- implicit def sbtProcessLogger2ScalaProcessLogger(logger: sbt.ProcessLogger): sys.process.ProcessLogger =
- ProcessLogger(msg => logger.info(msg), err => logger.error(err))
-
- /**
- * Use in the scripted `universal/multiproject-classifiers` test.
- * @param artifact
- * polyfill new methods
- */
- implicit class CompatArtifact(artifact: Artifact) {
- def withClassifier(classifier: Option[String]): Artifact =
- artifact.copy(classifier = classifier)
- }
-}
diff --git a/src/main/scala-sbt-0.13/com/typesafe/sbt/packager/MappingsHelper.scala b/src/main/scala-sbt-0.13/com/typesafe/sbt/packager/MappingsHelper.scala
deleted file mode 100644
index 636dc3126..000000000
--- a/src/main/scala-sbt-0.13/com/typesafe/sbt/packager/MappingsHelper.scala
+++ /dev/null
@@ -1,130 +0,0 @@
-package com.typesafe.sbt.packager
-
-import sbt._
-
-/** A set of helper methods to simplify the writing of mappings */
-object MappingsHelper {
-
- /**
- * return a Seq of mappings which effect is to add a whole directory in the generated package
- *
- * @example
- * {{{
- * mappings in Universal ++= directory(baseDirectory.value / "extra")
- * }}}
- *
- * @param sourceDir
- * @return
- * mappings
- */
- def directory(sourceDir: File): Seq[(File, String)] =
- Option(sourceDir.getParentFile)
- .map(parent => sourceDir.*** pair relativeTo(parent))
- .getOrElse(sourceDir.*** pair basic)
-
- /**
- * It lightens the build file if one wants to give a string instead of file.
- *
- * @example
- * {{{
- * mappings in Universal ++= directory("extra")
- * }}}
- *
- * @param sourceDir
- * @return
- * mappings
- */
- def directory(sourceDir: String): Seq[(File, String)] =
- directory(file(sourceDir))
-
- /**
- * return a Seq of mappings which effect is to add the content of directory in the generated package, excluding the
- * directory itself.
- *
- * @example
- * {{{
- * mappings in Universal ++= sourceDir(baseDirectory.value / "extra")
- * }}}
- *
- * @param sourceDir
- * @return
- * mappings
- */
- def contentOf(sourceDir: File): Seq[(File, String)] =
- (sourceDir.*** --- sourceDir) pair relativeTo(sourceDir)
-
- /**
- * It lightens the build file if one wants to give a string instead of file.
- *
- * @example
- * {{{
- * mappings in Universal ++= sourceDir("extra")
- * }}}
- *
- * @param sourceDir
- * as string representation
- * @return
- * mappings
- */
- def contentOf(sourceDir: String): Seq[(File, String)] =
- contentOf(file(sourceDir))
-
- /**
- * Create mappings from your classpath. For example if you want to add additional dependencies, like test or model.
- *
- * @example
- * Add all test artifacts to a separated test folder
- * {{{
- * mappings in Universal ++= fromClasspath((managedClasspath in Test).value, target = "test")
- * }}}
- *
- * @param entries
- * @param target
- * @return
- * a list of mappings
- */
- def fromClasspath(entries: Seq[Attributed[File]], target: String): Seq[(File, String)] =
- fromClasspath(entries, target, _ => true)
-
- /**
- * Create mappings from your classpath. For example if you want to add additional dependencies, like test or model.
- * You can also filter the artifacts that should be mapped to mappings.
- *
- * @example
- * Filter all osgi bundles
- * {{{
- * mappings in Universal ++= fromClasspath(
- * (managedClasspath in Runtime).value,
- * "osgi",
- * artifact => artifact.`type` == "bundle"
- * )
- * }}}
- *
- * @param entries
- * from where mappings should be created from
- * @param target
- * folder, e.g. `model`. Must not end with a slash
- * @param includeArtifact
- * function to determine if an artifact should result in a mapping
- * @param includeOnNoArtifact
- * default is false. When there's no Artifact meta data remove it
- */
- def fromClasspath(
- entries: Seq[Attributed[File]],
- target: String,
- includeArtifact: Artifact => Boolean,
- includeOnNoArtifact: Boolean = false
- ): Seq[(File, String)] =
- entries.filter(attr => attr.get(sbt.Keys.artifact.key) map includeArtifact getOrElse includeOnNoArtifact).map {
- attribute =>
- val file = attribute.data
- file -> s"$target/${file.getName}"
- }
-
- /**
- * Get the mappings for the given files relative to the given directories.
- */
- def relative(files: Seq[File], dirs: Seq[File]): Seq[(File, String)] =
- (files --- dirs) pair (relativeTo(dirs) | Path.flat)
-
-}
diff --git a/src/main/scala-sbt-0.13/com/typesafe/sbt/packager/SettingsHelper.scala b/src/main/scala-sbt-0.13/com/typesafe/sbt/packager/SettingsHelper.scala
deleted file mode 100644
index 5c3580234..000000000
--- a/src/main/scala-sbt-0.13/com/typesafe/sbt/packager/SettingsHelper.scala
+++ /dev/null
@@ -1,90 +0,0 @@
-package com.typesafe.sbt.packager
-
-import sbt.Keys._
-import sbt._
-
-object SettingsHelper {
-
- def addPackage(
- config: Configuration,
- packageTask: TaskKey[File],
- extension: String,
- classifier: Option[String] = None
- ): Seq[Setting[_]] =
- inConfig(config)(
- addArtifact(
- name apply (Artifact(
- _,
- extension,
- extension,
- classifier = classifier,
- configurations = Iterable.empty,
- url = None,
- extraAttributes = Map.empty
- )),
- packageTask
- )
- )
-
- def makeDeploymentSettings(
- config: Configuration,
- packageTask: TaskKey[File],
- extension: String,
- classifier: Option[String] = None
- ): Seq[Setting[_]] =
- inConfig(config)(Classpaths.ivyPublishSettings ++ Classpaths.jvmPublishSettings) ++ inConfig(config)(
- Seq(
- artifacts := Seq.empty,
- packagedArtifacts := Map.empty,
- projectID := ModuleID(organization.value, name.value, version.value),
- moduleSettings := InlineConfiguration(projectID.value, projectInfo.value, Seq.empty),
- ivyModule := {
- val ivy = ivySbt.value
- new ivy.Module(moduleSettings.value)
- },
- deliverLocalConfiguration := Classpaths.deliverConfig(crossTarget.value, logging = ivyLoggingLevel.value),
- deliverConfiguration := deliverLocalConfiguration.value,
- publishConfiguration := new PublishConfiguration(
- ivyFile = None,
- resolverName = Classpaths.getPublishTo(publishTo.value).name,
- artifacts = packagedArtifacts.value,
- checksums = checksums.value,
- logging = UpdateLogging.DownloadOnly,
- overwrite = isSnapshot.value
- ),
- publishLocalConfiguration := new PublishConfiguration(
- ivyFile = None,
- resolverName = "local",
- artifacts = packagedArtifacts.value,
- checksums = checksums.value,
- logging = UpdateLogging.DownloadOnly,
- overwrite = isSnapshot.value
- ),
- publishM2Configuration := new PublishConfiguration(
- ivyFile = None,
- resolverName = Resolver.mavenLocal.name,
- artifacts = packagedArtifacts.value,
- checksums = checksums.value,
- logging = UpdateLogging.DownloadOnly,
- overwrite = isSnapshot.value
- )
- )
- ) ++ addPackage(config, packageTask, extension, classifier) ++ addResolver(config)
-
- /**
- * SBT looks in the `otherResolvers` setting for resolvers defined in `publishTo`. If a user scopes a `publishTo`,
- * e.g.
- *
- * {{{
- * // publish the rpm to the target folder
- * publishTo in Rpm := Some(Resolver.file("target-resolver", target.value / "rpm-repo" ))
- * }}}
- *
- * then the resolver must also be present in the `otherResolvers`
- *
- * @param config
- * the ivy configuration to look for resolvers
- */
- private def addResolver(config: Configuration): Seq[Setting[_]] =
- Seq(otherResolvers ++= (publishTo in config).value.toSeq)
-}
diff --git a/src/main/scala/com/typesafe/sbt/PackagerPlugin.scala b/src/main/scala/com/typesafe/sbt/PackagerPlugin.scala
index 4a4eec099..6c3ad77b9 100644
--- a/src/main/scala/com/typesafe/sbt/PackagerPlugin.scala
+++ b/src/main/scala/com/typesafe/sbt/PackagerPlugin.scala
@@ -1,10 +1,10 @@
package com.typesafe.sbt
-import packager._
+import packager.*
import debian.DebianPlugin.autoImport.genChanges
import com.typesafe.sbt.packager.Keys.{packageXzTarball, packageZipTarball, validatePackage, validatePackageValidators}
import com.typesafe.sbt.packager.validation.Validation
-import sbt._
+import sbt.{*, given}
import sbt.Keys.{name, normalizedName, packageBin, streams}
/**
@@ -73,16 +73,16 @@ object SbtNativePackager extends AutoPlugin {
import SettingsHelper._
- @deprecated("Use enablePlugins(xxxDeployPlugin)", "1.x")
- def deploymentSettings =
- makeDeploymentSettings(Debian, Debian / packageBin, "deb") ++
- makeDeploymentSettings(Rpm, Rpm / packageBin, "rpm") ++
- makeDeploymentSettings(Windows, Windows / packageBin, "msi") ++
- makeDeploymentSettings(Universal, Universal / packageBin, "zip") ++
- addPackage(Universal, Universal / packageZipTarball, "tgz") ++
- makeDeploymentSettings(UniversalDocs, UniversalDocs / packageBin, "zip") ++
- addPackage(UniversalDocs, UniversalDocs / packageXzTarball, "txz") ++
- makeDeploymentSettings(Debian, Debian / genChanges, "changes")
+ // @deprecated("Use enablePlugins(xxxDeployPlugin)", "1.x")
+ // def deploymentSettings =
+ // makeDeploymentSettings(Debian, Debian / packageBin, "deb") ++
+ // makeDeploymentSettings(Rpm, Rpm / packageBin, "rpm") ++
+ // makeDeploymentSettings(Windows, Windows / packageBin, "msi") ++
+ // makeDeploymentSettings(Universal, Universal / packageBin, "zip") ++
+ // addPackage(Universal, Universal / packageZipTarball, "tgz") ++
+ // makeDeploymentSettings(UniversalDocs, UniversalDocs / packageBin, "zip") ++
+ // addPackage(UniversalDocs, UniversalDocs / packageXzTarball, "txz") ++
+ // makeDeploymentSettings(Debian, Debian / genChanges, "changes")
}
import autoImport._
diff --git a/src/main/scala-sbt-1.0/com/typesafe/sbt/packager/MappingsHelper.scala b/src/main/scala/com/typesafe/sbt/packager/MappingsHelper.scala
similarity index 69%
rename from src/main/scala-sbt-1.0/com/typesafe/sbt/packager/MappingsHelper.scala
rename to src/main/scala/com/typesafe/sbt/packager/MappingsHelper.scala
index 4e47424be..468ec724b 100644
--- a/src/main/scala-sbt-1.0/com/typesafe/sbt/packager/MappingsHelper.scala
+++ b/src/main/scala/com/typesafe/sbt/packager/MappingsHelper.scala
@@ -1,7 +1,8 @@
package com.typesafe.sbt.packager
-import sbt._
-import sbt.io._
+import sbt.{*, given}
+import sbt.io.*
+import xsbti.FileConverter
/** A set of helper methods to simplify the writing of mappings */
object MappingsHelper extends Mapper {
@@ -37,6 +38,13 @@ object MappingsHelper extends Mapper {
def contentOf(sourceDir: String): Seq[(File, String)] =
contentOf(file(sourceDir))
+ def contentOf(sourceDir: File, conv0: FileConverter): Seq[(PluginCompat.FileRef, String)] = {
+ implicit val conv: FileConverter = conv0
+ contentOf(sourceDir).map { case (f, p) =>
+ PluginCompat.toFileRef(f) -> p
+ }
+ }
+
/**
* Create mappings from your classpath. For example if you want to add additional dependencies, like test or model.
*
@@ -51,7 +59,10 @@ object MappingsHelper extends Mapper {
* @return
* a list of mappings
*/
- def fromClasspath(entries: Seq[Attributed[File]], target: String): Seq[(File, String)] =
+ def fromClasspath(
+ entries: Seq[Attributed[PluginCompat.FileRef]],
+ target: String
+ ): Seq[(PluginCompat.FileRef, String)] =
fromClasspath(entries, target, _ => true)
/**
@@ -78,20 +89,25 @@ object MappingsHelper extends Mapper {
* default is false. When there's no Artifact meta data remove it
*/
def fromClasspath(
- entries: Seq[Attributed[File]],
+ entries: Seq[Attributed[PluginCompat.FileRef]],
target: String,
- includeArtifact: Artifact => Boolean,
+ includeArtifact: PluginCompat.IncludeArtifact,
includeOnNoArtifact: Boolean = false
- ): Seq[(File, String)] =
- entries.filter(attr => attr.get(sbt.Keys.artifact.key) map includeArtifact getOrElse includeOnNoArtifact).map {
+ ): Seq[(PluginCompat.FileRef, String)] =
+ entries.filter(attr => attr.get(PluginCompat.artifactStr).map(includeArtifact) getOrElse includeOnNoArtifact).map {
attribute =>
val file = attribute.data
- file -> s"$target/${file.getName}"
+ val name = PluginCompat.getName(file)
+ file -> s"$target/${name}"
}
/**
* Get the mappings for the given files relative to the given directories.
*/
- def relative(files: Seq[File], dirs: Seq[File]): Seq[(File, String)] =
- (files --- dirs) pair (relativeTo(dirs) | flat)
+ def relative(files: Seq[File], dirs: Seq[File], conv0: FileConverter): Seq[(PluginCompat.FileRef, String)] = {
+ implicit val conv: FileConverter = conv0
+ (files --- dirs) pair (relativeTo(dirs) | flat) map { case (f, p) =>
+ PluginCompat.toFileRef(f) -> p
+ }
+ }
}
diff --git a/src/main/scala-sbt-1.0/com/typesafe/sbt/packager/SettingsHelper.scala b/src/main/scala/com/typesafe/sbt/packager/SettingsHelper.scala
similarity index 75%
rename from src/main/scala-sbt-1.0/com/typesafe/sbt/packager/SettingsHelper.scala
rename to src/main/scala/com/typesafe/sbt/packager/SettingsHelper.scala
index bdd2fd60f..02f23f7f0 100644
--- a/src/main/scala-sbt-1.0/com/typesafe/sbt/packager/SettingsHelper.scala
+++ b/src/main/scala/com/typesafe/sbt/packager/SettingsHelper.scala
@@ -1,9 +1,10 @@
package com.typesafe.sbt.packager
-import sbt._
-import sbt.Keys._
+import sbt.{*, given}
+import sbt.Keys.*
import sbt.librarymanagement.{IvyFileConfiguration, PublishConfiguration}
-import com.typesafe.sbt.packager.Compat._
+import com.typesafe.sbt.packager.Compat.*
+import xsbti.FileConverter
/**
* - TODO write tests for the SettingsHelper
@@ -14,27 +15,20 @@ object SettingsHelper {
def addPackage(
config: Configuration,
- packageTask: TaskKey[File],
+ packageTask: TaskKey[PluginCompat.FileRef],
extension: String,
classifier: Option[String] = None
): Seq[Setting[_]] =
inConfig(config)(
addArtifact(
- name apply (Artifact(
- _,
- extension,
- extension,
- classifier = classifier,
- configurations = Vector.empty,
- url = None
- )),
+ name.apply(Artifact(_, extension, extension, classifier = classifier, configurations = Vector.empty, None)),
packageTask
)
)
def makeDeploymentSettings(
config: Configuration,
- packageTask: TaskKey[File],
+ packageTask: TaskKey[PluginCompat.FileRef],
extension: String,
classifier: Option[String] = None
): Seq[Setting[_]] =
@@ -58,19 +52,31 @@ object SettingsHelper {
// -------------------------------
publishConfiguration := PublishConfiguration()
.withResolverName(Classpaths.getPublishTo(publishTo.value).name)
- .withArtifacts(packagedArtifacts.value.toVector)
+ .withArtifacts(packagedArtifacts.value.toVector.map { case (a, f) =>
+ val conv0 = fileConverter.value
+ implicit val conv: FileConverter = conv0
+ (a, PluginCompat.toFile(f))
+ })
.withChecksums(checksums.value.toVector)
.withOverwrite(isSnapshot.value)
.withLogging(UpdateLogging.DownloadOnly),
publishLocalConfiguration := PublishConfiguration()
.withResolverName("local")
- .withArtifacts(packagedArtifacts.value.toVector)
+ .withArtifacts(packagedArtifacts.value.toVector.map { case (a, f) =>
+ val conv0 = fileConverter.value
+ implicit val conv: FileConverter = conv0
+ (a, PluginCompat.toFile(f))
+ })
.withChecksums(checksums.value.toVector)
.withOverwrite(isSnapshot.value)
.withLogging(UpdateLogging.DownloadOnly),
publishM2Configuration := PublishConfiguration()
.withResolverName(Resolver.mavenLocal.name)
- .withArtifacts(packagedArtifacts.value.toVector)
+ .withArtifacts(packagedArtifacts.value.toVector.map { case (a, f) =>
+ val conv0 = fileConverter.value
+ implicit val conv: FileConverter = conv0
+ (a, PluginCompat.toFile(f))
+ })
.withChecksums(checksums.value.toVector)
.withOverwrite(isSnapshot.value)
.withLogging(UpdateLogging.DownloadOnly)
diff --git a/src/main/scala/com/typesafe/sbt/packager/Stager.scala b/src/main/scala/com/typesafe/sbt/packager/Stager.scala
index 525bda5a2..d9ca538b5 100644
--- a/src/main/scala/com/typesafe/sbt/packager/Stager.scala
+++ b/src/main/scala/com/typesafe/sbt/packager/Stager.scala
@@ -1,10 +1,12 @@
package com.typesafe.sbt.packager
-import sbt._
+import sbt.{*, given}
import sbt.Keys.TaskStreams
+import sbt.util.CacheStore
import java.io.File
import com.typesafe.sbt.packager.Compat._
+import xsbti.FileConverter
object Stager {
@@ -20,12 +22,17 @@ object Stager {
* @param mappings
* staging content
*/
- def stageFiles(config: String)(cacheDirectory: File, stageDirectory: File, mappings: Seq[(File, String)]): File = {
+ def stageFiles(
+ config: String
+ )(cacheDirectory: File, stageDirectory: File, mappings: Seq[(PluginCompat.FileRef, String)])(implicit
+ conv: FileConverter
+ ): File = {
val cache = cacheDirectory / ("packager-mappings-" + config)
- val copies = mappings map { case (file, path) =>
- file -> (stageDirectory / path)
+ val copies = mappings map { case (ref, path) =>
+ PluginCompat.toFile(ref) -> (stageDirectory / path)
}
- Sync(cache, FileInfo.hash, FileInfo.exists)(copies)
+ val store = CacheStore(cache)
+ Sync.sync(store, FileInfo.hash)(copies)
// Now set scripts to executable using Java's lack of understanding of permissions.
// TODO - Config file user-readable permissions....
for {
@@ -41,7 +48,9 @@ object Stager {
* @see
* stageFiles
*/
- def stage(config: String)(streams: TaskStreams, stageDirectory: File, mappings: Seq[(File, String)]): File =
+ def stage(config: String)(streams: TaskStreams, stageDirectory: File, mappings: Seq[(PluginCompat.FileRef, String)])(
+ implicit conv: FileConverter
+ ): File =
stageFiles(config)(streams.cacheDirectory, stageDirectory, mappings)
}
diff --git a/src/main/scala/com/typesafe/sbt/packager/archetypes/JavaAppKeys.scala b/src/main/scala/com/typesafe/sbt/packager/archetypes/JavaAppKeys.scala
index 22cd57a18..4f6f46147 100644
--- a/src/main/scala/com/typesafe/sbt/packager/archetypes/JavaAppKeys.scala
+++ b/src/main/scala/com/typesafe/sbt/packager/archetypes/JavaAppKeys.scala
@@ -1,6 +1,7 @@
package com.typesafe.sbt.packager.archetypes
-import sbt._
+import sbt.{*, given}
+import com.typesafe.sbt.packager.PluginCompat
/**
* Available settings/tasks for the [[com.typesafe.sbt.packager.archetypes.JavaAppPackaging]] and all depending
@@ -14,14 +15,10 @@ trait JavaAppKeys {
"bashScriptEnvConfigLocation",
"The location of a bash script that will be sourced before running the app."
)
- val scriptClasspathOrdering = TaskKey[Seq[(File, String)]](
- "scriptClasspathOrdering",
- "The order of the classpath used at runtime for the bat/bash scripts."
- )
- val projectDependencyArtifacts = TaskKey[Seq[Attributed[File]]](
- "projectDependencyArtifacts",
- "The set of exported artifacts from our dependent projects."
- )
+ val scriptClasspathOrdering =
+ taskKey[Seq[(PluginCompat.FileRef, String)]]("The order of the classpath used at runtime for the bat/bash scripts.")
+ val projectDependencyArtifacts =
+ taskKey[Seq[Attributed[PluginCompat.FileRef]]]("The set of exported artifacts from our dependent projects.")
val scriptClasspath = TaskKey[Seq[String]](
"scriptClasspath",
"A list of relative filenames (to the lib/ folder in the distribution) of what to include on the classpath."
diff --git a/src/main/scala/com/typesafe/sbt/packager/archetypes/JavaAppPackaging.scala b/src/main/scala/com/typesafe/sbt/packager/archetypes/JavaAppPackaging.scala
index 163976e53..dc921efa9 100644
--- a/src/main/scala/com/typesafe/sbt/packager/archetypes/JavaAppPackaging.scala
+++ b/src/main/scala/com/typesafe/sbt/packager/archetypes/JavaAppPackaging.scala
@@ -1,13 +1,15 @@
-package com.typesafe.sbt.packager.archetypes
+package com.typesafe.sbt.packager
+package archetypes
-import sbt._
-import sbt.Keys._
+import sbt.{*, given}
+import sbt.Keys.*
+import sbt.internal.BuildDependencies
import com.typesafe.sbt.SbtNativePackager.{Debian, Universal}
-import com.typesafe.sbt.packager._
import com.typesafe.sbt.packager.Keys.packageName
import com.typesafe.sbt.packager.linux.{LinuxFileMetaData, LinuxPackageMapping}
import com.typesafe.sbt.packager.linux.LinuxPlugin.autoImport.{defaultLinuxInstallLocation, linuxPackageMappings}
-import com.typesafe.sbt.packager.Compat._
+import com.typesafe.sbt.packager.Compat.*
+import xsbti.FileConverter
/**
* ==Java Application==
@@ -60,7 +62,8 @@ object JavaAppPackaging extends AutoPlugin {
projectDependencyArtifacts := findProjectDependencyArtifacts.value,
scriptClasspathOrdering ++= universalDepMappings(
(Runtime / dependencyClasspath).value,
- projectDependencyArtifacts.value
+ projectDependencyArtifacts.value,
+ fileConverter.value
),
scriptClasspathOrdering := scriptClasspathOrdering.value.distinct,
Universal / mappings ++= scriptClasspathOrdering.value,
@@ -77,7 +80,7 @@ object JavaAppPackaging extends AutoPlugin {
bundledJvmLocation := (bundledJvmLocation ?? None).value
)
- private def makeRelativeClasspathNames(mappings: Seq[(File, String)]): Seq[String] =
+ private def makeRelativeClasspathNames(mappings: Seq[(PluginCompat.FileRef, String)]): Seq[String] =
for {
(_, name) <- mappings
} yield
@@ -105,17 +108,14 @@ object JavaAppPackaging extends AutoPlugin {
// Determines a nicer filename for an attributed jar file, using the
// ivy metadata if available.
- private def getJarFullFilename(dep: Attributed[File]): String = {
+ private def getJarFullFilename(dep: Attributed[PluginCompat.FileRef]): String = {
val filename: Option[String] = for {
- module <-
- dep.metadata
- // sbt 0.13.x key
- .get(AttributeKey[ModuleID]("module-id"))
- // sbt 1.x key
- .orElse(dep.metadata.get(AttributeKey[ModuleID]("moduleID")))
- artifact <- dep.metadata.get(AttributeKey[Artifact]("artifact"))
+ moduleStr <- dep.metadata.get(PluginCompat.moduleIDStr)
+ artifactStr <- dep.metadata.get(PluginCompat.artifactStr)
+ module = PluginCompat.parseModuleIDStrAttribute(moduleStr)
+ artifact = PluginCompat.parseArtifactStrAttribute(artifactStr)
} yield makeJarName(module.organization, module.name, module.revision, artifact.name, artifact.classifier)
- filename.getOrElse(dep.data.getName)
+ filename.getOrElse(PluginCompat.getName(dep.data))
}
// Here we grab the dependencies...
@@ -123,23 +123,27 @@ object JavaAppPackaging extends AutoPlugin {
build.classpathTransitive.getOrElse(thisProject, Nil)
// TODO - Should we pull in more than just JARs? How do native packages come in?
- private def isRuntimeArtifact(dep: Attributed[File]): Boolean =
- dep.get(sbt.Keys.artifact.key).map(_.`type` == "jar").getOrElse {
- val name = dep.data.getName
- !(name.endsWith(".jar") || name.endsWith("-sources.jar") || name.endsWith("-javadoc.jar"))
- }
+ private def isRuntimeArtifact(dep: Attributed[PluginCompat.FileRef]): Boolean =
+ dep
+ .get(PluginCompat.artifactStr)
+ .map(PluginCompat.parseArtifactStrAttribute)
+ .map(_.`type` == "jar")
+ .getOrElse {
+ val name = PluginCompat.getName(dep.data)
+ !(name.endsWith(".jar") || name.endsWith("-sources.jar") || name.endsWith("-javadoc.jar"))
+ }
- private def findProjectDependencyArtifacts: Def.Initialize[Task[Seq[Attributed[File]]]] =
+ private def findProjectDependencyArtifacts: Def.Initialize[Task[Seq[Attributed[PluginCompat.FileRef]]]] =
Def
- .task {
+ .setting {
val stateTask = state.taskValue
val refs = thisProjectRef.value +: dependencyProjectRefs(buildDependencies.value, thisProjectRef.value)
// Dynamic lookup of dependencies...
val artTasks = refs map { ref =>
extractArtifacts(stateTask, ref)
}
- val allArtifactsTask: Task[Seq[Attributed[File]]] =
- artTasks.fold[Task[Seq[Attributed[File]]]](task(Nil)) { (previous, next) =>
+ val allArtifactsTask: Task[Seq[Attributed[PluginCompat.FileRef]]] =
+ artTasks.fold[Task[Seq[Attributed[PluginCompat.FileRef]]]](task(Nil)) { (previous, next) =>
for {
p <- previous
n <- next
@@ -147,9 +151,8 @@ object JavaAppPackaging extends AutoPlugin {
}
allArtifactsTask
}
- .flatMap(identity)
- private def extractArtifacts(stateTask: Task[State], ref: ProjectRef): Task[Seq[Attributed[File]]] =
+ private def extractArtifacts(stateTask: Task[State], ref: ProjectRef): Task[Seq[Attributed[PluginCompat.FileRef]]] =
stateTask.flatMap { state =>
val extracted = Project.extract(state)
// TODO - Is this correct?
@@ -159,31 +162,43 @@ object JavaAppPackaging extends AutoPlugin {
arts <- artifactTask
} yield for {
(art, file) <- arts.toSeq // TODO -Filter!
- } yield Attributed.blank(file).put(moduleID.key, module).put(artifact.key, art)
+ } yield Attributed
+ .blank(file)
+ .put(PluginCompat.moduleIDStr, PluginCompat.moduleIDToStr(module))
+ .put(PluginCompat.artifactStr, PluginCompat.artifactToStr(art))
}
- private def findRealDep(dep: Attributed[File], projectArts: Seq[Attributed[File]]): Option[Attributed[File]] =
- if (dep.data.isFile) Some(dep)
+ private def findRealDep(
+ dep: Attributed[PluginCompat.FileRef],
+ projectArts: Seq[Attributed[PluginCompat.FileRef]],
+ conv0: FileConverter
+ ): Option[Attributed[PluginCompat.FileRef]] = {
+ implicit val conv: FileConverter = conv0
+ if (PluginCompat.toFile(dep.data).isFile) Some(dep)
else
projectArts.find { art =>
// TODO - Why is the module not showing up for project deps?
// (art.get(sbt.Keys.moduleID.key) == dep.get(sbt.Keys.moduleID.key)) &&
- (art.get(sbt.Keys.artifact.key), dep.get(sbt.Keys.artifact.key)) match {
- case (Some(l), Some(r)) =>
+ (art.get(PluginCompat.artifactStr), dep.get(PluginCompat.artifactStr)) match {
+ case (Some(l0), Some(r0)) =>
+ val l = PluginCompat.parseArtifactStrAttribute(l0)
+ val r = PluginCompat.parseArtifactStrAttribute(r0)
// TODO - extra attributes and stuff for comparison?
// seems to break stuff if we do...
l.name == r.name && l.classifier == r.classifier
case _ => false
}
}
+ }
// Converts a managed classpath into a set of lib mappings.
private def universalDepMappings(
- deps: Seq[Attributed[File]],
- projectArts: Seq[Attributed[File]]
- ): Seq[(File, String)] =
+ deps: Seq[Attributed[PluginCompat.FileRef]],
+ projectArts: Seq[Attributed[PluginCompat.FileRef]],
+ conv0: FileConverter
+ ): Seq[(PluginCompat.FileRef, String)] =
for {
dep <- deps
- realDep <- findRealDep(dep, projectArts)
+ realDep <- findRealDep(dep, projectArts, conv0)
} yield realDep.data -> ("lib/" + getJarFullFilename(realDep))
}
diff --git a/src/main/scala/com/typesafe/sbt/packager/archetypes/JavaServerApplication.scala b/src/main/scala/com/typesafe/sbt/packager/archetypes/JavaServerApplication.scala
index f47c805d8..4327cf277 100644
--- a/src/main/scala/com/typesafe/sbt/packager/archetypes/JavaServerApplication.scala
+++ b/src/main/scala/com/typesafe/sbt/packager/archetypes/JavaServerApplication.scala
@@ -1,15 +1,17 @@
-package com.typesafe.sbt.packager.archetypes
+package com.typesafe.sbt.packager
+package archetypes
-import sbt._
-import sbt.Keys.{javaOptions, mainClass, run, sourceDirectory, streams, target}
+import sbt.{*, given}
+import sbt.Keys.{fileConverter, javaOptions, mainClass, run, sourceDirectory, streams, target}
import com.typesafe.sbt.SbtNativePackager.{Debian, Linux, Rpm, Universal}
-import com.typesafe.sbt.packager.Keys._
+import com.typesafe.sbt.packager.Keys.*
import com.typesafe.sbt.packager.linux.{LinuxFileMetaData, LinuxPackageMapping, LinuxPlugin, LinuxSymlink}
import com.typesafe.sbt.packager.linux.LinuxPlugin.autoImport.packageTemplateMapping
import com.typesafe.sbt.packager.debian.DebianPlugin
import com.typesafe.sbt.packager.rpm.RpmPlugin
import com.typesafe.sbt.packager.rpm.RpmPlugin.autoImport.RpmConstants
import com.typesafe.sbt.packager.archetypes.systemloader.ServerLoader
+import xsbti.FileConverter
/**
* ==Java Server App Packaging==
@@ -256,7 +258,7 @@ object JavaServerAppPackaging extends AutoPlugin {
}
// used to override template
- val rpmScripts = Option(scriptDirectory.listFiles) getOrElse Array.empty
+ val rpmScripts = Option(scriptDirectory.listFiles).getOrElse(Array.empty[File])
// remove all non files and already processed templates
rpmScripts.filter(s => s.isFile && !predefined.contains(s.getName)).foldLeft(predefinedScripts) {
diff --git a/src/main/scala/com/typesafe/sbt/packager/archetypes/TemplateWriter.scala b/src/main/scala/com/typesafe/sbt/packager/archetypes/TemplateWriter.scala
index 6a05541af..c447cdc62 100644
--- a/src/main/scala/com/typesafe/sbt/packager/archetypes/TemplateWriter.scala
+++ b/src/main/scala/com/typesafe/sbt/packager/archetypes/TemplateWriter.scala
@@ -49,7 +49,7 @@ object TemplateWriter {
sb append replace(line, replacements, keySurround)
sb append eol
}
- sb toString
+ sb.toString()
}
private[this] def replaceValues(
diff --git a/src/main/scala/com/typesafe/sbt/packager/archetypes/jlink/JlinkPlugin.scala b/src/main/scala/com/typesafe/sbt/packager/archetypes/jlink/JlinkPlugin.scala
index 5efedd9ae..7e58588be 100644
--- a/src/main/scala/com/typesafe/sbt/packager/archetypes/jlink/JlinkPlugin.scala
+++ b/src/main/scala/com/typesafe/sbt/packager/archetypes/jlink/JlinkPlugin.scala
@@ -3,15 +3,17 @@ package jlink
import scala.collection.immutable
import scala.sys.process.{BasicIO, Process, ProcessBuilder}
-import sbt._
-import sbt.Keys._
+import sbt.{*, given}
+import sbt.Keys.*
import com.typesafe.sbt.SbtNativePackager.{Debian, Universal}
import com.typesafe.sbt.packager.Keys.{bundledJvmLocation, packageName}
import com.typesafe.sbt.packager.Compat._
+import com.typesafe.sbt.packager.PluginCompat
import com.typesafe.sbt.packager.archetypes.jlink._
import com.typesafe.sbt.packager.archetypes.scripts.BashStartScriptKeys
import com.typesafe.sbt.packager.universal.UniversalPlugin
import java.io.File
+import xsbti.FileConverter
/**
* ==Jlink Application==
@@ -51,10 +53,13 @@ object JlinkPlugin extends AutoPlugin {
jlinkBuildImage / fullClasspath := (Compile / fullClasspath).value,
jlinkModules := (jlinkModules ?? Nil).value,
jlinkModules ++= {
+ val conv0 = fileConverter.value
+ implicit val conv: FileConverter = conv0
val log = streams.value.log
val javaHome0 = (jlinkBuildImage / javaHome).value.getOrElse(defaultJavaHome)
val run = runJavaTool(javaHome0, log) _
- val paths = (jlinkBuildImage / fullClasspath).value.map(_.data.getPath)
+ val paths =
+ (jlinkBuildImage / fullClasspath).value.map(PluginCompat.toNioPath).map(_.toString())
val modulePath = (jlinkModules / jlinkModulePath).value
val shouldIgnore = jlinkIgnoreMissingDependency.value
@@ -164,12 +169,15 @@ object JlinkPlugin extends AutoPlugin {
outDir
},
jlinkBuildImage / mappings := {
+ val conv0 = fileConverter.value
+ implicit val conv: FileConverter = conv0
val prefix = jlinkBundledJvmLocation.value
// make sure the prefix has a terminating slash
val prefix0 = if (prefix.isEmpty) prefix else prefix + "/"
findFiles(jlinkBuildImage.value).map { case (file, string) =>
- (file, prefix0 + string)
+ val ref = PluginCompat.toFileRef(file)
+ (ref, prefix0 + string)
}
},
Universal / mappings ++= (jlinkBuildImage / mappings).value
@@ -256,7 +264,7 @@ object JlinkPlugin extends AutoPlugin {
source: PackageDependency.Source
)
- private[jlink] final object PackageDependency {
+ private[jlink] object PackageDependency {
implicit object PackageDependencyOrdering extends Ordering[PackageDependency] {
override def compare(x: PackageDependency, y: PackageDependency): Int = {
diff --git a/src/main/scala/com/typesafe/sbt/packager/archetypes/scripts/ApplicationIniGenerator.scala b/src/main/scala/com/typesafe/sbt/packager/archetypes/scripts/ApplicationIniGenerator.scala
index 4c00aacab..8cf34a5f2 100644
--- a/src/main/scala/com/typesafe/sbt/packager/archetypes/scripts/ApplicationIniGenerator.scala
+++ b/src/main/scala/com/typesafe/sbt/packager/archetypes/scripts/ApplicationIniGenerator.scala
@@ -1,8 +1,10 @@
package com.typesafe.sbt.packager.archetypes.scripts
+import com.typesafe.sbt.packager.PluginCompat
import java.io.File
-import sbt._
+import sbt.{*, given}
+import xsbti.FileConverter
trait ApplicationIniGenerator {
@@ -11,12 +13,12 @@ trait ApplicationIniGenerator {
* the existing mappings plus a generated application.ini if custom javaOptions are specified
*/
def generateApplicationIni(
- universalMappings: Seq[(File, String)],
+ universalMappings: Seq[(PluginCompat.FileRef, String)],
javaOptions: Seq[String],
bashScriptConfigLocation: Option[String],
tmpDir: File,
log: Logger
- ): Seq[(File, String)] =
+ )(implicit conv: FileConverter): Seq[(PluginCompat.FileRef, String)] =
bashScriptConfigLocation
.collect {
case location if javaOptions.nonEmpty =>
@@ -42,7 +44,8 @@ trait ApplicationIniGenerator {
case _ =>
true
}
- (configFile -> pathMapping) +: filteredMappings
+ val configFileRef = PluginCompat.toFileRef(configFile)
+ (configFileRef -> pathMapping) +: filteredMappings
}
.getOrElse(universalMappings)
diff --git a/src/main/scala/com/typesafe/sbt/packager/archetypes/scripts/BashStartScriptKeys.scala b/src/main/scala/com/typesafe/sbt/packager/archetypes/scripts/BashStartScriptKeys.scala
index 71eca3ca7..6883c96a7 100644
--- a/src/main/scala/com/typesafe/sbt/packager/archetypes/scripts/BashStartScriptKeys.scala
+++ b/src/main/scala/com/typesafe/sbt/packager/archetypes/scripts/BashStartScriptKeys.scala
@@ -1,6 +1,7 @@
package com.typesafe.sbt.packager.archetypes.scripts
-import sbt._
+import sbt.{*, given}
+import com.typesafe.sbt.packager.PluginCompat
/**
* Keys related to the [[BashStartScriptPlugin]]
@@ -9,7 +10,7 @@ import sbt._
* [[BashStartScriptPlugin]]
*/
trait BashStartScriptKeys {
- val makeBashScripts = TaskKey[Seq[(File, String)]]("makeBashScripts", "Creates start scripts for this project.")
+ val makeBashScripts = taskKey[Seq[(PluginCompat.FileRef, String)]]("Creates start scripts for this project.")
val bashScriptTemplateLocation =
TaskKey[File]("bashScriptTemplateLocation", "The location of the bash script template.")
diff --git a/src/main/scala/com/typesafe/sbt/packager/archetypes/scripts/BashStartScriptPlugin.scala b/src/main/scala/com/typesafe/sbt/packager/archetypes/scripts/BashStartScriptPlugin.scala
index 1e74a29b3..1b4956775 100644
--- a/src/main/scala/com/typesafe/sbt/packager/archetypes/scripts/BashStartScriptPlugin.scala
+++ b/src/main/scala/com/typesafe/sbt/packager/archetypes/scripts/BashStartScriptPlugin.scala
@@ -5,8 +5,9 @@ import java.io.File
import com.typesafe.sbt.SbtNativePackager.Universal
import com.typesafe.sbt.packager.Keys._
import com.typesafe.sbt.packager.archetypes.{JavaAppPackaging, TemplateWriter}
-import sbt.Keys._
-import sbt._
+import sbt.Keys.*
+import sbt.{*, given}
+import xsbti.FileConverter
/**
* ==Bash StartScript Plugin==
@@ -69,13 +70,17 @@ object BashStartScriptPlugin extends AutoPlugin with ApplicationIniGenerator wit
bashScriptConfigLocation := (bashScriptConfigLocation ?? Some(appIniLocation)).value,
bashScriptEnvConfigLocation := (bashScriptEnvConfigLocation ?? None).value,
// Generating the application configuration
- Universal / mappings := generateApplicationIni(
- (Universal / mappings).value,
- (Universal / javaOptions).value,
- bashScriptConfigLocation.value,
- (Universal / target).value,
- streams.value.log
- ),
+ Universal / mappings := {
+ val conv0 = fileConverter.value
+ implicit val conv: FileConverter = conv0
+ generateApplicationIni(
+ (Universal / mappings).value,
+ (Universal / javaOptions).value,
+ bashScriptConfigLocation.value,
+ (Universal / target).value,
+ streams.value.log
+ )
+ },
makeBashScripts := generateStartScripts(
BashScriptConfig(
executableScriptName = executableScriptName.value,
@@ -87,6 +92,7 @@ object BashStartScriptPlugin extends AutoPlugin with ApplicationIniGenerator wit
(Compile / bashScriptDefines / mainClass).value,
(Compile / discoveredMainClasses).value,
(Universal / target).value / "scripts",
+ fileConverter.value,
streams.value.log
),
Universal / mappings ++= makeBashScripts.value
diff --git a/src/main/scala/com/typesafe/sbt/packager/archetypes/scripts/BatStartScriptKeys.scala b/src/main/scala/com/typesafe/sbt/packager/archetypes/scripts/BatStartScriptKeys.scala
index ab9042eba..550c2123d 100644
--- a/src/main/scala/com/typesafe/sbt/packager/archetypes/scripts/BatStartScriptKeys.scala
+++ b/src/main/scala/com/typesafe/sbt/packager/archetypes/scripts/BatStartScriptKeys.scala
@@ -1,4 +1,5 @@
-package com.typesafe.sbt.packager.archetypes.scripts
+package com.typesafe.sbt.packager
+package archetypes.scripts
import sbt._
@@ -9,7 +10,8 @@ import sbt._
* [[BatStartScriptPlugin]]
*/
trait BatStartScriptKeys {
- val makeBatScripts = TaskKey[Seq[(File, String)]]("makeBatScripts", "Creates start scripts for this project.")
+ val makeBatScripts =
+ taskKey[Seq[(PluginCompat.FileRef, String)]]("Creates start scripts for this project.")
val batScriptTemplateLocation =
TaskKey[File]("batScriptTemplateLocation", "The location of the bat script template.")
diff --git a/src/main/scala/com/typesafe/sbt/packager/archetypes/scripts/BatStartScriptPlugin.scala b/src/main/scala/com/typesafe/sbt/packager/archetypes/scripts/BatStartScriptPlugin.scala
index 09f8fa629..328370298 100644
--- a/src/main/scala/com/typesafe/sbt/packager/archetypes/scripts/BatStartScriptPlugin.scala
+++ b/src/main/scala/com/typesafe/sbt/packager/archetypes/scripts/BatStartScriptPlugin.scala
@@ -6,8 +6,9 @@ import com.typesafe.sbt.SbtNativePackager.Universal
import com.typesafe.sbt.packager.Keys._
import com.typesafe.sbt.packager.archetypes.{JavaAppPackaging, TemplateWriter}
import com.typesafe.sbt.packager.windows.NameHelper
-import sbt.Keys._
-import sbt._
+import sbt.Keys.*
+import sbt.{*, given}
+import xsbti.FileConverter
/**
* ==Bat StartScript Plugin==
@@ -53,47 +54,6 @@ object BatStartScriptPlugin extends AutoPlugin with ApplicationIniGenerator with
bundledJvmLocation: Option[String],
override val forwarderTemplateLocation: Option[File]
) extends ScriptConfig {
-
- @deprecated("1.3.21", "")
- def this(
- executableScriptName: String,
- scriptClasspath: Seq[String],
- configLocation: Option[String],
- extraDefines: Seq[String],
- replacements: Seq[(String, String)],
- templateLocation: File
- ) =
- this(
- executableScriptName,
- scriptClasspath,
- configLocation,
- extraDefines,
- replacements,
- templateLocation,
- None,
- None
- )
-
- @deprecated("1.3.21", "")
- def copy(
- executableScriptName: String = executableScriptName,
- scriptClasspath: Seq[String] = scriptClasspath,
- configLocation: Option[String] = configLocation,
- extraDefines: Seq[String] = extraDefines,
- replacements: Seq[(String, String)] = replacements,
- templateLocation: File = templateLocation
- ): BatScriptConfig =
- BatScriptConfig(
- executableScriptName,
- scriptClasspath,
- configLocation,
- extraDefines,
- replacements,
- templateLocation,
- bundledJvmLocation,
- forwarderTemplateLocation
- )
-
override def withScriptName(scriptName: String): BatScriptConfig = copy(executableScriptName = scriptName)
}
@@ -134,13 +94,17 @@ object BatStartScriptPlugin extends AutoPlugin with ApplicationIniGenerator with
batScriptExtraDefines := Nil,
batScriptReplacements := Replacements(executableScriptName.value),
// Generating the application configuration
- Universal / mappings := generateApplicationIni(
- (Universal / mappings).value,
- (Universal / javaOptions).value,
- batScriptConfigLocation.value,
- (Universal / target).value,
- streams.value.log
- ),
+ Universal / mappings := {
+ val conv0 = fileConverter.value
+ implicit val conv: FileConverter = conv0
+ generateApplicationIni(
+ (Universal / mappings).value,
+ (Universal / javaOptions).value,
+ batScriptConfigLocation.value,
+ (Universal / target).value,
+ streams.value.log
+ )
+ },
makeBatScripts := generateStartScripts(
BatScriptConfig(
executableScriptName = executableScriptName.value,
@@ -155,6 +119,7 @@ object BatStartScriptPlugin extends AutoPlugin with ApplicationIniGenerator with
(Compile / batScriptReplacements / mainClass).value,
(Compile / discoveredMainClasses).value,
(Universal / target).value / "scripts",
+ fileConverter.value,
streams.value.log
),
Universal / mappings ++= makeBatScripts.value
diff --git a/src/main/scala/com/typesafe/sbt/packager/archetypes/scripts/CommonStartScriptGenerator.scala b/src/main/scala/com/typesafe/sbt/packager/archetypes/scripts/CommonStartScriptGenerator.scala
index f9de4b3c7..69e41cb4b 100644
--- a/src/main/scala/com/typesafe/sbt/packager/archetypes/scripts/CommonStartScriptGenerator.scala
+++ b/src/main/scala/com/typesafe/sbt/packager/archetypes/scripts/CommonStartScriptGenerator.scala
@@ -3,8 +3,10 @@ package com.typesafe.sbt.packager.archetypes.scripts
import java.io.File
import java.net.URL
+import com.typesafe.sbt.packager.PluginCompat
import com.typesafe.sbt.packager.archetypes.TemplateWriter
-import sbt._
+import sbt.{*, given}
+import xsbti.FileConverter
trait CommonStartScriptGenerator {
@@ -67,27 +69,29 @@ trait CommonStartScriptGenerator {
mainClass: Option[String],
discoveredMainClasses: Seq[String],
targetDir: File,
+ conv: FileConverter,
log: sbt.Logger
- ): Seq[(File, String)] =
+ ): Seq[(PluginCompat.FileRef, String)] =
StartScriptMainClassConfig.from(mainClass, discoveredMainClasses) match {
case NoMain =>
log.warn("You have no main class in your project. No start script will be generated.")
Seq.empty
case SingleMain(main) =>
- Seq(createMainScript(main, config, targetDir, Seq(main)))
+ Seq(createMainScript(main, config, targetDir, Seq(main), conv))
case MultipleMains(mains) =>
- generateMainScripts(mains, config, targetDir, log)
+ generateMainScripts(mains, config, targetDir, conv, log)
case ExplicitMainWithAdditional(main, additional) =>
- createMainScript(main, config, targetDir, discoveredMainClasses) +:
- createForwarderScripts(config.executableScriptName, additional, targetDir, config, log)
+ createMainScript(main, config, targetDir, discoveredMainClasses, conv) +:
+ createForwarderScripts(config.executableScriptName, additional, targetDir, config, conv, log)
}
private[this] def generateMainScripts(
discoveredMainClasses: Seq[String],
config: SpecializedScriptConfig,
targetDir: File,
+ conv: FileConverter,
log: sbt.Logger
- ): Seq[(File, String)] = {
+ ): Seq[(PluginCompat.FileRef, String)] = {
val classAndScriptNames = ScriptUtils.createScriptNames(discoveredMainClasses)
ScriptUtils.warnOnScriptNameCollision(classAndScriptNames, log)
@@ -101,7 +105,7 @@ trait CommonStartScriptGenerator {
) // empty string to enforce the custom class in scripts
.map { case (qualifiedClassName, scriptName) =>
val newConfig = config.withScriptName(scriptName)
- createMainScript(qualifiedClassName, newConfig, targetDir, discoveredMainClasses)
+ createMainScript(qualifiedClassName, newConfig, targetDir, discoveredMainClasses, conv)
}
}
@@ -122,8 +126,10 @@ trait CommonStartScriptGenerator {
mainClass: String,
config: SpecializedScriptConfig,
targetDir: File,
- mainClasses: Seq[String]
- ): (File, String) = {
+ mainClasses: Seq[String],
+ conv0: FileConverter
+ ): (PluginCompat.FileRef, String) = {
+ implicit val conv: FileConverter = conv0
val template = resolveTemplate(config.templateLocation)
val replacements = createReplacementsForMainScript(mainClass, mainClasses, config)
val scriptContent = TemplateWriter.generateScript(template, replacements, eol, keySurround)
@@ -133,7 +139,8 @@ trait CommonStartScriptGenerator {
IO.write(script, scriptContent)
// TODO - Better control over this!
script.setExecutable(executableBitValue)
- script -> s"$scriptTargetFolder/$scriptNameWithSuffix"
+ val scriptRef = PluginCompat.toFileRef(script)
+ scriptRef -> s"$scriptTargetFolder/$scriptNameWithSuffix"
}
private[this] def resolveTemplate(templateLocation: File): URL =
@@ -145,8 +152,10 @@ trait CommonStartScriptGenerator {
discoveredMainClasses: Seq[String],
targetDir: File,
config: ScriptConfig,
+ conv0: FileConverter,
log: sbt.Logger
- ): Seq[(File, String)] = {
+ ): Seq[(PluginCompat.FileRef, String)] = {
+ implicit val conv: FileConverter = conv0
val tmp = targetDir / scriptTargetFolder
val forwarderTemplate =
config.forwarderTemplateLocation.map(resolveTemplate).getOrElse(getClass.getResource(forwarderTemplateName))
@@ -161,7 +170,8 @@ trait CommonStartScriptGenerator {
IO.write(file, scriptContent)
file.setExecutable(executableBitValue)
- file -> s"$scriptTargetFolder/$scriptName"
+ val fileRef = PluginCompat.toFileRef(file)
+ fileRef -> s"$scriptTargetFolder/$scriptName"
}
}
}
diff --git a/src/main/scala/com/typesafe/sbt/packager/archetypes/systemloader/SystemdPlugin.scala b/src/main/scala/com/typesafe/sbt/packager/archetypes/systemloader/SystemdPlugin.scala
index 7a6a28307..6b23b0100 100644
--- a/src/main/scala/com/typesafe/sbt/packager/archetypes/systemloader/SystemdPlugin.scala
+++ b/src/main/scala/com/typesafe/sbt/packager/archetypes/systemloader/SystemdPlugin.scala
@@ -1,6 +1,6 @@
package com.typesafe.sbt.packager.archetypes.systemloader
-import sbt._
+import sbt.{*, given}
import sbt.Keys.{sourceDirectory, target}
import com.typesafe.sbt.packager.Keys.{
defaultLinuxStartScriptLocation,
@@ -19,6 +19,7 @@ import com.typesafe.sbt.packager.Keys.{
stopRunlevels
}
import com.typesafe.sbt.SbtNativePackager.{Debian, Linux, Rpm, Universal}
+import com.typesafe.sbt.packager.PluginCompat
import com.typesafe.sbt.packager.archetypes.MaintainerScriptHelper.maintainerScriptsAppend
import com.typesafe.sbt.packager.debian.DebianPlugin
import com.typesafe.sbt.packager.debian.DebianPlugin.autoImport.DebianConstants
diff --git a/src/main/scala/com/typesafe/sbt/packager/archetypes/systemloader/SystemloaderPlugin.scala b/src/main/scala/com/typesafe/sbt/packager/archetypes/systemloader/SystemloaderPlugin.scala
index 61a84ac8c..1f1d6f5fc 100644
--- a/src/main/scala/com/typesafe/sbt/packager/archetypes/systemloader/SystemloaderPlugin.scala
+++ b/src/main/scala/com/typesafe/sbt/packager/archetypes/systemloader/SystemloaderPlugin.scala
@@ -1,7 +1,7 @@
package com.typesafe.sbt.packager.archetypes.systemloader
-import sbt._
-import sbt.Keys.{sourceDirectory, target}
+import sbt.{*, given}
+import sbt.Keys.{fileConverter, sourceDirectory, target}
import com.typesafe.sbt.SbtNativePackager.{Debian, Rpm}
import com.typesafe.sbt.packager.Keys.{
defaultLinuxStartScriptLocation,
diff --git a/src/main/scala/com/typesafe/sbt/packager/archetypes/systemloader/package.scala b/src/main/scala/com/typesafe/sbt/packager/archetypes/systemloader/package.scala
index 5c94ae8b6..cd6a01aef 100644
--- a/src/main/scala/com/typesafe/sbt/packager/archetypes/systemloader/package.scala
+++ b/src/main/scala/com/typesafe/sbt/packager/archetypes/systemloader/package.scala
@@ -1,13 +1,15 @@
package com.typesafe.sbt.packager.archetypes
-import sbt._
+import sbt.{*, given}
import java.io.File
import java.net.URL
+import com.typesafe.sbt.packager.PluginCompat
import com.typesafe.sbt.packager.linux._
import com.typesafe.sbt.packager.linux.LinuxPlugin.Users
import com.typesafe.sbt.packager.archetypes.systemloader.ServerLoader._
+import xsbti.FileConverter
package object systemloader {
diff --git a/src/main/scala/com/typesafe/sbt/packager/debian/DebianNativePackaging.scala b/src/main/scala/com/typesafe/sbt/packager/debian/DebianNativePackaging.scala
index 445f4e7d9..91e8454c3 100644
--- a/src/main/scala/com/typesafe/sbt/packager/debian/DebianNativePackaging.scala
+++ b/src/main/scala/com/typesafe/sbt/packager/debian/DebianNativePackaging.scala
@@ -1,11 +1,13 @@
-package com.typesafe.sbt.packager.debian
+package com.typesafe.sbt.packager
+package debian
import com.typesafe.sbt.SbtNativePackager.Debian
import com.typesafe.sbt.packager.Keys._
import com.typesafe.sbt.packager.linux.LinuxFileMetaData
import com.typesafe.sbt.packager.Compat._
-import sbt.Keys._
-import sbt._
+import sbt.Keys.*
+import sbt.{*, given}
+import xsbti.FileConverter
/**
* ==Native Packaging==
@@ -36,17 +38,20 @@ trait DebianNativePackaging extends DebianPluginLike {
inConfig(Debian)(
Seq(
debianNativeBuildOptions += "-Znone", // packages are largely JARs, which are already compressed
- genChanges := dpkgGenChanges(
- packageBin.value,
- debianChangelog.value,
- debianPackageMetadata.value,
- target.value
- ),
+ genChanges := {
+ val conv0 = fileConverter.value
+ implicit val conv: FileConverter = conv0
+ dpkgGenChanges(packageBin.value, debianChangelog.value, debianPackageMetadata.value, target.value)
+ },
debianSign := {
+ val conv0 = fileConverter.value
+ implicit val conv: FileConverter = conv0
val deb = packageBin.value
+ val debFile = PluginCompat.toFile(deb)
val role = debianSignRole.value
val log = streams.value.log
- sys.process.Process(Seq("dpkg-sig", "-s", role, deb.getAbsolutePath), Some(deb.getParentFile)) ! log match {
+ sys.process
+ .Process(Seq("dpkg-sig", "-s", role, debFile.getAbsolutePath), Some(debFile.getParentFile)) ! log match {
case 0 => ()
case x =>
sys.error("Failed to sign debian package! exit code: " + x)
@@ -54,8 +59,11 @@ trait DebianNativePackaging extends DebianPluginLike {
deb
},
lintian := {
- val file = packageBin.value
- sys.process.Process(Seq("lintian", "-c", "-v", file.getName), Some(file.getParentFile)).!
+ val conv0 = fileConverter.value
+ implicit val conv: FileConverter = conv0
+ val deb = packageBin.value
+ val debFile = PluginCompat.toFile(deb)
+ sys.process.Process(Seq("lintian", "-c", "-v", debFile.getName), Some(debFile.getParentFile)).!
},
/** Implementation of the actual packaging */
packageBin := buildPackage(
@@ -64,12 +72,18 @@ trait DebianNativePackaging extends DebianPluginLike {
packageArchitecture.value,
stage.value,
debianNativeBuildOptions.value,
+ fileConverter.value,
streams.value.log
)
)
)
- private[this] def dpkgGenChanges(debFile: File, changelog: Option[File], data: PackageMetaData, targetDir: File) = {
+ private[this] def dpkgGenChanges(
+ debFile: PluginCompat.FileRef,
+ changelog: Option[File],
+ data: PackageMetaData,
+ targetDir: File
+ )(implicit conv: FileConverter): PluginCompat.FileRef = {
println(s"Changelog: $changelog")
changelog match {
case None =>
@@ -79,10 +93,11 @@ trait DebianNativePackaging extends DebianPluginLike {
val debSrc = targetDir / "../tmp" / Names.DebianSource
debSrc.mkdirs()
copyAndFixPerms(chlog, debSrc / Names.Changelog, LinuxFileMetaData("0644"))
- IO.writeLines(debSrc / Names.Files, List(debFile.getName + " " + data.section + " " + data.priority))
+ val debFileFile = PluginCompat.toFile(debFile)
+ IO.writeLines(debSrc / Names.Files, List(debFileFile.getName + " " + data.section + " " + data.priority))
// dpkg-genchanges needs a "source" control file, located in a "debian" directory
IO.writeLines(debSrc / Names.Control, List(data.makeSourceControl()))
- val changesFileName = debFile.getName.replaceAll("deb$", "changes")
+ val changesFileName = debFileFile.getName.replaceAll("deb$", "changes")
val changesFile: File = targetDir / ".." / changesFileName
try {
val changes = sys.process.Process(Seq("dpkg-genchanges", "-b"), Some(targetDir / "../tmp")).!!
@@ -92,7 +107,8 @@ trait DebianNativePackaging extends DebianPluginLike {
case e: Exception =>
throw new RuntimeException("Failure generating changes file.", e)
}
- changesFile
+ val changesFileRef = PluginCompat.toFileRef(changesFile)
+ changesFileRef
}
}
@@ -102,8 +118,10 @@ trait DebianNativePackaging extends DebianPluginLike {
arch: String,
stageDir: File,
buildOptions: Seq[String],
+ conv0: FileConverter,
log: Logger
- ) = {
+ ): PluginCompat.FileRef = {
+ implicit val conv: FileConverter = conv0
log.info("Building debian package with native implementation")
// Make the package. We put this in fakeroot, so we can build the package with root owning files.
val archive = archiveFilename(name, version, arch)
@@ -115,7 +133,8 @@ trait DebianNativePackaging extends DebianPluginLike {
case x =>
sys.error("Failure packaging debian file. Exit code: " + x)
}
- stageDir / ".." / archive
+ val out = stageDir / ".." / archive
+ PluginCompat.toFileRef(out)
}
}
diff --git a/src/main/scala/com/typesafe/sbt/packager/debian/DebianPlugin.scala b/src/main/scala/com/typesafe/sbt/packager/debian/DebianPlugin.scala
index de4760bb1..3d76a7da3 100644
--- a/src/main/scala/com/typesafe/sbt/packager/debian/DebianPlugin.scala
+++ b/src/main/scala/com/typesafe/sbt/packager/debian/DebianPlugin.scala
@@ -1,4 +1,5 @@
-package com.typesafe.sbt.packager.debian
+package com.typesafe.sbt.packager
+package debian
import com.typesafe.sbt.SbtNativePackager.{Linux, Universal}
import com.typesafe.sbt.packager.Keys._
@@ -8,8 +9,9 @@ import com.typesafe.sbt.packager.linux.{LinuxFileMetaData, LinuxPackageMapping,
import com.typesafe.sbt.packager.universal.Archives
import com.typesafe.sbt.packager.validation._
import com.typesafe.sbt.packager.{chmod, Hashing, SettingsHelper}
-import sbt.Keys._
-import sbt._
+import sbt.Keys.*
+import sbt.{*, given}
+import xsbti.FileConverter
import scala.util.matching.Regex
@@ -154,7 +156,7 @@ object DebianPlugin extends AutoPlugin with DebianNativePackaging {
// apply all replacements
content.mapValues { lines =>
TemplateWriter.generateScriptFromLines(lines, replacements)
- }
+ }.toMap
},
debianMaintainerScripts := generateDebianMaintainerScripts(
(Debian / maintainerScripts).value,
@@ -189,12 +191,22 @@ object DebianPlugin extends AutoPlugin with DebianNativePackaging {
debianPackageProvides.value,
debianPackageRecommends.value
),
- debianPackageInstallSize := getPackageInstallSize(linuxPackageMappings.value),
+ debianPackageInstallSize := {
+ val conv0 = fileConverter.value
+ implicit val conv: FileConverter = conv0
+ getPackageInstallSize(linuxPackageMappings.value)
+ },
debianControlFile := createConfFile(debianPackageMetadata.value, debianPackageInstallSize.value, target.value),
- debianConffilesFile := createConffilesFile(linuxPackageMappings.value, target.value),
+ debianConffilesFile := {
+ val conv0 = fileConverter.value
+ implicit val conv: FileConverter = conv0
+ createConffilesFile(linuxPackageMappings.value, target.value)
+ },
debianMD5sumsFile := createMD5SumFile(stage.value),
debianMakeChownReplacements := makeChownReplacements(linuxPackageMappings.value, streams.value),
stage := {
+ val conv0 = fileConverter.value
+ implicit val conv: FileConverter = conv0
val debianTarget = target.value
stageMappings(linuxPackageMappings.value, debianTarget)
@@ -272,7 +284,7 @@ object DebianPlugin extends AutoPlugin with DebianNativePackaging {
dirs map { case (_, dirName) =>
targetDir / dirName
} foreach { targetDir =>
- targetDir mkdirs ()
+ targetDir.mkdirs()
chmod(targetDir, perms.permissions)
}
diff --git a/src/main/scala/com/typesafe/sbt/packager/debian/JDebPackaging.scala b/src/main/scala/com/typesafe/sbt/packager/debian/JDebPackaging.scala
index b68f1c549..374510914 100644
--- a/src/main/scala/com/typesafe/sbt/packager/debian/JDebPackaging.scala
+++ b/src/main/scala/com/typesafe/sbt/packager/debian/JDebPackaging.scala
@@ -1,9 +1,11 @@
-package com.typesafe.sbt.packager.debian
+package com.typesafe.sbt.packager
+package debian
+import com.typesafe.sbt.packager.PluginCompat
import com.typesafe.sbt.packager.archetypes.TemplateWriter
import com.typesafe.sbt.packager.universal.Archives
-import sbt._
-import sbt.Keys.{classpathTypes, normalizedName, packageBin, streams, target, version}
+import sbt.{*, given}
+import sbt.Keys.{classpathTypes, fileConverter, normalizedName, packageBin, streams, target, version}
import com.typesafe.sbt.packager.linux.{LinuxFileMetaData, LinuxPackageMapping, LinuxSymlink}
import com.typesafe.sbt.packager.linux.LinuxPlugin.autoImport.{
linuxPackageMappings,
@@ -14,6 +16,7 @@ import com.typesafe.sbt.packager.linux.LinuxPlugin.autoImport.{
import scala.collection.JavaConverters._
import DebianPlugin.Names
import DebianPlugin.autoImport._
+import xsbti.FileConverter
/**
* ==JDeb Plugin==
@@ -58,6 +61,8 @@ object JDebPackaging extends AutoPlugin with DebianPluginLike {
* Depends on the 'debianExplodedPackage' task as this creates all the files which are defined in the mappings.
*/
packageBin := {
+ val conv0 = fileConverter.value
+ implicit val conv: FileConverter = conv0
val targetDir = target.value
val log = streams.value.log
val mappings = linuxPackageMappings.value
@@ -80,8 +85,8 @@ object JDebPackaging extends AutoPlugin with DebianPluginLike {
val archive = archiveFilename(normalizedName.value, version.value, packageArchitecture.value)
val debianFile = targetDir.getParentFile / archive
val debMaker = new JDebPackagingTask()
- debMaker.packageDebian(mappings, symlinks, debianFile, targetDir, log)
- debianFile
+ debMaker.packageDebian(mappings, symlinks, debianFile, targetDir, fileConverter.value, log)
+ PluginCompat.toFileRef(debianFile)
},
packageBin := (packageBin dependsOn debianControlFile).value,
packageBin := (packageBin dependsOn debianConffilesFile).value,
@@ -147,8 +152,10 @@ private class JDebPackagingTask {
symlinks: Seq[LinuxSymlink],
debianFile: File,
targetDir: File,
+ conv0: FileConverter,
log: Logger
): Unit = {
+ implicit val conv: FileConverter = conv0
val debMaker = new DebMaker(
new JDebConsole(log),
(fileAndDirectoryProducers(mappings, targetDir) ++ linkProducers(symlinks)).asJava,
@@ -161,8 +168,8 @@ private class JDebPackagingTask {
debMaker setControl (targetDir / Names.DebianMaintainerScripts)
// TODO add signing with setKeyring, setKey, setPassphrase, setSignPackage, setSignMethod, setSignRole
- debMaker validate ()
- debMaker makeDeb ()
+ debMaker.validate()
+ debMaker.makeDeb()
}
/**
@@ -176,7 +183,7 @@ private class JDebPackagingTask {
// Directories need to be created so jdeb can pick them up
case (path, name) if path.isDirectory =>
val permMapper = new PermMapper(-1, -1, perms.user, perms.group, null, perms.permissions, -1, null)
- (target / cleanPath(name)) mkdirs ()
+ (target / cleanPath(name)).mkdirs()
new DataProducerDirectory(target, Array(cleanPath(name)), null, Array(permMapper))
// Files are just referenced
diff --git a/src/main/scala/com/typesafe/sbt/packager/debian/Keys.scala b/src/main/scala/com/typesafe/sbt/packager/debian/Keys.scala
index 21cd2cd29..7b7d936e7 100644
--- a/src/main/scala/com/typesafe/sbt/packager/debian/Keys.scala
+++ b/src/main/scala/com/typesafe/sbt/packager/debian/Keys.scala
@@ -2,7 +2,7 @@ package com.typesafe.sbt
package packager
package debian
-import sbt._
+import sbt.{*, given}
import linux.LinuxPackageMapping
/** DEB packaging specifc build targets. */
@@ -43,10 +43,12 @@ trait DebianKeys {
@deprecated("Use Debian/stage instead", "1.2.0")
val debianExplodedPackage = TaskKey[File]("debian-exploded-package", "makes an exploded debian package")
val lintian = TaskKey[Unit]("lintian", "runs the debian lintian tool on the current package.")
- val debianSign = TaskKey[File]("debian-sign", "runs the dpkg-sig command to sign the generated deb file.")
+ val debianSign =
+ taskKey[PluginCompat.FileRef]("runs the dpkg-sig command to sign the generated deb file.")
val debianSignRole =
SettingKey[String]("debian-sign-role", "The role to use when signing a debian file (defaults to 'builder').")
- val genChanges = TaskKey[File]("gen-changes", "runs the dpkg-genchanges command to generate the .changes file.")
+ val genChanges =
+ taskKey[PluginCompat.FileRef]("runs the dpkg-genchanges command to generate the .changes file.")
// Debian control scripts
val debianControlScriptsDirectory = SettingKey[File](
diff --git a/src/main/scala/com/typesafe/sbt/packager/docker/DockerPlugin.scala b/src/main/scala/com/typesafe/sbt/packager/docker/DockerPlugin.scala
index 1ea423fd0..b340da669 100644
--- a/src/main/scala/com/typesafe/sbt/packager/docker/DockerPlugin.scala
+++ b/src/main/scala/com/typesafe/sbt/packager/docker/DockerPlugin.scala
@@ -1,4 +1,5 @@
-package com.typesafe.sbt.packager.docker
+package com.typesafe.sbt.packager
+package docker
import com.typesafe.sbt.SbtNativePackager.Universal
import com.typesafe.sbt.packager.Keys._
@@ -7,15 +8,15 @@ import com.typesafe.sbt.packager.linux.LinuxPlugin.autoImport.{daemonUser, defau
import com.typesafe.sbt.packager.universal.UniversalPlugin
import com.typesafe.sbt.packager.universal.UniversalPlugin.autoImport.stage
import com.typesafe.sbt.packager.validation._
-import com.typesafe.sbt.packager.{MappingsHelper, Stager}
-import sbt.Keys._
-import sbt._
+import sbt.Keys.*
+import sbt.{*, given}
import java.io.File
import java.util.UUID
import java.util.concurrent.atomic.AtomicBoolean
import scala.sys.process.Process
import scala.util.Try
+import xsbti.FileConverter
/**
* ==Docker Plugin==
@@ -101,10 +102,12 @@ object DockerPlugin extends AutoPlugin {
(Docker / packageName).value,
Option((Docker / version).value)
),
- dockerLayerGrouping := { _: String =>
+ dockerLayerGrouping := { (_: String) =>
None
},
dockerGroupLayers := {
+ val conv0 = fileConverter.value
+ implicit val conv: FileConverter = conv0
val dockerBaseDirectory = (Docker / defaultLinuxInstallLocation).value
// Ensure this doesn't break even if the JvmPlugin isn't enabled.
var artifacts = projectDependencyArtifacts.?.value.getOrElse(Nil).map(_.data).toSet
@@ -119,7 +122,7 @@ object DockerPlugin extends AutoPlugin {
val oldFunction = dockerLayerGrouping.value
// By default we set this to a function that always returns None.
- val oldPartialFunction = Function.unlift((tuple: (File, String)) => oldFunction(tuple._2))
+ val oldPartialFunction = Function.unlift((tuple: (PluginCompat.FileRef, String)) => oldFunction(tuple._2))
val libDir = dockerBaseDirectory + "/lib/"
val binDir = dockerBaseDirectory + "/bin/"
@@ -183,6 +186,8 @@ object DockerPlugin extends AutoPlugin {
}
},
dockerCommands := {
+ val conv0 = fileConverter.value
+ implicit val conv: FileConverter = conv0
val strategy = dockerPermissionStrategy.value
val dockerBaseDirectory = (Docker / defaultLinuxInstallLocation).value
val user = (Docker / daemonUser).value
@@ -220,7 +225,7 @@ object DockerPlugin extends AutoPlugin {
.getOrElse {
// We couldn't find a source file for the mapping, so try with a dummy source file,
// in case there is an explicitly configured path based layer mapping, eg for a directory.
- layerToPath.lift((new File("/dev/null"), v))
+ layerToPath.lift((PluginCompat.toFileRef(new File("/dev/null")), v))
}
makeChmod(tpe, Seq(pathInLayer(v, layerId)))
}
@@ -328,13 +333,17 @@ object DockerPlugin extends AutoPlugin {
publish := publishTask.value,
clean := cleanTask.value,
sourceDirectory := sourceDirectory.value / "docker",
- stage := Stager.stage(Docker.name)(
- streams.value,
- stagingDirectory.value,
- dockerLayerMappings.value.map { case LayeredMapping(layerIdx, file, path) =>
- (file, pathInLayer(path, layerIdx))
- }
- ),
+ stage := {
+ val conv0 = fileConverter.value
+ implicit val conv: FileConverter = conv0
+ Stager.stage(Docker.name)(
+ streams.value,
+ stagingDirectory.value,
+ dockerLayerMappings.value.map { case LayeredMapping(layerIdx, file, path) =>
+ (file, pathInLayer(path, layerIdx))
+ }
+ )
+ },
stage := (stage dependsOn dockerGenerateConfig).value,
stagingDirectory := (Docker / target).value / "stage",
dockerLayerMappings := {
@@ -355,14 +364,20 @@ object DockerPlugin extends AutoPlugin {
defaultLinuxInstallLocation := "/opt/docker",
validatePackage := Validation
.runAndThrow(validatePackageValidators.value, streams.value.log),
- validatePackageValidators := Seq(
- nonEmptyMappings((Docker / mappings).value),
- filesExist((Docker / mappings).value),
- validateExposedPorts(dockerExposedPorts.value, dockerExposedUdpPorts.value),
- validateDockerVersion(dockerApiVersion.value),
- validateDockerPermissionStrategy(dockerPermissionStrategy.value, dockerVersion.value, dockerApiVersion.value)
- ),
- dockerPackageMappings := MappingsHelper.contentOf(sourceDirectory.value),
+ validatePackageValidators := {
+ val conv0 = fileConverter.value
+ implicit val conv: FileConverter = conv0
+ val xs = (Docker / mappings).value
+ val fileMappings = xs.map { case (ref, p) => PluginCompat.toFile(ref) -> p }
+ Seq(
+ nonEmptyMappings(fileMappings),
+ filesExist(fileMappings),
+ validateExposedPorts(dockerExposedPorts.value, dockerExposedUdpPorts.value),
+ validateDockerVersion(dockerApiVersion.value),
+ validateDockerPermissionStrategy(dockerPermissionStrategy.value, dockerVersion.value, dockerApiVersion.value)
+ )
+ },
+ dockerPackageMappings := MappingsHelper.contentOf(sourceDirectory.value, fileConverter.value),
dockerGenerateConfig := {
val _ = validatePackage.value
generateDockerConfig(dockerCommands.value, stagingDirectory.value)
@@ -631,7 +646,7 @@ object DockerPlugin extends AutoPlugin {
* uses the `Universal / mappings` to generate the `Docker / mappings`.
*/
def mapGenericFilesToDocker: Seq[Setting[_]] = {
- def renameDests(from: Seq[(File, String)], dest: String) =
+ def renameDests(from: Seq[(PluginCompat.FileRef, String)], dest: String) =
for {
(f, path) <- from
pathWithValidSeparator = if (Path.sep == '/') path else path.replace(Path.sep, '/')
diff --git a/src/main/scala/com/typesafe/sbt/packager/docker/Keys.scala b/src/main/scala/com/typesafe/sbt/packager/docker/Keys.scala
index 6300dd323..d34126136 100644
--- a/src/main/scala/com/typesafe/sbt/packager/docker/Keys.scala
+++ b/src/main/scala/com/typesafe/sbt/packager/docker/Keys.scala
@@ -11,7 +11,7 @@ import sbt._
trait DockerKeys {
val dockerGenerateConfig = TaskKey[File]("docker-generate-config", "Generates configuration file for Docker.")
val dockerPackageMappings =
- TaskKey[Seq[(File, String)]]("docker-package-mappings", "Generates location mappings for Docker build.")
+ taskKey[Seq[(PluginCompat.FileRef, String)]]("Generates location mappings for Docker build.")
val dockerBaseImage =
SettingKey[String]("dockerBaseImage", "Base image for Dockerfile.")
@@ -64,7 +64,7 @@ private[packager] trait DockerKeysEx extends DockerKeys {
"Group files by path into in layers to increase docker cache hits. " +
"Lower index means the file would be a part of an earlier layer."
)
- val dockerGroupLayers = taskKey[PartialFunction[(File, String), Int]](
+ val dockerGroupLayers = taskKey[PartialFunction[(PluginCompat.FileRef, String), Int]](
"Group files by mapping into layers to increase docker cache hits. " +
"Lower index means the file would be a part of an earlier layer."
)
diff --git a/src/main/scala/com/typesafe/sbt/packager/docker/LayeredMapping.scala b/src/main/scala/com/typesafe/sbt/packager/docker/LayeredMapping.scala
index 96824a6e3..585864044 100644
--- a/src/main/scala/com/typesafe/sbt/packager/docker/LayeredMapping.scala
+++ b/src/main/scala/com/typesafe/sbt/packager/docker/LayeredMapping.scala
@@ -1,4 +1,5 @@
-package com.typesafe.sbt.packager.docker
+package com.typesafe.sbt.packager
+package docker
import java.io.File
@@ -14,4 +15,4 @@ import java.io.File
* @param path
* The path in the final image
*/
-case class LayeredMapping(layerId: Option[Int], file: File, path: String)
+case class LayeredMapping(layerId: Option[Int], file: PluginCompat.FileRef, path: String)
diff --git a/src/main/scala/com/typesafe/sbt/packager/docker/dockerfile.scala b/src/main/scala/com/typesafe/sbt/packager/docker/dockerfile.scala
index 87021d3a3..654cc5046 100644
--- a/src/main/scala/com/typesafe/sbt/packager/docker/dockerfile.scala
+++ b/src/main/scala/com/typesafe/sbt/packager/docker/dockerfile.scala
@@ -94,6 +94,6 @@ case class Dockerfile(commands: CmdLike*) {
def makeContent: String = {
val sb = new StringBuilder
commands foreach { sb append _.makeContent }
- sb toString
+ sb.toString()
}
}
diff --git a/src/main/scala/com/typesafe/sbt/packager/graalvmnativeimage/GraalVMNativeImagePlugin.scala b/src/main/scala/com/typesafe/sbt/packager/graalvmnativeimage/GraalVMNativeImagePlugin.scala
index e1ddbf3db..184caf3c0 100644
--- a/src/main/scala/com/typesafe/sbt/packager/graalvmnativeimage/GraalVMNativeImagePlugin.scala
+++ b/src/main/scala/com/typesafe/sbt/packager/graalvmnativeimage/GraalVMNativeImagePlugin.scala
@@ -1,15 +1,18 @@
-package com.typesafe.sbt.packager.graalvmnativeimage
+package com.typesafe.sbt.packager
+package graalvmnativeimage
import java.io.ByteArrayInputStream
-import sbt._
-import sbt.Keys.{mainClass, name, _}
import com.typesafe.sbt.packager.{MappingsHelper, Stager}
-import com.typesafe.sbt.packager.Keys._
-import com.typesafe.sbt.packager.Compat._
+import com.typesafe.sbt.packager.Keys.*
+import com.typesafe.sbt.packager.Compat.*
import com.typesafe.sbt.packager.archetypes.JavaAppPackaging
import com.typesafe.sbt.packager.docker.{Cmd, DockerPlugin, Dockerfile, ExecCmd}
import com.typesafe.sbt.packager.universal.UniversalPlugin
+import sbt.{*, given}
+import sbt.Keys.{mainClass, name, _}
+import scala.sys.process.ProcessLogger
+import xsbti.FileConverter
/**
* Plugin to compile ahead-of-time native executables.
@@ -46,7 +49,7 @@ object GraalVMNativeImagePlugin extends AutoPlugin {
private lazy val scopedSettings = Seq[Setting[_]](
resourceDirectories := Seq(resourceDirectory.value),
includeFilter := "*",
- resources := resourceDirectories.value.descendantsExcept(includeFilter.value, excludeFilter.value).get,
+ resources := resourceDirectories.value.descendantsExcept(includeFilter.value, excludeFilter.value).get(),
UniversalPlugin.autoImport.containerBuildImage := Def.taskDyn {
graalVMNativeImageGraalVersion.value match {
case Some(tag) => generateContainerBuildImage(s"$GraalVMBaseImage:$tag")
@@ -54,6 +57,8 @@ object GraalVMNativeImagePlugin extends AutoPlugin {
}
}.value,
packageBin := {
+ val conv0 = fileConverter.value
+ implicit val conv: FileConverter = conv0
val targetDirectory = target.value
val binaryName = name.value
val nativeImageCommand = graalVMNativeImageCommand.value
@@ -67,20 +72,21 @@ object GraalVMNativeImagePlugin extends AutoPlugin {
UniversalPlugin.autoImport.containerBuildImage.value match {
case None =>
- buildLocal(
+ val file = buildLocal(
targetDirectory,
binaryName,
nativeImageCommand,
className,
- classpathJars.map(_._1),
+ classpathJars.map(x => PluginCompat.toFile(x._1)),
extraOptions,
UnbufferedProcessLogger(streams.log)
)
+ PluginCompat.toFileRef(file)
case Some(image) =>
- val resourceMappings = MappingsHelper.relative(graalResources, graalResourceDirectories)
+ val resourceMappings = MappingsHelper.relative(graalResources, graalResourceDirectories, conv)
- buildInDockerContainer(
+ val file = buildInDockerContainer(
targetDirectory,
binaryName,
className,
@@ -89,8 +95,10 @@ object GraalVMNativeImagePlugin extends AutoPlugin {
dockerCommand,
resourceMappings,
image,
+ conv,
streams
)
+ PluginCompat.toFileRef(file)
}
}
)
@@ -130,14 +138,15 @@ object GraalVMNativeImagePlugin extends AutoPlugin {
targetDirectory: File,
binaryName: String,
className: String,
- classpathJars: Seq[(File, String)],
+ classpathJars: Seq[(PluginCompat.FileRef, String)],
extraOptions: Seq[String],
dockerCommand: Seq[String],
- resources: Seq[(File, String)],
+ resources: Seq[(PluginCompat.FileRef, String)],
image: String,
+ conv0: FileConverter,
streams: TaskStreams
): File = {
-
+ implicit val conv: FileConverter = conv0
stage(targetDirectory, classpathJars, resources, streams)
val graalDestDir = "/opt/graalvm"
@@ -212,10 +221,10 @@ object GraalVMNativeImagePlugin extends AutoPlugin {
private def stage(
targetDirectory: File,
- classpathJars: Seq[(File, String)],
- resources: Seq[(File, String)],
+ classpathJars: Seq[(PluginCompat.FileRef, String)],
+ resources: Seq[(PluginCompat.FileRef, String)],
streams: TaskStreams
- ): File = {
+ )(implicit conv: FileConverter): File = {
val stageDir = targetDirectory / "stage"
val mappings = classpathJars ++ resources.map { case (resource, path) =>
resource -> s"resources/$path"
diff --git a/src/main/scala/com/typesafe/sbt/packager/jar/ClasspathJarPlugin.scala b/src/main/scala/com/typesafe/sbt/packager/jar/ClasspathJarPlugin.scala
index 7185aae56..5036957c8 100644
--- a/src/main/scala/com/typesafe/sbt/packager/jar/ClasspathJarPlugin.scala
+++ b/src/main/scala/com/typesafe/sbt/packager/jar/ClasspathJarPlugin.scala
@@ -4,8 +4,9 @@ import java.io.File
import java.util.jar.Attributes
import sbt.Package.ManifestAttributes
-import sbt._
+import sbt.{*, given}
import sbt.Keys._
+import com.typesafe.sbt.packager.PluginCompat
import com.typesafe.sbt.packager.Keys._
import com.typesafe.sbt.SbtNativePackager.Universal
import com.typesafe.sbt.packager.archetypes.JavaAppPackaging
@@ -13,10 +14,8 @@ import com.typesafe.sbt.packager.archetypes.JavaAppPackaging
object ClasspathJarPlugin extends AutoPlugin {
object autoImport {
- val packageJavaClasspathJar: TaskKey[File] = TaskKey[File](
- "packageJavaClasspathJar",
- "Creates a Java classpath jar that specifies the classpath in its manifest"
- )
+ val packageJavaClasspathJar: TaskKey[PluginCompat.FileRef] =
+ taskKey[PluginCompat.FileRef]("Creates a Java classpath jar that specifies the classpath in its manifest")
}
import autoImport._
@@ -28,18 +27,22 @@ object ClasspathJarPlugin extends AutoPlugin {
packageJavaClasspathJar / artifactClassifier := Option("classpath"),
packageJavaClasspathJar / packageOptions := {
val classpath = (packageJavaClasspathJar / scriptClasspath).value
- val manifestClasspath = Attributes.Name.CLASS_PATH -> classpath.mkString(" ")
+ val manifestClasspath = PluginCompat.classpathAttr -> classpath.mkString(" ")
Seq(ManifestAttributes(manifestClasspath))
},
packageJavaClasspathJar / artifactName := { (scalaVersion, moduleId, artifact) =>
moduleId.organization + "." + artifact.name + "-" + moduleId.revision +
artifact.classifier.fold("")("-" + _) + "." + artifact.extension
},
- bashScriptDefines / scriptClasspath := Seq((packageJavaClasspathJar / artifactPath).value.getName),
- batScriptReplacements / scriptClasspath := Seq((packageJavaClasspathJar / artifactPath).value.getName),
+ bashScriptDefines / scriptClasspath := {
+ Seq(PluginCompat.getArtifactPathName((packageJavaClasspathJar / artifactPath).value))
+ },
+ batScriptReplacements / scriptClasspath := {
+ Seq(PluginCompat.getArtifactPathName((packageJavaClasspathJar / artifactPath).value))
+ },
Universal / mappings += {
val classpathJar = packageJavaClasspathJar.value
- classpathJar -> ("lib/" + classpathJar.getName)
+ classpathJar -> ("lib/" + PluginCompat.getName(classpathJar))
}
)
}
diff --git a/src/main/scala/com/typesafe/sbt/packager/jar/LauncherJarPlugin.scala b/src/main/scala/com/typesafe/sbt/packager/jar/LauncherJarPlugin.scala
index ae32b4471..ceeacd0b2 100644
--- a/src/main/scala/com/typesafe/sbt/packager/jar/LauncherJarPlugin.scala
+++ b/src/main/scala/com/typesafe/sbt/packager/jar/LauncherJarPlugin.scala
@@ -4,17 +4,18 @@ import java.io.File
import java.util.jar.Attributes
import sbt.Package.ManifestAttributes
-import sbt._
+import sbt.{*, given}
import sbt.Keys._
+import com.typesafe.sbt.packager.PluginCompat
import com.typesafe.sbt.packager.Keys._
import com.typesafe.sbt.SbtNativePackager.Universal
import com.typesafe.sbt.packager.archetypes.JavaAppPackaging
+import xsbti.FileConverter
object LauncherJarPlugin extends AutoPlugin {
object autoImport {
- val packageJavaLauncherJar: TaskKey[File] = TaskKey[File](
- "packageJavaLauncherJar",
+ val packageJavaLauncherJar: TaskKey[PluginCompat.FileRef] = taskKey[PluginCompat.FileRef](
"Creates a Java launcher jar that specifies the main class and classpath in its manifest"
)
}
@@ -29,9 +30,9 @@ object LauncherJarPlugin extends AutoPlugin {
packageJavaLauncherJar / artifactClassifier := Option("launcher"),
packageJavaLauncherJar / packageOptions := {
val classpath = (packageJavaLauncherJar / scriptClasspath).value
- val manifestClasspath = Attributes.Name.CLASS_PATH -> classpath.mkString(" ")
+ val manifestClasspath = PluginCompat.classpathAttr -> classpath.mkString(" ")
val manifestMainClass =
- (Compile / packageJavaLauncherJar / mainClass).value.map(Attributes.Name.MAIN_CLASS -> _)
+ (Compile / packageJavaLauncherJar / mainClass).value.map(PluginCompat.mainclassAttr -> _)
Seq(ManifestAttributes(manifestMainClass.toSeq :+ manifestClasspath: _*))
},
packageJavaLauncherJar / artifactName := { (scalaVersion, moduleId, artifact) =>
@@ -39,16 +40,24 @@ object LauncherJarPlugin extends AutoPlugin {
artifact.classifier.fold("")("-" + _) + "." + artifact.extension
},
Compile / bashScriptDefines / mainClass := {
- Some(s"""-jar "$$lib_dir/${(packageJavaLauncherJar / artifactPath).value.getName}"""")
+ val conv0 = fileConverter.value
+ implicit val conv: FileConverter = conv0
+ val a = (packageJavaLauncherJar / artifactPath).value
+ Some(s"""-jar "$$lib_dir/${PluginCompat.artifactPathToFile(a).getName}"""")
},
bashScriptDefines / scriptClasspath := Nil,
Compile / batScriptReplacements / mainClass := {
- Some(s"""-jar "%APP_LIB_DIR%\\${(packageJavaLauncherJar / artifactPath).value.getName}"""")
+ val conv0 = fileConverter.value
+ implicit val conv: FileConverter = conv0
+ val a = (packageJavaLauncherJar / artifactPath).value
+ Some(s"""-jar "%APP_LIB_DIR%\\${PluginCompat.artifactPathToFile(a).getName}"""")
},
batScriptReplacements / scriptClasspath := Nil,
Universal / mappings += {
val javaLauncher = packageJavaLauncherJar.value
- javaLauncher -> ("lib/" + javaLauncher.getName)
+ val conv0 = fileConverter.value
+ implicit val conv: FileConverter = conv0
+ javaLauncher -> ("lib/" + PluginCompat.toFile(javaLauncher).getName)
}
)
}
diff --git a/src/main/scala/com/typesafe/sbt/packager/jdkpackager/JDKPackagerAntHelper.scala b/src/main/scala/com/typesafe/sbt/packager/jdkpackager/JDKPackagerAntHelper.scala
index 3a91c263b..aba8b58d6 100644
--- a/src/main/scala/com/typesafe/sbt/packager/jdkpackager/JDKPackagerAntHelper.scala
+++ b/src/main/scala/com/typesafe/sbt/packager/jdkpackager/JDKPackagerAntHelper.scala
@@ -1,12 +1,14 @@
package com.typesafe.sbt.packager.jdkpackager
+import com.typesafe.sbt.packager.PluginCompat
import com.typesafe.sbt.packager.jdkpackager.JDKPackagerPlugin.autoImport._
import org.apache.tools.ant.{BuildEvent, BuildListener, ProjectHelper}
-import sbt.Keys._
-import sbt._
+import sbt.Keys.*
+import sbt.{*, given}
import scala.util.Try
import scala.xml.Elem
+import xsbti.FileConverter
/**
* Helpers for working with Ant build definitions
@@ -135,10 +137,12 @@ object JDKPackagerAntHelper {
private[jdkpackager] def deployDOM(
basename: String,
packageType: String,
- mainJar: File,
+ mainJar: PluginCompat.ArtifactPath,
outputDir: File,
- infoDOM: InfoDOM
- ): DeployDOM =
+ infoDOM: InfoDOM,
+ conv0: FileConverter
+ ): DeployDOM = {
+ implicit val conv: FileConverter = conv0
// format: OFF
-
+
+ }
// format: ON
type BuildDOM = xml.Elem
@@ -176,7 +181,7 @@ object JDKPackagerAntHelper {
antExtraClasspath: Seq[File],
name: String,
sourceDir: File,
- mappings: Seq[(File, String)],
+ mappings: Seq[(PluginCompat.FileRef, String)],
platformDOM: PlatformDOM,
applicationDOM: ApplicationDOM,
deployDOM: DeployDOM
@@ -233,7 +238,7 @@ object JDKPackagerAntHelper {
val globs =
Seq("*.dmg", "*.pkg", "*.app", "*.msi", "*.exe", "*.deb", "*.rpm")
val finder = globs.foldLeft(PathFinder.empty)(_ +++ output ** _)
- val result = finder.getPaths.headOption
+ val result = finder.getPaths().headOption
result.foreach(f => s.log.info("Wrote " + f))
result.map(file)
}
@@ -248,8 +253,14 @@ object JDKPackagerAntHelper {
}
/** Build package via Ant build.xml definition. */
- private[jdkpackager] def buildPackageWithAnt(buildXML: File, target: File, s: TaskStreams): File = {
+ private[jdkpackager] def buildPackageWithAnt(
+ buildXML: File,
+ target: File,
+ conv0: FileConverter,
+ s: TaskStreams
+ ): PluginCompat.FileRef = {
import org.apache.tools.ant.{Project => AntProject}
+ implicit val conv: FileConverter = conv0
val ap = new AntProject
ap.setUserProperty("ant.file", buildXML.getAbsolutePath)
@@ -264,7 +275,8 @@ object JDKPackagerAntHelper {
ap.removeBuildListener(adapter)
// Not sure what to do when we can't find the result
- findResult(target, s).getOrElse(target)
+ val result = findResult(target, s).getOrElse(target)
+ PluginCompat.toFileRef(result)
}
/** For piping Ant messages to sbt logger. */
diff --git a/src/main/scala/com/typesafe/sbt/packager/jdkpackager/JDKPackagerPlugin.scala b/src/main/scala/com/typesafe/sbt/packager/jdkpackager/JDKPackagerPlugin.scala
index 635020576..1b2d67c80 100644
--- a/src/main/scala/com/typesafe/sbt/packager/jdkpackager/JDKPackagerPlugin.scala
+++ b/src/main/scala/com/typesafe/sbt/packager/jdkpackager/JDKPackagerPlugin.scala
@@ -1,14 +1,14 @@
package com.typesafe.sbt.packager.jdkpackager
import com.typesafe.sbt.SbtNativePackager
-import com.typesafe.sbt.packager.Keys._
+import com.typesafe.sbt.packager.Keys.*
import com.typesafe.sbt.packager.SettingsHelper
import com.typesafe.sbt.packager.archetypes.JavaAppPackaging
import com.typesafe.sbt.packager.archetypes.jar.LauncherJarPlugin
-import sbt.Keys._
-import sbt._
+import sbt.Keys.*
+import sbt.{*, given}
import SbtNativePackager.Universal
-import JDKPackagerAntHelper._
+import JDKPackagerAntHelper.*
/**
* Package format via Oracle's packaging tool bundled with JDK 8.
@@ -74,11 +74,12 @@ object JDKPackagerPlugin extends AutoPlugin {
maintainer.value,
jdkAppIcon.value,
jdkPackagerAssociations.value
- )
+ ),
+ fileConverter.value
)
),
writeAntBuild := writeAntFile(target.value, antBuildDefn.value, streams.value),
- packageBin := buildPackageWithAnt(writeAntBuild.value, target.value, streams.value)
+ packageBin := buildPackageWithAnt(writeAntBuild.value, target.value, fileConverter.value, streams.value)
)
)
diff --git a/src/main/scala/com/typesafe/sbt/packager/linux/Keys.scala b/src/main/scala/com/typesafe/sbt/packager/linux/Keys.scala
index d58ad8fa6..cd5cc8720 100644
--- a/src/main/scala/com/typesafe/sbt/packager/linux/Keys.scala
+++ b/src/main/scala/com/typesafe/sbt/packager/linux/Keys.scala
@@ -2,7 +2,7 @@ package com.typesafe.sbt
package packager
package linux
-import sbt._
+import sbt.{*, given}
import com.typesafe.sbt.packager.archetypes.systemloader.ServerLoader
/** Linux packaging generic build targets. */
@@ -34,7 +34,7 @@ trait LinuxKeys {
val generateManPages = TaskKey[Unit]("generate-man-pages", "Shows all the man files in the current project")
val linuxMakeStartScript =
- TaskKey[Option[File]]("linuxMakeStartScript", "Creates or discovers the start script used by this project")
+ taskKey[Option[File]]("Creates or discovers the start script used by this project")
val linuxStartScriptTemplate = TaskKey[URL](
"linuxStartScriptTemplate",
"The location of the template start script file we use for debian (upstart or init.d"
@@ -67,7 +67,8 @@ trait LinuxKeys {
""".stripMargin
)
- val makeEtcDefault = TaskKey[Option[File]]("makeEtcDefault", "Creates or discovers the /etc/default/ script")
+ val makeEtcDefault =
+ taskKey[Option[File]]("Creates or discovers the /etc/default/ script")
val defaultLinuxInstallLocation =
SettingKey[String]("defaultLinuxInstallLocation", "The location where we will install generic linux packages.")
diff --git a/src/main/scala/com/typesafe/sbt/packager/linux/LinuxMappingDSL.scala b/src/main/scala/com/typesafe/sbt/packager/linux/LinuxMappingDSL.scala
index 5754dabe2..e2d0b9adc 100644
--- a/src/main/scala/com/typesafe/sbt/packager/linux/LinuxMappingDSL.scala
+++ b/src/main/scala/com/typesafe/sbt/packager/linux/LinuxMappingDSL.scala
@@ -1,6 +1,6 @@
package com.typesafe.sbt.packager.linux
-import sbt._
+import sbt.{*, given}
trait LinuxMappingDSL {
@@ -13,7 +13,7 @@ trait LinuxMappingDSL {
* @param files
*/
def packageTemplateMapping(files: String*)(dir: File = new File(sys.props("java.io.tmpdir"))) =
- LinuxPackageMapping(files map ((dir, _)))
+ LinuxPackageMapping(files.map((dir, _)))
// TODO can the packager.MappingsHelper be used here?
/**
@@ -34,7 +34,7 @@ trait LinuxMappingDSL {
def mapDirectoryAndContents(dirs: (File, String)*): Seq[(File, String)] =
for {
(src, dest) <- dirs
- path <- (src ** AllPassFilter).get
+ path <- (src ** AllPassFilter).get()
} yield path -> path.toString.replaceFirst(src.toString, dest)
/**
diff --git a/src/main/scala/com/typesafe/sbt/packager/linux/LinuxPackageMapping.scala b/src/main/scala/com/typesafe/sbt/packager/linux/LinuxPackageMapping.scala
index 4f66e0545..c28808aae 100644
--- a/src/main/scala/com/typesafe/sbt/packager/linux/LinuxPackageMapping.scala
+++ b/src/main/scala/com/typesafe/sbt/packager/linux/LinuxPackageMapping.scala
@@ -2,8 +2,9 @@ package com.typesafe.sbt
package packager
package linux
-import sbt._
+import sbt.{*, given}
import LinuxPlugin.Users
+import com.typesafe.sbt.packager.linux.{Mapper => M}
case class LinuxFileMetaData(
user: String = Users.Root,
@@ -31,8 +32,8 @@ case class LinuxPackageMapping(
def withPerms(perms: String) = copy(fileData = fileData withPerms perms)
def withConfig(c: String = "true") = copy(fileData = fileData withConfig c)
def withContents() =
- copy(mappings = Mapper.mapDirectoryAndContents(mappings.toSeq: _*))
- def asDocs() = copy(fileData = fileData asDocs ())
+ copy(mappings = M.mapDirectoryAndContents(mappings.toSeq *))
+ def asDocs() = copy(fileData = fileData.asDocs())
/** Modifies the current package mapping to have gzipped data. */
def gzipped = copy(zipped = true)
diff --git a/src/main/scala/com/typesafe/sbt/packager/linux/LinuxPlugin.scala b/src/main/scala/com/typesafe/sbt/packager/linux/LinuxPlugin.scala
index 44a5d4d3e..3bfe9b4a6 100644
--- a/src/main/scala/com/typesafe/sbt/packager/linux/LinuxPlugin.scala
+++ b/src/main/scala/com/typesafe/sbt/packager/linux/LinuxPlugin.scala
@@ -1,12 +1,13 @@
-package com.typesafe.sbt.packager.linux
+package com.typesafe.sbt.packager
+package linux
-import sbt._
-import sbt.Keys.{mappings, name, sourceDirectory, streams}
+import sbt.{*, given}
+import sbt.Keys.{fileConverter, mappings, name, sourceDirectory, streams}
import com.typesafe.sbt.SbtNativePackager.Universal
-import com.typesafe.sbt.packager.MappingsHelper
-import com.typesafe.sbt.packager.Keys._
+import com.typesafe.sbt.packager.Keys.*
import com.typesafe.sbt.packager.universal.UniversalPlugin
import com.typesafe.sbt.packager.archetypes.TemplateWriter
+import xsbti.FileConverter
/**
* Plugin containing all the generic values used for packaging linux software.
@@ -50,7 +51,7 @@ object LinuxPlugin extends AutoPlugin {
Linux / sourceDirectory := sourceDirectory.value / "linux",
generateManPages := {
val log = streams.value.log
- for (file <- ((Linux / sourceDirectory).value / "usr/share/man/man1" ** "*.1").get) {
+ for (file <- ((Linux / sourceDirectory).value / "usr/share/man/man1" ** "*.1").get()) {
val man = makeMan(file)
log.info("Generated man page for[" + file + "] =")
log.info(man)
@@ -116,27 +117,32 @@ object LinuxPlugin extends AutoPlugin {
linuxPackageMappings ++= getUniversalFolderMappings(
(Linux / packageName).value,
defaultLinuxInstallLocation.value,
- (Universal / mappings).value
+ (Universal / mappings).value,
+ fileConverter.value
),
// Now we generate symlinks.
linuxPackageSymlinks ++= {
+ val conv0 = fileConverter.value
+ implicit val conv: FileConverter = conv0
val installLocation = defaultLinuxInstallLocation.value
val linuxPackageName = (Linux / packageName).value
for {
(file, name) <- (Universal / mappings).value
- if !file.isDirectory
+ if !PluginCompat.toFile(file).isDirectory
if name startsWith "bin/"
if !(name endsWith ".bat") // IGNORE windows-y things.
} yield LinuxSymlink("/usr/" + name, installLocation + "/" + linuxPackageName + "/" + name)
},
// Map configuration files
linuxPackageSymlinks ++= {
+ val conv0 = fileConverter.value
+ implicit val conv: FileConverter = conv0
val linuxPackageName = (Linux / packageName).value
val installLocation = defaultLinuxInstallLocation.value
val configLocation = defaultLinuxConfigLocation.value
val needsConfLink =
(Universal / mappings).value exists { case (file, destination) =>
- (destination startsWith "conf/") && !file.isDirectory
+ (destination startsWith "conf/") && !PluginCompat.toFile(file).isDirectory
}
if (needsConfLink)
Seq(
@@ -189,7 +195,7 @@ object LinuxPlugin extends AutoPlugin {
* placeholder->content
*/
def controlScriptFunctionsReplacement(template: Option[URL] = None): (String, String) = {
- val url = template getOrElse LinuxPlugin.controlFunctions
+ val url = template getOrElse LinuxPlugin.controlFunctions()
LinuxPlugin.CONTROL_FUNCTIONS -> TemplateWriter.generateScript(source = url, replacements = Nil)
}
@@ -240,7 +246,7 @@ object LinuxPlugin extends AutoPlugin {
Seq(
packageMappingWithRename(binaries ++ directories: _*) withUser user withGroup group withPerms "0755",
packageMappingWithRename(compressedManPages: _*).gzipped withUser user withGroup group withPerms "0644",
- packageMappingWithRename(configFiles: _*) withConfig () withUser user withGroup group withPerms "0644",
+ packageMappingWithRename(configFiles: _*).withConfig() withUser user withGroup group withPerms "0644",
packageMappingWithRename(remaining: _*) withUser user withGroup group withPerms "0644"
)
}
@@ -251,13 +257,17 @@ object LinuxPlugin extends AutoPlugin {
private[this] def getUniversalFolderMappings(
pkg: String,
installLocation: String,
- mappings: Seq[(File, String)]
+ mappings: Seq[(PluginCompat.FileRef, String)],
+ conv0: FileConverter
): Seq[LinuxPackageMapping] = {
+ implicit val conv: FileConverter = conv0
// TODO - More windows filters...
- def isWindowsFile(f: (File, String)): Boolean =
+ def isWindowsFile(f: (PluginCompat.FileRef, String)): Boolean =
f._2 endsWith ".bat"
- val filtered = mappings.filterNot(isWindowsFile)
+ val filtered = mappings.filterNot(isWindowsFile).map { case (x, p) =>
+ (PluginCompat.toFile(x), p)
+ }
if (filtered.isEmpty) Seq.empty
else
diff --git a/src/main/scala/com/typesafe/sbt/packager/rpm/RpmHelper.scala b/src/main/scala/com/typesafe/sbt/packager/rpm/RpmHelper.scala
index 00e58e599..2de76b24b 100644
--- a/src/main/scala/com/typesafe/sbt/packager/rpm/RpmHelper.scala
+++ b/src/main/scala/com/typesafe/sbt/packager/rpm/RpmHelper.scala
@@ -1,14 +1,16 @@
package com.typesafe.sbt.packager.rpm
-import sbt._
+import sbt.{*, given}
+import com.typesafe.sbt.packager.PluginCompat
import com.typesafe.sbt.packager.linux.LinuxSymlink
import com.typesafe.sbt.packager.sourceDateEpoch
+import xsbti.FileConverter
object RpmHelper {
/** Returns the host vendor for an rpm. */
def hostVendor =
- sys.process.Process(Seq("rpm", "-E", "%{_host_vendor}")) !!
+ sys.process.Process(Seq("rpm", "-E", "%{_host_vendor}")).!!
/**
* Prepares the staging directory for the rpm build command.
@@ -22,7 +24,7 @@ object RpmHelper {
* @return
* the `workArea`
*/
- def stage(spec: RpmSpec, workArea: File, log: sbt.Logger): File = {
+ def stage(spec: RpmSpec, workArea: File, log: sbt.Logger)(implicit conv: FileConverter): File = {
buildWorkArea(workArea)
copyFiles(spec, workArea, log)
writeSpecFile(spec, workArea, log)
@@ -31,8 +33,12 @@ object RpmHelper {
workArea
}
- private[rpm] def defaultRpmArtifactPath(stagingArea: File, meta: RpmMetadata): File =
- stagingArea / "RPMS" / meta.arch / s"${meta.name}-${meta.version}-${meta.release}.${meta.arch}.rpm"
+ private[rpm] def defaultRpmArtifactPath(stagingArea: File, meta: RpmMetadata)(implicit
+ conv: FileConverter
+ ): PluginCompat.ArtifactPath =
+ PluginCompat.toArtifactPath(
+ stagingArea / "RPMS" / meta.arch / s"${meta.name}-${meta.version}-${meta.release}.${meta.arch}.rpm"
+ )
/**
* Build the rpm package
@@ -46,12 +52,14 @@ object RpmHelper {
* @return
* The rpm package
*/
- def buildRpm(spec: RpmSpec, stagingArea: File, log: sbt.Logger): File = {
+ def buildRpm(spec: RpmSpec, stagingArea: File, log: sbt.Logger)(implicit
+ conv: FileConverter
+ ): PluginCompat.ArtifactPath = {
buildPackage(stagingArea, spec, log)
defaultRpmArtifactPath(stagingArea, spec.meta)
}
- private[this] def copyFiles(spec: RpmSpec, workArea: File, log: sbt.Logger): Unit = {
+ private[this] def copyFiles(spec: RpmSpec, workArea: File, log: sbt.Logger)(implicit conv: FileConverter): Unit = {
// TODO - special treatment of icon...
val buildroot = workArea / "tmp-buildroot"
@@ -80,7 +88,9 @@ object RpmHelper {
LinuxSymlink.makeSymLinks(spec.symlinks, buildroot, relativeLinks = false)
}
- private[this] def writeSpecFile(spec: RpmSpec, workArea: File, log: sbt.Logger): File = {
+ private[this] def writeSpecFile(spec: RpmSpec, workArea: File, log: sbt.Logger)(implicit
+ conv: FileConverter
+ ): File = {
val specdir = workArea / "SPECS"
val rpmBuildroot = workArea / "buildroot"
val tmpBuildRoot = workArea / "tmp-buildroot"
diff --git a/src/main/scala/com/typesafe/sbt/packager/rpm/RpmMetadata.scala b/src/main/scala/com/typesafe/sbt/packager/rpm/RpmMetadata.scala
index 169f11214..daa0909e8 100644
--- a/src/main/scala/com/typesafe/sbt/packager/rpm/RpmMetadata.scala
+++ b/src/main/scala/com/typesafe/sbt/packager/rpm/RpmMetadata.scala
@@ -7,6 +7,8 @@ import com.typesafe.sbt.packager.linux.{LinuxFileMetaData, LinuxPackageMapping,
import com.typesafe.sbt.packager.rpm.RpmPlugin.Names._
import com.typesafe.sbt.packager.archetypes.TemplateWriter
import java.io.File
+import java.nio.file.Files
+import xsbti.FileConverter
case class RpmMetadata(
name: String,
@@ -198,14 +200,14 @@ case class RpmSpec(
sb.toString
}
- private[this] def fileSection: String = {
+ private[this] def fileSection(implicit conv: FileConverter): String = {
val sb = new StringBuilder
sb append "\n%files\n"
// TODO - default attribute string.
for {
mapping <- mappings
(file, dest) <- mapping.mappings
- } sb append makeFilesLine(dest, mapping.fileData, file.isDirectory)
+ } sb.append(makeFilesLine(dest, mapping.fileData, file.isDirectory))
symlinks foreach (l => sb append s"${l.link}\n")
sb.toString
@@ -229,7 +231,7 @@ case class RpmSpec(
}
// TODO - This is *very* tied to RPM helper, may belong *in* RpmHelper
- def writeSpec(rpmRoot: File, tmpRoot: File): String = {
+ def writeSpec(rpmRoot: File, tmpRoot: File)(implicit conv: FileConverter): String = {
val sb = new StringBuilder
sb append ("Name: %s\n" format meta.name)
sb append ("Version: %s\n" format meta.version)
diff --git a/src/main/scala/com/typesafe/sbt/packager/rpm/RpmPlugin.scala b/src/main/scala/com/typesafe/sbt/packager/rpm/RpmPlugin.scala
index ea23a39c9..557bcb2de 100644
--- a/src/main/scala/com/typesafe/sbt/packager/rpm/RpmPlugin.scala
+++ b/src/main/scala/com/typesafe/sbt/packager/rpm/RpmPlugin.scala
@@ -1,15 +1,17 @@
package com.typesafe.sbt.packager.rpm
-import sbt._
-import sbt.Keys._
+import sbt.{*, given}
+import sbt.Keys.*
import java.nio.charset.Charset
import com.typesafe.sbt.SbtNativePackager.Linux
+import com.typesafe.sbt.packager.PluginCompat
import com.typesafe.sbt.packager.SettingsHelper
-import com.typesafe.sbt.packager.Keys._
-import com.typesafe.sbt.packager.linux._
-import com.typesafe.sbt.packager.Compat._
-import com.typesafe.sbt.packager.validation._
+import com.typesafe.sbt.packager.Keys.*
+import com.typesafe.sbt.packager.linux.*
+import com.typesafe.sbt.packager.Compat.*
+import com.typesafe.sbt.packager.validation.*
+import xsbti.FileConverter
/**
* Plugin containing all generic values used for packaging rpms.
@@ -104,12 +106,16 @@ object RpmPlugin extends AutoPlugin {
Rpm / executableScriptName := (Linux / executableScriptName).value,
rpmDaemonLogFile := s"${(Linux / packageName).value}.log",
Rpm / daemonStdoutLogFile := Some(rpmDaemonLogFile.value),
- Rpm / validatePackageValidators := Seq(
- nonEmptyMappings((Rpm / linuxPackageMappings).value.flatMap(_.mappings)),
- filesExist((Rpm / linuxPackageMappings).value.flatMap(_.mappings)),
- checkMaintainer((Rpm / maintainer).value, asWarning = false),
- epochIsNaturalNumber((Rpm / rpmEpoch).value.getOrElse(0))
- ),
+ Rpm / validatePackageValidators := {
+ val conv0 = fileConverter.value
+ implicit val conv: FileConverter = conv0
+ Seq(
+ nonEmptyMappings((Rpm / linuxPackageMappings).value.flatMap(_.mappings)),
+ filesExist((Rpm / linuxPackageMappings).value.flatMap(_.mappings)),
+ checkMaintainer((Rpm / maintainer).value, asWarning = false),
+ epochIsNaturalNumber((Rpm / rpmEpoch).value.getOrElse(0))
+ )
+ },
// override the linux sourceDirectory setting
Rpm / sourceDirectory := sourceDirectory.value,
Rpm / packageArchitecture := "noarch",
@@ -164,18 +170,35 @@ object RpmPlugin extends AutoPlugin {
(Rpm / linuxPackageSymlinks).value,
(Rpm / defaultLinuxInstallLocation).value
),
- Rpm / stage := RpmHelper.stage(rpmSpecConfig.value, (Rpm / target).value, streams.value.log),
- Rpm / packageBin / artifactPath := RpmHelper.defaultRpmArtifactPath((Rpm / target).value, rpmMetadata.value),
+ Rpm / stage := {
+ val conv0 = fileConverter.value
+ implicit val conv: FileConverter = conv0
+ RpmHelper.stage(rpmSpecConfig.value, (Rpm / target).value, streams.value.log)
+ },
+ Rpm / packageBin / artifactPath := {
+ val conv0 = fileConverter.value
+ implicit val conv: FileConverter = conv0
+ RpmHelper.defaultRpmArtifactPath((Rpm / target).value, rpmMetadata.value)
+ },
Rpm / packageBin := {
+ val conv0 = fileConverter.value
+ implicit val conv: FileConverter = conv0
val defaultPath = RpmHelper.buildRpm(rpmSpecConfig.value, (Rpm / stage).value, streams.value.log)
// `file` points to where buildRpm created the rpm. However we want it to be at `artifactPath`.
// If `artifactPath` is not the default value then we need to copy the file.
val path = (Rpm / packageBin / artifactPath).value
- if (path.getCanonicalFile != defaultPath.getCanonicalFile) IO.copyFile(defaultPath, path)
- path
+ val defaultPathFile = PluginCompat.artifactPathToFile(defaultPath)
+ val pathFile = PluginCompat.artifactPathToFile(path)
+ if (pathFile.getCanonicalFile != defaultPathFile.getCanonicalFile)
+ IO.copyFile(defaultPathFile, pathFile)
+ PluginCompat.toFileRef(pathFile)
},
rpmLint := {
- sys.process.Process(Seq("rpmlint", "-v", (Rpm / packageBin).value.getAbsolutePath)) ! streams.value.log match {
+ val conv0 = fileConverter.value
+ implicit val conv: FileConverter = conv0
+ val pkg = (Rpm / packageBin).value
+ val path = PluginCompat.toNioPath(pkg)
+ sys.process.Process(Seq("rpmlint", "-v", path.toAbsolutePath().toString())).!(streams.value.log) match {
case 0 => ()
case x => sys.error("Failed to run rpmlint, exit status: " + x)
}
diff --git a/src/main/scala/com/typesafe/sbt/packager/universal/Keys.scala b/src/main/scala/com/typesafe/sbt/packager/universal/Keys.scala
index 8c2e91f79..521563600 100644
--- a/src/main/scala/com/typesafe/sbt/packager/universal/Keys.scala
+++ b/src/main/scala/com/typesafe/sbt/packager/universal/Keys.scala
@@ -6,15 +6,16 @@ import sbt._
trait UniversalKeys {
val packageZipTarball =
- TaskKey[File]("package-zip-tarball", "Creates a tgz package.")
+ taskKey[PluginCompat.FileRef]("Creates a tgz package.")
val packageXzTarball =
- TaskKey[File]("package-xz-tarball", "Creates a txz package.")
- val packageOsxDmg = TaskKey[File]("package-osx-dmg", "Creates a dmg package for macOS (only on macOS).")
+ taskKey[PluginCompat.FileRef]("Creates a txz package.")
+ val packageOsxDmg =
+ taskKey[PluginCompat.FileRef]("Creates a dmg package for macOS (only on macOS).")
val stage = TaskKey[File](
"stage",
"Create a local directory with all the files laid out as they would be in the final distribution."
)
- val dist = TaskKey[File]("dist", "Creates the distribution packages.")
+ val dist = taskKey[PluginCompat.FileRef]("Creates the distribution packages.")
val stagingDirectory = SettingKey[File]("stagingDirectory", "Directory where we stage distributions/releases.")
val topLevelDirectory = SettingKey[Option[String]]("topLevelDirectory", "Top level dir in compressed output file.")
val universalArchiveOptions =
diff --git a/src/main/scala/com/typesafe/sbt/packager/universal/UniversalPlugin.scala b/src/main/scala/com/typesafe/sbt/packager/universal/UniversalPlugin.scala
index 502e40091..7542c45db 100644
--- a/src/main/scala/com/typesafe/sbt/packager/universal/UniversalPlugin.scala
+++ b/src/main/scala/com/typesafe/sbt/packager/universal/UniversalPlugin.scala
@@ -1,14 +1,16 @@
-package com.typesafe.sbt.packager.universal
+package com.typesafe.sbt.packager
+package universal
-import sbt._
-import sbt.Keys._
-import Archives._
+import sbt.{*, given}
+import sbt.Keys.*
+import Archives.*
import com.typesafe.sbt.SbtNativePackager
-import com.typesafe.sbt.packager.Keys._
+import com.typesafe.sbt.packager.Keys.*
import com.typesafe.sbt.packager.docker.DockerPlugin
import com.typesafe.sbt.packager.validation._
import com.typesafe.sbt.packager.{SettingsHelper, Stager}
import sbt.Keys.TaskStreams
+import xsbti.FileConverter
/**
* ==Universal Plugin==
@@ -84,10 +86,14 @@ object UniversalPlugin extends AutoPlugin {
inConfig(config)(
Seq(
packageName := (packageName.value + "-" + version.value),
- mappings := findSources(sourceDirectory.value),
+ mappings := findSources(sourceDirectory.value, fileConverter.value),
dist := printDist(packageBin.value, streams.value),
stagingDirectory := target.value / "stage",
- stage := Stager.stage(config.name)(streams.value, stagingDirectory.value, mappings.value)
+ stage := {
+ val conv0 = fileConverter.value
+ implicit val conv: FileConverter = conv0
+ Stager.stage(config.name)(streams.value, stagingDirectory.value, mappings.value)
+ }
)
) ++ Seq(
config / sourceDirectory := sourceDirectory.value / config.name,
@@ -105,35 +111,49 @@ object UniversalPlugin extends AutoPlugin {
UniversalSrc / packageXzTarball / universalArchiveOptions := Seq("-pcvf")
)
- private[this] def printDist(dist: File, streams: TaskStreams): File = {
+ private[this] def printDist(dist: PluginCompat.FileRef, streams: TaskStreams): PluginCompat.FileRef = {
streams.log.info("")
- streams.log.info("Your package is ready in " + dist.getCanonicalPath)
+ streams.log.info("Your package is ready in " + dist.toString())
streams.log.info("")
dist
}
- private type Packager = (File, String, Seq[(File, String)], Option[String], Seq[String]) => File
+ private type Packager =
+ (File, String, Seq[(File, String)], Option[String], Seq[String]) => File
/** Creates packaging settings for a given package key, configuration + archive type. */
- private[this] def makePackageSettings(packageKey: TaskKey[File], config: Configuration)(
+ private[this] def makePackageSettings(packageKey: TaskKey[PluginCompat.FileRef], config: Configuration)(
packager: Packager
): Seq[Setting[_]] =
inConfig(config)(
Seq(
packageKey / universalArchiveOptions := Nil,
packageKey / mappings := mappings.value,
- packageKey := packager(
- target.value,
- packageName.value,
- (packageKey / mappings).value,
- topLevelDirectory.value,
- (packageKey / universalArchiveOptions).value
- ),
- packageKey / validatePackageValidators := (config / validatePackageValidators).value ++ Seq(
- nonEmptyMappings((packageKey / mappings).value),
- filesExist((packageKey / mappings).value),
- checkMaintainer((packageKey / maintainer).value, asWarning = true)
- ),
+ packageKey := {
+ val conv0 = fileConverter.value
+ implicit val conv: FileConverter = conv0
+ val xs = (packageKey / mappings).value
+ val fileMappings = xs.map { case (ref, p) => PluginCompat.toFile(ref) -> p }
+ val file = packager(
+ target.value,
+ packageName.value,
+ fileMappings,
+ topLevelDirectory.value,
+ (packageKey / universalArchiveOptions).value
+ )
+ PluginCompat.toFileRef(file)
+ },
+ packageKey / validatePackageValidators := {
+ val conv0 = fileConverter.value
+ implicit val conv: FileConverter = conv0
+ val xs = (packageKey / mappings).value
+ val fileMappings = xs.map { case (ref, p) => PluginCompat.toFile(ref) -> p }
+ (config / validatePackageValidators).value ++ Seq(
+ nonEmptyMappings(fileMappings),
+ filesExist(fileMappings),
+ checkMaintainer((packageKey / maintainer).value, asWarning = true)
+ )
+ },
packageKey / validatePackage := Validation
.runAndThrow((config / packageKey / validatePackageValidators).value, streams.value.log),
packageKey := packageKey.dependsOn(packageKey / validatePackage).value
@@ -141,8 +161,12 @@ object UniversalPlugin extends AutoPlugin {
)
/** Finds all sources in a source directory. */
- private[this] def findSources(sourceDir: File): Seq[(File, String)] =
- ((PathFinder(sourceDir) ** AllPassFilter) --- sourceDir).pair(file => IO.relativize(sourceDir, file))
+ private[this] def findSources(sourceDir: File, conv0: FileConverter): Seq[(PluginCompat.FileRef, String)] = {
+ implicit val conv: FileConverter = conv0
+ ((PathFinder(sourceDir) ** AllPassFilter) --- sourceDir).pair(file => IO.relativize(sourceDir, file)).map {
+ case (f, p) => PluginCompat.toFileRef(f) -> p
+ }
+ }
}
diff --git a/src/main/scala/com/typesafe/sbt/packager/validation/package.scala b/src/main/scala/com/typesafe/sbt/packager/validation/package.scala
index c770d402f..dcddff676 100644
--- a/src/main/scala/com/typesafe/sbt/packager/validation/package.scala
+++ b/src/main/scala/com/typesafe/sbt/packager/validation/package.scala
@@ -1,6 +1,6 @@
package com.typesafe.sbt.packager
-import sbt._
+import sbt.{*, given}
/**
* ==validation==
@@ -42,7 +42,7 @@ package object validation {
}
.map { case (file, dest) =>
ValidationError(
- description = s"Not found: ${file.getAbsolutePath} (mapped to $dest)",
+ description = s"Not found: ${file} (mapped to $dest)",
howToFix = "Generate the file in the task/setting that adds it to the mappings task"
)
}
diff --git a/src/main/scala/com/typesafe/sbt/packager/windows/WindowsPlugin.scala b/src/main/scala/com/typesafe/sbt/packager/windows/WindowsPlugin.scala
index e310e0744..3d021ee14 100644
--- a/src/main/scala/com/typesafe/sbt/packager/windows/WindowsPlugin.scala
+++ b/src/main/scala/com/typesafe/sbt/packager/windows/WindowsPlugin.scala
@@ -1,14 +1,16 @@
package com.typesafe.sbt.packager.windows
-import sbt._
-import sbt.Keys.{mappings, name, packageBin, sourceDirectory, streams, target, version}
+import sbt.{*, given}
+import sbt.Keys.{fileConverter, mappings, name, packageBin, sourceDirectory, streams, target, version}
import com.typesafe.sbt.SbtNativePackager.Universal
import com.typesafe.sbt.packager.Keys.{maintainer, packageDescription, packageName, packageSummary}
import com.typesafe.sbt.packager.universal.UniversalPlugin
-import com.typesafe.sbt.packager.Compat._
+import com.typesafe.sbt.packager.Compat.*
+import com.typesafe.sbt.packager.PluginCompat
import com.typesafe.sbt.packager.SettingsHelper
import com.typesafe.sbt.packager.sourceDateEpoch
+import xsbti.FileConverter
/**
* ==Windows Plugin==
@@ -96,6 +98,8 @@ object WindowsPlugin extends AutoPlugin {
},
wixFiles := Seq(wixFile.value)
) ++ inConfig(Windows)(Seq(packageBin := {
+ val conv0 = fileConverter.value
+ implicit val conv: FileConverter = conv0
val wsxSources = wixFiles.value
val msi = target.value / (name.value + ".msi")
@@ -107,7 +111,7 @@ object WindowsPlugin extends AutoPlugin {
src.getAbsolutePath != dest.getAbsolutePath
}
IO.copy(wsxCopyPairs)
- IO.copy(for ((f, to) <- mappings.value) yield (f, target.value / to))
+ IO.copy(for ((f, to) <- mappings.value) yield (PluginCompat.toFile(f), target.value / to))
// Now compile WIX
val candleCmd = findWixExecutable("candle") +:
@@ -137,7 +141,7 @@ object WindowsPlugin extends AutoPlugin {
case 0 => ()
case exitCode => sys.error(s"Unable to run build msi. Exited with ${exitCode}")
}
- msi
+ PluginCompat.toFileRef(msi)
}))
/**
@@ -146,7 +150,11 @@ object WindowsPlugin extends AutoPlugin {
def mapGenericFilesToWindows: Seq[Setting[_]] =
Seq(
Windows / mappings := (Universal / mappings).value,
- wixFeatures := makeWindowsFeatures((Windows / packageName).value, (Windows / mappings).value)
+ wixFeatures := {
+ val conv0 = fileConverter.value
+ implicit val conv: FileConverter = conv0
+ makeWindowsFeatures((Windows / packageName).value, (Windows / mappings).value)
+ }
)
/**
@@ -159,12 +167,15 @@ object WindowsPlugin extends AutoPlugin {
* @return
* windows features
*/
- def makeWindowsFeatures(name: String, mappings: Seq[(File, String)]): Seq[WindowsFeature] = {
+ def makeWindowsFeatures(name: String, mappings: Seq[(PluginCompat.FileRef, String)])(implicit
+ conv: FileConverter
+ ): Seq[WindowsFeature] = {
// TODO select main script! Filter Config links!
val files =
for {
- (file, name) <- mappings
+ (ref, name) <- mappings
+ file = PluginCompat.toFile(ref)
if !file.isDirectory
} yield ComponentFile(name, editable = name startsWith "conf")
val corePackage =
@@ -185,7 +196,8 @@ object WindowsPlugin extends AutoPlugin {
components = Seq(AddDirectoryToPath("bin"))
)
val configLinks = for {
- (file, name) <- mappings
+ (ref, name) <- mappings
+ file = PluginCompat.toFile(ref)
if !file.isDirectory
if name startsWith "conf/"
} yield name.replaceAll("//", "/").stripSuffix("/").stripSuffix("/")
diff --git a/src/main/scala/com/typesafe/sbt/packager/windows/WixHelper.scala b/src/main/scala/com/typesafe/sbt/packager/windows/WixHelper.scala
index 6af48ad9f..c412c844a 100644
--- a/src/main/scala/com/typesafe/sbt/packager/windows/WixHelper.scala
+++ b/src/main/scala/com/typesafe/sbt/packager/windows/WixHelper.scala
@@ -6,6 +6,7 @@ import Keys._
import sbt._
import collection.mutable.ArrayBuffer
+import scala.annotation.nowarn
import scala.collection.mutable
case class WindowsProductInfo(
@@ -81,10 +82,13 @@ object WixHelper {
// so there was a gap and dirXml failed to create some directories
def allParentDirs(f: File): Seq[File] =
Option(f).toSeq.flatMap(f => f +: allParentDirs(f.getParentFile))
+ @nowarn
val filenamesPrep =
for {
f <- features
- ComponentFile(name, _) <- f.components
+ name <- f.components.collect{
+ case ComponentFile(name, _) => name
+ }
} yield allParentDirs(file(name))
val filenames = filenamesPrep.flatten.map(_.toString.replaceAll("\\\\", "/")).filter(_ != "")
// Now for directories...
@@ -322,7 +326,7 @@ object WixHelper {
// reference: https://github.com/sbt/sbt-native-packager/issues/726
def generateComponentsAndDirectoryXml(dir: File, id_prefix: String = ""): (Seq[String], scala.xml.Node) = {
def makeId(f: File) =
- cleanStringForId(IO.relativize(dir, f) map (id_prefix +) getOrElse (id_prefix + f.getName))
+ cleanStringForId(IO.relativize(dir, f).map(id_prefix + _).getOrElse(id_prefix + f.getName))
def handleFile(f: File): (Seq[String], scala.xml.Node) = {
val id = makeId(f)
val xml = (
diff --git a/src/sbt-test/ash/add-app-settings/build.sbt b/src/sbt-test/ash/add-app-settings/build.sbt
index 02421431c..400280e17 100644
--- a/src/sbt-test/ash/add-app-settings/build.sbt
+++ b/src/sbt-test/ash/add-app-settings/build.sbt
@@ -1,5 +1,7 @@
enablePlugins(JavaAppPackaging, AshScriptPlugin)
+scalaVersion := "2.12.20"
+
name := "simple-app"
version := "0.1.0"
diff --git a/src/sbt-test/ash/add-app-settings/test b/src/sbt-test/ash/add-app-settings/test
index b2923955e..e15e12766 100644
--- a/src/sbt-test/ash/add-app-settings/test
+++ b/src/sbt-test/ash/add-app-settings/test
@@ -1,5 +1,5 @@
# Run the staging and check the script.
> stage
-$ exists target/universal/stage/bin/simple-app
+$ exists target/**/universal/stage/bin/simple-app
> scriptCheck
> runCheck
\ No newline at end of file
diff --git a/src/sbt-test/ash/command-line-settings/build.sbt b/src/sbt-test/ash/command-line-settings/build.sbt
index 234409f2c..175da3420 100644
--- a/src/sbt-test/ash/command-line-settings/build.sbt
+++ b/src/sbt-test/ash/command-line-settings/build.sbt
@@ -1,5 +1,7 @@
enablePlugins(JavaAppPackaging, AshScriptPlugin)
+scalaVersion := "2.12.20"
+
name := "command-line-app"
version := "0.1.0-SNAPSHOT"
diff --git a/src/sbt-test/ash/command-line-settings/test b/src/sbt-test/ash/command-line-settings/test
index 9d8ebd734..cfdb3f580 100644
--- a/src/sbt-test/ash/command-line-settings/test
+++ b/src/sbt-test/ash/command-line-settings/test
@@ -1,6 +1,6 @@
# Run the staging and check the script.
> stage
-$ exists target/universal/stage/bin/command-line-app
+$ exists target/**/universal/stage/bin/command-line-app
> checkSystemProperty
> checkResidual
> checkComplexResidual
diff --git a/src/sbt-test/ash/memory-settings/test b/src/sbt-test/ash/memory-settings/test
index b2923955e..e15e12766 100644
--- a/src/sbt-test/ash/memory-settings/test
+++ b/src/sbt-test/ash/memory-settings/test
@@ -1,5 +1,5 @@
# Run the staging and check the script.
> stage
-$ exists target/universal/stage/bin/simple-app
+$ exists target/**/universal/stage/bin/simple-app
> scriptCheck
> runCheck
\ No newline at end of file
diff --git a/src/sbt-test/ash/top-level-main/build.sbt b/src/sbt-test/ash/top-level-main/build.sbt
index 0633728fc..5b50c40de 100644
--- a/src/sbt-test/ash/top-level-main/build.sbt
+++ b/src/sbt-test/ash/top-level-main/build.sbt
@@ -6,7 +6,7 @@ name := "top-level-main"
version := "0.1.0"
-scalaVersion := "3.3.3"
+scalaVersion := "3.3.4"
TaskKey[Unit]("runCheck") := {
val cwd = (Universal / stagingDirectory).value
diff --git a/src/sbt-test/ash/top-level-main/project/build.properties b/src/sbt-test/ash/top-level-main/project/build.properties
deleted file mode 100644
index 0b699c305..000000000
--- a/src/sbt-test/ash/top-level-main/project/build.properties
+++ /dev/null
@@ -1 +0,0 @@
-sbt.version=1.10.2
diff --git a/src/sbt-test/bash/java-home-var-expansion/build.sbt b/src/sbt-test/bash/java-home-var-expansion/build.sbt
index d106ba650..76d1aa90b 100644
--- a/src/sbt-test/bash/java-home-var-expansion/build.sbt
+++ b/src/sbt-test/bash/java-home-var-expansion/build.sbt
@@ -12,7 +12,7 @@ TaskKey[Unit]("runCheck") := {
val cwd = (Universal / stagingDirectory).value
// Don't check for java but it will fail since the jre is not in place
val cmd = Seq((cwd / "bin" / packageName.value).getAbsolutePath, "-v", "-no-version-check")
- val output = sys.process.Process(cmd, cwd).lines_!
+ val output = sys.process.Process(cmd, cwd).lineStream_!
val outStr = output.mkString("\n")
// Check that ${app_home} has been substitued
assert(outStr.contains("stage/bin/../jre/bin/java"), "Output didn't contain success: " + output)
diff --git a/src/sbt-test/bash/memory-settings/test b/src/sbt-test/bash/memory-settings/test
index c50f2af5e..76c0d9b29 100644
--- a/src/sbt-test/bash/memory-settings/test
+++ b/src/sbt-test/bash/memory-settings/test
@@ -1,5 +1,5 @@
# Run the staging and check the script.
> stage
-$ exists target/universal/stage/conf/application.ini
+$ exists target/**/universal/stage/conf/application.ini
> jvmoptsCheck
> runCheck
\ No newline at end of file
diff --git a/src/sbt-test/bash/multiple-apps/test b/src/sbt-test/bash/multiple-apps/test
index ad1a3b65f..5a3e852a3 100644
--- a/src/sbt-test/bash/multiple-apps/test
+++ b/src/sbt-test/bash/multiple-apps/test
@@ -1,11 +1,11 @@
# Run the staging and check the script.
> stage
-$ exists target/universal/stage/bin/main-app
-$ exists target/universal/stage/bin/second-app
+$ exists target/**/universal/stage/bin/main-app
+$ exists target/**/universal/stage/bin/second-app
> checkNoExplicitMain
> clean
-> set mainClass in Compile := Some("com.example.MainApp")
+> set Compile / mainClass := Some("com.example.MainApp")
> stage
-$ exists target/universal/stage/bin/test-project
-$ exists target/universal/stage/bin/second-app
+$ exists target/**/universal/stage/bin/test-project
+$ exists target/**/universal/stage/bin/second-app
> checkExplicitMain
\ No newline at end of file
diff --git a/src/sbt-test/bash/top-level-main/build.sbt b/src/sbt-test/bash/top-level-main/build.sbt
index 9e823aeae..6720ab9f9 100644
--- a/src/sbt-test/bash/top-level-main/build.sbt
+++ b/src/sbt-test/bash/top-level-main/build.sbt
@@ -6,7 +6,7 @@ name := "top-level-main"
version := "0.1.0"
-scalaVersion := "3.3.3"
+scalaVersion := "3.3.4"
TaskKey[Unit]("runCheck") := {
val cwd = (Universal / stagingDirectory).value
diff --git a/src/sbt-test/bash/top-level-main/project/build.properties b/src/sbt-test/bash/top-level-main/project/build.properties
deleted file mode 100644
index 0b699c305..000000000
--- a/src/sbt-test/bash/top-level-main/project/build.properties
+++ /dev/null
@@ -1 +0,0 @@
-sbt.version=1.10.2
diff --git a/src/sbt-test/debian/daemon-group-gid-deb/test b/src/sbt-test/debian/daemon-group-gid-deb/test
index 9fb9c6de2..4ffbd91ec 100644
--- a/src/sbt-test/debian/daemon-group-gid-deb/test
+++ b/src/sbt-test/debian/daemon-group-gid-deb/test
@@ -1,12 +1,12 @@
# Run the debian packaging.
> Debian/packageBin
-$ exists target/debian-test_0.1.0_all.deb
+$ exists target/**/debian-test_0.1.0_all.deb
-$ exists target/debian-test-0.1.0/etc
-$ exists target/debian-test-0.1.0/etc/init/debian-test.conf
+$ exists target/**/debian-test-0.1.0/etc
+$ exists target/**/debian-test-0.1.0/etc/init/debian-test.conf
# Check defaults
-$ exists target/debian-test-0.1.0/DEBIAN/prerm
-$ exists target/debian-test-0.1.0/DEBIAN/postinst
+$ exists target/**/debian-test-0.1.0/DEBIAN/prerm
+$ exists target/**/debian-test-0.1.0/DEBIAN/postinst
# Check files for defaults
> checkControlFiles
diff --git a/src/sbt-test/debian/daemon-user-deb/test b/src/sbt-test/debian/daemon-user-deb/test
index c4c5f8b1b..c825c6e07 100644
--- a/src/sbt-test/debian/daemon-user-deb/test
+++ b/src/sbt-test/debian/daemon-user-deb/test
@@ -1,10 +1,10 @@
# Run the debian packaging.
> Debian/packageBin
-$ exists target/debian-test_0.1.0_all.deb
+$ exists target/**/debian-test_0.1.0_all.deb
# Check defaults
-$ exists target/debian-test-0.1.0/DEBIAN/prerm
-$ exists target/debian-test-0.1.0/DEBIAN/postinst
+$ exists target/**/debian-test-0.1.0/DEBIAN/prerm
+$ exists target/**/debian-test-0.1.0/DEBIAN/postinst
# Check files for defaults
> checkControlFiles
diff --git a/src/sbt-test/debian/daemon-user-homedir-deb/test b/src/sbt-test/debian/daemon-user-homedir-deb/test
index c4c5f8b1b..c825c6e07 100644
--- a/src/sbt-test/debian/daemon-user-homedir-deb/test
+++ b/src/sbt-test/debian/daemon-user-homedir-deb/test
@@ -1,10 +1,10 @@
# Run the debian packaging.
> Debian/packageBin
-$ exists target/debian-test_0.1.0_all.deb
+$ exists target/**/debian-test_0.1.0_all.deb
# Check defaults
-$ exists target/debian-test-0.1.0/DEBIAN/prerm
-$ exists target/debian-test-0.1.0/DEBIAN/postinst
+$ exists target/**/debian-test-0.1.0/DEBIAN/prerm
+$ exists target/**/debian-test-0.1.0/DEBIAN/postinst
# Check files for defaults
> checkControlFiles
diff --git a/src/sbt-test/debian/daemon-user-shell-deb/test b/src/sbt-test/debian/daemon-user-shell-deb/test
index c4c5f8b1b..c825c6e07 100644
--- a/src/sbt-test/debian/daemon-user-shell-deb/test
+++ b/src/sbt-test/debian/daemon-user-shell-deb/test
@@ -1,10 +1,10 @@
# Run the debian packaging.
> Debian/packageBin
-$ exists target/debian-test_0.1.0_all.deb
+$ exists target/**/debian-test_0.1.0_all.deb
# Check defaults
-$ exists target/debian-test-0.1.0/DEBIAN/prerm
-$ exists target/debian-test-0.1.0/DEBIAN/postinst
+$ exists target/**/debian-test-0.1.0/DEBIAN/prerm
+$ exists target/**/debian-test-0.1.0/DEBIAN/postinst
# Check files for defaults
> checkControlFiles
diff --git a/src/sbt-test/debian/daemon-user-uid-deb/test b/src/sbt-test/debian/daemon-user-uid-deb/test
index 7a4415185..e4efedf59 100644
--- a/src/sbt-test/debian/daemon-user-uid-deb/test
+++ b/src/sbt-test/debian/daemon-user-uid-deb/test
@@ -1,12 +1,12 @@
# Run the debian packaging.
> Debian/packageBin
-$ exists target/debian-test_0.1.0_all.deb
+$ exists target/**/debian-test_0.1.0_all.deb
-$ exists target/debian-test-0.1.0/etc
+$ exists target/**/debian-test-0.1.0/etc
# Check defaults
-$ exists target/debian-test-0.1.0/DEBIAN/prerm
-$ exists target/debian-test-0.1.0/DEBIAN/postinst
+$ exists target/**/debian-test-0.1.0/DEBIAN/prerm
+$ exists target/**/debian-test-0.1.0/DEBIAN/postinst
# Check files for defaults
> checkControlFiles
diff --git a/src/sbt-test/debian/file-permissions/build.sbt b/src/sbt-test/debian/file-permissions/build.sbt
index e380a9625..0a0561ae8 100644
--- a/src/sbt-test/debian/file-permissions/build.sbt
+++ b/src/sbt-test/debian/file-permissions/build.sbt
@@ -13,4 +13,4 @@ packageDescription := """A fun package description of our software,
linuxPackageMappings += packageMapping(
((Compile / resourceDirectory).value / "sudoers.d", "/etc/sudoers.d")
-) withPerms ("0440") asDocs ()
+).withPerms("0440").asDocs()
diff --git a/src/sbt-test/debian/file-permissions/test b/src/sbt-test/debian/file-permissions/test
index b05050334..5c0f2d9e2 100644
--- a/src/sbt-test/debian/file-permissions/test
+++ b/src/sbt-test/debian/file-permissions/test
@@ -1,3 +1,3 @@
# Run the debian packaging.
> Debian/packageBin
-$ exists target/debian-test_0.1.0_all.deb
+$ exists target/**/debian-test_0.1.0_all.deb
diff --git a/src/sbt-test/debian/gen-changes/test b/src/sbt-test/debian/gen-changes/test
index ddb6fb91c..cf6df891a 100644
--- a/src/sbt-test/debian/gen-changes/test
+++ b/src/sbt-test/debian/gen-changes/test
@@ -1,4 +1,4 @@
# Run the debian packaging.
> Debian/genChanges
-$ exists target/debian-test_0.1.0_all.deb
-$ exists target/debian-test_0.1.0_all.changes
\ No newline at end of file
+$ exists target/**/debian-test_0.1.0_all.deb
+$ exists target/**/debian-test_0.1.0_all.changes
\ No newline at end of file
diff --git a/src/sbt-test/debian/java-app-archetype/build.sbt b/src/sbt-test/debian/java-app-archetype/build.sbt
index 35cc8471f..1ed76f3ee 100644
--- a/src/sbt-test/debian/java-app-archetype/build.sbt
+++ b/src/sbt-test/debian/java-app-archetype/build.sbt
@@ -25,7 +25,7 @@ TaskKey[Unit]("checkScript") := {
val scriptContents = IO.read(script)
System.err.println(scriptContents)
System.err.println("---END SCRIPT---")
- for (file <- dir.**(AllPassFilter).get)
+ for (file <- dir.**(AllPassFilter).get())
System.err.println("\t" + file)
}
val cmd = "bash " + script.getAbsolutePath + " -d"
diff --git a/src/sbt-test/debian/java-app-archetype/test b/src/sbt-test/debian/java-app-archetype/test
index ad62a9397..dd9803af0 100644
--- a/src/sbt-test/debian/java-app-archetype/test
+++ b/src/sbt-test/debian/java-app-archetype/test
@@ -1,6 +1,6 @@
# Run the debian packaging.
> Debian/packageBin
-$ exists target/debian-test_0.1.0_all.deb
+$ exists target/**/debian-test_0.1.0_all.deb
> stage
-$ exists target/universal/stage/bin/debian-test
+$ exists target/**/universal/stage/bin/debian-test
> checkScript
diff --git a/src/sbt-test/debian/jdeb-conflicts/test b/src/sbt-test/debian/jdeb-conflicts/test
index a16790d66..b2bed207d 100644
--- a/src/sbt-test/debian/jdeb-conflicts/test
+++ b/src/sbt-test/debian/jdeb-conflicts/test
@@ -1,5 +1,5 @@
# Run the debian packaging.
$ mkdir src/resources/empty
> Debian/packageBin
-$ exists target/debian-test_0.1.0_all.deb
+$ exists target/**/debian-test_0.1.0_all.deb
> checkConflicts
diff --git a/src/sbt-test/debian/jdeb-dependencies/test b/src/sbt-test/debian/jdeb-dependencies/test
index 847976fc3..7a181dab6 100644
--- a/src/sbt-test/debian/jdeb-dependencies/test
+++ b/src/sbt-test/debian/jdeb-dependencies/test
@@ -1,5 +1,5 @@
# Run the debian packaging.
$ mkdir src/resources/empty
> Debian/packageBin
-$ exists target/debian-test_0.1.0_all.deb
+$ exists target/**/debian-test_0.1.0_all.deb
> checkDependencies
diff --git a/src/sbt-test/debian/jdeb-dir-mappings/test b/src/sbt-test/debian/jdeb-dir-mappings/test
index cab429e41..ad1a4ddb5 100644
--- a/src/sbt-test/debian/jdeb-dir-mappings/test
+++ b/src/sbt-test/debian/jdeb-dir-mappings/test
@@ -1,5 +1,5 @@
# Run the debian packaging.
$ mkdir src/resources/empty
> Debian/packageBin
-$ exists target/debian-test_0.1.0_all.deb
+$ exists target/**/debian-test_0.1.0_all.deb
> checkDirMappings
diff --git a/src/sbt-test/debian/jdeb-provides/test b/src/sbt-test/debian/jdeb-provides/test
index 24e6737db..8f146a557 100644
--- a/src/sbt-test/debian/jdeb-provides/test
+++ b/src/sbt-test/debian/jdeb-provides/test
@@ -1,5 +1,5 @@
# Run the debian packaging.
$ mkdir src/resources/empty
> Debian/packageBin
-$ exists target/debian-test_0.1.0_all.deb
+$ exists target/**/debian-test_0.1.0_all.deb
> checkProvides
diff --git a/src/sbt-test/debian/jdeb-script-replacements/test b/src/sbt-test/debian/jdeb-script-replacements/test
index 2a5966d19..7178758a2 100644
--- a/src/sbt-test/debian/jdeb-script-replacements/test
+++ b/src/sbt-test/debian/jdeb-script-replacements/test
@@ -1,5 +1,5 @@
# Run the debian packaging.
$ mkdir src/resources/empty
> Debian/packageBin
-$ exists target/debian-test_0.1.0_all.deb
+$ exists target/**/debian-test_0.1.0_all.deb
> checkControlFiles
diff --git a/src/sbt-test/debian/log-directory/test b/src/sbt-test/debian/log-directory/test
index 917978b16..d7ef12ade 100644
--- a/src/sbt-test/debian/log-directory/test
+++ b/src/sbt-test/debian/log-directory/test
@@ -1,3 +1,6 @@
+# Workaround: set target folder to what it was in sbt 1.x because with sbt 2.x and project matrix target is target/out/jvm/scala-3.3.3/
+> set target := baseDirectory.value / "target"
+
# Run the debian packaging.
> Debian/packageBin
$ exists target/debian-test_0.1.0_all.deb
diff --git a/src/sbt-test/debian/native-build-compress/build.sbt b/src/sbt-test/debian/native-build-compress/build.sbt
index b2d57aa5b..99b4dd1ff 100644
--- a/src/sbt-test/debian/native-build-compress/build.sbt
+++ b/src/sbt-test/debian/native-build-compress/build.sbt
@@ -12,6 +12,6 @@ packageSummary := "Summary"
TaskKey[Unit]("checkDebCompression") := {
val deb = target.value / s"${(Debian / name).value}_${(Debian / version).value}_all.deb"
- val output = sys.process.Process(Seq("ar", "-t", deb.toString)).lines
+ val output = sys.process.Process(Seq("ar", "-t", deb.toString)).lineStream
assert(output.exists(_.startsWith("data.tar."))) // exact extension varies by dpkg-deb version
}
diff --git a/src/sbt-test/debian/native-build-default/build.sbt b/src/sbt-test/debian/native-build-default/build.sbt
index 3941a8ea0..55da34a9c 100644
--- a/src/sbt-test/debian/native-build-default/build.sbt
+++ b/src/sbt-test/debian/native-build-default/build.sbt
@@ -10,6 +10,6 @@ packageSummary := "Summary"
TaskKey[Unit]("checkDebCompression") := {
val deb = target.value / s"${(Debian / name).value}_${(Debian / version).value}_all.deb"
- val output = sys.process.Process(Seq("ar", "-t", deb.toString)).lines
+ val output = sys.process.Process(Seq("ar", "-t", deb.toString)).lineStream
assert(output.contains("data.tar"))
}
diff --git a/src/sbt-test/debian/override-control-files/test b/src/sbt-test/debian/override-control-files/test
index d5c245362..07eb83607 100644
--- a/src/sbt-test/debian/override-control-files/test
+++ b/src/sbt-test/debian/override-control-files/test
@@ -1,16 +1,16 @@
# Run the debian packaging.
> Debian/packageBin
-$ exists target/debian-test_0.1.0_all.deb
+$ exists target/**/debian-test_0.1.0_all.deb
-$ exists target/debian-test-0.1.0/etc
-$ exists target/debian-test-0.1.0/etc/default/debian-test
-$ exists target/debian-test-0.1.0/etc/init/debian-test.conf
+$ exists target/**/debian-test-0.1.0/etc
+$ exists target/**/debian-test-0.1.0/etc/default/debian-test
+$ exists target/**/debian-test-0.1.0/etc/init/debian-test.conf
# Check defaults
-$ exists target/debian-test-0.1.0/DEBIAN/preinst
-$ exists target/debian-test-0.1.0/DEBIAN/postinst
-$ exists target/debian-test-0.1.0/DEBIAN/postrm
-$ exists target/debian-test-0.1.0/DEBIAN/prerm
+$ exists target/**/debian-test-0.1.0/DEBIAN/preinst
+$ exists target/**/debian-test-0.1.0/DEBIAN/postinst
+$ exists target/**/debian-test-0.1.0/DEBIAN/postrm
+$ exists target/**/debian-test-0.1.0/DEBIAN/prerm
# Check files for defaults
> checkControlFiles
diff --git a/src/sbt-test/debian/override-etc-default/test b/src/sbt-test/debian/override-etc-default/test
index 51b2e7079..ae7c7cc42 100644
--- a/src/sbt-test/debian/override-etc-default/test
+++ b/src/sbt-test/debian/override-etc-default/test
@@ -1,6 +1,6 @@
# Run the debian packaging.
> Debian/packageBin
-$ exists target/debian-test_0.1.0_all.deb
+$ exists target/**/debian-test_0.1.0_all.deb
# Check files for defaults
> checkEtcDefault
diff --git a/src/sbt-test/debian/override-loader-functions/test b/src/sbt-test/debian/override-loader-functions/test
index 331ca8209..86315a4e1 100644
--- a/src/sbt-test/debian/override-loader-functions/test
+++ b/src/sbt-test/debian/override-loader-functions/test
@@ -1,6 +1,6 @@
# Run the debian packaging.
> Debian/packageBin
-$ exists target/debian-test_0.1.0_all.deb
+$ exists target/**/debian-test_0.1.0_all.deb
# Check files for defaults
> checkLoaderFunctions
diff --git a/src/sbt-test/debian/override-start-script-systemd/test b/src/sbt-test/debian/override-start-script-systemd/test
index ae757fd33..c91e87c67 100644
--- a/src/sbt-test/debian/override-start-script-systemd/test
+++ b/src/sbt-test/debian/override-start-script-systemd/test
@@ -1,6 +1,6 @@
# Run the debian packaging.
> Debian/packageBin
-$ exists target/debian-test_0.1.0_all.deb
+$ exists target/**/debian-test_0.1.0_all.deb
# Check files for defaults
> checkStartupScript
diff --git a/src/sbt-test/debian/override-start-script-systemv/test b/src/sbt-test/debian/override-start-script-systemv/test
index ae757fd33..c91e87c67 100644
--- a/src/sbt-test/debian/override-start-script-systemv/test
+++ b/src/sbt-test/debian/override-start-script-systemv/test
@@ -1,6 +1,6 @@
# Run the debian packaging.
> Debian/packageBin
-$ exists target/debian-test_0.1.0_all.deb
+$ exists target/**/debian-test_0.1.0_all.deb
# Check files for defaults
> checkStartupScript
diff --git a/src/sbt-test/debian/override-start-script-upstart/test b/src/sbt-test/debian/override-start-script-upstart/test
index ae757fd33..c91e87c67 100644
--- a/src/sbt-test/debian/override-start-script-upstart/test
+++ b/src/sbt-test/debian/override-start-script-upstart/test
@@ -1,6 +1,6 @@
# Run the debian packaging.
> Debian/packageBin
-$ exists target/debian-test_0.1.0_all.deb
+$ exists target/**/debian-test_0.1.0_all.deb
# Check files for defaults
> checkStartupScript
diff --git a/src/sbt-test/debian/simple-deb/test b/src/sbt-test/debian/simple-deb/test
index b05050334..5c0f2d9e2 100644
--- a/src/sbt-test/debian/simple-deb/test
+++ b/src/sbt-test/debian/simple-deb/test
@@ -1,3 +1,3 @@
# Run the debian packaging.
> Debian/packageBin
-$ exists target/debian-test_0.1.0_all.deb
+$ exists target/**/debian-test_0.1.0_all.deb
diff --git a/src/sbt-test/debian/simple-jdeb/test b/src/sbt-test/debian/simple-jdeb/test
index b05050334..5c0f2d9e2 100644
--- a/src/sbt-test/debian/simple-jdeb/test
+++ b/src/sbt-test/debian/simple-jdeb/test
@@ -1,3 +1,3 @@
# Run the debian packaging.
> Debian/packageBin
-$ exists target/debian-test_0.1.0_all.deb
+$ exists target/**/debian-test_0.1.0_all.deb
diff --git a/src/sbt-test/debian/systemd-deb/test b/src/sbt-test/debian/systemd-deb/test
index cf6e9b55f..c82c945cb 100644
--- a/src/sbt-test/debian/systemd-deb/test
+++ b/src/sbt-test/debian/systemd-deb/test
@@ -1,8 +1,8 @@
# Run the debian packaging.
> Debian/packageBin
-$ exists target/debian-test_0.1.0_all.deb
+$ exists target/**/debian-test_0.1.0_all.deb
-$ exists target/debian-test-0.1.0/lib/systemd/system/debian-test.service
+$ exists target/**/debian-test-0.1.0/lib/systemd/system/debian-test.service
> show Debian/serverLoader
> show Debian/linuxStartScriptTemplate
> plugins
diff --git a/src/sbt-test/debian/sysvinit-deb/test b/src/sbt-test/debian/sysvinit-deb/test
index 11ea2c846..599473559 100644
--- a/src/sbt-test/debian/sysvinit-deb/test
+++ b/src/sbt-test/debian/sysvinit-deb/test
@@ -1,10 +1,10 @@
# Run the debian packaging.
> Debian/packageBin
-$ exists target/debian-test_0.1.0_all.deb
+$ exists target/**/debian-test_0.1.0_all.deb
-$ exists target/debian-test-0.1.0/etc
-$ exists target/debian-test-0.1.0/etc/default/debian-test
-$ exists target/debian-test-0.1.0/etc/init.d/debian-test
+$ exists target/**/debian-test-0.1.0/etc
+$ exists target/**/debian-test-0.1.0/etc/default/debian-test
+$ exists target/**/debian-test-0.1.0/etc/init.d/debian-test
> checkControlFiles
> checkStartupScript
diff --git a/src/sbt-test/debian/sysvinit-stoptimeouts-deb/test b/src/sbt-test/debian/sysvinit-stoptimeouts-deb/test
index fc9d9fcbc..2bf41c016 100644
--- a/src/sbt-test/debian/sysvinit-stoptimeouts-deb/test
+++ b/src/sbt-test/debian/sysvinit-stoptimeouts-deb/test
@@ -1,10 +1,10 @@
# Run the debian packaging.
> Debian/packageBin
-$ exists target/debian-test_0.1.0_all.deb
+$ exists target/**/debian-test_0.1.0_all.deb
-$ exists target/debian-test-0.1.0/etc
-$ exists target/debian-test-0.1.0/etc/default/debian-test
-$ exists target/debian-test-0.1.0/etc/init.d/debian-test
+$ exists target/**/debian-test-0.1.0/etc
+$ exists target/**/debian-test-0.1.0/etc/default/debian-test
+$ exists target/**/debian-test-0.1.0/etc/init.d/debian-test
> checkControlFiles
> checkStartupScript
\ No newline at end of file
diff --git a/src/sbt-test/debian/test-executableScriptName/test b/src/sbt-test/debian/test-executableScriptName/test
index 9b57d9747..696bae05c 100644
--- a/src/sbt-test/debian/test-executableScriptName/test
+++ b/src/sbt-test/debian/test-executableScriptName/test
@@ -1,17 +1,17 @@
# Run the debian packaging.
> Debian/packageBin
-$ exists target/debian-test_0.1.0_all.deb
+$ exists target/**/debian-test_0.1.0_all.deb
# Testing the packageName configuration
-$ exists target/debian-test-0.1.0/DEBIAN
-$ exists target/debian-test-0.1.0/DEBIAN/control
+$ exists target/**/debian-test-0.1.0/DEBIAN
+$ exists target/**/debian-test-0.1.0/DEBIAN/control
# --------------------------------------------
-$ exists target/debian-test-0.1.0/usr/
-$ exists target/debian-test-0.1.0/usr/share/
-$ exists target/debian-test-0.1.0/usr/share/debian-test/
-$ exists target/debian-test-0.1.0/usr/share/debian-test/bin/
-$ exists target/debian-test-0.1.0/usr/share/debian-test/bin/debian-exec
-$ exists target/debian-test-0.1.0/var/log/debian-test/
-$ exists target/debian-test-0.1.0/etc/default/debian-test/
+$ exists target/**/debian-test-0.1.0/usr/
+$ exists target/**/debian-test-0.1.0/usr/share/
+$ exists target/**/debian-test-0.1.0/usr/share/debian-test/
+$ exists target/**/debian-test-0.1.0/usr/share/debian-test/bin/
+$ exists target/**/debian-test-0.1.0/usr/share/debian-test/bin/debian-exec
+$ exists target/**/debian-test-0.1.0/var/log/debian-test/
+$ exists target/**/debian-test-0.1.0/etc/default/debian-test/
# --------------------------------------------
-$ exists target/debian-test-0.1.0/etc/init/debian-test.conf
+$ exists target/**/debian-test-0.1.0/etc/init/debian-test.conf
> checkUpstartScript
diff --git a/src/sbt-test/debian/test-mapping-helpers/test b/src/sbt-test/debian/test-mapping-helpers/test
index 0dfe174ee..de91214bf 100644
--- a/src/sbt-test/debian/test-mapping-helpers/test
+++ b/src/sbt-test/debian/test-mapping-helpers/test
@@ -1,12 +1,12 @@
# Run the debian packaging.
> Debian/packageBin
-$ exists target/debian-test_0.1.0_all.deb
+$ exists target/**/debian-test_0.1.0_all.deb
# Template directories
-$ exists target/debian-test-0.1.0/opt/test/debian-test
-$ exists target/debian-test-0.1.0/opt/test/other
+$ exists target/**/debian-test-0.1.0/opt/test/debian-test
+$ exists target/**/debian-test-0.1.0/opt/test/other
# Directories with content
-$ exists target/debian-test-0.1.0/usr/share/conf
-$ exists target/debian-test-0.1.0/usr/share/conf/application.conf
-$ exists target/debian-test-0.1.0/usr/share/conf/log4j.properties
+$ exists target/**/debian-test-0.1.0/usr/share/conf
+$ exists target/**/debian-test-0.1.0/usr/share/conf/application.conf
+$ exists target/**/debian-test-0.1.0/usr/share/conf/log4j.properties
diff --git a/src/sbt-test/debian/test-mapping/test b/src/sbt-test/debian/test-mapping/test
index 4330fc6ca..f37638f31 100644
--- a/src/sbt-test/debian/test-mapping/test
+++ b/src/sbt-test/debian/test-mapping/test
@@ -1,12 +1,12 @@
# Run the debian packaging.
> Debian/packageBin
-$ exists target/debian-test-override_0.1.0_all.deb
+$ exists target/**/debian-test-override_0.1.0_all.deb
# Testing the packageName configuration
-$ exists target/debian-test-override-0.1.0/DEBIAN
-$ exists target/debian-test-override-0.1.0/DEBIAN/control
+$ exists target/**/debian-test-override-0.1.0/DEBIAN
+$ exists target/**/debian-test-override-0.1.0/DEBIAN/control
> checkControlScript
-$ exists target/debian-test-override-0.1.0/usr/
-$ exists target/debian-test-override-0.1.0/usr/share/
-$ exists target/debian-test-override-0.1.0/usr/share/debian-test-package/
-# Testing control script
+$ exists target/**/debian-test-override-0.1.0/usr/
+$ exists target/**/debian-test-override-0.1.0/usr/share/
+$ exists target/**/debian-test-override-0.1.0/usr/share/debian-test-package/
+# Testing control script
# TODO - Test that the generic mapping did the right thing.
diff --git a/src/sbt-test/debian/test-packageName/test b/src/sbt-test/debian/test-packageName/test
index 1d34c9488..46626a798 100644
--- a/src/sbt-test/debian/test-packageName/test
+++ b/src/sbt-test/debian/test-packageName/test
@@ -1,14 +1,14 @@
# Run the debian packaging.
> Debian/packageBin
-$ exists target/debian-test-override_0.1.0_all.deb
+$ exists target/**/debian-test-override_0.1.0_all.deb
# Testing the packageName configuration
-$ exists target/debian-test-override-0.1.0/DEBIAN
-$ exists target/debian-test-override-0.1.0/DEBIAN/control
+$ exists target/**/debian-test-override-0.1.0/DEBIAN
+$ exists target/**/debian-test-override-0.1.0/DEBIAN/control
> checkControlScript
-$ exists target/debian-test-override-0.1.0/usr/
-$ exists target/debian-test-override-0.1.0/usr/share/
-$ exists target/debian-test-override-0.1.0/usr/share/debian-test-package/
-$ exists target/debian-test-override-0.1.0/var/log/debian-test-package/
-$ exists target/debian-test-override-0.1.0/etc/default/debian-test-package/
-# Testing control script
+$ exists target/**/debian-test-override-0.1.0/usr/
+$ exists target/**/debian-test-override-0.1.0/usr/share/
+$ exists target/**/debian-test-override-0.1.0/usr/share/debian-test-package/
+$ exists target/**/debian-test-override-0.1.0/var/log/debian-test-package/
+$ exists target/**/debian-test-override-0.1.0/etc/default/debian-test-package/
+# Testing control script
# TODO - Test that the generic mapping did the right thing.
diff --git a/src/sbt-test/debian/upstart-deb-facilities/test b/src/sbt-test/debian/upstart-deb-facilities/test
index 09e8a4ef0..a7b48ebef 100644
--- a/src/sbt-test/debian/upstart-deb-facilities/test
+++ b/src/sbt-test/debian/upstart-deb-facilities/test
@@ -1,3 +1,6 @@
+# Workaround: set target folder to what it was in sbt 1.x because with sbt 2.x and project matrix target is target/out/jvm/scala-3.3.3/
+> set target := baseDirectory.value / "target"
+
# Run the debian packaging.
> Debian/packageBin
$ exists target/debian-test_0.1.0_all.deb
diff --git a/src/sbt-test/debian/upstart-deb/test b/src/sbt-test/debian/upstart-deb/test
index 873e31ddb..81d628118 100644
--- a/src/sbt-test/debian/upstart-deb/test
+++ b/src/sbt-test/debian/upstart-deb/test
@@ -1,14 +1,17 @@
+# Workaround: set target folder to what it was in sbt 1.x because with sbt 2.x and project matrix target is target/out/jvm/scala-3.3.3/
+> set target := baseDirectory.value / "target"
+
# Run the debian packaging.
> Debian/packageBin
-$ exists target/debian-test_0.1.0_all.deb
+$ exists target/**/debian-test_0.1.0_all.deb
-$ exists target/debian-test-0.1.0/etc
-$ exists target/debian-test-0.1.0/etc/default/debian-test
-$ exists target/debian-test-0.1.0/etc/init/debian-test.conf
+$ exists target/**/debian-test-0.1.0/etc
+$ exists target/**/debian-test-0.1.0/etc/default/debian-test
+$ exists target/**/debian-test-0.1.0/etc/init/debian-test.conf
# Check defaults
-$ exists target/debian-test-0.1.0/DEBIAN/prerm
-$ exists target/debian-test-0.1.0/DEBIAN/postinst
+$ exists target/**/debian-test-0.1.0/DEBIAN/prerm
+$ exists target/**/debian-test-0.1.0/DEBIAN/postinst
# Check files for defaults
> checkControlFiles
diff --git a/src/sbt-test/docker/build-command/build.sbt b/src/sbt-test/docker/build-command/build.sbt
index a12111e74..85254dccf 100644
--- a/src/sbt-test/docker/build-command/build.sbt
+++ b/src/sbt-test/docker/build-command/build.sbt
@@ -1,9 +1,15 @@
+import xsbti.FileConverter
+import com.typesafe.sbt.packager.PluginCompat
+import NativePackagerHelper._
+
enablePlugins(JavaAppPackaging)
name := "docker-build-command-test"
version := "0.1.0"
-import NativePackagerHelper._
-Docker / mappings ++= directory("src/main/resources/docker-test")
+Docker / mappings ++= {
+ implicit val converter: FileConverter = fileConverter.value
+ PluginCompat.toFileRefsMapping(directory("src/main/resources/docker-test"))
+}
dockerBuildCommand := Seq("docker", "build", "-t", "docker-build-command-test:0.1.0", "docker-test/")
diff --git a/src/sbt-test/docker/entrypoint/test b/src/sbt-test/docker/entrypoint/test
index 3f913d21e..0ca60277a 100644
--- a/src/sbt-test/docker/entrypoint/test
+++ b/src/sbt-test/docker/entrypoint/test
@@ -1,3 +1,6 @@
+# Workaround: set target folder to what it was in sbt 1.x because with sbt 2.x and project matrix target is target/out/jvm/scala-3.3.3/
+> set target := baseDirectory.value / "target"
+
# Stage the distribution and ensure files show up.
> Docker/stage
$ exec grep -q -F 'ENTRYPOINT ["/bin/sh", "-c", "env"]' target/docker/stage/Dockerfile
diff --git a/src/sbt-test/docker/multiple-main-classes/test b/src/sbt-test/docker/multiple-main-classes/test
index 879c86277..221c97937 100644
--- a/src/sbt-test/docker/multiple-main-classes/test
+++ b/src/sbt-test/docker/multiple-main-classes/test
@@ -1,3 +1,6 @@
+# Workaround: set target folder to what it was in sbt 1.x because with sbt 2.x and project matrix target is target/out/jvm/scala-3.3.3/
+> set target := baseDirectory.value / "target"
+
# Stage the distribution and ensure files show up.
> Docker/stage
$ exec grep -q -F 'RUN ["chmod", "u+x,g+x", "/4/opt/docker/bin/multi-main-name"]' target/docker/stage/Dockerfile
diff --git a/src/sbt-test/docker/ports/test b/src/sbt-test/docker/ports/test
index 7b5cb4802..21b28e162 100644
--- a/src/sbt-test/docker/ports/test
+++ b/src/sbt-test/docker/ports/test
@@ -1,3 +1,6 @@
+# Workaround: set target folder to what it was in sbt 1.x because with sbt 2.x and project matrix target is target/out/jvm/scala-3.3.3/
+> set target := baseDirectory.value / "target"
+
# Stage the distribution and ensure files show up.
> Docker/stage
$ exec grep -q -F 'EXPOSE 9000 9001 10000/udp 10001/udp' target/docker/stage/Dockerfile
diff --git a/src/sbt-test/docker/staging/test b/src/sbt-test/docker/staging/test
index 311010877..23bf201f1 100644
--- a/src/sbt-test/docker/staging/test
+++ b/src/sbt-test/docker/staging/test
@@ -1,3 +1,6 @@
+# Workaround: set target folder to what it was in sbt 1.x because with sbt 2.x and project matrix target is target/out/jvm/scala-3.3.3/
+> set target := baseDirectory.value / "target"
+
# Stage the distribution and ensure files show up.
> Docker/stage
$ exists target/docker/stage/Dockerfile
diff --git a/src/sbt-test/docker/test-executableScriptName/test b/src/sbt-test/docker/test-executableScriptName/test
index c593baf3f..4d8a9cfe9 100644
--- a/src/sbt-test/docker/test-executableScriptName/test
+++ b/src/sbt-test/docker/test-executableScriptName/test
@@ -1,3 +1,6 @@
+# Workaround: set target folder to what it was in sbt 1.x because with sbt 2.x and project matrix target is target/out/jvm/scala-3.3.3/
+> set target := baseDirectory.value / "target"
+
# Generate the Docker image locally
> Docker/publishLocal
$ exists target/docker/stage/Dockerfile
diff --git a/src/sbt-test/docker/test-layer-groups/build.sbt b/src/sbt-test/docker/test-layer-groups/build.sbt
index 52dac99fe..80762fd37 100644
--- a/src/sbt-test/docker/test-layer-groups/build.sbt
+++ b/src/sbt-test/docker/test-layer-groups/build.sbt
@@ -1,13 +1,21 @@
+import com.typesafe.sbt.packager.PluginCompat
+import xsbti.FileConverter
+
enablePlugins(JavaAppPackaging)
organization := "com.example"
name := "docker-groups"
version := "0.1.0"
-Docker / dockerPackageMappings ++= Seq(
- (baseDirectory.value / "docker" / "spark-env.sh") -> "/opt/docker/spark/spark-env.sh",
- (baseDirectory.value / "docker" / "log4j.properties") -> "/opt/docker/other/log4j.properties"
-)
+Docker / dockerPackageMappings ++= {
+ implicit val converter: FileConverter = fileConverter.value
+ PluginCompat.toFileRefsMapping(
+ Seq(
+ (baseDirectory.value / "docker" / "spark-env.sh") -> "/opt/docker/spark/spark-env.sh",
+ (baseDirectory.value / "docker" / "log4j.properties") -> "/opt/docker/other/log4j.properties"
+ )
+ )
+}
libraryDependencies += "org.slf4j" % "slf4j-api" % "1.7.30"
diff --git a/src/sbt-test/docker/test-layer-groups/test b/src/sbt-test/docker/test-layer-groups/test
index 3b7bddef6..0fab32ca0 100644
--- a/src/sbt-test/docker/test-layer-groups/test
+++ b/src/sbt-test/docker/test-layer-groups/test
@@ -1,3 +1,6 @@
+# Workaround: set target folder to what it was in sbt 1.x because with sbt 2.x and project matrix target is target/out/jvm/scala-3.3.3/
+> set target := baseDirectory.value / "target"
+
# Generate the Docker image locally
> Docker/publishLocal
$ exists target/docker/stage/Dockerfile
@@ -16,6 +19,8 @@ $ exec bash -c 'docker rmi docker-groups:0.1.0'
$ copy-file changes/nolayers.sbt layers.sbt
> reload
+# Workaround: set target folder to what it was in sbt 1.x because with sbt 2.x and project matrix target is target/out/jvm/scala-3.3.3/
+> set target := baseDirectory.value / "target"
> clean
> Docker/publishLocal
$ exists target/docker/stage/opt/docker/bin
diff --git a/src/sbt-test/docker/test-packageName-universal/test b/src/sbt-test/docker/test-packageName-universal/test
index 8a402aa2c..bf22c9933 100644
--- a/src/sbt-test/docker/test-packageName-universal/test
+++ b/src/sbt-test/docker/test-packageName-universal/test
@@ -1,3 +1,6 @@
+# Workaround: set target folder to what it was in sbt 1.x because with sbt 2.x and project matrix target is target/out/jvm/scala-3.3.3/
+> set target := baseDirectory.value / "target"
+
# Generate the Docker image locally
> Docker/publishLocal
$ exists target/docker/stage/Dockerfile
diff --git a/src/sbt-test/docker/test-packageName/test b/src/sbt-test/docker/test-packageName/test
index 8a402aa2c..bf22c9933 100644
--- a/src/sbt-test/docker/test-packageName/test
+++ b/src/sbt-test/docker/test-packageName/test
@@ -1,3 +1,6 @@
+# Workaround: set target folder to what it was in sbt 1.x because with sbt 2.x and project matrix target is target/out/jvm/scala-3.3.3/
+> set target := baseDirectory.value / "target"
+
# Generate the Docker image locally
> Docker/publishLocal
$ exists target/docker/stage/Dockerfile
diff --git a/src/sbt-test/docker/udp-only-ports/test b/src/sbt-test/docker/udp-only-ports/test
index ce429756d..bb754c9c0 100644
--- a/src/sbt-test/docker/udp-only-ports/test
+++ b/src/sbt-test/docker/udp-only-ports/test
@@ -1,3 +1,6 @@
+# Workaround: set target folder to what it was in sbt 1.x because with sbt 2.x and project matrix target is target/out/jvm/scala-3.3.3/
+> set target := baseDirectory.value / "target"
+
# Stage the distribution and ensure files show up.
> Docker/stage
$ exec grep -q -F 'EXPOSE 10000/udp 10001/udp' target/docker/stage/Dockerfile
diff --git a/src/sbt-test/docker/volumes/test b/src/sbt-test/docker/volumes/test
index ae85d3124..3e3b388e8 100644
--- a/src/sbt-test/docker/volumes/test
+++ b/src/sbt-test/docker/volumes/test
@@ -1,3 +1,6 @@
+# Workaround: set target folder to what it was in sbt 1.x because with sbt 2.x and project matrix target is target/out/jvm/scala-3.3.3/
+> set target := baseDirectory.value / "target"
+
# Stage the distribution and ensure files show up.
> Docker/stage
$ exec grep -q -F 'VOLUME ["/opt/docker/logs", "/opt/docker/config"]' target/docker/stage/Dockerfile
diff --git a/src/sbt-test/graalvm-native-image/docker-native-image/test b/src/sbt-test/graalvm-native-image/docker-native-image/test
index f2d97592c..489c46e33 100644
--- a/src/sbt-test/graalvm-native-image/docker-native-image/test
+++ b/src/sbt-test/graalvm-native-image/docker-native-image/test
@@ -1,3 +1,6 @@
+# Workaround: set target folder to what it was in sbt 1.x because with sbt 2.x and project matrix target is target/out/jvm/scala-3.3.3/
+> set target := baseDirectory.value / "target"
+
# Generate the GraalVM native image
> show GraalVMNativeImage/packageBin
$ exec bash -c 'target/graalvm-native-image/docker-test | grep -q "Hello Graal"'
diff --git a/src/sbt-test/graalvm-native-image/simple-native-image/test b/src/sbt-test/graalvm-native-image/simple-native-image/test
index 63db2d82a..d1304ba87 100644
--- a/src/sbt-test/graalvm-native-image/simple-native-image/test
+++ b/src/sbt-test/graalvm-native-image/simple-native-image/test
@@ -1,3 +1,6 @@
+# Workaround: set target folder to what it was in sbt 1.x because with sbt 2.x and project matrix target is target/out/jvm/scala-3.3.3/
+> set target := baseDirectory.value / "target"
+
# Generate the GraalVM native image
> show GraalVMNativeImage/packageBin
$ exec bash -c 'target/graalvm-native-image/simple-test | grep -q "Hello Graal"'
diff --git a/src/sbt-test/jar/classpath-jar/build.sbt b/src/sbt-test/jar/classpath-jar/build.sbt
index 9b644b2c1..ccebd3caf 100644
--- a/src/sbt-test/jar/classpath-jar/build.sbt
+++ b/src/sbt-test/jar/classpath-jar/build.sbt
@@ -15,7 +15,7 @@ TaskKey[Unit]("checkClasspath") := {
assert(bat contains "set \"APP_CLASSPATH=%APP_LIB_DIR%\\classpath-jar-test.classpath-jar-test-0.1.0-classpath.jar\"")
val jar = new java.util.jar.JarFile(dir / "lib" / "classpath-jar-test.classpath-jar-test-0.1.0-classpath.jar")
assert(jar.getManifest().getMainAttributes().getValue("Class-Path") contains "com.typesafe.config")
- jar close
+ jar.close()
}
TaskKey[Unit]("runCheck") := {
diff --git a/src/sbt-test/jar/classpath-jar/test b/src/sbt-test/jar/classpath-jar/test
index e55f12b4f..db6cc0fc7 100644
--- a/src/sbt-test/jar/classpath-jar/test
+++ b/src/sbt-test/jar/classpath-jar/test
@@ -1,3 +1,6 @@
+# Workaround: set target folder to what it was in sbt 1.x because with sbt 2.x and project matrix target is target/out/jvm/scala-3.3.3/
+> set target := baseDirectory.value / "target"
+
# Run the staging and check the script.
> stage
$ exists target/universal/stage/lib/classpath-jar-test.classpath-jar-test-0.1.0-classpath.jar
diff --git a/src/sbt-test/jar/launcher-jar with spaces/build.sbt b/src/sbt-test/jar/launcher-jar with spaces/build.sbt
index d5cd2678a..7073364c5 100644
--- a/src/sbt-test/jar/launcher-jar with spaces/build.sbt
+++ b/src/sbt-test/jar/launcher-jar with spaces/build.sbt
@@ -31,7 +31,7 @@ TaskKey[Unit]("checkClasspath") := {
attributes.getValue("Main-Class").toString() contains "test.Test",
"MANIFEST Main-Class should contain test.Test:\n" + attributes.getValue("Main-Class").toString()
)
- jar close
+ jar.close()
}
TaskKey[Unit]("runCheck") := {
diff --git a/src/sbt-test/jar/launcher-jar with spaces/test b/src/sbt-test/jar/launcher-jar with spaces/test
index 09c0d76d8..8c4f2b779 100644
--- a/src/sbt-test/jar/launcher-jar with spaces/test
+++ b/src/sbt-test/jar/launcher-jar with spaces/test
@@ -1,3 +1,6 @@
+# Workaround: set target folder to what it was in sbt 1.x because with sbt 2.x and project matrix target is target/out/jvm/scala-3.3.3/
+> set target := baseDirectory.value / "target"
+
# Run the staging and check the script.
> stage
$ exists target/universal/stage/lib/launcher-jar-test.launcher-jar-test-0.1.0-launcher.jar
diff --git a/src/sbt-test/jar/launcher-jar/build.sbt b/src/sbt-test/jar/launcher-jar/build.sbt
index 057c6a579..adb983780 100644
--- a/src/sbt-test/jar/launcher-jar/build.sbt
+++ b/src/sbt-test/jar/launcher-jar/build.sbt
@@ -33,7 +33,7 @@ TaskKey[Unit]("checkClasspath") := {
attributes.getValue("Main-Class") contains "test.Test",
"MANIFEST Main-Class should contain test.Test:\n" + attributes.getValue("Main-Class")
)
- jar close
+ jar.close()
}
TaskKey[Unit]("runCheck") := {
diff --git a/src/sbt-test/jar/launcher-jar/test b/src/sbt-test/jar/launcher-jar/test
index 09c0d76d8..8c4f2b779 100644
--- a/src/sbt-test/jar/launcher-jar/test
+++ b/src/sbt-test/jar/launcher-jar/test
@@ -1,3 +1,6 @@
+# Workaround: set target folder to what it was in sbt 1.x because with sbt 2.x and project matrix target is target/out/jvm/scala-3.3.3/
+> set target := baseDirectory.value / "target"
+
# Run the staging and check the script.
> stage
$ exists target/universal/stage/lib/launcher-jar-test.launcher-jar-test-0.1.0-launcher.jar
diff --git a/src/sbt-test/jdkpackager/test-package-image/build.sbt b/src/sbt-test/jdkpackager/test-package-image/build.sbt
index 584055a81..62e415b52 100644
--- a/src/sbt-test/jdkpackager/test-package-image/build.sbt
+++ b/src/sbt-test/jdkpackager/test-package-image/build.sbt
@@ -35,14 +35,14 @@ lazy val iconGlob = sys.props("os.name").toLowerCase match {
case _ => "*.png"
}
-jdkAppIcon := (baseDirectory.value / ".." / ".." / ".." / ".." / "test-project-jdkpackager" ** iconGlob).getPaths.headOption
+jdkAppIcon := (baseDirectory.value / ".." / ".." / ".." / ".." / "test-project-jdkpackager" ** iconGlob).getPaths().headOption
.map(file)
TaskKey[Unit]("checkImage") := {
val (extension, os) = sys.props("os.name").toLowerCase match {
- case osys if osys.contains("mac") => (".app", 'mac)
- case osys if osys.contains("win") => (".exe", 'windows)
- case _ => ("", 'linux)
+ case osys if osys.contains("mac") => ("", "mac")
+ case osys if osys.contains("win") => (".exe", "windows")
+ case _ => ("", "linux")
}
val expectedImage = (JDKPackager / target).value / "bundles" / (name.value + extension)
println(s"Checking for '${expectedImage.getAbsolutePath}'")
diff --git a/src/sbt-test/jdkpackager/test-package-mappings/build.sbt b/src/sbt-test/jdkpackager/test-package-mappings/build.sbt
index d9caeea9f..09318d7fb 100644
--- a/src/sbt-test/jdkpackager/test-package-mappings/build.sbt
+++ b/src/sbt-test/jdkpackager/test-package-mappings/build.sbt
@@ -1,3 +1,8 @@
+import com.typesafe.sbt.packager.PluginCompat
+
+import NativePackagerHelper._
+import xsbti.FileConverter
+
enablePlugins(JDKPackagerPlugin)
name := "JDKPackagerPluginTest"
@@ -16,11 +21,9 @@ packageDescription := "Test JDKPackagerPlugin with mappings"
jdkPackagerType := "image"
-Universal / mappings += baseDirectory.value / "src" / "deploy" / "README.md" -> "README.md"
-
Universal / mappings ++= {
- val dir = baseDirectory.value / "src" / "deploy" / "stuff"
- (dir.**(AllPassFilter) --- dir) pair (file => IO.relativize(dir.getParentFile, file))
+ implicit val converter: FileConverter = fileConverter.value
+ PluginCompat.toFileRefsMapping(directory(baseDirectory.value / "src" / "deploy"))
}
lazy val iconGlob = sys.props("os.name").toLowerCase match {
@@ -29,21 +32,21 @@ lazy val iconGlob = sys.props("os.name").toLowerCase match {
case _ => "*.png"
}
-jdkAppIcon := (baseDirectory.value / ".." / ".." / ".." / ".." / "test-project-jdkpackager" ** iconGlob).getPaths.headOption
+jdkAppIcon := (baseDirectory.value / ".." / ".." / ".." / ".." / "test-project-jdkpackager" ** iconGlob).getPaths().headOption
.map(file)
TaskKey[Unit]("checkImage") := {
val (extension, os) = sys.props("os.name").toLowerCase match {
- case osys if osys.contains("mac") => (".app", 'mac)
- case osys if osys.contains("win") => (".exe", 'windows)
- case _ => ("", 'linux)
+ case osys if osys.contains("mac") => ("", "mac")
+ case osys if osys.contains("win") => (".exe", "windows")
+ case _ => ("", "linux")
}
val expectedImage = (JDKPackager / target).value / "bundles" / (name.value + extension)
println(s"Checking for '${expectedImage.getAbsolutePath}'")
assert(expectedImage.exists, s"Expected image file to be found at '$expectedImage'")
val files = os match {
- case 'mac =>
+ case "mac" =>
Seq(
expectedImage / "Contents" / "Java" / "README.md",
expectedImage / "Contents" / "Java" / "stuff" / "something-1.md",
diff --git a/src/sbt-test/jlink/test-jlink-minimal/build.sbt b/src/sbt-test/jlink/test-jlink-minimal/build.sbt
index d40155302..db80b5a12 100644
--- a/src/sbt-test/jlink/test-jlink-minimal/build.sbt
+++ b/src/sbt-test/jlink/test-jlink-minimal/build.sbt
@@ -2,6 +2,8 @@
import scala.sys.process.Process
import com.typesafe.sbt.packager.Compat._
+import com.typesafe.sbt.packager.PluginCompat
+import xsbti.FileConverter
enablePlugins(JlinkPlugin, ClasspathJarPlugin, BashStartScriptPlugin, BatStartScriptPlugin)
@@ -10,6 +12,7 @@ autoScalaLibrary := false
(Compile / packageDoc / mappings) := Seq()
TaskKey[Unit]("runChecks") := {
+ implicit val converter: FileConverter = fileConverter.value
val log = streams.value.log
def run(exe: String, args: Seq[String]): String = {
@@ -18,9 +21,9 @@ TaskKey[Unit]("runChecks") := {
}
val (extension, os) = sys.props("os.name").toLowerCase match {
- case os if os.contains("mac") => (".app", 'mac)
- case os if os.contains("win") => (".exe", 'windows)
- case _ => ("", 'linux)
+ case os if os.contains("mac") => ("", "mac")
+ case os if os.contains("win") => (".exe", "windows")
+ case _ => ("", "linux")
}
val stageDir = (Universal / stagingDirectory).value
@@ -32,13 +35,13 @@ TaskKey[Unit]("runChecks") := {
log.info(s"Produced image:\n$releaseInfo")
// Run the application directly.
- val classpathJar = (stageDir / "lib" / packageJavaClasspathJar.value.getName).getAbsolutePath
+ val classpathJar = (stageDir / "lib" / PluginCompat.toFile(packageJavaClasspathJar.value).getName).getAbsolutePath
run(javaExe, Seq("-cp", classpathJar, "JlinkTestApp"))
// Make sure the scripts use the correct JVM
val startScripts = (os match {
- case 'windows => makeBatScripts.value.map(_._2)
- case _ => makeBashScripts.value.map(_._2)
+ case "windows" => makeBatScripts.value.map(_._2)
+ case _ => makeBashScripts.value.map(_._2)
}).map(s => (stageDir / s).getAbsolutePath)
startScripts.foreach { script =>
diff --git a/src/sbt-test/jlink/test-jlink-minimal/test b/src/sbt-test/jlink/test-jlink-minimal/test
index 6f5cb2a07..e7518bada 100644
--- a/src/sbt-test/jlink/test-jlink-minimal/test
+++ b/src/sbt-test/jlink/test-jlink-minimal/test
@@ -1,3 +1,6 @@
+# Workaround: set target folder to what it was in sbt 1.x because with sbt 2.x and project matrix target is target/out/jvm/scala-3.3.3/
+> set target := baseDirectory.value / "target"
+
# Run the jlink packaging
> stage
> runChecks
\ No newline at end of file
diff --git a/src/sbt-test/jlink/test-jlink-misc/build.sbt b/src/sbt-test/jlink/test-jlink-misc/build.sbt
index 8afe6f765..9b33b033b 100644
--- a/src/sbt-test/jlink/test-jlink-misc/build.sbt
+++ b/src/sbt-test/jlink/test-jlink-misc/build.sbt
@@ -3,6 +3,8 @@
import scala.sys.process.Process
import com.typesafe.sbt.packager.Compat._
+import com.typesafe.sbt.packager.PluginCompat
+import xsbti.FileConverter
val runChecks = taskKey[Unit]("Run checks for a specific issue")
val runFailingChecks = taskKey[Unit]("Run checks for a specific issue, expecting them to fail")
@@ -29,10 +31,11 @@ val issue1247BadAutoModuleName = project
.enablePlugins(JlinkPlugin)
.settings(
Compile / managedClasspath += {
+ implicit val converter: FileConverter = fileConverter.value
// Build an empty jar with an unsupported name
val jarFile = target.value / "foo_2.11.jar"
IO.jar(Nil, jarFile, new java.util.jar.Manifest)
- Attributed.blank(jarFile)
+ Attributed.blank(PluginCompat.toFileRef(jarFile))
},
runChecks := jlinkBuildImage.value
)
@@ -72,7 +75,7 @@ val issue1266 = project
libraryDependencies += "com.sun.xml.fastinfoset" % "FastInfoset" % "1.2.16",
// A lot of "dummy" dependencies, so that the resulting classpath is over
// the command line limit (2MB on my machine)
- Compile / unmanagedJars ++= {
+ jlinkModulePath ++= {
def mkPath(ix: Int) = target.value / s"there-is-no-such-file-$ix.jar"
1.to(300000).map(mkPath)
@@ -105,16 +108,20 @@ val issue1293 = project
jlinkIgnoreMissingDependency := JlinkIgnore.everything,
// Use `paramaner` (and only it) as an automatic module
jlinkModulePath := {
+ implicit val converter: FileConverter = fileConverter.value
// Get the full classpath with all the resolved dependencies.
(jlinkBuildImage / fullClasspath).value
// Find the ones that have `paranamer` as their artifact names.
.filter { item =>
- item.get(moduleID.key).exists { modId =>
- modId.name == "paranamer"
- }
+ item.get(PluginCompat.moduleIDStr)
+ .map(PluginCompat.parseModuleIDStrAttribute)
+ .exists { modId =>
+ modId.name == "paranamer"
+ }
}
// Get raw `File` objects.
.map(_.data)
+ .map(PluginCompat.toFile)
},
runChecks := jlinkBuildImage.value
)
diff --git a/src/sbt-test/jlink/test-jlink-misc/test b/src/sbt-test/jlink/test-jlink-misc/test
index 762cc7900..5bdca8ed8 100644
--- a/src/sbt-test/jlink/test-jlink-misc/test
+++ b/src/sbt-test/jlink/test-jlink-misc/test
@@ -1,3 +1,6 @@
+# Workaround: set target folder to what it was in sbt 1.x because with sbt 2.x and project matrix target is target/out/jvm/scala-3.3.3/
+> set target := baseDirectory.value / "target"
+
# These tasks can be aggregated, but running them one by one means
# more granular output in case of a failure.
> issue1243/runChecks
@@ -6,4 +9,6 @@
> issue1247JakartaJavaModules/runChecks
> issue1266/runChecks
-> issue1284/runFailingChecks
+> show issue1293/jlinkBuildImage/fullClasspath
+> show issue1293/jlinkModulePath
> issue1293/runChecks
\ No newline at end of file
diff --git a/src/sbt-test/jlink/test-jlink-missing-deps/test b/src/sbt-test/jlink/test-jlink-missing-deps/test
index 13c322ed0..eef096b12 100644
--- a/src/sbt-test/jlink/test-jlink-missing-deps/test
+++ b/src/sbt-test/jlink/test-jlink-missing-deps/test
@@ -1,3 +1,6 @@
+# Workaround: set target folder to what it was in sbt 1.x because with sbt 2.x and project matrix target is target/out/jvm/scala-3.3.3/
+> set target := baseDirectory.value / "target"
+
> compile
# Should fail since we have a missing dependency.
-> withoutIgnore/jlinkBuildImage
diff --git a/src/sbt-test/rpm/changelog-test/test b/src/sbt-test/rpm/changelog-test/test
index f72019964..9a76759be 100644
--- a/src/sbt-test/rpm/changelog-test/test
+++ b/src/sbt-test/rpm/changelog-test/test
@@ -1,7 +1,7 @@
# Run the debian packaging.
> Rpm/packageBin
-$ exists target/rpm/RPMS/noarch/rpm-test-0.1.0-1.noarch.rpm
-$ exists target/rpm/SPECS/rpm-test.spec
+$ exists target/**/rpm/RPMS/noarch/rpm-test-0.1.0-1.noarch.rpm
+$ exists target/**/rpm/SPECS/rpm-test.spec
# Check files for defaults
> checkSpecFile
diff --git a/src/sbt-test/rpm/config-no-replace/build.sbt b/src/sbt-test/rpm/config-no-replace/build.sbt
index 772876a33..1e19bc932 100644
--- a/src/sbt-test/rpm/config-no-replace/build.sbt
+++ b/src/sbt-test/rpm/config-no-replace/build.sbt
@@ -1,4 +1,6 @@
import com.typesafe.sbt.packager.Compat._
+import com.typesafe.sbt.packager.PluginCompat
+import xsbti.FileConverter
enablePlugins(RpmPlugin)
@@ -26,7 +28,8 @@ Rpm / packageArchitecture := "x86_64"
linuxPackageMappings := configWithNoReplace(linuxPackageMappings.value)
TaskKey[Unit]("unzip") := {
- val rpmPath = Seq((Rpm / packageBin).value.getAbsolutePath)
+ implicit val converter: FileConverter = fileConverter.value
+ val rpmPath = Seq(PluginCompat.toFile((Rpm / packageBin).value).getAbsolutePath)
sys.process.Process("rpm2cpio", rpmPath) #| sys.process.Process("cpio -i --make-directories") ! streams.value.log
}
diff --git a/src/sbt-test/rpm/config-no-replace/test b/src/sbt-test/rpm/config-no-replace/test
index a4dc7f960..d4b3c6d8e 100644
--- a/src/sbt-test/rpm/config-no-replace/test
+++ b/src/sbt-test/rpm/config-no-replace/test
@@ -1,6 +1,6 @@
# Run the debian packaging.
> Rpm/packageBin
-$ exists target/rpm/RPMS/x86_64/rpm-test-0.1.0-1.x86_64.rpm
+$ exists target/**/rpm/RPMS/x86_64/rpm-test-0.1.0-1.x86_64.rpm
> unzip
diff --git a/src/sbt-test/rpm/override-loader-functions/test b/src/sbt-test/rpm/override-loader-functions/test
index b65c5213b..f563bdba4 100644
--- a/src/sbt-test/rpm/override-loader-functions/test
+++ b/src/sbt-test/rpm/override-loader-functions/test
@@ -1,5 +1,5 @@
# Run the rpm packaging.
> Rpm/packageBin
-$ exists target/rpm/RPMS/noarch/rpm-test-0.1.0-1.noarch.rpm
+$ exists target/**/rpm/RPMS/noarch/rpm-test-0.1.0-1.noarch.rpm
> checkLoaderScript
diff --git a/src/sbt-test/rpm/override-start-script-systemd/build.sbt b/src/sbt-test/rpm/override-start-script-systemd/build.sbt
index 8a8c3b250..f4b93c719 100644
--- a/src/sbt-test/rpm/override-start-script-systemd/build.sbt
+++ b/src/sbt-test/rpm/override-start-script-systemd/build.sbt
@@ -1,4 +1,6 @@
import com.typesafe.sbt.packager.Compat._
+import com.typesafe.sbt.packager.PluginCompat
+import xsbti.FileConverter
enablePlugins(JavaServerAppPackaging, SystemdPlugin)
@@ -26,7 +28,8 @@ rpmLicense := Some("BSD")
rpmGroup := Some("test-group")
TaskKey[Unit]("unzip") := {
- val rpmPath = Seq((Rpm / packageBin).value.getAbsolutePath)
+ implicit val converter: FileConverter = fileConverter.value
+ val rpmPath = Seq(PluginCompat.toFile((Rpm / packageBin).value).getAbsolutePath)
sys.process.Process("rpm2cpio", rpmPath) #| sys.process.Process("cpio -i --make-directories") ! streams.value.log
()
}
diff --git a/src/sbt-test/rpm/override-start-script-systemd/test b/src/sbt-test/rpm/override-start-script-systemd/test
index a934fe61c..35a557601 100644
--- a/src/sbt-test/rpm/override-start-script-systemd/test
+++ b/src/sbt-test/rpm/override-start-script-systemd/test
@@ -1,10 +1,12 @@
# Run the rpm packaging.
> Rpm/packageBin
-$ exists target/rpm/RPMS/noarch/rpm-test-0.1.0-1.noarch.rpm
+$ exists target/**/rpm/RPMS/noarch/rpm-test-0.1.0-1.noarch.rpm
> unzip
# Bootscript != executable Script
-$ exists /usr/lib/systemd/system/rpm-test.service
+
+# TODO: absolute path bug
+# $ exists /usr/lib/systemd/system/rpm-test.service
# $ exists usr/share/rpm-test/bin/rpm-exec
-> checkStartupScript
\ No newline at end of file
+> checkStartupScript
diff --git a/src/sbt-test/rpm/override-start-script-systemv/build.sbt b/src/sbt-test/rpm/override-start-script-systemv/build.sbt
index 8f7e3f375..993fceb62 100644
--- a/src/sbt-test/rpm/override-start-script-systemv/build.sbt
+++ b/src/sbt-test/rpm/override-start-script-systemv/build.sbt
@@ -1,4 +1,6 @@
import com.typesafe.sbt.packager.Compat._
+import com.typesafe.sbt.packager.PluginCompat
+import xsbti.FileConverter
enablePlugins(JavaServerAppPackaging, SystemVPlugin)
@@ -26,7 +28,8 @@ rpmLicense := Some("BSD")
rpmGroup := Some("test-group")
TaskKey[Unit]("unzip") := {
- val rpmPath = Seq((Rpm / packageBin).value.getAbsolutePath)
+ implicit val converter: FileConverter = fileConverter.value
+ val rpmPath = Seq(PluginCompat.toFile((Rpm / packageBin).value).getAbsolutePath)
sys.process.Process("rpm2cpio", rpmPath) #| sys.process.Process("cpio -i --make-directories") ! streams.value.log
()
}
diff --git a/src/sbt-test/rpm/override-start-script-systemv/test b/src/sbt-test/rpm/override-start-script-systemv/test
index fc66b2b24..ddfbf1f34 100644
--- a/src/sbt-test/rpm/override-start-script-systemv/test
+++ b/src/sbt-test/rpm/override-start-script-systemv/test
@@ -1,6 +1,6 @@
# Run the rpm packaging.
> Rpm/packageBin
-$ exists target/rpm/RPMS/noarch/rpm-test-0.1.0-1.noarch.rpm
+$ exists target/**/rpm/RPMS/noarch/rpm-test-0.1.0-1.noarch.rpm
> unzip
# Bootscript != executable Script
diff --git a/src/sbt-test/rpm/override-start-script-upstart/build.sbt b/src/sbt-test/rpm/override-start-script-upstart/build.sbt
index 65f7f82e6..3da4d3b3a 100644
--- a/src/sbt-test/rpm/override-start-script-upstart/build.sbt
+++ b/src/sbt-test/rpm/override-start-script-upstart/build.sbt
@@ -1,4 +1,6 @@
import com.typesafe.sbt.packager.Compat._
+import com.typesafe.sbt.packager.PluginCompat
+import xsbti.FileConverter
enablePlugins(JavaServerAppPackaging, UpstartPlugin)
@@ -26,7 +28,8 @@ rpmLicense := Some("BSD")
rpmGroup := Some("test-group")
TaskKey[Unit]("unzip") := {
- val rpmPath = Seq((Rpm / packageBin).value.getAbsolutePath)
+ implicit val converter: FileConverter = fileConverter.value
+ val rpmPath = Seq(PluginCompat.toFile((Rpm / packageBin).value).getAbsolutePath)
sys.process.Process("rpm2cpio", rpmPath) #| sys.process.Process("cpio -i --make-directories") ! streams.value.log
()
}
diff --git a/src/sbt-test/rpm/override-start-script-upstart/test b/src/sbt-test/rpm/override-start-script-upstart/test
index 4b83e4ffa..56191a6ed 100644
--- a/src/sbt-test/rpm/override-start-script-upstart/test
+++ b/src/sbt-test/rpm/override-start-script-upstart/test
@@ -1,6 +1,6 @@
# Run the rpm packaging.
> Rpm/packageBin
-$ exists target/rpm/RPMS/noarch/rpm-test-0.1.0-1.noarch.rpm
+$ exists target/**/rpm/RPMS/noarch/rpm-test-0.1.0-1.noarch.rpm
> unzip
# Bootscript != executable Script
diff --git a/src/sbt-test/rpm/path-override-rpm/build.sbt b/src/sbt-test/rpm/path-override-rpm/build.sbt
index 3cfd264a1..b01fb8ad1 100644
--- a/src/sbt-test/rpm/path-override-rpm/build.sbt
+++ b/src/sbt-test/rpm/path-override-rpm/build.sbt
@@ -1,4 +1,6 @@
import com.typesafe.sbt.packager.Compat._
+import com.typesafe.sbt.packager.PluginCompat
+import xsbti.FileConverter
enablePlugins(JavaServerAppPackaging, SystemVPlugin)
@@ -23,7 +25,8 @@ defaultLinuxInstallLocation := "/opt/test"
defaultLinuxLogsLocation := "/opt/test/log"
TaskKey[Unit]("unzip") := {
- val rpmPath = Seq((Rpm / packageBin).value.getAbsolutePath)
+ implicit val converter: FileConverter = fileConverter.value
+ val rpmPath = Seq(PluginCompat.toFile((Rpm / packageBin).value).getAbsolutePath)
sys.process.Process("rpm2cpio", rpmPath) #| sys.process.Process("cpio -i --make-directories") ! streams.value.log
()
}
diff --git a/src/sbt-test/rpm/path-override-rpm/test b/src/sbt-test/rpm/path-override-rpm/test
index ebccb09a5..a89ffed6e 100644
--- a/src/sbt-test/rpm/path-override-rpm/test
+++ b/src/sbt-test/rpm/path-override-rpm/test
@@ -1,6 +1,6 @@
# Run the rpm packaging.
> Rpm/packageBin
-$ exists target/rpm/RPMS/noarch/rpm-test-0.1.0-1.noarch.rpm
+$ exists target/**/rpm/RPMS/noarch/rpm-test-0.1.0-1.noarch.rpm
> unzip
$ exists opt/test/rpm-test
diff --git a/src/sbt-test/rpm/scriplets-no-javarepack-rpm/test b/src/sbt-test/rpm/scriplets-no-javarepack-rpm/test
index c4cfdc6ff..6282aa4c6 100644
--- a/src/sbt-test/rpm/scriplets-no-javarepack-rpm/test
+++ b/src/sbt-test/rpm/scriplets-no-javarepack-rpm/test
@@ -1,6 +1,6 @@
# Run the RPM packaging.
> Rpm/packageBin
-$ exists target/rpm/RPMS/noarch/rpm-test-no-repack-0.1.0-2.noarch.rpm
-$ exists target/rpm/SPECS/rpm-test-no-repack.spec
+$ exists target/**/rpm/RPMS/noarch/rpm-test-no-repack-0.1.0-2.noarch.rpm
+$ exists target/**/rpm/SPECS/rpm-test-no-repack.spec
> checkSpecFile
\ No newline at end of file
diff --git a/src/sbt-test/rpm/scriplets-use-javarepack-rpm/test b/src/sbt-test/rpm/scriplets-use-javarepack-rpm/test
index ac7fc7378..d25044964 100644
--- a/src/sbt-test/rpm/scriplets-use-javarepack-rpm/test
+++ b/src/sbt-test/rpm/scriplets-use-javarepack-rpm/test
@@ -1,6 +1,6 @@
# Run the RPM packaging.
> Rpm/packageBin
-$ exists target/rpm/RPMS/noarch/rpm-test-with-repack-0.1.0-2.noarch.rpm
-$ exists target/rpm/SPECS/rpm-test-with-repack.spec
+$ exists target/**/rpm/RPMS/noarch/rpm-test-with-repack-0.1.0-2.noarch.rpm
+$ exists target/**/rpm/SPECS/rpm-test-with-repack.spec
> checkSpecFile
\ No newline at end of file
diff --git a/src/sbt-test/rpm/scriptlets-override-build-rpm/test b/src/sbt-test/rpm/scriptlets-override-build-rpm/test
index f72019964..9a76759be 100644
--- a/src/sbt-test/rpm/scriptlets-override-build-rpm/test
+++ b/src/sbt-test/rpm/scriptlets-override-build-rpm/test
@@ -1,7 +1,7 @@
# Run the debian packaging.
> Rpm/packageBin
-$ exists target/rpm/RPMS/noarch/rpm-test-0.1.0-1.noarch.rpm
-$ exists target/rpm/SPECS/rpm-test.spec
+$ exists target/**/rpm/RPMS/noarch/rpm-test-0.1.0-1.noarch.rpm
+$ exists target/**/rpm/SPECS/rpm-test.spec
# Check files for defaults
> checkSpecFile
diff --git a/src/sbt-test/rpm/scriptlets-override-rpm/build.sbt b/src/sbt-test/rpm/scriptlets-override-rpm/build.sbt
index 0d71a41e7..d627fc775 100644
--- a/src/sbt-test/rpm/scriptlets-override-rpm/build.sbt
+++ b/src/sbt-test/rpm/scriptlets-override-rpm/build.sbt
@@ -1,4 +1,6 @@
import com.typesafe.sbt.packager.Compat._
+import com.typesafe.sbt.packager.PluginCompat
+import xsbti.FileConverter
enablePlugins(JavaServerAppPackaging, SystemVPlugin)
@@ -17,7 +19,8 @@ rpmLicense := Some("BSD")
(Compile / run / mainClass) := Some("com.example.MainApp")
TaskKey[Unit]("unzipAndCheck") := {
- val rpmFile = (Rpm / packageBin).value
+ implicit val converter: FileConverter = fileConverter.value
+ val rpmFile = PluginCompat.toFile((Rpm / packageBin).value)
val rpmPath = Seq(rpmFile.getAbsolutePath)
sys.process.Process("rpm2cpio", rpmPath) #| sys.process.Process("cpio -i --make-directories") ! streams.value.log
val scriptlets = sys.process.Process("rpm -qp --scripts " + rpmFile.getAbsolutePath) !! streams.value.log
diff --git a/src/sbt-test/rpm/scriptlets-override-rpm/test b/src/sbt-test/rpm/scriptlets-override-rpm/test
index 2a51f566e..4eafcf066 100644
--- a/src/sbt-test/rpm/scriptlets-override-rpm/test
+++ b/src/sbt-test/rpm/scriptlets-override-rpm/test
@@ -1,6 +1,6 @@
# Run the debian packaging.
> Rpm/packageBin
-$ exists target/rpm/RPMS/noarch/rpm-test-0.1.0-1.noarch.rpm
+$ exists target/**/rpm/RPMS/noarch/rpm-test-0.1.0-1.noarch.rpm
# Check rpm contents
> unzipAndCheck
diff --git a/src/sbt-test/rpm/scriptlets-rpm/build.sbt b/src/sbt-test/rpm/scriptlets-rpm/build.sbt
index e4f0c6421..603741cf8 100644
--- a/src/sbt-test/rpm/scriptlets-rpm/build.sbt
+++ b/src/sbt-test/rpm/scriptlets-rpm/build.sbt
@@ -45,7 +45,7 @@ TaskKey[Unit]("checkSpecFile") := {
}
TaskKey[Unit]("checkRpmVersion") := {
- val fullRpmVersion = sys.process.Process("rpm", Seq("--version")) !!
+ val fullRpmVersion = sys.process.Process("rpm", Seq("--version")).!!
val firstDigit = fullRpmVersion indexWhere Character.isDigit
val rpmVersion = fullRpmVersion substring firstDigit
streams.value.log.info("Found rpmVersion: " + rpmVersion)
diff --git a/src/sbt-test/rpm/scriptlets-rpm/test b/src/sbt-test/rpm/scriptlets-rpm/test
index 022438214..9af483660 100644
--- a/src/sbt-test/rpm/scriptlets-rpm/test
+++ b/src/sbt-test/rpm/scriptlets-rpm/test
@@ -1,7 +1,7 @@
# Run the debian packaging.
> Rpm/packageBin
-$ exists target/rpm/RPMS/noarch/rpm-test-0.1.0-1.noarch.rpm
-$ exists target/rpm/SPECS/rpm-test.spec
+$ exists target/**/rpm/RPMS/noarch/rpm-test-0.1.0-1.noarch.rpm
+$ exists target/**/rpm/SPECS/rpm-test.spec
# Check files for defaults
> checkSpecFile
diff --git a/src/sbt-test/rpm/setarch-rpm/test b/src/sbt-test/rpm/setarch-rpm/test
index df9828f9c..8a008d4a1 100644
--- a/src/sbt-test/rpm/setarch-rpm/test
+++ b/src/sbt-test/rpm/setarch-rpm/test
@@ -1,7 +1,7 @@
# Run the debian packaging.
> Rpm/packageBin
-$ exists target/rpm/RPMS/i386/rpm-package-0.1.0-1.i386.rpm
-$ exists target/rpm/SPECS/rpm-package.spec
+$ exists target/**/rpm/RPMS/i386/rpm-package-0.1.0-1.i386.rpm
+$ exists target/**/rpm/SPECS/rpm-package.spec
# Check files for defaults
> checkSpecFile
diff --git a/src/sbt-test/rpm/simple-rpm/test b/src/sbt-test/rpm/simple-rpm/test
index 9adf56b0b..2ba7a54ed 100644
--- a/src/sbt-test/rpm/simple-rpm/test
+++ b/src/sbt-test/rpm/simple-rpm/test
@@ -1,6 +1,6 @@
> Rpm/stage
-$ exists target/rpm
+$ exists target/**/rpm
> checkSpecFile
# Run the rpm packaging.
> Rpm/packageBin
-$ exists target/rpm/RPMS/x86_64/rpm-test-0.1.0-1.x86_64.rpm
+$ exists target/**/rpm/RPMS/x86_64/rpm-test-0.1.0-1.x86_64.rpm
diff --git a/src/sbt-test/rpm/snapshot-override-rpm/test b/src/sbt-test/rpm/snapshot-override-rpm/test
index df30cd27d..7bb076c27 100644
--- a/src/sbt-test/rpm/snapshot-override-rpm/test
+++ b/src/sbt-test/rpm/snapshot-override-rpm/test
@@ -1,6 +1,6 @@
# Run the debian packaging.
> Rpm/packageBin
-$ exists target/rpm/RPMS/noarch/rpm-test-1-SNAPSHOT.noarch.rpm
+$ exists target/**/rpm/RPMS/noarch/rpm-test-1-SNAPSHOT.noarch.rpm
#Check release and version configured correctly
> checkSnapshot
diff --git a/src/sbt-test/rpm/snapshot-rpm/test b/src/sbt-test/rpm/snapshot-rpm/test
index 773479f59..271ac6713 100644
--- a/src/sbt-test/rpm/snapshot-rpm/test
+++ b/src/sbt-test/rpm/snapshot-rpm/test
@@ -1,6 +1,6 @@
# Run the debian packaging.
> Rpm/packageBin
-$ exists target/rpm/RPMS/noarch/rpm-test-0.1.0-SNAPSHOT.noarch.rpm
+$ exists target/**/rpm/RPMS/noarch/rpm-test-0.1.0-SNAPSHOT.noarch.rpm
#Check release and version configured correctly
> checkSnapshot
\ No newline at end of file
diff --git a/src/sbt-test/rpm/symlink-rpm/test b/src/sbt-test/rpm/symlink-rpm/test
index 0e89be30b..771f2f0be 100644
--- a/src/sbt-test/rpm/symlink-rpm/test
+++ b/src/sbt-test/rpm/symlink-rpm/test
@@ -1,4 +1,4 @@
> Rpm/packageBin
-$ exists target/rpm/RPMS/noarch/rpm-package-0.1.0-1.noarch.rpm
-$ exists target/rpm/SPECS/rpm-package.spec
+$ exists target/**/rpm/RPMS/noarch/rpm-package-0.1.0-1.noarch.rpm
+$ exists target/**/rpm/SPECS/rpm-package.spec
> checkSpecFile
diff --git a/src/sbt-test/rpm/systemd-rpm/build.sbt b/src/sbt-test/rpm/systemd-rpm/build.sbt
index 4c1bb9517..23833abf9 100644
--- a/src/sbt-test/rpm/systemd-rpm/build.sbt
+++ b/src/sbt-test/rpm/systemd-rpm/build.sbt
@@ -1,4 +1,6 @@
import com.typesafe.sbt.packager.Compat._
+import com.typesafe.sbt.packager.PluginCompat
+import xsbti.FileConverter
enablePlugins(JavaServerAppPackaging, SystemdPlugin)
@@ -19,7 +21,8 @@ rpmGroup := Some("test-group")
Rpm / requiredStartFacilities := Some("serviceA.service")
TaskKey[Unit]("unzip") := {
- val rpmPath = Seq((Rpm / packageBin).value.getAbsolutePath)
+ implicit val converter: FileConverter = fileConverter.value
+ val rpmPath = Seq(PluginCompat.toFile((Rpm / packageBin).value).getAbsolutePath)
sys.process.Process("rpm2cpio", rpmPath) #| sys.process.Process("cpio -i --make-directories") ! streams.value.log
()
}
diff --git a/src/sbt-test/rpm/systemd-rpm/test b/src/sbt-test/rpm/systemd-rpm/test
index c3521d4eb..b0e33abb3 100644
--- a/src/sbt-test/rpm/systemd-rpm/test
+++ b/src/sbt-test/rpm/systemd-rpm/test
@@ -1,6 +1,6 @@
# Run the rpm packaging.
> Rpm/packageBin
-$ exists target/rpm/RPMS/noarch/rpm-test-0.1.0-1.noarch.rpm
+$ exists target/**/rpm/RPMS/noarch/rpm-test-0.1.0-1.noarch.rpm
> unzip
$ exists usr/lib/systemd/system/rpm-test.service
diff --git a/src/sbt-test/rpm/sysvinit-rpm/build.sbt b/src/sbt-test/rpm/sysvinit-rpm/build.sbt
index 1754a2ff7..d92efba05 100644
--- a/src/sbt-test/rpm/sysvinit-rpm/build.sbt
+++ b/src/sbt-test/rpm/sysvinit-rpm/build.sbt
@@ -1,4 +1,6 @@
import com.typesafe.sbt.packager.Compat._
+import com.typesafe.sbt.packager.PluginCompat
+import xsbti.FileConverter
enablePlugins(JavaServerAppPackaging, SystemVPlugin)
@@ -19,10 +21,10 @@ rpmDaemonLogFile := "test.log"
(Compile / run / mainClass) := Some("com.example.MainApp")
TaskKey[Unit]("unzipAndCheck") := {
- val rpmPath = Seq((Rpm / packageBin).value.getAbsolutePath)
- sys.process.Process("rpm2cpio", rpmPath) #| sys.process.Process("cpio -i --make-directories") ! streams.value.log
- val scriptlets =
- sys.process.Process("rpm -qp --scripts " + (Rpm / packageBin).value.getAbsolutePath) !! streams.value.log
+ implicit val converter: FileConverter = fileConverter.value
+ val rpmPath = PluginCompat.toFile((Rpm / packageBin).value).getAbsolutePath
+ sys.process.Process("rpm2cpio", Seq(rpmPath)) #| sys.process.Process("cpio -i --make-directories") ! streams.value.log
+ val scriptlets = sys.process.Process("rpm -qp --scripts " + rpmPath) !! streams.value.log
assert(scriptlets contains "addGroup rpm-test", "addGroup not present in \n" + scriptlets)
assert(scriptlets contains "addUser rpm-test", "Incorrect useradd command in \n" + scriptlets)
assert(scriptlets contains "deleteGroup rpm-test", "deleteGroup not present in \n" + scriptlets)
diff --git a/src/sbt-test/rpm/sysvinit-rpm/test b/src/sbt-test/rpm/sysvinit-rpm/test
index 36b8a73d5..969248dc6 100644
--- a/src/sbt-test/rpm/sysvinit-rpm/test
+++ b/src/sbt-test/rpm/sysvinit-rpm/test
@@ -1,6 +1,6 @@
# Run the rpm packaging.
> Rpm/packageBin
-$ exists target/rpm/RPMS/noarch/rpm-test-0.1.0-1.noarch.rpm
+$ exists target/**/rpm/RPMS/noarch/rpm-test-0.1.0-1.noarch.rpm
> checkSpecFile
> checkSpecAutostart
diff --git a/src/sbt-test/rpm/test-artifactPath/build.sbt b/src/sbt-test/rpm/test-artifactPath/build.sbt
index bb45f2ee4..c745710b7 100644
--- a/src/sbt-test/rpm/test-artifactPath/build.sbt
+++ b/src/sbt-test/rpm/test-artifactPath/build.sbt
@@ -1,3 +1,6 @@
+import com.typesafe.sbt.packager.PluginCompat
+import xsbti.FileConverter
+
enablePlugins(JavaServerAppPackaging, SystemVPlugin)
name := "rpm-test"
@@ -10,7 +13,10 @@ packageSummary := "Test rpm package"
Linux / packageName := "rpm-package"
-(Rpm / packageBin / artifactPath) := target.value / s"${(Rpm / packageName).value}-${(Rpm / version).value}.rpm"
+(Rpm / packageBin / artifactPath) := {
+ implicit val converter: FileConverter = fileConverter.value
+ PluginCompat.toFileRef(target.value / s"${(Rpm / packageName).value}-${(Rpm / version).value}.rpm")
+}
packageDescription := """A fun package description of our software,
with multiple lines."""
diff --git a/src/sbt-test/rpm/test-artifactPath/test b/src/sbt-test/rpm/test-artifactPath/test
index 28a926fb6..a587ed1f1 100644
--- a/src/sbt-test/rpm/test-artifactPath/test
+++ b/src/sbt-test/rpm/test-artifactPath/test
@@ -1,8 +1,8 @@
# Run the debian packaging.
> Rpm/packageBin
-$ exists target/rpm-package-0.1.0.rpm
-$ exists target/rpm/RPMS/noarch/rpm-package-0.1.0-1.noarch.rpm
-$ exists target/rpm/SPECS/rpm-package.spec
+$ exists target/**/rpm-package-0.1.0.rpm
+$ exists target/**/rpm/RPMS/noarch/rpm-package-0.1.0-1.noarch.rpm
+$ exists target/**/rpm/SPECS/rpm-package.spec
# Check files for defaults
> checkSpecFile
diff --git a/src/sbt-test/rpm/test-executableScriptName/build.sbt b/src/sbt-test/rpm/test-executableScriptName/build.sbt
index 75727efc6..c63107578 100644
--- a/src/sbt-test/rpm/test-executableScriptName/build.sbt
+++ b/src/sbt-test/rpm/test-executableScriptName/build.sbt
@@ -1,4 +1,6 @@
import com.typesafe.sbt.packager.Compat._
+import com.typesafe.sbt.packager.PluginCompat
+import xsbti.FileConverter
enablePlugins(JavaServerAppPackaging, SystemVPlugin)
@@ -40,7 +42,8 @@ TaskKey[Unit]("checkSpecFile") := {
}
TaskKey[Unit]("unzip") := {
- val rpmPath = Seq((Rpm / packageBin).value.getAbsolutePath)
+ implicit val converter: FileConverter = fileConverter.value
+ val rpmPath = Seq(PluginCompat.toFile((Rpm / packageBin).value).getAbsolutePath)
sys.process.Process("rpm2cpio", rpmPath) #| sys.process.Process("cpio -i --make-directories") ! streams.value.log
()
}
diff --git a/src/sbt-test/rpm/test-executableScriptName/test b/src/sbt-test/rpm/test-executableScriptName/test
index 24b5674e2..82f92bcdb 100644
--- a/src/sbt-test/rpm/test-executableScriptName/test
+++ b/src/sbt-test/rpm/test-executableScriptName/test
@@ -1,7 +1,7 @@
# Run the debian packaging.
> Rpm/packageBin
-$ exists target/rpm/RPMS/noarch/rpm-test-0.1.0-1.noarch.rpm
-$ exists target/rpm/SPECS/rpm-test.spec
+$ exists target/**/rpm/RPMS/noarch/rpm-test-0.1.0-1.noarch.rpm
+$ exists target/**/rpm/SPECS/rpm-test.spec
# Check files for defaults
> checkSpecFile
diff --git a/src/sbt-test/rpm/test-packageName/test b/src/sbt-test/rpm/test-packageName/test
index 9fe7cf1b2..ef9a1af7e 100644
--- a/src/sbt-test/rpm/test-packageName/test
+++ b/src/sbt-test/rpm/test-packageName/test
@@ -1,7 +1,7 @@
# Run the debian packaging.
> Rpm/packageBin
-$ exists target/rpm/RPMS/noarch/rpm-package-0.1.0-1.noarch.rpm
-$ exists target/rpm/SPECS/rpm-package.spec
+$ exists target/**/rpm/RPMS/noarch/rpm-package-0.1.0-1.noarch.rpm
+$ exists target/**/rpm/SPECS/rpm-package.spec
# Check files for defaults
> checkSpecFile
diff --git a/src/sbt-test/universal/clear-stage-dir/test b/src/sbt-test/universal/clear-stage-dir/test
index a99c3561a..ffc9a3e28 100644
--- a/src/sbt-test/universal/clear-stage-dir/test
+++ b/src/sbt-test/universal/clear-stage-dir/test
@@ -1,9 +1,9 @@
# Stage the distribution and ensure files show up.
> Universal/stage
-$ exists target/universal/stage/conf/test
-$ exists target/universal/stage/conf/test2
+$ exists target/**/universal/stage/conf/test
+$ exists target/**/universal/stage/conf/test2
$ delete src/universal/conf/test2
> Universal/stage
-$ exists target/universal/stage/conf/test
-$ absent target/universal/stage/conf/test2
+$ exists target/**/universal/stage/conf/test
+$ absent target/**/universal/stage/conf/test2
diff --git a/src/sbt-test/universal/dist/test b/src/sbt-test/universal/dist/test
index 09179aca1..ab1c10f30 100644
--- a/src/sbt-test/universal/dist/test
+++ b/src/sbt-test/universal/dist/test
@@ -1,3 +1,3 @@
# Create the distribution and ensure files show up.
> dist
-$ exists target/universal/simple-test-0.1.0.zip
+$ exists target/**/universal/simple-test-0.1.0.zip
diff --git a/src/sbt-test/universal/multiproject-classifiers/build.sbt b/src/sbt-test/universal/multiproject-classifiers/build.sbt
index 6b99f2fd6..142501d2b 100644
--- a/src/sbt-test/universal/multiproject-classifiers/build.sbt
+++ b/src/sbt-test/universal/multiproject-classifiers/build.sbt
@@ -1,4 +1,6 @@
import com.typesafe.sbt.packager.Compat._
+import com.typesafe.sbt.packager.PluginCompat
+import xsbti.FileConverter
lazy val appVersion = "1.0"
@@ -9,7 +11,7 @@ lazy val mySettings: Seq[Setting[_]] =
TaskKey[Unit]("showFiles") := {
System.out.synchronized {
println("Files in [" + name.value + "]")
- val files = (target.value / "universal/stage").**(AllPassFilter).get
+ val files = (target.value / "universal/stage").**(AllPassFilter).get()
files foreach println
}
}
@@ -25,18 +27,20 @@ lazy val sub = project
ivyConfigurations += Assets,
Assets / artifact := artifact.value.withClassifier(classifier = Some("assets")),
packagedArtifacts += {
+ implicit val converter: FileConverter = fileConverter.value
val file = target.value / "assets.jar"
val assetsDir = baseDirectory.value / "src" / "main" / "assets"
val sources = assetsDir.**(AllPassFilter).filter(_.isFile) pair (file => IO.relativize(assetsDir, file))
IO.zip(sources, file)
- (Assets / artifact).value -> file
+ (Assets / artifact).value -> PluginCompat.toFileRef(file)
},
Assets / exportedProducts := {
- Seq(
- Attributed
- .blank(baseDirectory.value / "src" / "main" / "assets")
- .put(artifact.key, (Assets / artifact).value)
- .put(AttributeKey[ModuleID]("module-id"), projectID.value)
+ implicit val converter: FileConverter = fileConverter.value
+ val assetsDir = baseDirectory.value / "src" / "main" / "assets"
+ assetsDir.**(AllPassFilter).filter(_.isFile).classpath.map(
+ _
+ .put(PluginCompat.artifactStr, PluginCompat.artifactToStr((Assets / artifact).value))
+ .put(PluginCompat.moduleIDStr, PluginCompat.moduleIDToStr(projectID.value))
)
}
)
diff --git a/src/sbt-test/universal/multiproject-classifiers/test b/src/sbt-test/universal/multiproject-classifiers/test
index c47a0712e..93b21ee33 100644
--- a/src/sbt-test/universal/multiproject-classifiers/test
+++ b/src/sbt-test/universal/multiproject-classifiers/test
@@ -1,5 +1,5 @@
# Run the staging and check the script.
> stage
> showFiles
-$ exists target/universal/stage/lib/org.test.sub-1.0.jar
-$ exists target/universal/stage/lib/org.test.sub-1.0-assets.jar
+$ exists target/**/universal/stage/lib/org.test.sub-1.0.jar
+$ exists target/**/universal/stage/lib/org.test.sub-1.0-assets.jar
diff --git a/src/sbt-test/universal/staging-custom-main/build.sbt b/src/sbt-test/universal/staging-custom-main/build.sbt
index f9d5789f3..728f6063b 100644
--- a/src/sbt-test/universal/staging-custom-main/build.sbt
+++ b/src/sbt-test/universal/staging-custom-main/build.sbt
@@ -1,4 +1,6 @@
import com.typesafe.sbt.packager.Compat._
+import com.typesafe.sbt.packager.PluginCompat
+import xsbti.FileConverter
enablePlugins(JavaAppPackaging)
@@ -9,14 +11,15 @@ version := "0.1.0"
Compile / mainClass := Some("Main")
TaskKey[Unit]("unzip") := {
- val args = Seq((Universal / packageBin).value.getAbsolutePath)
+ implicit val converter: FileConverter = fileConverter.value
+ val args = Seq(PluginCompat.toFile((Universal / packageBin).value).getAbsolutePath)
sys.process.Process("unzip", args) ! streams.value.log
}
TaskKey[Unit]("check") := {
val zipFile = (Universal / packageBin).value
val process = sys.process.Process("stage-custom-main-0.1.0/bin/stage-custom-main", Seq("-main", "CustomMain"))
- val out = (process !!)
+ val out = (process.!!)
if (out.trim != "A custom main method") sys.error("unexpected output: " + out)
()
}
diff --git a/src/sbt-test/universal/staging-custom-main/test b/src/sbt-test/universal/staging-custom-main/test
index 76b582116..aa7e9778d 100644
--- a/src/sbt-test/universal/staging-custom-main/test
+++ b/src/sbt-test/universal/staging-custom-main/test
@@ -1,6 +1,6 @@
# Stage the distribution and ensure main class can be run.
> show Universal/packageBin
-$ exists target/universal/stage-custom-main-0.1.0.zip
+$ exists target/**/universal/stage-custom-main-0.1.0.zip
> unzip
$ exists stage-custom-main-0.1.0/bin/
$ exists stage-custom-main-0.1.0/bin/stage-custom-main
diff --git a/src/sbt-test/universal/staging/test b/src/sbt-test/universal/staging/test
index e30e6eb83..b58c01efb 100644
--- a/src/sbt-test/universal/staging/test
+++ b/src/sbt-test/universal/staging/test
@@ -1,3 +1,3 @@
# Stage the distribution and ensure files show up.
> show Universal/stage
-$ exists target/universal/stage/conf/test
+$ exists target/**/universal/stage/conf/test
diff --git a/src/sbt-test/universal/test-executableScriptName/build.sbt b/src/sbt-test/universal/test-executableScriptName/build.sbt
index 300822822..f28f56329 100644
--- a/src/sbt-test/universal/test-executableScriptName/build.sbt
+++ b/src/sbt-test/universal/test-executableScriptName/build.sbt
@@ -1,4 +1,6 @@
import com.typesafe.sbt.packager.Compat._
+import com.typesafe.sbt.packager.PluginCompat
+import xsbti.FileConverter
enablePlugins(JavaAppPackaging)
@@ -9,6 +11,7 @@ executableScriptName := "simple-exec"
version := "0.1.0"
TaskKey[Unit]("unzip") := {
- val args = Seq((Universal / packageBin).value.getAbsolutePath)
+ implicit val converter: FileConverter = fileConverter.value
+ val args = Seq(PluginCompat.toFile((Universal / packageBin).value).getAbsolutePath)
sys.process.Process("unzip", args) ! streams.value.log
}
diff --git a/src/sbt-test/universal/test-executableScriptName/test b/src/sbt-test/universal/test-executableScriptName/test
index 114b38ed9..f7bdbaba6 100644
--- a/src/sbt-test/universal/test-executableScriptName/test
+++ b/src/sbt-test/universal/test-executableScriptName/test
@@ -1,6 +1,6 @@
# Run the zip packaging.
> show Universal/packageBin
-$ exists target/universal/simple-test-0.1.0.zip
+$ exists target/**/universal/simple-test-0.1.0.zip
> unzip
$ exists simple-test-0.1.0/bin/
$ exists simple-test-0.1.0/bin/simple-exec
\ No newline at end of file
diff --git a/src/sbt-test/universal/test-mapping-helpers/build.sbt b/src/sbt-test/universal/test-mapping-helpers/build.sbt
index b21cf0613..36b8f9da1 100644
--- a/src/sbt-test/universal/test-mapping-helpers/build.sbt
+++ b/src/sbt-test/universal/test-mapping-helpers/build.sbt
@@ -1,6 +1,8 @@
import com.typesafe.sbt.packager.Compat._
+import com.typesafe.sbt.packager.PluginCompat
import com.typesafe.sbt.packager.MappingsHelper._
+import xsbti.FileConverter
enablePlugins(JavaAppPackaging)
@@ -9,20 +11,28 @@ name := "simple-test"
version := "0.1.0"
// or just place your cache folder in /src/universal/
-Universal / mappings ++= directory("src/main/resources/cache")
+Universal / mappings ++= {
+ implicit val converter: FileConverter = fileConverter.value
+ PluginCompat.toFileRefsMapping(directory("src/main/resources/cache"))
+}
// or just place your cache folder in /src/universal/
-Universal / mappings ++= contentOf("src/main/resources/docs")
+Universal / mappings ++= {
+ implicit val converter: FileConverter = fileConverter.value
+ PluginCompat.toFileRefsMapping(contentOf("src/main/resources/docs"))
+}
Universal / mappings += {
(Compile / packageBin).value
+ implicit val converter: FileConverter = fileConverter.value
// we are using the reference.conf as default application.conf
// the user can override settings here
val conf = sourceDirectory.value / "main" / "resources" / "reference.conf"
- conf -> "conf/application.conf"
+ PluginCompat.toFileRef(conf) -> "conf/application.conf"
}
TaskKey[Unit]("unzip") := {
- val args = Seq((Universal / packageBin).value.getAbsolutePath)
+ implicit val converter: FileConverter = fileConverter.value
+ val args = Seq(PluginCompat.toFile((Universal / packageBin).value).getAbsolutePath)
sys.process.Process("unzip", args) ! streams.value.log
}
diff --git a/src/sbt-test/universal/test-mapping-helpers/test b/src/sbt-test/universal/test-mapping-helpers/test
index c759eb42c..6694746df 100644
--- a/src/sbt-test/universal/test-mapping-helpers/test
+++ b/src/sbt-test/universal/test-mapping-helpers/test
@@ -1,6 +1,6 @@
# Run the universal packaging.
> show Universal/packageBin
-$ exists target/universal/simple-test-0.1.0.zip
+$ exists target/**/universal/simple-test-0.1.0.zip
> unzip
$ exists simple-test-0.1.0/
diff --git a/src/sbt-test/universal/test-native-zip/test b/src/sbt-test/universal/test-native-zip/test
index dbe2f2838..cffa3a636 100644
--- a/src/sbt-test/universal/test-native-zip/test
+++ b/src/sbt-test/universal/test-native-zip/test
@@ -1,5 +1,5 @@
# Run the zip packaging.
> show Universal/packageBin
-$ exists target/universal/simple-test-0.1.0.zip
+$ exists target/**/universal/simple-test-0.1.0.zip
# TODO - Check contents of zips. Ensure file permissions are preserved.
diff --git a/src/sbt-test/universal/test-packageName/test b/src/sbt-test/universal/test-packageName/test
index cc149ff1d..6514ecb90 100644
--- a/src/sbt-test/universal/test-packageName/test
+++ b/src/sbt-test/universal/test-packageName/test
@@ -1,11 +1,11 @@
# Run the zip packaging.
> show Universal/packageBin
-$ exists target/universal/simple-package.zip
+$ exists target/**/universal/simple-package.zip
# Run the tgz packaging.
> Universal/packageZipTarball
-$ exists target/universal/simple-package.tgz
+$ exists target/**/universal/simple-package.tgz
# Run the txz packaging.
> Universal/packageXzTarball
-$ exists target/universal/simple-package.txz
\ No newline at end of file
+$ exists target/**/universal/simple-package.txz
\ No newline at end of file
diff --git a/src/sbt-test/universal/test-zips-no-top-level-dir/test b/src/sbt-test/universal/test-zips-no-top-level-dir/test
index 0956fca05..e35e4a006 100644
--- a/src/sbt-test/universal/test-zips-no-top-level-dir/test
+++ b/src/sbt-test/universal/test-zips-no-top-level-dir/test
@@ -1,14 +1,14 @@
# Run the zip packaging.
> show Universal/packageBin
-$ exists target/universal/simple-test-0.1.0.zip
+$ exists target/**/universal/simple-test-0.1.0.zip
# Run the tgz packaging.
> Universal/packageZipTarball
-$ exists target/universal/simple-test-0.1.0.tgz
+$ exists target/**/universal/simple-test-0.1.0.tgz
# Run the txz packaging.
> Universal/packageXzTarball
-$ exists target/universal/simple-test-0.1.0.txz
+$ exists target/**/universal/simple-test-0.1.0.txz
# TODO - Check contents of zips
diff --git a/src/sbt-test/universal/test-zips/test b/src/sbt-test/universal/test-zips/test
index f7e84ce98..382bb73b7 100644
--- a/src/sbt-test/universal/test-zips/test
+++ b/src/sbt-test/universal/test-zips/test
@@ -1,26 +1,26 @@
# Run the zip packaging.
> show Universal/packageBin
-$ exists target/universal/simple-test-0.1.0.zip
+$ exists target/**/universal/simple-test-0.1.0.zip
> UniversalDocs/packageBin
-$ exists target/universal-docs/simple-test-0.1.0.zip
+$ exists target/**/universal-docs/simple-test-0.1.0.zip
> UniversalSrc/packageBin
-$ exists target/universal-src/simple-test-0.1.0.zip
+$ exists target/**/universal-src/simple-test-0.1.0.zip
# Run the tgz packaging.
> Universal/packageZipTarball
-$ exists target/universal/simple-test-0.1.0.tgz
+$ exists target/**/universal/simple-test-0.1.0.tgz
> UniversalDocs/packageZipTarball
-$ exists target/universal-docs/simple-test-0.1.0.tgz
+$ exists target/**/universal-docs/simple-test-0.1.0.tgz
> UniversalSrc/packageZipTarball
-$ exists target/universal-src/simple-test-0.1.0.tgz
+$ exists target/**/universal-src/simple-test-0.1.0.tgz
# Run the txz packaging.
> Universal/packageXzTarball
-$ exists target/universal/simple-test-0.1.0.txz
+$ exists target/**/universal/simple-test-0.1.0.txz
> UniversalDocs/packageXzTarball
-$ exists target/universal-docs/simple-test-0.1.0.txz
+$ exists target/**/universal-docs/simple-test-0.1.0.txz
> UniversalSrc/packageXzTarball
-$ exists target/universal-src/simple-test-0.1.0.txz
+$ exists target/**/universal-src/simple-test-0.1.0.txz
# TODO - Check contents of zips
diff --git a/src/sbt-test/universal/validation/test b/src/sbt-test/universal/validation/test
index b191d43e7..6a4af2400 100644
--- a/src/sbt-test/universal/validation/test
+++ b/src/sbt-test/universal/validation/test
@@ -3,4 +3,4 @@
$ mkdir src/universal
$ copy-file build.sbt src/universal/test-file
> Universal/packageBin
-$ exists target/universal/simple-test-0.1.0.zip
+$ exists target/**/universal/simple-test-0.1.0.zip
diff --git a/src/sbt-test/windows/custom-wix/test b/src/sbt-test/windows/custom-wix/test
index 34cde9116..7e699de20 100644
--- a/src/sbt-test/windows/custom-wix/test
+++ b/src/sbt-test/windows/custom-wix/test
@@ -1,3 +1,6 @@
+# Workaround: set target folder to what it was in sbt 1.x because with sbt 2.x and project matrix target is target/out/jvm/scala-3.3.3/
+> set target := baseDirectory.value / "target"
+
# Run the windows packaging.
> Windows/packageBin
$ exists target/windows/custom-wix.msi
diff --git a/src/sbt-test/windows/java-app-archetype/test b/src/sbt-test/windows/java-app-archetype/test
index f46ca6985..24297d995 100644
--- a/src/sbt-test/windows/java-app-archetype/test
+++ b/src/sbt-test/windows/java-app-archetype/test
@@ -1,3 +1,6 @@
+# Workaround: set target folder to what it was in sbt 1.x because with sbt 2.x and project matrix target is target/out/jvm/scala-3.3.3/
+> set target := baseDirectory.value / "target"
+
# Run the windows packaging.
> Windows/packageBin
$ exists target/windows/windows-test.msi
diff --git a/src/sbt-test/windows/memory-settings/test b/src/sbt-test/windows/memory-settings/test
index c50f2af5e..3d1305ff8 100644
--- a/src/sbt-test/windows/memory-settings/test
+++ b/src/sbt-test/windows/memory-settings/test
@@ -1,3 +1,6 @@
+# Workaround: set target folder to what it was in sbt 1.x because with sbt 2.x and project matrix target is target/out/jvm/scala-3.3.3/
+> set target := baseDirectory.value / "target"
+
# Run the staging and check the script.
> stage
$ exists target/universal/stage/conf/application.ini
diff --git a/src/sbt-test/windows/multiple-apps/test b/src/sbt-test/windows/multiple-apps/test
index e47f8e132..455c7415b 100644
--- a/src/sbt-test/windows/multiple-apps/test
+++ b/src/sbt-test/windows/multiple-apps/test
@@ -1,10 +1,13 @@
+# Workaround: set target folder to what it was in sbt 1.x because with sbt 2.x and project matrix target is target/out/jvm/scala-3.3.3/
+> set target := baseDirectory.value / "target"
+
# Run the staging and check the script.
> stage
$ exists target/universal/stage/bin/main-app.bat
$ exists target/universal/stage/bin/second-app.bat
> checkNoExplicitMain
> clean
-> set mainClass in Compile := Some("com.example.MainApp")
+> set Compile / mainClass := Some("com.example.MainApp")
> stage
$ exists target/universal/stage/bin/test-project.bat
$ exists target/universal/stage/bin/second-app.bat
diff --git a/src/sbt-test/windows/test-bat-template/build.sbt b/src/sbt-test/windows/test-bat-template/build.sbt
index 0e6948333..d249b91ad 100644
--- a/src/sbt-test/windows/test-bat-template/build.sbt
+++ b/src/sbt-test/windows/test-bat-template/build.sbt
@@ -1,5 +1,7 @@
import com.typesafe.sbt.packager.Compat._
+scalaVersion := "2.12.20"
+
enablePlugins(JavaAppPackaging)
name := "windows-test"
diff --git a/src/sbt-test/windows/test-bat-template/test b/src/sbt-test/windows/test-bat-template/test
index faaa3ec4b..7b849abd5 100644
--- a/src/sbt-test/windows/test-bat-template/test
+++ b/src/sbt-test/windows/test-bat-template/test
@@ -1,3 +1,6 @@
+# Workaround: set target folder to what it was in sbt 1.x because with sbt 2.x and project matrix target is target/out/jvm/scala-3.3.3/
+> set target := baseDirectory.value / "target"
+
# Run the windows batch.
> stage
$ exists target/universal/stage/bin/windows-test.bat
diff --git a/src/sbt-test/windows/test-custom-main/build.sbt b/src/sbt-test/windows/test-custom-main/build.sbt
index 63c31d49f..70a999c64 100644
--- a/src/sbt-test/windows/test-custom-main/build.sbt
+++ b/src/sbt-test/windows/test-custom-main/build.sbt
@@ -12,7 +12,7 @@ TaskKey[Unit]("checkAppMain") := {
val zipFile = (Universal / packageBin).value
val process =
sys.process.Process("target/universal/stage/bin/test-custom-main.bat")
- val out = (process !!)
+ val out = process.!!
if (out.trim != "App Main Method") sys.error("unexpected output: " + out)
()
}
@@ -21,7 +21,7 @@ TaskKey[Unit]("checkCustomMain") := {
val zipFile = (Universal / packageBin).value
val process =
sys.process.Process("target/universal/stage/bin/test-custom-main.bat", Seq("-main", "CustomMain"))
- val out = (process !!)
+ val out = process.!!
if (out.trim != "Custom Main Method") sys.error("unexpected output: " + out)
()
}
diff --git a/src/sbt-test/windows/test-custom-main/test b/src/sbt-test/windows/test-custom-main/test
index 3e67cf9e7..8982fbd0b 100644
--- a/src/sbt-test/windows/test-custom-main/test
+++ b/src/sbt-test/windows/test-custom-main/test
@@ -1,3 +1,6 @@
+# Workaround: set target folder to what it was in sbt 1.x because with sbt 2.x and project matrix target is target/out/jvm/scala-3.3.3/
+> set target := baseDirectory.value / "target"
+
# Stage the distribution and ensure main class can be run.
> stage
$ exists target/universal/stage/bin/
diff --git a/src/test/scala/com/typesafe/sbt/packager/universal/ZipHelperSpec.scala b/src/test/scala/com/typesafe/sbt/packager/universal/ZipHelperSpec.scala
index eb2c9b80a..979ed21b5 100644
--- a/src/test/scala/com/typesafe/sbt/packager/universal/ZipHelperSpec.scala
+++ b/src/test/scala/com/typesafe/sbt/packager/universal/ZipHelperSpec.scala
@@ -6,7 +6,7 @@ import org.scalatest._
import java.io.File
import java.nio.file.{Files, Path, Paths}
import java.nio.file.attribute.PosixFilePermission._
-import scala.collection.JavaConversions._
+import scala.collection.JavaConverters._
import org.scalatest.matchers.should.Matchers
import org.scalatest.wordspec.AnyWordSpec
@@ -15,12 +15,12 @@ class ZipHelperSpec extends AnyWordSpec with Matchers with BeforeAndAfterEach wi
var tmp: Path = _
val toDelete = scala.collection.mutable.ListBuffer[Path]()
- override def beforeEach: Unit = {
+ override def beforeEach(): Unit = {
tmp = Files createTempDirectory "_sbt-native-packager"
toDelete += tmp
}
- override def afterAll: Unit =
+ override def afterAll(): Unit =
toDelete foreach { dir =>
scala.util.Try {
Files.walkFileTree(dir, new DeleteDirectoryVisitor)