tianocore / edk2-basetools

EDK II BaseTools Python tools as a PIP module
Other
25 stars 35 forks source link

BaseTools: Generate compile information in build report #88

Closed gapalomi closed 1 year ago

gapalomi commented 1 year ago

REF:https://bugzilla.tianocore.org/show_bug.cgi?id=2850

Add "-Y REPORT_INFO" option to build command to generate compile information as part of BuildReport. This option generates files to be used by external tools as IDE's to enhance functionality. Files are created inside build folder:

///CompileInfo Files created: * compile_commands.json - Compilation Database. To be used by IDE's to enable advance features * cscope.files - List of files used in compilation. Used by Cscope to parse C code and provide browse functionality. * module_report.json - Module data form buildReport in Json format.
codecov[bot] commented 1 year ago

Codecov Report

Base: 4.28% // Head: 4.28% // Decreases project coverage by -0.01% :warning:

Coverage data is based on head (15779bb) compared to base (e2dc17a). Patch coverage: 0.00% of modified lines in pull request are covered.

:exclamation: Current head 15779bb differs from pull request most recent head 6bc7654. Consider uploading reports for the commit 6bc7654 to get more accurate results

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #88 +/- ## ========================================= - Coverage 4.28% 4.28% -0.01% ========================================= Files 181 181 Lines 81448 81533 +85 ========================================= - Hits 3493 3490 -3 - Misses 77955 78043 +88 ``` | Flag | Coverage Δ | | |---|---|---| | Linux | `4.28% <0.00%> (-0.01%)` | :arrow_down: | | Windows_NT | `?` | | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=tianocore#carryforward-flags-in-the-pull-request-comment) to find out more. | [Impacted Files](https://codecov.io/gh/tianocore/edk2-basetools/pull/88?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=tianocore) | Coverage Δ | | |---|---|---| | [edk2basetools/GenFds/SubTypeGuidSection.py](https://codecov.io/gh/tianocore/edk2-basetools/pull/88?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=tianocore#diff-ZWRrMmJhc2V0b29scy9HZW5GZHMvU3ViVHlwZUd1aWRTZWN0aW9uLnB5) | `0.00% <0.00%> (ø)` | | | [edk2basetools/build/BuildReport.py](https://codecov.io/gh/tianocore/edk2-basetools/pull/88?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=tianocore#diff-ZWRrMmJhc2V0b29scy9idWlsZC9CdWlsZFJlcG9ydC5weQ==) | `0.00% <0.00%> (ø)` | | | [edk2basetools/build/buildoptions.py](https://codecov.io/gh/tianocore/edk2-basetools/pull/88?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=tianocore#diff-ZWRrMmJhc2V0b29scy9idWlsZC9idWlsZG9wdGlvbnMucHk=) | `0.00% <0.00%> (ø)` | | | [edk2basetools/Common/LongFilePathSupport.py](https://codecov.io/gh/tianocore/edk2-basetools/pull/88?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=tianocore#diff-ZWRrMmJhc2V0b29scy9Db21tb24vTG9uZ0ZpbGVQYXRoU3VwcG9ydC5weQ==) | `50.00% <0.00%> (-13.64%)` | :arrow_down: | Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=tianocore). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=tianocore)

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

gapalomi commented 1 year ago

the 3 files are intended to provide program consumable friendly information about the build process.

cscope.files contains all the files used for compilation. Originally intended for tools like cscope but it can be purposed for other different tools (doxygen for example).

compile_commands.json is a standard already defined that its used by multiple IDE to enhance its functionality.

module_report.json contains similar information as original build report. The file can be used by community to develop or enhance external tools. As example I'm working on a visual studio script that consumes this report and provides information.

I'm attaching a sample of generated files for EmulatorPkg build CompileInfo.zip

spbrogan commented 1 year ago

the 3 files are intended to provide program consumable friendly information about the build process.

cscope.files contains all the files used for compilation. Originally intended for tools like cscope but it can be purposed for other different tools (doxygen for example).

compile_commands.json is a standard already defined that its used by multiple IDE to enhance its functionality.

module_report.json contains similar information as original build report. The file can be used by community to develop or enhance external tools. As example I'm working on a visual studio script that consumes this report and provides information.

I'm attaching a sample of generated files for EmulatorPkg build CompileInfo.zip

Thanks.
I still am asking if the new logic for dumping as json can be triggered by a unique flag so that it can be turned on independent of the other reports.

I also noticed that the library information doesn't list the library class. Ideally for each library it would be great to have path to library inf and library class name and/or path to library class definition.

Looks great overall.

gapalomi commented 1 year ago

The way I see it it's that the 3 files will serve the same purpose of enhance developer experience (maybe -Y REPORT_INFO doesn't reflect that, let me know a suggestion). The use case I see it's that after developer compiles source code, its IDE will reload its symbols using compile_commands.json but at the same time other plugins in those IDEs will make use of module_report.json and cscope.files to complement IDE features, for example indicate you are reviewing a file that was not used in compilation or show you a property window based on module_report.json with information off the opened file.

Regarding the library class you are correct, its missing I will add it in following patch. Just to clarify, the Libraries section of a module only has the Path element for each library used by that module. To get the full information of that Library you need to cross check and look for the full information of the library. Let me know if that makes sense.

Thanks for the feedback.

gapalomi commented 1 year ago

I have extended module_report.json with:

Also I have cherry picked patch to fix build issue per this request: https://edk2.groups.io/g/devel/message/100522