diff --git a/build.sbt b/build.sbt index a94453a7b..1916dd988 100644 --- a/build.sbt +++ b/build.sbt @@ -24,9 +24,7 @@ git.remoteRepo := "git@github.com:sbt/sbt-native-packager.git" // scripted test settings scriptedSettings -scriptedLaunchOpts <+= version apply { v => - "-Dproject.version=" + v -} +scriptedLaunchOpts += "-Dproject.version=" + version.value // Release configuration releasePublishArtifactsAction := PgpKeys.publishSigned.value diff --git a/project/build.properties b/project/build.properties index 43b8278c6..64317fdae 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=0.13.11 +sbt.version=0.13.15 diff --git a/project/plugins.sbt b/project/plugins.sbt index 269b9e299..a91cecbcf 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -3,9 +3,7 @@ addSbtPlugin("com.typesafe.sbt" % "sbt-site" % "1.0.0") addSbtPlugin("com.github.gseitz" % "sbt-release" % "1.0.0") addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.0.0") -libraryDependencies <+= (sbtVersion) { sv => - "org.scala-sbt" % "scripted-plugin" % sv -} +libraryDependencies += "org.scala-sbt" % "scripted-plugin" % sbtVersion.value // Scripted plugin needs to declare this as a dependency libraryDependencies += "jline" % "jline" % "2.11" diff --git a/src/main/scala/com/typesafe/sbt/packager/SettingsHelper.scala b/src/main/scala/com/typesafe/sbt/packager/SettingsHelper.scala index bcfe0af96..ba15bc15d 100644 --- a/src/main/scala/com/typesafe/sbt/packager/SettingsHelper.scala +++ b/src/main/scala/com/typesafe/sbt/packager/SettingsHelper.scala @@ -29,7 +29,7 @@ object SettingsHelper { packageTask: TaskKey[File], extension: String, classifier: Option[String] = None): Seq[Setting[_]] = - inConfig(config)(Classpaths.publishSettings) ++ inConfig(config)( + inConfig(config)(Classpaths.ivyPublishSettings ++ Classpaths.jvmPublishSettings) ++ inConfig(config)( Seq( artifacts := Seq.empty, packagedArtifacts := Map.empty, 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 72d042444..db716d3c1 100644 --- a/src/main/scala/com/typesafe/sbt/packager/archetypes/JavaAppPackaging.scala +++ b/src/main/scala/com/typesafe/sbt/packager/archetypes/JavaAppPackaging.scala @@ -120,8 +120,9 @@ object JavaAppPackaging extends AutoPlugin { } private def findProjectDependencyArtifacts: Def.Initialize[Task[Seq[Attributed[File]]]] = - (buildDependencies, thisProjectRef, state).apply { (build, thisProject, stateTask) => - val refs = thisProject +: dependencyProjectRefs(build, thisProject) + Def.task { + 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) @@ -134,7 +135,7 @@ object JavaAppPackaging extends AutoPlugin { } yield p ++ n.filter(isRuntimeArtifact) } allArtifactsTask - } + }.flatMap(identity) private def extractArtifacts(stateTask: Task[State], ref: ProjectRef): Task[Seq[Attributed[File]]] = stateTask.flatMap { state => diff --git a/src/sbt-test/cygwin/java-app-archetype/build.sbt b/src/sbt-test/cygwin/java-app-archetype/build.sbt index beb019d64..53cd7e6e6 100644 --- a/src/sbt-test/cygwin/java-app-archetype/build.sbt +++ b/src/sbt-test/cygwin/java-app-archetype/build.sbt @@ -4,20 +4,21 @@ name := "windows-test" version := "0.1.0" -TaskKey[Unit]("check-cygwin-script") <<= (stagingDirectory in Universal, name, streams) map { (dir, name, streams) => +TaskKey[Unit]("check-cygwin-script") := { + val dir = (stagingDirectory in Universal).value // TODO - FIx our cygwin detection! val cygwinBash = file("C:\\cygwin\\bin\\bash.exe") if (!cygwinBash.exists) sys.error("Unable to find the default cygwin (c:\\cygwin) install for testing.") else { - val script = dir / "bin" / name + val script = dir / "bin" / name.value val PathParts = "([\\w])+\\:\\\\(.+)".r val PathParts(drive, path) = script.getAbsolutePath val cygdriveScriptPath = "/cygdrive/" + drive.toLowerCase + "/" + path.replaceAll("\\\\", "/") val pathEnv = "C:\\cygwin\\bin" val cmd = Seq(cygwinBash.getAbsolutePath, cygdriveScriptPath, "-d") val result = - Process(cmd, Some(dir), "PATH" -> pathEnv) ! streams.log match { + Process(cmd, Some(dir), "PATH" -> pathEnv) ! streams.value.log match { case 0 => () case n => sys.error("Failed to run script: " + cygdriveScriptPath + " error code: " + n) diff --git a/src/sbt-test/debian/daemon-group-gid-deb/build.sbt b/src/sbt-test/debian/daemon-group-gid-deb/build.sbt index 6f9ef0c34..f512f9c27 100644 --- a/src/sbt-test/debian/daemon-group-gid-deb/build.sbt +++ b/src/sbt-test/debian/daemon-group-gid-deb/build.sbt @@ -14,8 +14,8 @@ packageSummary := "Test debian package" packageDescription := """A fun package description of our software, with multiple lines.""" -TaskKey[Unit]("check-control-files") <<= (target, streams) map { (target, out) => - val debian = target / "debian-test-0.1.0" / "DEBIAN" +TaskKey[Unit]("check-control-files") := { + val debian = target.value / "debian-test-0.1.0" / "DEBIAN" val postinst = IO.read(debian / "postinst") val postrm = IO.read(debian / "postrm") assert(postinst contains """addGroup daemongroup "25000"""", "postinst misses addgroup for daemongroup: " + postinst) @@ -41,6 +41,6 @@ TaskKey[Unit]("check-control-files") <<= (target, streams) map { (target, out) = !(postinst contains "chown daemonuser:daemongroup /usr/share/debian-test"), "postinst contains chown /usr/share/app_name: \n" + postinst ) - out.log.success("Successfully tested upstart control files") + streams.value.log.success("Successfully tested upstart control files") () } diff --git a/src/sbt-test/debian/daemon-user-deb/build.sbt b/src/sbt-test/debian/daemon-user-deb/build.sbt index 4acf86f7c..ecbd67f7e 100644 --- a/src/sbt-test/debian/daemon-user-deb/build.sbt +++ b/src/sbt-test/debian/daemon-user-deb/build.sbt @@ -13,8 +13,8 @@ packageSummary := "Test debian package" packageDescription := """A fun package description of our software, with multiple lines.""" -TaskKey[Unit]("check-control-files") <<= (target, streams) map { (target, out) => - val debian = target / "debian-test-0.1.0" / "DEBIAN" +TaskKey[Unit]("check-control-files") := { + val debian = target.value / "debian-test-0.1.0" / "DEBIAN" val postinst = IO.read(debian / "postinst") val postrm = IO.read(debian / "postrm") assert(postinst contains """addGroup daemongroup """"", "postinst misses addgroup for daemongroup: " + postinst) @@ -40,6 +40,6 @@ TaskKey[Unit]("check-control-files") <<= (target, streams) map { (target, out) = !(postinst contains "chown daemonuser:daemongroup /usr/share/debian-test"), "postinst contains chown /usr/share/app_name: \n" + postinst ) - out.log.success("Successfully tested upstart control files") + streams.value.log.success("Successfully tested upstart control files") () } diff --git a/src/sbt-test/debian/daemon-user-shell-deb/build.sbt b/src/sbt-test/debian/daemon-user-shell-deb/build.sbt index fbb973b44..cbd02e9be 100644 --- a/src/sbt-test/debian/daemon-user-shell-deb/build.sbt +++ b/src/sbt-test/debian/daemon-user-shell-deb/build.sbt @@ -14,8 +14,8 @@ packageSummary := "Test debian package" packageDescription := """A fun package description of our software, with multiple lines.""" -TaskKey[Unit]("check-control-files") <<= (target, streams) map { (target, out) => - val debian = target / "debian-test-0.1.0" / "DEBIAN" +TaskKey[Unit]("check-control-files") := { + val debian = target.value / "debian-test-0.1.0" / "DEBIAN" val postinst = IO.read(debian / "postinst") val postrm = IO.read(debian / "postrm") assert( diff --git a/src/sbt-test/debian/daemon-user-uid-deb/build.sbt b/src/sbt-test/debian/daemon-user-uid-deb/build.sbt index 9ddc43fa1..b7462ec46 100644 --- a/src/sbt-test/debian/daemon-user-uid-deb/build.sbt +++ b/src/sbt-test/debian/daemon-user-uid-deb/build.sbt @@ -14,8 +14,8 @@ packageSummary := "Test debian package" packageDescription := """A fun package description of our software, with multiple lines.""" -TaskKey[Unit]("check-control-files") <<= (target, streams) map { (target, out) => - val debian = target / "debian-test-0.1.0" / "DEBIAN" +TaskKey[Unit]("check-control-files") := { + val debian = target.value / "debian-test-0.1.0" / "DEBIAN" val postinst = IO.read(debian / "postinst") val postrm = IO.read(debian / "postrm") assert(postinst contains """addGroup daemongroup """"", "postinst misses addgroup for daemongroup: " + postinst) @@ -41,6 +41,6 @@ TaskKey[Unit]("check-control-files") <<= (target, streams) map { (target, out) = !(postinst contains "chown daemonuser:daemongroup /usr/share/debian-test"), "postinst contains chown /usr/share/app_name: \n" + postinst ) - out.log.success("Successfully tested upstart control files") + streams.value.log.success("Successfully tested upstart control files") () } diff --git a/src/sbt-test/debian/java-app-archetype/build.sbt b/src/sbt-test/debian/java-app-archetype/build.sbt index e32512534..e3fbb961a 100644 --- a/src/sbt-test/debian/java-app-archetype/build.sbt +++ b/src/sbt-test/debian/java-app-archetype/build.sbt @@ -15,8 +15,9 @@ debianPackageDependencies in Debian ++= Seq("java2-runtime", "bash (>= 2.05a-11) debianPackageRecommends in Debian += "git" -TaskKey[Unit]("check-script") <<= (stagingDirectory in Universal, name, streams) map { (dir, name, streams) => - val script = dir / "bin" / name +TaskKey[Unit]("check-script") := { + val dir = (stagingDirectory in Universal).value + val script = dir / "bin" / name.value System.out.synchronized { System.err.println("---SCRIPT---") val scriptContents = IO.read(script) @@ -27,7 +28,7 @@ TaskKey[Unit]("check-script") <<= (stagingDirectory in Universal, name, streams) } val cmd = "bash " + script.getAbsolutePath + " -d" val result = - Process(cmd) ! streams.log match { + Process(cmd) ! streams.value.log match { case 0 => () case n => sys.error("Failed to run script: " + script.getAbsolutePath + " error code: " + n) diff --git a/src/sbt-test/debian/jdeb-conflicts/build.sbt b/src/sbt-test/debian/jdeb-conflicts/build.sbt index dbe98be82..004dd944e 100644 --- a/src/sbt-test/debian/jdeb-conflicts/build.sbt +++ b/src/sbt-test/debian/jdeb-conflicts/build.sbt @@ -13,13 +13,13 @@ packageDescription := """A fun package description of our software, debianPackageConflicts in Debian := Seq("debian-test-package") -TaskKey[Unit]("check-conflicts") <<= (target, streams) map { (target, out) => - val extracted = target / "extracted" - Seq("dpkg-deb", "-R", (target / "debian-test_0.1.0_all.deb").absolutePath, extracted.absolutePath).! +TaskKey[Unit]("check-conflicts") := { + val extracted = target.value / "extracted" + Seq("dpkg-deb", "-R", (target.value / "debian-test_0.1.0_all.deb").absolutePath, extracted.absolutePath).! val control = IO.read(extracted / "DEBIAN" / "control") assert(control.contains("Conflicts:")) - out.log.success("Successfully tested systemV control files") + streams.value.log.success("Successfully tested systemV control files") () } diff --git a/src/sbt-test/debian/jdeb-dependencies/build.sbt b/src/sbt-test/debian/jdeb-dependencies/build.sbt index 2f42e3b59..3e596ce12 100644 --- a/src/sbt-test/debian/jdeb-dependencies/build.sbt +++ b/src/sbt-test/debian/jdeb-dependencies/build.sbt @@ -13,13 +13,13 @@ packageDescription := """A fun package description of our software, debianPackageDependencies in Debian := Seq() -TaskKey[Unit]("check-dependencies") <<= (target, streams) map { (target, out) => - val extracted = target / "extracted" - Seq("dpkg-deb", "-R", (target / "debian-test_0.1.0_all.deb").absolutePath, extracted.absolutePath).! +TaskKey[Unit]("check-dependencies") := { + val extracted = target.value / "extracted" + Seq("dpkg-deb", "-R", (target.value / "debian-test_0.1.0_all.deb").absolutePath, extracted.absolutePath).! val control = IO.read(extracted / "DEBIAN" / "control") assert(!control.contains("Depends:")) - out.log.success("Successfully tested systemV control files") + streams.value.log.success("Successfully tested systemV control files") () } diff --git a/src/sbt-test/debian/jdeb-dir-mappings/build.sbt b/src/sbt-test/debian/jdeb-dir-mappings/build.sbt index d73fe9723..cd41a8c86 100644 --- a/src/sbt-test/debian/jdeb-dir-mappings/build.sbt +++ b/src/sbt-test/debian/jdeb-dir-mappings/build.sbt @@ -23,14 +23,14 @@ linuxPackageMappings in Debian += packageDirectoryAndContentsMapping( (baseDirectory.value / "src" / "resources" / "empty") -> "/var/empty" ) -TaskKey[Unit]("check-dir-mappings") <<= (target, streams) map { (target, out) => +TaskKey[Unit]("check-dir-mappings") := { // val tmpDir = java.nio.file.Files.createTempDirectory("jdeb") val extracted = file("/tmp/jdeb" + System.currentTimeMillis().toString) - Seq("dpkg-deb", "-R", (target / "debian-test_0.1.0_all.deb").absolutePath, extracted.absolutePath).! + Seq("dpkg-deb", "-R", (target.value / "debian-test_0.1.0_all.deb").absolutePath, extracted.absolutePath).! assert((extracted / "usr/share/conf/application.conf").exists(), "File application.conf not exists") assert((extracted / "usr/share/conf/log4j.properties").exists(), "File log4j.properties not exists") assert((extracted / "var/empty").exists(), "Empty dir not exists") extracted.delete() - out.log.success("Successfully tested control script") + streams.value.log.success("Successfully tested control script") () } diff --git a/src/sbt-test/debian/jdeb-provides/build.sbt b/src/sbt-test/debian/jdeb-provides/build.sbt index 054edd56e..376bcb205 100644 --- a/src/sbt-test/debian/jdeb-provides/build.sbt +++ b/src/sbt-test/debian/jdeb-provides/build.sbt @@ -13,13 +13,13 @@ packageDescription := """A fun package description of our software, debianPackageProvides in Debian := Seq("debian-test-package") -TaskKey[Unit]("check-provides") <<= (target, streams) map { (target, out) => - val extracted = target / "extracted" - Seq("dpkg-deb", "-R", (target / "debian-test_0.1.0_all.deb").absolutePath, extracted.absolutePath).! +TaskKey[Unit]("check-provides") := { + val extracted = target.value / "extracted" + Seq("dpkg-deb", "-R", (target.value / "debian-test_0.1.0_all.deb").absolutePath, extracted.absolutePath).! val control = IO.read(extracted / "DEBIAN" / "control") assert(control.contains("Provides:")) - out.log.success("Successfully tested systemV control files") + streams.value.log.success("Successfully tested systemV control files") () } diff --git a/src/sbt-test/debian/jdeb-script-replacements/build.sbt b/src/sbt-test/debian/jdeb-script-replacements/build.sbt index b5911ccd4..2f94cd211 100644 --- a/src/sbt-test/debian/jdeb-script-replacements/build.sbt +++ b/src/sbt-test/debian/jdeb-script-replacements/build.sbt @@ -15,11 +15,11 @@ debianPackageDependencies in Debian ++= Seq("java2-runtime", "bash (>= 2.05a-11) debianPackageRecommends in Debian += "git" -TaskKey[Unit]("check-control-files") <<= (target, streams) map { (target, out) => +TaskKey[Unit]("check-control-files") := { val header = "#!/bin/sh" - val extracted = target / "extracted" + val extracted = target.value / "extracted" println(extracted.getAbsolutePath) - Seq("dpkg-deb", "-R", (target / "debian-test_0.1.0_all.deb").absolutePath, extracted.absolutePath).! + Seq("dpkg-deb", "-R", (target.value / "debian-test_0.1.0_all.deb").absolutePath, extracted.absolutePath).! val preinst = extracted / "DEBIAN/preinst" val postinst = extracted / "DEBIAN/postinst" val prerm = extracted / "DEBIAN/prerm" @@ -32,6 +32,6 @@ TaskKey[Unit]("check-control-files") <<= (target, streams) map { (target, out) = "script contains more than one header line:\n" + script + "\n" + content ) } - out.log.success("Successfully tested systemV control files") + streams.value.log.success("Successfully tested systemV control files") () } diff --git a/src/sbt-test/debian/log-directory/build.sbt b/src/sbt-test/debian/log-directory/build.sbt index 2a91a8e59..e0270d33c 100644 --- a/src/sbt-test/debian/log-directory/build.sbt +++ b/src/sbt-test/debian/log-directory/build.sbt @@ -17,17 +17,17 @@ packageDescription := """A fun package description of our software, defaultLinuxLogsLocation := "/non-standard/log" -InputKey[Unit]("check-softlink") <<= inputTask { (argTask: TaskKey[Seq[String]]) => - (argTask) map { (args: Seq[String]) => - assert(args.size >= 2, "Usage: check-softlink link to target") - val link = args(0) - val target = args(args.size - 1) - val absolutePath = ("readlink -m " + link).!!.trim - assert(link != absolutePath, "Expected symbolic link '" + link + "' does not exist") - assert( - target == absolutePath, - "Expected symbolic link '" + link + "' to point to '" + - target + "', but instead it's '" + absolutePath + "'" - ) - } +InputKey[Unit]("check-softlink") := { + import complete.DefaultParsers._ + val args = spaceDelimited("").parsed + assert(args.size >= 2, "Usage: check-softlink link to target") + val link = args(0) + val target = args(args.size - 1) + val absolutePath = ("readlink -m " + link).!!.trim + assert(link != absolutePath, "Expected symbolic link '" + link + "' does not exist") + assert( + target == absolutePath, + "Expected symbolic link '" + link + "' to point to '" + + target + "', but instead it's '" + absolutePath + "'" + ) } diff --git a/src/sbt-test/debian/override-control-files/build.sbt b/src/sbt-test/debian/override-control-files/build.sbt index 953b8f231..a943ee690 100644 --- a/src/sbt-test/debian/override-control-files/build.sbt +++ b/src/sbt-test/debian/override-control-files/build.sbt @@ -24,8 +24,8 @@ maintainerScripts in Debian := maintainerScriptsFromDirectory( Seq(Preinst, Postinst, Prerm, Postrm) ) -TaskKey[Unit]("check-control-files") <<= (target, streams) map { (target, out) => - val debian = target / "debian-test-0.1.0" / "DEBIAN" +TaskKey[Unit]("check-control-files") := { + val debian = target.value / "debian-test-0.1.0" / "DEBIAN" val postinst = IO.read(debian / "postinst") val preinst = IO.read(debian / "preinst") val postrm = IO.read(debian / "postrm") diff --git a/src/sbt-test/debian/override-etc-default/build.sbt b/src/sbt-test/debian/override-etc-default/build.sbt index 1c04e40fb..5053e8d6b 100644 --- a/src/sbt-test/debian/override-etc-default/build.sbt +++ b/src/sbt-test/debian/override-etc-default/build.sbt @@ -20,10 +20,10 @@ packageSummary := "Test debian package" packageDescription := """A fun package description of our software, with multiple lines.""" -TaskKey[Unit]("check-etc-default") <<= (target, streams) map { (target, out) => - val extracted = target / "tmp" / "extracted-package" +TaskKey[Unit]("check-etc-default") := { + val extracted = target.value / "tmp" / "extracted-package" extracted.mkdirs() - Seq("dpkg-deb", "-R", (target / "debian-test_0.1.0_all.deb").absolutePath, extracted.absolutePath).! + Seq("dpkg-deb", "-R", (target.value / "debian-test_0.1.0_all.deb").absolutePath, extracted.absolutePath).! val script = IO.read(extracted / "etc" / "default" / "debian-test") assert( diff --git a/src/sbt-test/debian/override-loader-functions/build.sbt b/src/sbt-test/debian/override-loader-functions/build.sbt index 9d216534a..51b804d05 100644 --- a/src/sbt-test/debian/override-loader-functions/build.sbt +++ b/src/sbt-test/debian/override-loader-functions/build.sbt @@ -14,10 +14,10 @@ packageSummary := "Test debian package" packageDescription := """A fun package description of our software, with multiple lines.""" -TaskKey[Unit]("check-loader-functions") <<= (target, streams) map { (target, out) => - val extracted = target / "tmp" / "extracted-package" +TaskKey[Unit]("check-loader-functions") := { + val extracted = target.value / "tmp" / "extracted-package" extracted.mkdirs() - Seq("dpkg-deb", "-e", (target / "debian-test_0.1.0_all.deb").absolutePath, extracted.absolutePath).! + Seq("dpkg-deb", "-e", (target.value / "debian-test_0.1.0_all.deb").absolutePath, extracted.absolutePath).! val script = IO.read(extracted / "postinst") diff --git a/src/sbt-test/debian/override-start-script-systemd/build.sbt b/src/sbt-test/debian/override-start-script-systemd/build.sbt index 50efd8ba5..af8065a0a 100644 --- a/src/sbt-test/debian/override-start-script-systemd/build.sbt +++ b/src/sbt-test/debian/override-start-script-systemd/build.sbt @@ -14,10 +14,10 @@ packageSummary := "Test debian package" packageDescription := """A fun package description of our software, with multiple lines.""" -TaskKey[Unit]("check-startup-script") <<= (target, streams) map { (target, out) => - val extracted = target / "tmp" / "extracted-package" +TaskKey[Unit]("check-startup-script") := { + val extracted = target.value / "tmp" / "extracted-package" extracted.mkdirs() - Seq("dpkg-deb", "-R", (target / "debian-test_0.1.0_all.deb").absolutePath, extracted.absolutePath).! + Seq("dpkg-deb", "-R", (target.value / "debian-test_0.1.0_all.deb").absolutePath, extracted.absolutePath).! val script = IO.read(extracted / "lib" / "systemd" / "system" / "debian-test.service") assert(script.startsWith("# right systemd template"), s"override script wasn't picked, script is\n$script") diff --git a/src/sbt-test/debian/override-start-script-systemv/build.sbt b/src/sbt-test/debian/override-start-script-systemv/build.sbt index 3fcc374f7..67de20462 100644 --- a/src/sbt-test/debian/override-start-script-systemv/build.sbt +++ b/src/sbt-test/debian/override-start-script-systemv/build.sbt @@ -14,10 +14,10 @@ packageSummary := "Test debian package" packageDescription := """A fun package description of our software, with multiple lines.""" -TaskKey[Unit]("check-startup-script") <<= (target, streams) map { (target, out) => - val extracted = target / "tmp" / "extracted-package" +TaskKey[Unit]("check-startup-script") := { + val extracted = target.value / "tmp" / "extracted-package" extracted.mkdirs() - Seq("dpkg-deb", "-R", (target / "debian-test_0.1.0_all.deb").absolutePath, extracted.absolutePath).! + Seq("dpkg-deb", "-R", (target.value / "debian-test_0.1.0_all.deb").absolutePath, extracted.absolutePath).! val script = IO.read(extracted / "etc" / "init.d" / "debian-test") assert(script.startsWith("# right systemv template"), s"override script wasn't picked, script is\n$script") diff --git a/src/sbt-test/debian/override-start-script-upstart/build.sbt b/src/sbt-test/debian/override-start-script-upstart/build.sbt index d7315a20e..27fc1a50b 100644 --- a/src/sbt-test/debian/override-start-script-upstart/build.sbt +++ b/src/sbt-test/debian/override-start-script-upstart/build.sbt @@ -14,10 +14,10 @@ packageSummary := "Test debian package" packageDescription := """A fun package description of our software, with multiple lines.""" -TaskKey[Unit]("check-startup-script") <<= (target, streams) map { (target, out) => - val extracted = target / "tmp" / "extracted-package" +TaskKey[Unit]("check-startup-script") := { + val extracted = target.value / "tmp" / "extracted-package" extracted.mkdirs() - Seq("dpkg-deb", "-R", (target / "debian-test_0.1.0_all.deb").absolutePath, extracted.absolutePath).! + Seq("dpkg-deb", "-R", (target.value / "debian-test_0.1.0_all.deb").absolutePath, extracted.absolutePath).! val script = IO.read(extracted / "etc" / "init" / "debian-test.conf") assert(script.startsWith("# right upstart template"), s"override script wasn't picked, script is\n$script") diff --git a/src/sbt-test/debian/systemd-deb/build.sbt b/src/sbt-test/debian/systemd-deb/build.sbt index 502cc4b95..5c658d631 100644 --- a/src/sbt-test/debian/systemd-deb/build.sbt +++ b/src/sbt-test/debian/systemd-deb/build.sbt @@ -14,8 +14,8 @@ daemonUser in Linux := "testuser" systemdSuccessExitStatus in Debian += "1" -TaskKey[Unit]("check-startup-script") <<= (target, streams) map { (target, out) => - val script = IO.read(target / "debian-test-0.1.0" / "lib" / "systemd" / "system" / "debian-test.service") +TaskKey[Unit]("check-startup-script") := { + val script = IO.read(target.value / "debian-test-0.1.0" / "lib" / "systemd" / "system" / "debian-test.service") assert(script.contains("Requires=network.target"), "script doesn't contain Default-Start header\n" + script) assert(script.contains("User=testuser"), "script doesn't contain `User` header\n" + script) assert( @@ -23,27 +23,27 @@ TaskKey[Unit]("check-startup-script") <<= (target, streams) map { (target, out) "script doesn't contain EnvironmentFile header\n" + script ) assert(script.contains("SuccessExitStatus=1"), "script doesn't contain SuccessExitStatus header\n" + script) - out.log.success("Successfully tested systemd start up script") + streams.value.log.success("Successfully tested systemd start up script") () } -TaskKey[Unit]("check-etc-default") <<= (target, streams) map { (target, out) => +TaskKey[Unit]("check-etc-default") := { val script = - IO.read(target / "debian-test-0.1.0" / "etc" / "default" / "debian-test") + IO.read(target.value / "debian-test-0.1.0" / "etc" / "default" / "debian-test") assert(script.contains("systemd"), s"systemd etc-default template wasn't selected; contents are:\n" + script) () } -TaskKey[Unit]("check-autostart") <<= (target, streams) map { (target, out) => - val script = IO.read(target / "debian-test-0.1.0" / "DEBIAN" / "postinst") +TaskKey[Unit]("check-autostart") := { + val script = IO.read(target.value / "debian-test-0.1.0" / "DEBIAN" / "postinst") assert(script.contains("""addService debian-test || echo "debian-test could not be registered" |startService debian-test || echo "debian-test could not be started" |""".stripMargin), "addService, startService post install commands missing or incorrect") () } -TaskKey[Unit]("check-no-autostart") <<= (target, streams) map { (target, out) => - val script = IO.read(target / "debian-test-0.1.0" / "DEBIAN" / "postinst") +TaskKey[Unit]("check-no-autostart") := { + val script = IO.read(target.value / "debian-test-0.1.0" / "DEBIAN" / "postinst") assert(script.contains("""addService debian-test || echo "debian-test could not be registered" |""".stripMargin), "addService post install commands missing or incorrect") () diff --git a/src/sbt-test/debian/sysvinit-deb/build.sbt b/src/sbt-test/debian/sysvinit-deb/build.sbt index 2d6bf4521..a97d4fd4b 100644 --- a/src/sbt-test/debian/sysvinit-deb/build.sbt +++ b/src/sbt-test/debian/sysvinit-deb/build.sbt @@ -21,22 +21,22 @@ requiredStartFacilities in Debian := Some("$test-deb-service") daemonStdoutLogFile := Some("test.log") -TaskKey[Unit]("check-control-files") <<= (target, streams) map { (target, out) => +TaskKey[Unit]("check-control-files") := { val header = "#!/bin/sh" - val debian = target / "debian-test-0.1.0" / "DEBIAN" + val debian = target.value / "debian-test-0.1.0" / "DEBIAN" val postinst = IO.read(debian / "postinst") val postrm = IO.read(debian / "postrm") Seq(postinst, postrm) foreach { script => assert(script.startsWith(header), "script doesn't start with #!/bin/sh header:\n" + script) assert(header.r.findAllIn(script).length == 1, "script contains more than one header line:\n" + script) } - out.log.success("Successfully tested systemV control files") + streams.value.log.success("Successfully tested systemV control files") () } -TaskKey[Unit]("check-startup-script") <<= (target, streams) map { (target, out) => +TaskKey[Unit]("check-startup-script") := { val script = - IO.read(target / "debian-test-0.1.0" / "etc" / "init.d" / "debian-test") + IO.read(target.value / "debian-test-0.1.0" / "etc" / "init.d" / "debian-test") assert(script.contains("# Default-Start: 2 3 4 5"), "script doesn't contain Default-Start header\n" + script) assert(script.contains("# Default-Stop: 0 1 6"), "script doesn't contain Default-Stop header\n" + script) assert( @@ -55,20 +55,20 @@ TaskKey[Unit]("check-startup-script") <<= (target, streams) map { (target, out) ) assert(script.contains("""logfile="test.log""""), "script contains wrong log file for stdout\n" + script) - out.log.success("Successfully tested systemV start up script") + streams.value.log.success("Successfully tested systemV start up script") () } -TaskKey[Unit]("check-autostart") <<= (target, streams) map { (target, out) => - val script = IO.read(target / "debian-test-0.1.0" / "DEBIAN" / "postinst") +TaskKey[Unit]("check-autostart") := { + val script = IO.read(target.value / "debian-test-0.1.0" / "DEBIAN" / "postinst") assert(script.contains("""addService debian-test || echo "debian-test could not be registered" |startService debian-test || echo "debian-test could not be started" |""".stripMargin), "addService, startService post install commands missing or incorrect") () } -TaskKey[Unit]("check-no-autostart") <<= (target, streams) map { (target, out) => - val script = IO.read(target / "debian-test-0.1.0" / "DEBIAN" / "postinst") +TaskKey[Unit]("check-no-autostart") := { + val script = IO.read(target.value / "debian-test-0.1.0" / "DEBIAN" / "postinst") assert(script.contains("""addService debian-test || echo "debian-test could not be registered" |""".stripMargin), "addService post install commands missing or incorrect") () diff --git a/src/sbt-test/debian/sysvinit-stoptimeouts-deb/build.sbt b/src/sbt-test/debian/sysvinit-stoptimeouts-deb/build.sbt index ccd5d8e3c..27cf2ceac 100644 --- a/src/sbt-test/debian/sysvinit-stoptimeouts-deb/build.sbt +++ b/src/sbt-test/debian/sysvinit-stoptimeouts-deb/build.sbt @@ -23,22 +23,22 @@ termTimeout in Debian := 10 killTimeout in Debian := 20 -TaskKey[Unit]("check-control-files") <<= (target, streams) map { (target, out) => +TaskKey[Unit]("check-control-files") := { val header = "#!/bin/sh" - val debian = target / "debian-test-0.1.0" / "DEBIAN" + val debian = target.value / "debian-test-0.1.0" / "DEBIAN" val postinst = IO.read(debian / "postinst") val postrm = IO.read(debian / "postrm") Seq(postinst, postrm) foreach { script => assert(script.startsWith(header), "script doesn't start with #!/bin/sh header:\n" + script) assert(header.r.findAllIn(script).length == 1, "script contains more than one header line:\n" + script) } - out.log.success("Successfully tested systemV control files") + streams.value.log.success("Successfully tested systemV control files") () } -TaskKey[Unit]("check-startup-script") <<= (target, streams) map { (target, out) => +TaskKey[Unit]("check-startup-script") := { val script = - IO.read(target / "debian-test-0.1.0" / "etc" / "init.d" / "debian-test") + IO.read(target.value / "debian-test-0.1.0" / "etc" / "init.d" / "debian-test") assert(script.contains("# Default-Start: 2 3 4 5"), "script doesn't contain Default-Start header\n" + script) assert(script.contains("# Default-Stop: 0 1 6"), "script doesn't contain Default-Stop header\n" + script) assert( @@ -50,6 +50,6 @@ TaskKey[Unit]("check-startup-script") <<= (target, streams) map { (target, out) "script doesn't contain Required-Stop header\n" + script ) assert(script.contains("--retry=TERM/10/KILL/20"), "script doesn't contains stop timeouts\n" + script) - out.log.success("Successfully tested systemV start up script") + streams.value.log.success("Successfully tested systemV start up script") () } diff --git a/src/sbt-test/debian/test-executableScriptName/build.sbt b/src/sbt-test/debian/test-executableScriptName/build.sbt index e4c1441f3..d62b4a896 100644 --- a/src/sbt-test/debian/test-executableScriptName/build.sbt +++ b/src/sbt-test/debian/test-executableScriptName/build.sbt @@ -17,9 +17,9 @@ debianPackageDependencies in Debian ++= Seq("java2-runtime", "bash (>= 2.05a-11) debianPackageRecommends in Debian += "git" -TaskKey[Unit]("check-upstart-script") <<= (target, streams) map { (target, out) => - val script = IO.read(target / "debian-test-0.1.0" / "etc" / "init" / "debian-test.conf") +TaskKey[Unit]("check-upstart-script") := { + val script = IO.read(target.value / "debian-test-0.1.0" / "etc" / "init" / "debian-test.conf") assert(script.contains("exec sudo -u debian-test bin/debian-exec"), "wrong exec call\n" + script) - out.log.success("Successfully tested control script") + streams.value.log.success("Successfully tested control script") () } diff --git a/src/sbt-test/debian/test-mapping-helpers/build.sbt b/src/sbt-test/debian/test-mapping-helpers/build.sbt index adcd8f9a7..76f1a17d4 100644 --- a/src/sbt-test/debian/test-mapping-helpers/build.sbt +++ b/src/sbt-test/debian/test-mapping-helpers/build.sbt @@ -17,8 +17,8 @@ packageDescription := """A fun package description of our software, // linuxPackageMappings in Debian += packageTemplateMapping("/var/run/debian")() // not work linuxPackageMappings in Debian += packageTemplateMapping(Seq("/opt/test/other"): _*)() -linuxPackageMappings in Debian <+= (Keys.normalizedName, target) map { (name, tmp) => - packageTemplateMapping("/opt/test/" + name)(tmp) +linuxPackageMappings in Debian += { + packageTemplateMapping("/opt/test/" + Keys.normalizedName.value)(target.value) } // Consider using mappings in Universal diff --git a/src/sbt-test/debian/test-mapping/build.sbt b/src/sbt-test/debian/test-mapping/build.sbt index b7e20c8df..00c2e65d6 100644 --- a/src/sbt-test/debian/test-mapping/build.sbt +++ b/src/sbt-test/debian/test-mapping/build.sbt @@ -19,11 +19,11 @@ debianPackageDependencies in Debian ++= Seq("java2-runtime", "bash (>= 2.05a-11) debianPackageRecommends in Debian += "git" -TaskKey[Unit]("check-control-script") <<= (target, streams) map { (target, out) => +TaskKey[Unit]("check-control-script") := { val script = - IO.read(target / "debian-test-override-0.1.0" / "DEBIAN" / "control") + IO.read(target.value / "debian-test-override-0.1.0" / "DEBIAN" / "control") assert(script.contains("Package: debian-test-package\n"), "script doesn't [Package: debian-test-package]\n" + script) assert(script.contains("Source: debian-test-package\n"), "script doesn't [Source: debian-test-package]\n" + script) - out.log.success("Successfully tested control script") + streams.value.log.success("Successfully tested control script") () } diff --git a/src/sbt-test/debian/test-packageName/build.sbt b/src/sbt-test/debian/test-packageName/build.sbt index 0634ea07d..c202fb018 100644 --- a/src/sbt-test/debian/test-packageName/build.sbt +++ b/src/sbt-test/debian/test-packageName/build.sbt @@ -19,11 +19,11 @@ debianPackageDependencies in Debian ++= Seq("java2-runtime", "bash (>= 2.05a-11) debianPackageRecommends in Debian += "git" -TaskKey[Unit]("check-control-script") <<= (target, streams) map { (target, out) => +TaskKey[Unit]("check-control-script") := { val script = - IO.read(target / "debian-test-override-0.1.0" / "DEBIAN" / "control") + IO.read(target.value / "debian-test-override-0.1.0" / "DEBIAN" / "control") assert(script.contains("Package: debian-test-package\n"), "script doesn't [Package: debian-test-package]\n" + script) assert(script.contains("Source: debian-test-package\n"), "script doesn't [Source: debian-test-package]\n" + script) - out.log.success("Successfully tested control script") + streams.value.log.success("Successfully tested control script") () } diff --git a/src/sbt-test/debian/upstart-deb-facilities/build.sbt b/src/sbt-test/debian/upstart-deb-facilities/build.sbt index 705204028..55850d1c4 100644 --- a/src/sbt-test/debian/upstart-deb-facilities/build.sbt +++ b/src/sbt-test/debian/upstart-deb-facilities/build.sbt @@ -21,13 +21,13 @@ requiredStopFacilities in Debian := Some("[networking]") packageDescription := """A fun package description of our software, with multiple lines.""" -TaskKey[Unit]("check-startup-script") <<= (target, streams) map { (target, out) => - val script = IO.read(target / "debian-test-0.1.0" / "etc" / "init" / "debian-test.conf") +TaskKey[Unit]("check-startup-script") := { + val script = IO.read(target.value / "debian-test-0.1.0" / "etc" / "init" / "debian-test.conf") assert(script.contains("start on runlevel [2345]"), "script doesn't contain start on runlevel header\n" + script) assert(script.contains("stop on runlevel [016]"), "script doesn't contain stop on runlevel header\n" + script) assert(script.contains("start on started [networking]"), "script contains start on started header\n" + script) assert(script.contains("stop on stopping [networking]"), "script contains stop on stopping header\n" + script) assert(script.contains("kill timeout 5"), "script doenst't contain kill 'kill timeout 5'\n" + script) - out.log.success("Successfully tested systemV start up script") + streams.value.log.success("Successfully tested systemV start up script") () } diff --git a/src/sbt-test/debian/upstart-deb/build.sbt b/src/sbt-test/debian/upstart-deb/build.sbt index a7313f260..ec89455f6 100644 --- a/src/sbt-test/debian/upstart-deb/build.sbt +++ b/src/sbt-test/debian/upstart-deb/build.sbt @@ -14,33 +14,33 @@ packageSummary := "Test debian package" packageDescription := """A fun package description of our software, with multiple lines.""" -TaskKey[Unit]("check-control-files") <<= (target, streams) map { (target, out) => - val debian = target / "debian-test-0.1.0" / "DEBIAN" +TaskKey[Unit]("check-control-files") := { + val debian = target.value / "debian-test-0.1.0" / "DEBIAN" val postinst = IO.read(debian / "postinst") val prerm = IO.read(debian / "prerm") assert(postinst contains "initctl reload-configuration", "postinst misses initctl: " + postinst) assert(postinst contains """startService debian-test""", "postinst misses service start: " + postinst) assert(prerm contains """stopService debian-test""", "prerm misses stop: " + prerm) - out.log.success("Successfully tested upstart control files") + streams.value.log.success("Successfully tested upstart control files") () } -InputKey[Unit]("check-softlink") <<= inputTask { (argTask: TaskKey[Seq[String]]) => - (argTask) map { (args: Seq[String]) => - assert(args.size >= 2, "Usage: check-softlink link to target") - val link = args(0) - val target = args(args.size - 1) - val absolutePath = ("readlink -m " + link).!!.trim - assert(link != absolutePath, "Expected symbolic link '" + link + "' does not exist") - assert( - target == absolutePath, - "Expected symbolic link '" + link + "' to point to '" + target + "', but instead it's '" + absolutePath + "'" - ) - } +InputKey[Unit]("check-softlink") := { + import complete.DefaultParsers._ + val args = spaceDelimited("").parsed + assert(args.size >= 2, "Usage: check-softlink link to target") + val link = args(0) + val target = args(args.size - 1) + val absolutePath = ("readlink -m " + link).!!.trim + assert(link != absolutePath, "Expected symbolic link '" + link + "' does not exist") + assert( + target == absolutePath, + "Expected symbolic link '" + link + "' to point to '" + target + "', but instead it's '" + absolutePath + "'" + ) } -TaskKey[Unit]("check-startup-script") <<= (target, streams) map { (target, out) => - val script = IO.read(target / "debian-test-0.1.0" / "etc" / "init" / "debian-test.conf") +TaskKey[Unit]("check-startup-script") := { + val script = IO.read(target.value / "debian-test-0.1.0" / "etc" / "init" / "debian-test.conf") assert(script.contains("start on runlevel [2345]"), "script doesn't contain start on runlevel header\n" + script) assert(script.contains("stop on runlevel [016]"), "script doesn't contain stop on runlevel header\n" + script) assert(!script.contains("start on started"), "script contains start on started header\n" + script) @@ -53,16 +53,16 @@ TaskKey[Unit]("check-startup-script") <<= (target, streams) map { (target, out) () } -TaskKey[Unit]("check-autostart") <<= (target, streams) map { (target, out) => - val script = IO.read(target / "debian-test-0.1.0" / "DEBIAN" / "postinst") +TaskKey[Unit]("check-autostart") := { + val script = IO.read(target.value / "debian-test-0.1.0" / "DEBIAN" / "postinst") assert(script.contains("""addService debian-test || echo "debian-test could not be registered" |startService debian-test || echo "debian-test could not be started" |""".stripMargin), "addService, startService post install commands missing or incorrect") () } -TaskKey[Unit]("check-no-autostart") <<= (target, streams) map { (target, out) => - val script = IO.read(target / "debian-test-0.1.0" / "DEBIAN" / "postinst") +TaskKey[Unit]("check-no-autostart") := { + val script = IO.read(target.value / "debian-test-0.1.0" / "DEBIAN" / "postinst") assert(script.contains("""addService debian-test || echo "debian-test could not be registered" |""".stripMargin), "addService post install commands missing or incorrect") () diff --git a/src/sbt-test/docker/test-executableScriptName/build.sbt b/src/sbt-test/docker/test-executableScriptName/build.sbt index f5d54bac7..6160d488e 100644 --- a/src/sbt-test/docker/test-executableScriptName/build.sbt +++ b/src/sbt-test/docker/test-executableScriptName/build.sbt @@ -10,12 +10,12 @@ version := "0.1.0" maintainer := "Gary Coady " -TaskKey[Unit]("check-dockerfile") <<= (target, streams) map { (target, out) => - val dockerfile = IO.read(target / "docker" / "Dockerfile") +TaskKey[Unit]("check-dockerfile") := { + val dockerfile = IO.read(target.value / "docker" / "Dockerfile") assert( dockerfile.contains("ENTRYPOINT [\"bin/docker-exec\"]\n"), "dockerfile doesn't contain ENTRYPOINT [\"docker-exec\"]\n" + dockerfile ) - out.log.success("Successfully tested control script") + streams.value.log.success("Successfully tested control script") () } diff --git a/src/sbt-test/docker/test-packageName-universal/build.sbt b/src/sbt-test/docker/test-packageName-universal/build.sbt index ee0cec50d..7a0add09b 100644 --- a/src/sbt-test/docker/test-packageName-universal/build.sbt +++ b/src/sbt-test/docker/test-packageName-universal/build.sbt @@ -8,12 +8,12 @@ version := "0.1.0" maintainer := "Gary Coady " -TaskKey[Unit]("check-dockerfile") <<= (target, streams) map { (target, out) => - val dockerfile = IO.read(target / "docker" / "Dockerfile") +TaskKey[Unit]("check-dockerfile") := { + val dockerfile = IO.read(target.value / "docker" / "Dockerfile") assert( dockerfile.contains("ENTRYPOINT [\"bin/docker-test\"]\n"), "dockerfile doesn't contain ENTRYPOINT [\"docker-test\"]\n" + dockerfile ) - out.log.success("Successfully tested control script") + streams.value.log.success("Successfully tested control script") () } diff --git a/src/sbt-test/docker/test-packageName/build.sbt b/src/sbt-test/docker/test-packageName/build.sbt index cef82a62c..d86fab96c 100644 --- a/src/sbt-test/docker/test-packageName/build.sbt +++ b/src/sbt-test/docker/test-packageName/build.sbt @@ -9,12 +9,12 @@ version := "0.1.0" maintainer := "Gary Coady " -TaskKey[Unit]("check-dockerfile") <<= (target, streams) map { (target, out) => - val dockerfile = IO.read(target / "docker" / "Dockerfile") +TaskKey[Unit]("check-dockerfile") := { + val dockerfile = IO.read(target.value / "docker" / "Dockerfile") assert( dockerfile.contains("ENTRYPOINT [\"bin/docker-test\"]\n"), "dockerfile doesn't contain ENTRYPOINT [\"docker-test\"]\n" + dockerfile ) - out.log.success("Successfully tested control script") + streams.value.log.success("Successfully tested control script") () } diff --git a/src/sbt-test/jdkpackager/test-package-image/build.sbt b/src/sbt-test/jdkpackager/test-package-image/build.sbt index b6ea6dc17..f809f7c31 100644 --- a/src/sbt-test/jdkpackager/test-package-image/build.sbt +++ b/src/sbt-test/jdkpackager/test-package-image/build.sbt @@ -38,13 +38,13 @@ lazy val iconGlob = sys.props("os.name").toLowerCase match { jdkAppIcon := (baseDirectory.value / ".." / ".." / ".." / ".." / "test-project-jdkpackager" ** iconGlob).getPaths.headOption .map(file) -TaskKey[Unit]("checkImage") <<= (target in JDKPackager, name, streams) map { (base, name, streams) ⇒ +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) } - val expectedImage = base / "bundles" / (name + extension) + val expectedImage = (target in JDKPackager).value / "bundles" / (name.value + extension) println(s"Checking for '${expectedImage.getAbsolutePath}'") assert(expectedImage.exists, s"Expected image file to be found at '$expectedImage'") diff --git a/src/sbt-test/jdkpackager/test-package-mappings/build.sbt b/src/sbt-test/jdkpackager/test-package-mappings/build.sbt index 083834df4..59b60cde3 100644 --- a/src/sbt-test/jdkpackager/test-package-mappings/build.sbt +++ b/src/sbt-test/jdkpackager/test-package-mappings/build.sbt @@ -18,8 +18,8 @@ jdkPackagerType := "image" mappings in Universal += baseDirectory.value / "src" / "deploy" / "README.md" -> "README.md" -mappings in Universal <++= (baseDirectory) map { base ⇒ - val dir = base / "src" / "deploy" / "stuff" +mappings in Universal ++= { + val dir = baseDirectory.value / "src" / "deploy" / "stuff" (dir.*** --- dir) pair relativeTo(dir.getParentFile) } @@ -32,13 +32,13 @@ lazy val iconGlob = sys.props("os.name").toLowerCase match { jdkAppIcon := (baseDirectory.value / ".." / ".." / ".." / ".." / "test-project-jdkpackager" ** iconGlob).getPaths.headOption .map(file) -TaskKey[Unit]("checkImage") <<= (target in JDKPackager, name, streams) map { (base, name, streams) ⇒ +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) } - val expectedImage = base / "bundles" / (name + extension) + val expectedImage = (target in JDKPackager).value / "bundles" / (name.value + extension) println(s"Checking for '${expectedImage.getAbsolutePath}'") assert(expectedImage.exists, s"Expected image file to be found at '$expectedImage'") @@ -50,7 +50,7 @@ TaskKey[Unit]("checkImage") <<= (target in JDKPackager, name, streams) map { (ba expectedImage / "Contents" / "Java" / "stuff" / "something-2.md" ) case _ ⇒ - streams.log.warn("Test needs to be implemented for " + sys.props("os.name")) + streams.value.log.warn("Test needs to be implemented for " + sys.props("os.name")) Seq.empty } diff --git a/src/sbt-test/jdkpackager/test-package-minimal/build.sbt b/src/sbt-test/jdkpackager/test-package-minimal/build.sbt index 9d7c8a804..9a8bbdb79 100644 --- a/src/sbt-test/jdkpackager/test-package-minimal/build.sbt +++ b/src/sbt-test/jdkpackager/test-package-minimal/build.sbt @@ -6,13 +6,13 @@ mainClass in Compile := Some("ExampleApp") jdkPackagerType := "image" -TaskKey[Unit]("checkImage") <<= (target in JDKPackager, name, streams) map { (base, name, streams) ⇒ +TaskKey[Unit]("checkImage") := { val extension = sys.props("os.name").toLowerCase match { case os if os.contains("mac") ⇒ ".app" case os if os.contains("win") ⇒ ".exe" case _ ⇒ "" } - val expectedImage = base / "bundles" / (name + extension) + val expectedImage = (target in JDKPackager).value / "bundles" / (name.value + extension) println(s"Checking for '${expectedImage.getAbsolutePath}'") assert(expectedImage.exists, s"Expected image file to be found at '$expectedImage'") } diff --git a/src/sbt-test/rpm/changelog-test/build.sbt b/src/sbt-test/rpm/changelog-test/build.sbt index ac1ebdade..497251183 100644 --- a/src/sbt-test/rpm/changelog-test/build.sbt +++ b/src/sbt-test/rpm/changelog-test/build.sbt @@ -21,10 +21,10 @@ rpmLicense := Some("BSD") rpmChangelogFile := Some("conf/changelog") -TaskKey[Unit]("check-spec-file") <<= (target, streams) map { (target, out) => - val spec = IO.read(target / "rpm" / "SPECS" / "rpm-test.spec") +TaskKey[Unit]("check-spec-file") := { + val spec = IO.read(target.value / "rpm" / "SPECS" / "rpm-test.spec") // Check if the RPM writted the changelog tag on the task assert(spec contains "%changelog\n", "Spec doesn't contain %changelog tag on the SPEC") - out.log.success("Successfully tested rpm test file") + streams.value.log.success("Successfully tested rpm test file") () } diff --git a/src/sbt-test/rpm/config-no-replace/build.sbt b/src/sbt-test/rpm/config-no-replace/build.sbt index b6cb49ad3..fa29b6a6d 100644 --- a/src/sbt-test/rpm/config-no-replace/build.sbt +++ b/src/sbt-test/rpm/config-no-replace/build.sbt @@ -23,13 +23,13 @@ packageArchitecture in Rpm := "x86_64" linuxPackageMappings := configWithNoReplace(linuxPackageMappings.value) -TaskKey[Unit]("unzip") <<= (packageBin in Rpm, streams) map { (rpmFile, streams) => - val rpmPath = Seq(rpmFile.getAbsolutePath) - Process("rpm2cpio", rpmPath) #| Process("cpio -i --make-directories") ! streams.log +TaskKey[Unit]("unzip") := { + val rpmPath = Seq((packageBin in Rpm).value.getAbsolutePath) + Process("rpm2cpio", rpmPath) #| Process("cpio -i --make-directories") ! streams.value.log } -TaskKey[Unit]("checkSpecFile") <<= (target, streams) map { (target, out) => - val spec = IO.read(target / "rpm" / "SPECS" / "rpm-test.spec") +TaskKey[Unit]("checkSpecFile") := { + val spec = IO.read(target.value / "rpm" / "SPECS" / "rpm-test.spec") assert( spec contains @@ -43,6 +43,6 @@ TaskKey[Unit]("checkSpecFile") <<= (target, streams) map { (target, out) => "Sets custom config to 'noreplace'" ) - out.log.success("Successfully tested rpm test file") + streams.value.log.success("Successfully tested rpm test file") () } diff --git a/src/sbt-test/rpm/override-loader-functions/build.sbt b/src/sbt-test/rpm/override-loader-functions/build.sbt index 09526c117..cc961b784 100644 --- a/src/sbt-test/rpm/override-loader-functions/build.sbt +++ b/src/sbt-test/rpm/override-loader-functions/build.sbt @@ -23,8 +23,8 @@ rpmLicense := Some("BSD") rpmGroup := Some("test-group") -TaskKey[Unit]("check-loader-script") <<= (target, streams) map { (target, out) => - val path = target / "rpm" / "RPMS" / "noarch" / "rpm-test-0.1.0-1.noarch.rpm" +TaskKey[Unit]("check-loader-script") := { + val path = target.value / "rpm" / "RPMS" / "noarch" / "rpm-test-0.1.0-1.noarch.rpm" val scripts = s"rpm -qp --scripts ${path.absolutePath}".!! assert(scripts.contains("# right systemd template"), s"override script wasn't picked, scripts are\n$scripts") 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 feed54a6b..df2fcee64 100644 --- a/src/sbt-test/rpm/override-start-script-systemd/build.sbt +++ b/src/sbt-test/rpm/override-start-script-systemd/build.sbt @@ -23,13 +23,13 @@ rpmLicense := Some("BSD") rpmGroup := Some("test-group") -TaskKey[Unit]("unzip") <<= (packageBin in Rpm, streams) map { (rpmFile, streams) => - val rpmPath = Seq(rpmFile.getAbsolutePath) - Process("rpm2cpio", rpmPath) #| Process("cpio -i --make-directories") ! streams.log +TaskKey[Unit]("unzip") := { + val rpmPath = Seq((packageBin in Rpm).value.getAbsolutePath) + Process("rpm2cpio", rpmPath) #| Process("cpio -i --make-directories") ! streams.value.log () } -TaskKey[Unit]("checkStartupScript") <<= (target, streams) map { (target, out) => +TaskKey[Unit]("checkStartupScript") := { val script = IO.read(file("usr/lib/systemd/system/rpm-test.service")) assert(script.startsWith("# right systemd template"), s"override script wasn't picked, script is\n$script") () 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 10781fda8..8f9c48a9d 100644 --- a/src/sbt-test/rpm/override-start-script-systemv/build.sbt +++ b/src/sbt-test/rpm/override-start-script-systemv/build.sbt @@ -23,13 +23,13 @@ rpmLicense := Some("BSD") rpmGroup := Some("test-group") -TaskKey[Unit]("unzip") <<= (packageBin in Rpm, streams) map { (rpmFile, streams) => - val rpmPath = Seq(rpmFile.getAbsolutePath) - Process("rpm2cpio", rpmPath) #| Process("cpio -i --make-directories") ! streams.log +TaskKey[Unit]("unzip") := { + val rpmPath = Seq((packageBin in Rpm).value.getAbsolutePath) + Process("rpm2cpio", rpmPath) #| Process("cpio -i --make-directories") ! streams.value.log () } -TaskKey[Unit]("checkStartupScript") <<= (target, streams) map { (target, out) => +TaskKey[Unit]("checkStartupScript") := { val script = IO.read(file("etc/init.d/rpm-test")) assert(script.startsWith("# right systemv template"), s"override script wasn't picked, script is\n$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 564431b93..95047c749 100644 --- a/src/sbt-test/rpm/override-start-script-upstart/build.sbt +++ b/src/sbt-test/rpm/override-start-script-upstart/build.sbt @@ -23,13 +23,13 @@ rpmLicense := Some("BSD") rpmGroup := Some("test-group") -TaskKey[Unit]("unzip") <<= (packageBin in Rpm, streams) map { (rpmFile, streams) => - val rpmPath = Seq(rpmFile.getAbsolutePath) - Process("rpm2cpio", rpmPath) #| Process("cpio -i --make-directories") ! streams.log +TaskKey[Unit]("unzip") := { + val rpmPath = Seq((packageBin in Rpm).value.getAbsolutePath) + Process("rpm2cpio", rpmPath) #| Process("cpio -i --make-directories") ! streams.value.log () } -TaskKey[Unit]("checkStartupScript") <<= (target, streams) map { (target, out) => +TaskKey[Unit]("checkStartupScript") := { val script = IO.read(file("etc/init/rpm-test.conf")) assert(script.startsWith("# right upstart template"), s"override script wasn't picked, script is\n$script") () diff --git a/src/sbt-test/rpm/path-override-rpm/build.sbt b/src/sbt-test/rpm/path-override-rpm/build.sbt index d6b6ad42b..16a2dc213 100644 --- a/src/sbt-test/rpm/path-override-rpm/build.sbt +++ b/src/sbt-test/rpm/path-override-rpm/build.sbt @@ -20,19 +20,19 @@ rpmGroup := Some("test-group") defaultLinuxInstallLocation := "/opt/test" defaultLinuxLogsLocation := "/opt/test/log" -TaskKey[Unit]("unzip") <<= (baseDirectory, packageBin in Rpm, streams) map { (baseDir, rpmFile, streams) => - val rpmPath = Seq(rpmFile.getAbsolutePath) - Process("rpm2cpio", rpmPath) #| Process("cpio -i --make-directories") ! streams.log +TaskKey[Unit]("unzip") := { + val rpmPath = Seq((packageBin in Rpm).value.getAbsolutePath) + Process("rpm2cpio", rpmPath) #| Process("cpio -i --make-directories") ! streams.value.log () } -TaskKey[Unit]("check-init-file") <<= (baseDirectory, streams) map { (target, out) => - val initd = IO.read(target / "etc" / "init.d" / "rpm-test") +TaskKey[Unit]("check-init-file") := { + val initd = IO.read(baseDirectory.value / "etc" / "init.d" / "rpm-test") assert(initd contains "/opt/test/rpm-test", "defaultLinuxInstallLocation not overriden in init.d\n" + initd) assert( initd contains "/opt/test/log/rpm-test/$logfile", "defaultLinuxLogsLocation not overriden in init.d\n" + initd ) - out.log.success("Successfully tested rpm-test file") + streams.value.log.success("Successfully tested rpm-test file") () } diff --git a/src/sbt-test/rpm/scriplets-no-javarepack-rpm/build.sbt b/src/sbt-test/rpm/scriplets-no-javarepack-rpm/build.sbt index 19b53671b..c0236f73d 100644 --- a/src/sbt-test/rpm/scriplets-no-javarepack-rpm/build.sbt +++ b/src/sbt-test/rpm/scriplets-no-javarepack-rpm/build.sbt @@ -22,9 +22,9 @@ rpmLicense := Some("BSD") rpmBrpJavaRepackJars := false -TaskKey[Unit]("check-spec-file") <<= (target, streams) map { (target, out) => - val spec = IO.read(target / "rpm" / "SPECS" / "rpm-test-no-repack.spec") +TaskKey[Unit]("check-spec-file") := { + val spec = IO.read(target.value / "rpm" / "SPECS" / "rpm-test-no-repack.spec") assert(spec.contains("""%define __jar_repack %nil"""), "Missing java repack disabling in %pre") - out.log.success("Successfully tested rpm test file") + streams.value.log.success("Successfully tested rpm test file") () } diff --git a/src/sbt-test/rpm/scriplets-use-javarepack-rpm/build.sbt b/src/sbt-test/rpm/scriplets-use-javarepack-rpm/build.sbt index cb47552c9..6550e9ecd 100644 --- a/src/sbt-test/rpm/scriplets-use-javarepack-rpm/build.sbt +++ b/src/sbt-test/rpm/scriplets-use-javarepack-rpm/build.sbt @@ -22,9 +22,9 @@ rpmLicense := Some("BSD") rpmBrpJavaRepackJars := true -TaskKey[Unit]("check-spec-file") <<= (target, streams) map { (target, out) => - val spec = IO.read(target / "rpm" / "SPECS" / "rpm-test-with-repack.spec") +TaskKey[Unit]("check-spec-file") := { + val spec = IO.read(target.value / "rpm" / "SPECS" / "rpm-test-with-repack.spec") assert(!spec.contains("""%define __jar_repack %nil"""), "%pre should not contain jar repack when set to true") - out.log.success("Successfully tested rpm test file") + streams.value.log.success("Successfully tested rpm test file") () } diff --git a/src/sbt-test/rpm/scriptlets-override-build-rpm/build.sbt b/src/sbt-test/rpm/scriptlets-override-build-rpm/build.sbt index 54f5e1afc..e6e9b2dbd 100644 --- a/src/sbt-test/rpm/scriptlets-override-build-rpm/build.sbt +++ b/src/sbt-test/rpm/scriptlets-override-build-rpm/build.sbt @@ -29,8 +29,8 @@ maintainerScripts in Rpm := Map( Postun -> Seq("""echo "post-uninstall"""") ) -TaskKey[Unit]("check-spec-file") <<= (target, streams) map { (target, out) => - val spec = IO.read(target / "rpm" / "SPECS" / "rpm-test.spec") +TaskKey[Unit]("check-spec-file") := { + val spec = IO.read(target.value / "rpm" / "SPECS" / "rpm-test.spec") assert(spec contains "%pre\necho \"pre-install\"", "Spec doesn't contain %pre scriptlet") assert(spec contains "%post\necho \"post-install\"", "Spec doesn't contain %post scriptlet") assert(spec contains "%pretrans\necho \"pretrans\"", "Spec doesn't contain %pretrans scriptlet") @@ -45,6 +45,6 @@ TaskKey[Unit]("check-spec-file") <<= (target, streams) map { (target, out) => ) assert(!(spec contains "groupdel rpm-test"), "Groupdel should be overridden \n" + spec) assert(!(spec contains "userdel rpm-test"), "Userdel should be overridden in \n" + spec) - out.log.success("Successfully tested rpm test file") + streams.value.log.success("Successfully tested rpm test file") () } diff --git a/src/sbt-test/rpm/scriptlets-override-rpm/build.sbt b/src/sbt-test/rpm/scriptlets-override-rpm/build.sbt index 9a25775c7..125acb57b 100644 --- a/src/sbt-test/rpm/scriptlets-override-rpm/build.sbt +++ b/src/sbt-test/rpm/scriptlets-override-rpm/build.sbt @@ -14,10 +14,11 @@ rpmLicense := Some("BSD") mainClass in (Compile, run) := Some("com.example.MainApp") -TaskKey[Unit]("unzipAndCheck") <<= (packageBin in Rpm, streams) map { (rpmFile, streams) => +TaskKey[Unit]("unzipAndCheck") := { + val rpmFile = (packageBin in Rpm).value val rpmPath = Seq(rpmFile.getAbsolutePath) - Process("rpm2cpio", rpmPath) #| Process("cpio -i --make-directories") ! streams.log - val scriptlets = Process("rpm -qp --scripts " + rpmFile.getAbsolutePath) !! streams.log + Process("rpm2cpio", rpmPath) #| Process("cpio -i --make-directories") ! streams.value.log + val scriptlets = Process("rpm -qp --scripts " + rpmFile.getAbsolutePath) !! streams.value.log assert(scriptlets contains "echo postinst", "'echo 'postinst' not present in \n" + scriptlets) assert(scriptlets contains "echo preinst", "'echo 'preinst' not present in \n" + scriptlets) assert(scriptlets contains "echo postun", "'echo 'postun' not present in \n" + scriptlets) @@ -25,8 +26,8 @@ TaskKey[Unit]("unzipAndCheck") <<= (packageBin in Rpm, streams) map { (rpmFile, () } -TaskKey[Unit]("check-spec-file") <<= (target, streams) map { (target, out) => - val spec = IO.read(target / "rpm" / "SPECS" / "rpm-test.spec") +TaskKey[Unit]("check-spec-file") := { + val spec = IO.read(target.value / "rpm" / "SPECS" / "rpm-test.spec") assert(spec contains "echo postinst", "'echo 'postinst' not present in \n" + spec) assert(spec contains "echo preinst", "'echo 'preinst' not present in \n" + spec) assert(spec contains "echo postun", "'echo 'postun' not present in \n" + spec) @@ -40,8 +41,8 @@ def countSubstring(str: String, substr: String): Int = def isUnique(str: String, searchstr: String): Boolean = countSubstring(str, searchstr) == 1 -TaskKey[Unit]("unique-scripts-in-spec-file") <<= (target, streams) map { (target, out) => - val spec = IO.read(target / "rpm" / "SPECS" / "rpm-test.spec") +TaskKey[Unit]("unique-scripts-in-spec-file") := { + val spec = IO.read(target.value / "rpm" / "SPECS" / "rpm-test.spec") assert(isUnique(spec, "echo postinst"), "'echo 'postinst' not unique in \n" + spec) assert(isUnique(spec, "echo preinst"), "'echo 'preinst' not unique in \n" + spec) assert(isUnique(spec, "echo postun"), "'echo 'postun' not unique in \n" + spec) diff --git a/src/sbt-test/rpm/scriptlets-rpm/build.sbt b/src/sbt-test/rpm/scriptlets-rpm/build.sbt index 325d9be02..e8be87b92 100644 --- a/src/sbt-test/rpm/scriptlets-rpm/build.sbt +++ b/src/sbt-test/rpm/scriptlets-rpm/build.sbt @@ -30,8 +30,8 @@ maintainerScripts in Rpm := Map( Postun -> Seq("""echo "post-uninstall"""") ) -TaskKey[Unit]("check-spec-file") <<= (target, streams) map { (target, out) => - val spec = IO.read(target / "rpm" / "SPECS" / "rpm-test.spec") +TaskKey[Unit]("check-spec-file") := { + val spec = IO.read(target.value / "rpm" / "SPECS" / "rpm-test.spec") assert(spec contains "%pre\necho \"pre-install\"", "Spec doesn't contain %pre scriptlet") assert(spec contains "%post\necho \"post-install\"", "Spec doesn't contain %post scriptlet") assert( @@ -81,15 +81,15 @@ TaskKey[Unit]("check-spec-file") <<= (target, streams) map { (target, out) => |""".stripMargin, "%postun scriptlet does not contain relocate link" ) - out.log.success("Successfully tested rpm test file") + streams.value.log.success("Successfully tested rpm test file") () } -TaskKey[Unit]("check-rpm-version") <<= (target, streams) map { (target, out) => +TaskKey[Unit]("check-rpm-version") := { val fullRpmVersion = Process("rpm", Seq("--version")) !! val firstDigit = fullRpmVersion indexWhere Character.isDigit val rpmVersion = fullRpmVersion substring firstDigit - out.log.info("Found rpmVersion: " + rpmVersion) + streams.value.log.info("Found rpmVersion: " + rpmVersion) val (major, minor, patch) = rpmVersion.trim.split("\\.").map(_.toInt) match { case Array(major) => (major, 0, 0) case Array(major, minor) => (major, minor, 0) diff --git a/src/sbt-test/rpm/setarch-rpm/build.sbt b/src/sbt-test/rpm/setarch-rpm/build.sbt index 13948fa05..11fa77682 100644 --- a/src/sbt-test/rpm/setarch-rpm/build.sbt +++ b/src/sbt-test/rpm/setarch-rpm/build.sbt @@ -26,9 +26,9 @@ linuxPackageMappings := { linuxPackageMappings.value :+ helloMapping } -TaskKey[Unit]("check-spec-file") <<= (target, streams) map { (target, out) => - val spec = IO.read(target / "rpm" / "SPECS" / "rpm-package.spec") - out.log.success(spec) +TaskKey[Unit]("check-spec-file") := { + val spec = IO.read(target.value / "rpm" / "SPECS" / "rpm-package.spec") + streams.value.log.success(spec) assert( spec contains "%attr(0644,root,root) /usr/share/rpm-package/lib/rpm-test.rpm-test-0.1.0.jar", "Wrong installation path\n" + spec @@ -37,6 +37,6 @@ TaskKey[Unit]("check-spec-file") <<= (target, streams) map { (target, out) => spec contains "%attr(0755,root,root) /usr/share/rpm-package/libexec/hello-32bit", "Wrong 32-bit exe installation path\n" + spec ) - out.log.success("Successfully tested rpm-package file") + streams.value.log.success("Successfully tested rpm-package file") () } diff --git a/src/sbt-test/rpm/simple-rpm/build.sbt b/src/sbt-test/rpm/simple-rpm/build.sbt index 75e963ab7..5919a5162 100644 --- a/src/sbt-test/rpm/simple-rpm/build.sbt +++ b/src/sbt-test/rpm/simple-rpm/build.sbt @@ -33,8 +33,8 @@ linuxPackageSymlinks in Rpm := Seq(LinuxSymlink("/etc/link1", "destination1"), L defaultLinuxInstallLocation in Rpm := "/opt/foo" -TaskKey[Unit]("checkSpecFile") <<= (target, streams) map { (target, out) => - val spec = IO.read(target / "rpm" / "SPECS" / "rpm-test.spec") +TaskKey[Unit]("checkSpecFile") := { + val spec = IO.read(target.value / "rpm" / "SPECS" / "rpm-test.spec") assert(spec contains "Name: rpm-test", "Contains project name") assert(spec contains "Version: 0.1.0", "Contains project version") assert(spec contains "Release: 1", "Contains project release") @@ -68,6 +68,6 @@ TaskKey[Unit]("checkSpecFile") <<= (target, streams) map { (target, out) => "Contains package symlink link (2)" ) - out.log.success("Successfully tested rpm test file") + streams.value.log.success("Successfully tested rpm test file") () } diff --git a/src/sbt-test/rpm/systemd-rpm/build.sbt b/src/sbt-test/rpm/systemd-rpm/build.sbt index 99a28f178..22f1ab099 100644 --- a/src/sbt-test/rpm/systemd-rpm/build.sbt +++ b/src/sbt-test/rpm/systemd-rpm/build.sbt @@ -16,23 +16,23 @@ rpmGroup := Some("test-group") requiredStartFacilities in Rpm := Some("serviceA.service") -TaskKey[Unit]("unzip") <<= (packageBin in Rpm, streams) map { (rpmFile, streams) => - val rpmPath = Seq(rpmFile.getAbsolutePath) - Process("rpm2cpio", rpmPath) #| Process("cpio -i --make-directories") ! streams.log +TaskKey[Unit]("unzip") := { + val rpmPath = Seq((packageBin in Rpm).value.getAbsolutePath) + Process("rpm2cpio", rpmPath) #| Process("cpio -i --make-directories") ! streams.value.log () } -TaskKey[Unit]("checkStartupScript") <<= (target, streams) map { (target, out) => +TaskKey[Unit]("checkStartupScript") := { val script = IO.read(file("usr/lib/systemd/system/rpm-test.service")) val runScript = file("usr/share/rpm-test/bin/rpm-test") assert(script.contains("Requires=serviceA.service"), "script doesn't contain Default-Start header\n" + script) assert(script.contains("SuccessExitStatus="), "script doesn't contain SuccessExitStatus header\n" + script) - out.log.success("Successfully tested systemd start up script") + streams.value.log.success("Successfully tested systemd start up script") () } -TaskKey[Unit]("checkSpecFile") <<= (target, streams) map { (target, out) => - val spec = IO.read(target / "rpm" / "SPECS" / "rpm-test.spec") +TaskKey[Unit]("checkSpecFile") := { + val spec = IO.read(target.value / "rpm" / "SPECS" / "rpm-test.spec") println(spec) assert( spec contains @@ -110,12 +110,12 @@ TaskKey[Unit]("checkSpecFile") <<= (target, streams) map { (target, out) => "rpm restartService() scriptlet is missing or incorrect" ) - out.log.success("Successfully tested rpm test file") + streams.value.log.success("Successfully tested rpm test file") () } -TaskKey[Unit]("check-spec-autostart") <<= (target, streams) map { (target, out) => - val spec = IO.read(target / "rpm" / "SPECS" / "rpm-test.spec") +TaskKey[Unit]("check-spec-autostart") := { + val spec = IO.read(target.value / "rpm" / "SPECS" / "rpm-test.spec") println(spec) assert( @@ -134,8 +134,8 @@ TaskKey[Unit]("check-spec-autostart") <<= (target, streams) map { (target, out) () } -TaskKey[Unit]("check-spec-no-autostart") <<= (target, streams) map { (target, out) => - val spec = IO.read(target / "rpm" / "SPECS" / "rpm-test.spec") +TaskKey[Unit]("check-spec-no-autostart") := { + val spec = IO.read(target.value / "rpm" / "SPECS" / "rpm-test.spec") println(spec) assert( diff --git a/src/sbt-test/rpm/sysvinit-rpm/build.sbt b/src/sbt-test/rpm/sysvinit-rpm/build.sbt index 703612769..4fa9fc80b 100644 --- a/src/sbt-test/rpm/sysvinit-rpm/build.sbt +++ b/src/sbt-test/rpm/sysvinit-rpm/build.sbt @@ -16,16 +16,16 @@ rpmDaemonLogFile := "test.log" mainClass in (Compile, run) := Some("com.example.MainApp") -TaskKey[Unit]("unzipAndCheck") <<= (baseDirectory, packageBin in Rpm, streams) map { (baseDir, rpmFile, streams) => - val rpmPath = Seq(rpmFile.getAbsolutePath) - Process("rpm2cpio", rpmPath) #| Process("cpio -i --make-directories") ! streams.log - val scriptlets = Process("rpm -qp --scripts " + rpmFile.getAbsolutePath) !! streams.log +TaskKey[Unit]("unzipAndCheck") := { + val rpmPath = Seq((packageBin in Rpm).value.getAbsolutePath) + Process("rpm2cpio", rpmPath) #| Process("cpio -i --make-directories") ! streams.value.log + val scriptlets = Process("rpm -qp --scripts " + (packageBin in Rpm).value.getAbsolutePath) !! 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) assert(scriptlets contains "deleteUser rpm-test", "deleteUser rpm not present in \n" + scriptlets) - val startupScript = IO.read(baseDir / "etc" / "init.d" / "rpm-test") + val startupScript = IO.read(baseDirectory.value / "etc" / "init.d" / "rpm-test") assert( startupScript contains """ @@ -44,8 +44,8 @@ TaskKey[Unit]("unzipAndCheck") <<= (baseDirectory, packageBin in Rpm, streams) m () } -TaskKey[Unit]("check-spec-file") <<= (target, streams) map { (target, out) => - val spec = IO.read(target / "rpm" / "SPECS" / "rpm-test.spec") +TaskKey[Unit]("check-spec-file") := { + val spec = IO.read(target.value / "rpm" / "SPECS" / "rpm-test.spec") assert(spec contains "addGroup rpm-test", "addGroup not present in \n" + spec) assert(spec contains "addUser rpm-test", "Incorrect useradd command in \n" + spec) assert(spec contains "deleteGroup rpm-test", "deleteGroup not present in \n" + spec) @@ -144,8 +144,8 @@ TaskKey[Unit]("check-spec-file") <<= (target, streams) map { (target, out) => () } -TaskKey[Unit]("check-spec-autostart") <<= (target, streams) map { (target, out) => - val spec = IO.read(target / "rpm" / "SPECS" / "rpm-test.spec") +TaskKey[Unit]("check-spec-autostart") := { + val spec = IO.read(target.value / "rpm" / "SPECS" / "rpm-test.spec") assert( spec contains """ diff --git a/src/sbt-test/rpm/test-executableScriptName/build.sbt b/src/sbt-test/rpm/test-executableScriptName/build.sbt index be8d85bc1..f733dde89 100644 --- a/src/sbt-test/rpm/test-executableScriptName/build.sbt +++ b/src/sbt-test/rpm/test-executableScriptName/build.sbt @@ -23,8 +23,8 @@ rpmLicense := Some("BSD") rpmGroup := Some("test-group") -TaskKey[Unit]("check-spec-file") <<= (target, streams) map { (target, out) => - val spec = IO.read(target / "rpm" / "SPECS" / "rpm-test.spec") +TaskKey[Unit]("check-spec-file") := { + val spec = IO.read(target.value / "rpm" / "SPECS" / "rpm-test.spec") assert( spec contains "%attr(0644,root,root) /usr/share/rpm-test/lib/rpm-test.rpm-test-0.1.0.jar", "Wrong installation path\n" + spec @@ -33,17 +33,17 @@ TaskKey[Unit]("check-spec-file") <<= (target, streams) map { (target, out) => assert(spec contains "%config %attr(644,root,root) /etc/default/rpm-test", "Wrong etc default file\n" + spec) assert(spec contains "%dir %attr(755,rpm-test,rpm-test) /var/log/rpm-test", "Wrong logging dir path\n" + spec) assert(spec contains "%dir %attr(755,rpm-test,rpm-test) /var/run/rpm-test", "Wrong /var/run dir path\n" + spec) - out.log.success("Successfully tested rpm-test file") + streams.value.log.success("Successfully tested rpm-test file") () } -TaskKey[Unit]("unzip") <<= (packageBin in Rpm, streams) map { (rpmFile, streams) => - val rpmPath = Seq(rpmFile.getAbsolutePath) - Process("rpm2cpio", rpmPath) #| Process("cpio -i --make-directories") ! streams.log +TaskKey[Unit]("unzip") := { + val rpmPath = Seq((packageBin in Rpm).value.getAbsolutePath) + Process("rpm2cpio", rpmPath) #| Process("cpio -i --make-directories") ! streams.value.log () } -TaskKey[Unit]("checkStartupScript") <<= (target, streams) map { (target, out) => +TaskKey[Unit]("checkStartupScript") := { val script = IO.read(file("etc/init.d/rpm-test")) assert( script contains "rpm-exec", @@ -53,6 +53,6 @@ TaskKey[Unit]("checkStartupScript") <<= (target, streams) map { (target, out) => script contains """RUN_CMD="$exec >> /var/log/rpm-test/$logfile 2>&1 &"""", "SystemV script didn't contain default daemon log filename 'rpm-test.log' \n" + script ) - out.log.success("Successfully tested startup script start up script") + streams.value.log.success("Successfully tested startup script start up script") () } diff --git a/src/sbt-test/rpm/test-packageName/build.sbt b/src/sbt-test/rpm/test-packageName/build.sbt index 483818932..a5a15ceb3 100644 --- a/src/sbt-test/rpm/test-packageName/build.sbt +++ b/src/sbt-test/rpm/test-packageName/build.sbt @@ -21,9 +21,9 @@ rpmUrl := Some("http://github.com/sbt/sbt-native-packager") rpmLicense := Some("BSD") -TaskKey[Unit]("check-spec-file") <<= (target, streams) map { (target, out) => - val spec = IO.read(target / "rpm" / "SPECS" / "rpm-package.spec") - out.log.success(spec) +TaskKey[Unit]("check-spec-file") := { + val spec = IO.read(target.value / "rpm" / "SPECS" / "rpm-package.spec") + streams.value.log.success(spec) assert( spec contains "%attr(0644,root,root) /usr/share/rpm-package/lib/rpm-test.rpm-test-0.1.0.jar", "Wrong installation path\n" + spec @@ -38,6 +38,6 @@ TaskKey[Unit]("check-spec-file") <<= (target, streams) map { (target, out) => spec contains "%dir %attr(755,rpm-package,rpm-package) /var/run/rpm-package", "Wrong /var/run dir path\n" + spec ) - out.log.success("Successfully tested rpm-package file") + streams.value.log.success("Successfully tested rpm-package file") () } diff --git a/src/sbt-test/universal/staging-custom-main/build.sbt b/src/sbt-test/universal/staging-custom-main/build.sbt index c972d07ea..4d5f3359e 100644 --- a/src/sbt-test/universal/staging-custom-main/build.sbt +++ b/src/sbt-test/universal/staging-custom-main/build.sbt @@ -6,14 +6,15 @@ version := "0.1.0" mainClass in Compile := Some("Main") -TaskKey[Unit]("unzip") <<= (packageBin in Universal, streams) map { (zipFile, streams) => - val args = Seq(zipFile.getAbsolutePath) - Process("unzip", args) ! streams.log +TaskKey[Unit]("unzip") := { + val args = Seq((packageBin in Universal).value.getAbsolutePath) + Process("unzip", args) ! streams.value.log } -TaskKey[Unit]("check") <<= (packageBin in Universal, streams) map { (zipFile, streams) => +TaskKey[Unit]("check") := { + val zipFile = (packageBin in Universal).value val process = sbt.Process("stage-custom-main-0.1.0/bin/stage-custom-main", Seq("-main", "CustomMain")) val out = (process !!) - if (out.trim != "A custom main method") error("unexpected output: " + out) + if (out.trim != "A custom main method") sys.error("unexpected output: " + out) () } diff --git a/src/sbt-test/universal/test-executableScriptName/build.sbt b/src/sbt-test/universal/test-executableScriptName/build.sbt index 1684893e5..5d5cb873a 100644 --- a/src/sbt-test/universal/test-executableScriptName/build.sbt +++ b/src/sbt-test/universal/test-executableScriptName/build.sbt @@ -6,7 +6,7 @@ executableScriptName := "simple-exec" version := "0.1.0" -TaskKey[Unit]("unzip") <<= (packageBin in Universal, streams) map { (zipFile, streams) => - val args = Seq(zipFile.getAbsolutePath) - Process("unzip", args) ! streams.log +TaskKey[Unit]("unzip") := { + val args = Seq((packageBin in Universal).value.getAbsolutePath) + Process("unzip", args) ! streams.value.log } diff --git a/src/sbt-test/universal/test-mapping-helpers/build.sbt b/src/sbt-test/universal/test-mapping-helpers/build.sbt index 6065b32c4..12af5bd4e 100644 --- a/src/sbt-test/universal/test-mapping-helpers/build.sbt +++ b/src/sbt-test/universal/test-mapping-helpers/build.sbt @@ -12,14 +12,15 @@ mappings in Universal ++= directory("src/main/resources/cache") // or just place your cache folder in /src/universal/ mappings in Universal ++= contentOf("src/main/resources/docs") -mappings in Universal <+= (packageBin in Compile, sourceDirectory) map { (_, src) => +mappings in Universal += { + (packageBin in Compile).value // we are using the reference.conf as default application.conf // the user can override settings here - val conf = src / "main" / "resources" / "reference.conf" + val conf = sourceDirectory.value / "main" / "resources" / "reference.conf" conf -> "conf/application.conf" } -TaskKey[Unit]("unzip") <<= (packageBin in Universal, streams) map { (zipFile, streams) => - val args = Seq(zipFile.getAbsolutePath) - Process("unzip", args) ! streams.log +TaskKey[Unit]("unzip") := { + val args = Seq((packageBin in Universal).value.getAbsolutePath) + Process("unzip", args) ! streams.value.log } diff --git a/src/sbt-test/windows/java-app-archetype/build.sbt b/src/sbt-test/windows/java-app-archetype/build.sbt index ea8e210bb..15d26b195 100644 --- a/src/sbt-test/windows/java-app-archetype/build.sbt +++ b/src/sbt-test/windows/java-app-archetype/build.sbt @@ -14,11 +14,11 @@ wixProductId := "ce07be71-510d-414a-92d4-dff47631848a" wixProductUpgradeId := "4552fb0e-e257-4dbd-9ecb-dba9dbacf424" -TaskKey[Unit]("check-script") <<= (stagingDirectory in Universal, name, streams) map { (dir, name, streams) => - val script = dir / "bin" / (name + ".bat") +TaskKey[Unit]("check-script") := { + val script = (stagingDirectory in Universal).value / "bin" / (name.value + ".bat") val cmd = Seq("cmd", "/c", script.getAbsolutePath) val result = - Process(cmd) ! streams.log match { + Process(cmd) ! streams.value.log match { case 0 => () case n => sys.error("Failed to run script: " + script.getAbsolutePath + " error code: " + n) diff --git a/src/sbt-test/windows/test-bat-template/build.sbt b/src/sbt-test/windows/test-bat-template/build.sbt index 560c4274a..3bb3f02bb 100644 --- a/src/sbt-test/windows/test-bat-template/build.sbt +++ b/src/sbt-test/windows/test-bat-template/build.sbt @@ -33,10 +33,11 @@ batScriptExtraDefines += "exit /B" batScriptExtraDefines += ":print_args_end" -TaskKey[Unit]("check-script") <<= (stagingDirectory in Universal, name, streams) map { (dir, name, streams) => +TaskKey[Unit]("check-script") := { + val dir = (stagingDirectory in Universal).value import scala.sys.process._ val fails = new StringBuilder() - val script = dir / "bin" / (name + ".bat") + val script = dir / "bin" / (name.value + ".bat") val detailScript: File = { val d = dir / "bin" / "detail.bat" val out = new java.io.PrintWriter(d, "UTF-8") diff --git a/src/sbt-test/windows/test-custom-main/build.sbt b/src/sbt-test/windows/test-custom-main/build.sbt index ababd2885..71f41098c 100644 --- a/src/sbt-test/windows/test-custom-main/build.sbt +++ b/src/sbt-test/windows/test-custom-main/build.sbt @@ -6,7 +6,8 @@ version := "0.1.0" mainClass in Compile := Some("Main") -TaskKey[Unit]("check-app-main") <<= (packageBin in Universal, streams) map { (zipFile, streams) => +TaskKey[Unit]("check-app-main") := { + val zipFile = (packageBin in Universal).value val process = sbt.Process("target/universal/stage/bin/test-custom-main.bat") val out = (process !!) @@ -14,7 +15,8 @@ TaskKey[Unit]("check-app-main") <<= (packageBin in Universal, streams) map { (zi () } -TaskKey[Unit]("check-custom-main") <<= (packageBin in Universal, streams) map { (zipFile, streams) => +TaskKey[Unit]("check-custom-main") := { + val zipFile = (packageBin in Universal).value val process = sbt.Process("target/universal/stage/bin/test-custom-main.bat", Seq("-main", "CustomMain")) val out = (process !!)