File tree Expand file tree Collapse file tree 4 files changed +27
-1
lines changed
main/scala/com/lightbend/sbt/javaagent Expand file tree Collapse file tree 4 files changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -64,7 +64,8 @@ object JavaAgent extends AutoPlugin {
64
64
fork in run := enableFork(fork in run, _.scope.run).value,
65
65
fork in Test := enableFork(fork in Test , _.scope.test).value,
66
66
javaOptions in run ++= agentOptions(_.agent.scope.run).value,
67
- javaOptions in Test ++= agentOptions(_.agent.scope.test).value
67
+ javaOptions in Test ++= agentOptions(_.agent.scope.test).value,
68
+ fullClasspath in Test := filterAgents((fullClasspath in Test ).value, resolvedJavaAgents.value)
68
69
)
69
70
70
71
private def resolveAgents = Def .task[Seq [ResolvedAgent ]] {
@@ -93,4 +94,8 @@ object JavaAgent extends AutoPlugin {
93
94
}
94
95
}
95
96
97
+ def filterAgents (classpath : Classpath , resolvedAgents : Seq [ResolvedAgent ]): Classpath = {
98
+ val agents = resolvedAgents.map(resolved => resolved.artifact.absolutePath)
99
+ classpath.filter(aFile => ! agents.contains(aFile.data.getAbsolutePath))
100
+ }
96
101
}
Original file line number Diff line number Diff line change 4
4
> check-log
5
5
> stage
6
6
> check-dist
7
+ > check-test-and-run-paths
Original file line number Diff line number Diff line change @@ -19,3 +19,18 @@ TaskKey[Unit]("check-dist") := {
19
19
expect(" dist run" , output, " Agent 86" )
20
20
expect(" dist run" , output, " class maxwell.Maxwell" )
21
21
}
22
+
23
+ TaskKey [Unit ](" check-test-and-run-paths" ) := {
24
+ assert(
25
+ ! ((dependencyClasspath in Runtime ).value exists (f => f.data.name.contains(" maxwell" ))),
26
+ " maxwell test agent is available on the runtime class path"
27
+ )
28
+ assert(
29
+ (dependencyClasspath in Test ).value exists (f => f.data.name.contains(" maxwell" )),
30
+ " maxwell test agent is not available on the test compile class path"
31
+ )
32
+ assert(
33
+ ! ((fullClasspath in Test ).value exists (f => f.data.name.contains(" maxwell" ))),
34
+ " maxwell test agent is available on the test run class path"
35
+ )
36
+ }
Original file line number Diff line number Diff line change @@ -9,6 +9,11 @@ TaskKey[Unit]("check") := {
9
9
" javaOptions in Test do not contain 'maxwell' agent"
10
10
)
11
11
12
+ assert(
13
+ ! ((fullClasspath in Test ).value exists (f => f.data.name.contains(" maxwell" ))),
14
+ " maxwell test agent is available on the test run class path"
15
+ )
16
+
12
17
val testLog = IO .read(BuiltinCommands .lastLogFile(state.value).get)
13
18
14
19
assert(
You can’t perform that action at this time.
0 commit comments