Enhance D2D pipeline to identify generated code #1900 - #2216
Open
chinyeungli wants to merge 1 commit into
Open
Conversation
* Add code to identify generated code based on path patterns or bytecode markers * Update status flag for identified generated files * Update extra_data field for reason the file is identifed as generated Signed-off-by: Chin Yeung Li <tli@nexb.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Issues
Changes
This PR enhances the D2D pipeline to support generated code.
Non-Java Code
The current D2D pipeline already has options to handle Groovy, Scala, Kotlin, etc.
Further enhancements are tracked in:
#1875
#1993
#2214
Generated Code with Sources
For the scenarios described in #1900, all generated sources (from XSD or other tools) or enhanced bytecode should have corresponding
.javafiles generated. The current technique of file basename/path matching and mapping should handle D2D processing without issue.Generated Code without Sources
This leaves cases where binary (
.class) files are compiled from generated sources during build time, but those generated sources are not packaged in the final source package. In these scenarios,.classfiles exist without corresponding.javafiles.To address this, we use bytecode markers to identify if
.classfiles were compiled from generated sources. The code uses theread_bytes()function to read the raw bytes and search for markers indicating generated source code.Additionally, path patterns are used to identify generated sources.
Sample:
Identified generated file status

Reason of why it's identified as generated file

Checklist