-
Notifications
You must be signed in to change notification settings - Fork 318
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?
| project.pluginManager.withPlugin("java") {configurePostCompilationInstrumentation("java", project, extension) } | ||
| project.pluginManager.withPlugin("kotlin") {configurePostCompilationInstrumentation("kotlin", project, extension) } | ||
| project.pluginManager.withPlugin("scala") {configurePostCompilationInstrumentation("scala", project, extension) } | ||
| project.pluginManager.withPlugin("groovy") {configurePostCompilationInstrumentation("groovy", project, extension) } |
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.
Maybe this way would be a bit more elegant? WDYT?
| project.pluginManager.withPlugin("java") {configurePostCompilationInstrumentation("java", project, extension) } | |
| project.pluginManager.withPlugin("kotlin") {configurePostCompilationInstrumentation("kotlin", project, extension) } | |
| project.pluginManager.withPlugin("scala") {configurePostCompilationInstrumentation("scala", project, extension) } | |
| project.pluginManager.withPlugin("groovy") {configurePostCompilationInstrumentation("groovy", project, extension) } | |
| ['java', 'kotlin', 'scala', 'groovy'].each { id -> | |
| project.pluginManager.withPlugin(id) { | |
| configurePostCompilationInstrumentation(id, project, extension) | |
| } | |
| } |
| */ | ||
| @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.
| project.afterEvaluate { p -> | ||
| instrumentJava.dependsOn compileMain_play27Java | ||
| forbiddenApisMain_play27.dependsOn instrumentMain_play27Java | ||
| // instrumentJava.dependsOn compileMain_play27Java |
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.
Looks like missing TODO remove here too?
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.
Yeah, you are too early for the review 😅
I need to work a bit here and there on this
| } | ||
| apply plugin: 'instrument' | ||
| // apply plugin: 'instrument' |
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.
Better to remove?
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.
OK, will wait a bit 👍
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
|
The current implementation was using bad practices in various ways, `project.afterEvaluate`, task creation, explicit `dependsOn`
…utions to instrument plugin
aa6d660 to
0067ada
Compare


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#9316Additional 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]