-
Notifications
You must be signed in to change notification settings - Fork 22
🐛 fix: do not include agent if scope is only Test #37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
gaeljw
wants to merge
1
commit into
sbt:master
Choose a base branch
from
gaeljw:gh36
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
lazy val agentTest = project.in(file(".")).enablePlugins(JavaAgent, JavaAppPackaging) | ||
|
||
javaAgents += "sbt.javaagent.test" % "maxwell" % sys.props( | ||
"project.version" | ||
) % "dist;test" | ||
|
||
libraryDependencies += "com.novocode" % "junit-interface" % "0.11" % "test" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
addSbtPlugin("com.github.sbt" % "sbt-javaagent" % sys.props("project.version")) | ||
addSbtPlugin("com.github.sbt" % "sbt-native-packager" % sys.props("packager.version")) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
object Main extends App |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
class Test { | ||
@org.junit.Test def test(): Unit = () | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
> stage | ||
> check |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
TaskKey[Unit]("check") := { | ||
|
||
assert( | ||
(Test / javaOptions).value exists (s => | ||
s.contains("-javaagent:") && s.contains("maxwell") | ||
), | ||
"Test / javaOptions do not contain 'maxwell' agent" | ||
) | ||
|
||
assert( | ||
!((Test / fullClasspath).value exists (f => | ||
f.data.name.contains("maxwell") | ||
)), | ||
"maxwell test agent is available on the test run class path" | ||
) | ||
|
||
// Check that the agent is included in dist | ||
|
||
assert( | ||
(Universal / mappings).value exists { case (file, path) => | ||
path == "maxwell/maxwell.jar" | ||
}, | ||
"dist mappings do not include 'maxwell/maxwell.jar'" | ||
) | ||
|
||
import scala.sys.process._ | ||
val output = | ||
((Universal / com.typesafe.sbt.packager.universal.UniversalPlugin.autoImport.stagingDirectory).value / "bin" / packageName.value).absolutePath.!! | ||
|
||
assert( | ||
output contains "Agent 86", | ||
"output does not include 'Agent 86'" | ||
) | ||
|
||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
lazy val agentTest = project.in(file(".")).enablePlugins(JavaAgent, JavaAppPackaging) | ||
|
||
javaAgents += "sbt.javaagent.test" % "maxwell" % sys.props( | ||
"project.version" | ||
) % "test" | ||
|
||
libraryDependencies += "com.novocode" % "junit-interface" % "0.11" % "test" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
addSbtPlugin("com.github.sbt" % "sbt-javaagent" % sys.props("project.version")) | ||
addSbtPlugin("com.github.sbt" % "sbt-native-packager" % sys.props("packager.version")) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
object Main extends App |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
class Test { | ||
@org.junit.Test def test(): Unit = () | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
> stage | ||
> check |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
TaskKey[Unit]("check") := { | ||
|
||
assert( | ||
(Test / javaOptions).value exists (s => | ||
s.contains("-javaagent:") && s.contains("maxwell") | ||
), | ||
"Test / javaOptions do not contain 'maxwell' agent" | ||
) | ||
|
||
assert( | ||
!((Test / fullClasspath).value exists (f => | ||
f.data.name.contains("maxwell") | ||
)), | ||
"maxwell test agent is available on the test run class path" | ||
) | ||
|
||
// Check that the agent is not included in dist | ||
|
||
assert( | ||
(Universal / mappings).value forall { case (file, path) => | ||
path != "maxwell/maxwell.jar" | ||
}, | ||
"dist mappings include 'maxwell/maxwell.jar'" | ||
) | ||
|
||
import scala.sys.process._ | ||
val output = | ||
((Universal / com.typesafe.sbt.packager.universal.UniversalPlugin.autoImport.stagingDirectory).value / "bin" / packageName.value).absolutePath.!! | ||
|
||
assert( | ||
!(output contains "Agent 86"), | ||
"output include 'Agent 86'" | ||
) | ||
|
||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ℹ️ I assume this PR would be released as a new minor, feel free to change this line if you prefer to release it as bugfix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to release at least a new minor version because in main branch we also dropped support for SBT 0.13.
Will take a look at this pr soon