-
Notifications
You must be signed in to change notification settings - Fork 322
Rewrite InstrumentPlugin to be lazy #9475
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
base: master
Are you sure you want to change the base?
Conversation
|
Hi! 👋 Thanks for your pull request! 🎉 To help us review it, please make sure to:
If you need help, please check our contributing guidelines. |
AlexeyKuznetsov-DD
left a comment
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.
Just curious, what would be the benefit? Faster build?
| */ | ||
| @SuppressWarnings('unused') | ||
| class InstrumentPlugin implements Plugin<Project> { | ||
| public static final String DEFAULT_JAVA_VERSION = 'default' |
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.
Just curious, why it is default and not 8?
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.
Good question! In the previous code javaVersion was null if not explicitly set, but declaring an additional task input via it.inputs.property("javaVersion", javaVersion) do not allow null, so I introduced a default value. The java version is maily used to affect which workQueue is chosen, so using default or 8 has no consequences in this PR.
That being said, decoupling the Java target version from the Gradle JVM will have an effect and in this case we will have to be handled, but that's a separate work.
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.
To be fair though, I'm not sure the language matters here much because it's about post-processing classes. Which will be done by bytebuddy plugins. Let's keep it like this for now.
248b4eb to
3094d50
Compare
|
Status report The new approach of the instrument post-processing works in almost all simple projects, e.g. Important The diff was made by this custom tool https://github.com/bric3/jardiff
|
aa6d660 to
0067ada
Compare
|
Just a minor comment. Probably it make sense to refactor this plugin to Kotlin. |
0067ada to
210d17c
Compare
d3a2cd2 to
899f804
Compare
The current implementation was using bad practices in various ways, `project.afterEvaluate`, task creation, explicit `dependsOn` # Conflicts: # buildSrc/src/main/groovy/InstrumentPlugin.groovy # buildSrc/src/main/groovy/MuzzlePlugin.groovy # dd-java-agent/instrumentation/jetty-9/build.gradle # Conflicts: # buildSrc/src/main/groovy/InstrumentPlugin.groovy # buildSrc/src/test/groovy/InstrumentPluginTest.groovy # dd-java-agent/instrumentation/play/play-2.4/build.gradle # dd-java-agent/instrumentation/play/play-2.6/build.gradle
…utions to instrument plugin
…and configuration
…tJava Since instrument plugin do post-processing within compileTask, it not anymore required to depends on instrumentation tasks (as they don't exist anymore)
899f804 to
9b5556c
Compare
Yes, but I'd rather do it, in a second pass. Once this settles down. |


What Does This Do
This work explore a rewrite of the InstrumentPlugin to avoid eager configuration.
At the same time, I'm exploring the instrument post-processing to be a compiler last action,
instead of adding its own task to run after compilation and intercepting itself.
Motivation
Related to
MuzzlePlugin#9315CallSiteInstrumentationPlugin#9316Blocked by
afterEvaluate#9752testJvmConstraintsGradle extension to replace extra properties #9892:dd-java-agent:testing#10218jetty-server-9.0project setup to multiple modules #9683Additional Notes
Contributor Checklist
type:and (comp:orinst:) labels in addition to any usefull labelsclose,fixor any linking keywords when referencing an issue.Use
solvesinstead, and assign the PR milestone to the issueJira ticket: [PROJ-IDENT]