Skip to content

mintro: dump ast of subdir meson.build files #11446

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
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

bruchar1
Copy link
Member

No description provided.

@codecov
Copy link

codecov bot commented Feb 23, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (dea72e4) 70.30% compared to head (019a0e2) 68.83%.

❗ Current head 019a0e2 differs from pull request most recent head 384e8b0. Consider uploading reports for the commit 384e8b0 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #11446      +/-   ##
==========================================
- Coverage   70.30%   68.83%   -1.48%     
==========================================
  Files         219      209      -10     
  Lines       48478    45560    -2918     
  Branches    11461     9433    -2028     
==========================================
- Hits        34082    31360    -2722     
+ Misses      11963    11777     -186     
+ Partials     2433     2423      -10     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@bruchar1 bruchar1 force-pushed the introspect-sources branch 2 times, most recently from 169f054 to 5e087d4 Compare February 24, 2023 02:07
@bruchar1 bruchar1 force-pushed the introspect-sources branch from 5e087d4 to c667327 Compare March 2, 2023 16:11
@bruchar1 bruchar1 force-pushed the introspect-sources branch 4 times, most recently from c318287 to 2c0f32e Compare March 2, 2023 19:28
@bruchar1
Copy link
Member Author

bruchar1 commented Mar 2, 2023

Oups! I forgot to include ast from the root meson.build... Should be better now.

@xclaesse
Copy link
Member

xclaesse commented Mar 3, 2023

Oups! I forgot to include ast from the root meson.build... Should be better now.

Interesting, I would have expected the root meson.build to be in self.processed_buildfiles, but it's not. The real interpreter does that too, which has the effect that subdir('.') in the root meson.build file parse itself again but luckily abort with ERROR: Second call to project().

@xclaesse
Copy link
Member

xclaesse commented Mar 3, 2023

Now the question is does backward compat matter? I have no idea who uses --ast... Maybe would need to be guarded with --recursive flags? dunno.

@bruchar1 bruchar1 force-pushed the introspect-sources branch from 2c0f32e to a30cbb5 Compare March 3, 2023 02:02
@bruchar1
Copy link
Member Author

bruchar1 commented Mar 3, 2023

Now the question is does backward compat matter? I have no idea who uses --ast... Maybe would need to be guarded with --recursive flags? dunno.

I doubt it could be used for anything else that debugging... Not dumping subdirs means the result was unusable except for projects with only one meson.build file. Imho, that should not break anything important. If something breaks with this, it would break with any change in the structure of the AST...

@bruchar1
Copy link
Member Author

bruchar1 commented Mar 3, 2023

Interesting, I would have expected the root meson.build to be in self.processed_buildfiles, but it's not.

Hum... I changed it. This is the right thing to do. It simplifies the dump_ast function.

@bruchar1 bruchar1 force-pushed the introspect-sources branch from a30cbb5 to 920bff9 Compare March 3, 2023 02:10
@bruchar1
Copy link
Member Author

bruchar1 commented Mar 8, 2023

@xclaesse Was everything ok with you?

@xclaesse
Copy link
Member

xclaesse commented Mar 8, 2023

If something breaks with this, it would break with any change in the structure of the AST...

Not really, because this changes the output to a dict, so any tool that was parsing this json are now broken, if any. Wondering if the CLI syntax that requires passing meson.build argument should mean that we want AST for only that particular file. And if we change to allow passing a directory then that would mean recursive.

@bruchar1
Copy link
Member Author

bruchar1 commented Mar 8, 2023

Not really, because this changes the output to a dict, so any tool that was parsing this json are now broken, if any.

Technically, the output is still json... It just is one level deeper.

Wondering if the CLI syntax that requires passing meson.build argument should mean that we want AST for only that particular file. And if we change to allow passing a directory then that would mean recursive.

That could be great. However, this would require #11485, changes to the introspection interpreter to be able to parse a meson file without project node, and changes to the subdir visitor.

@bruchar1
Copy link
Member Author

I just updated this PR. Instead of breaking the output of the existing --ast, I introduced a new --full-ast option to introspect.

@bruchar1 bruchar1 force-pushed the introspect-sources branch 2 times, most recently from fc3bbdc to 19a6595 Compare August 10, 2023 19:06
@bruchar1 bruchar1 requested a review from xclaesse August 11, 2023 11:26
@bruchar1 bruchar1 force-pushed the introspect-sources branch from 19a6595 to e778ee8 Compare August 15, 2023 13:20
@tristan957 tristan957 added this to the 1.3.0 milestone Aug 15, 2023
@xclaesse xclaesse modified the milestones: 1.3.0, 1.4.0 Oct 17, 2023
It semms IntrospectionInterpreter needs vsenv to find compiler.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants