Skip to content

Commit c87a2fc

Browse files
authored
Migrate to sbt 1.x syntax (#33)
1 parent 17bd3f6 commit c87a2fc

File tree

18 files changed

+122
-52
lines changed

18 files changed

+122
-52
lines changed

src/main/scala/com/lightbend/sbt/javaagent/JavaAgentPackaging.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ object JavaAgentPackaging extends AutoPlugin {
2424
override def projectSettings = {
2525
import com.typesafe.sbt.packager.{ Keys => PackagerKeys }
2626
Seq(
27-
mappings in Universal ++= agentMappings.value.map(m => m._1 -> m._2),
27+
Universal / mappings ++= agentMappings.value.map(m => m._1 -> m._2),
2828
PackagerKeys.bashScriptExtraDefines ++= agentBashScriptOptions.value,
2929
PackagerKeys.batScriptExtraDefines ++= agentBatScriptOptions.value
3030
)
Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
lazy val agentOptions = project in file(".") enablePlugins (JavaAgent, JavaAppPackaging)
1+
lazy val agentOptions =
2+
project.in(file(".")).enablePlugins(JavaAgent, JavaAppPackaging)
23

3-
javaAgents += JavaAgent(module = "sbt.javaagent.test" % "maxwell" % sys.props("project.version") % "dist;test",
4-
arguments = "Get_Smart;Agent_99")
4+
javaAgents += JavaAgent(
5+
module = "sbt.javaagent.test" % "maxwell" % sys.props(
6+
"project.version"
7+
) % "dist;test",
8+
arguments = "Get_Smart;Agent_99"
9+
)

src/sbt-test/agent/arguments/test.sbt

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,35 @@
11
TaskKey[Unit]("check") := {
22
assert(
3-
(fork in Test).value,
4-
"fork in Test is not enabled"
3+
(Test / fork).value,
4+
"Test / fork is not enabled"
55
)
66

77
assert(
8-
(javaOptions in Test).value exists (s => s.contains("-javaagent:") && s.contains("maxwell")),
9-
"javaOptions in Test do not contain 'maxwell' agent"
8+
(Test / javaOptions).value exists (s =>
9+
s.contains("-javaagent:") && s.contains("maxwell")
10+
),
11+
"Test / javaOptions do not contain 'maxwell' agent"
1012
)
1113

1214
assert(
13-
(javaOptions in Test).value exists (s => s.contains("-javaagent:") && s.contains("maxwell") && s.contains("=Get_Smart;Agent_99")),
14-
"javaOptions in Test do not contain 'Get_Smart;Agent_99' agent arguments"
15+
(Test / javaOptions).value exists (s =>
16+
s.contains("-javaagent:") && s.contains("maxwell") && s.contains(
17+
"=Get_Smart;Agent_99"
18+
)
19+
),
20+
"Test / javaOptions do not contain 'Get_Smart;Agent_99' agent arguments"
1521
)
1622

1723
assert(
18-
(mappings in Universal).value exists { case (file, path) => path == "maxwell/maxwell.jar" },
24+
(Universal / mappings).value exists { case (file, path) =>
25+
path == "maxwell/maxwell.jar"
26+
},
1927
"dist mappings do not include 'maxwell/maxwell.jar'"
2028
)
2129

2230
import scala.sys.process._
23-
val output = ((stagingDirectory in Universal).value / "bin" / packageName.value).absolutePath.!!
31+
val output =
32+
((Universal / stagingDirectory).value / "bin" / packageName.value).absolutePath.!!
2433

2534
assert(
2635
!(output contains "Agent 86"),

src/sbt-test/agent/compile/build.sbt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1-
lazy val agentCompile = project in file(".") enablePlugins (JavaAgent, JavaAppPackaging)
1+
lazy val agentCompile =
2+
project.in(file(".")).enablePlugins(JavaAgent, JavaAppPackaging)
23

3-
javaAgents += "sbt.javaagent.test" % "maxwell" % sys.props("project.version") % "compile"
4+
javaAgents += "sbt.javaagent.test" % "maxwell" % sys.props(
5+
"project.version"
6+
) % "compile"

src/sbt-test/agent/compile/test.sbt

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
TaskKey[Unit]("checkDependency") := {
22
assert(
3-
libraryDependencies.value contains ("sbt.javaagent.test" % "maxwell" % sys.props("project.version") % "provided"),
3+
libraryDependencies.value contains ("sbt.javaagent.test" % "maxwell" % sys
4+
.props("project.version") % "provided"),
45
"maxwell test agent is not in libraryDependencies under 'provided'"
56
)
67
}
@@ -16,22 +17,29 @@ TaskKey[Unit]("checkLog") := {
1617

1718
TaskKey[Unit]("checkDist") := {
1819
import scala.sys.process._
19-
val output = ((stagingDirectory in Universal).value / "bin" / packageName.value).absolutePath.!!
20+
val output =
21+
((Universal / stagingDirectory).value / "bin" / packageName.value).absolutePath.!!
2022
expect("dist run", output, "Agent 86")
2123
expect("dist run", output, "class maxwell.Maxwell")
2224
}
2325

2426
TaskKey[Unit]("checkTestAndRunPaths") := {
2527
assert(
26-
!((dependencyClasspath in Runtime).value exists (f => f.data.name.contains("maxwell"))),
28+
!((Runtime / dependencyClasspath).value exists (f =>
29+
f.data.name.contains("maxwell")
30+
)),
2731
"maxwell test agent is available on the runtime class path"
2832
)
2933
assert(
30-
(dependencyClasspath in Test).value exists (f => f.data.name.contains("maxwell")),
34+
(Test / dependencyClasspath).value exists (f =>
35+
f.data.name.contains("maxwell")
36+
),
3137
"maxwell test agent is not available on the test compile class path"
3238
)
3339
assert(
34-
!((fullClasspath in Test).value exists (f => f.data.name.contains("maxwell"))),
40+
!((Test / fullClasspath).value exists (f =>
41+
f.data.name.contains("maxwell")
42+
)),
3543
"maxwell test agent is available on the test run class path"
3644
)
3745
}

src/sbt-test/agent/confs/build.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
lazy val agentConfs = project in file(".") enablePlugins JavaAgent
1+
lazy val agentConfs = project.in(file(".")).enablePlugins(JavaAgent)
22

33
javaAgents += "sbt.javaagent.test" % "maxwell" % sys.props("project.version") % "compile;test"
44

src/sbt-test/agent/dist/build.sbt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1-
lazy val agentDist = project in file(".") enablePlugins (JavaAgent, JavaAppPackaging)
1+
lazy val agentDist =
2+
project.in(file(".")).enablePlugins(JavaAgent, JavaAppPackaging)
23

34
javaAgents += "sbt.javaagent.test" % "maxwell" % sys.props("project.version")

src/sbt-test/agent/dist/test.sbt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
TaskKey[Unit]("check") := {
22
assert(
3-
(mappings in Universal).value exists { case (file, path) => path == "maxwell/maxwell.jar" },
3+
(Universal / mappings).value exists { case (file, path) =>
4+
path == "maxwell/maxwell.jar"
5+
},
46
"dist mappings do not include 'maxwell/maxwell.jar'"
57
)
68

79
import scala.sys.process._
8-
val output = ((stagingDirectory in Universal).value / "bin" / packageName.value).absolutePath.!!
10+
val output =
11+
((Universal / stagingDirectory).value / "bin" / packageName.value).absolutePath.!!
912

1013
assert(
1114
output contains "Agent 86",
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1-
lazy val agentDist = project in file(".") enablePlugins (JavaAgent, JavaAppPackaging)
1+
lazy val agentDist =
2+
project.in(file(".")).enablePlugins(JavaAgent, JavaAppPackaging)
23

34
javaAgents += "sbt.javaagent.test" % "maxwell" % sys.props("project.version")

src/sbt-test/agent/dist_1.9.x/test.sbt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
TaskKey[Unit]("check") := {
22
assert(
3-
(mappings in Universal).value exists { case (file, path) => path == "maxwell/maxwell.jar" },
3+
(Universal / mappings).value exists { case (file, path) =>
4+
path == "maxwell/maxwell.jar"
5+
},
46
"dist mappings do not include 'maxwell/maxwell.jar'"
57
)
68

79
import scala.sys.process._
8-
val output = ((stagingDirectory in Universal).value / "bin" / packageName.value).absolutePath.!!
10+
val output =
11+
((Universal / stagingDirectory).value / "bin" / packageName.value).absolutePath.!!
912

1013
assert(
1114
output contains "Agent 86",

0 commit comments

Comments
 (0)