Skip to content
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

module dependency analysis improvements #543

Conversation

shayne-fletcher
Copy link
Contributor

@shayne-fletcher shayne-fletcher commented Jul 22, 2024

simplify ghc -M and add new tests (in total now 6 x 3 builds).

@shayne-fletcher shayne-fletcher force-pushed the calc-module-deps-no-ignore-pkgs branch 3 times, most recently from 9bddc52 to c77c75a Compare July 23, 2024 00:50
@shayne-fletcher shayne-fletcher force-pushed the calc-module-deps-no-ignore-pkgs branch 3 times, most recently from 32a3330 to 2f7a46f Compare July 23, 2024 01:02
@shayne-fletcher shayne-fletcher mentioned this pull request Jul 23, 2024
@shayne-fletcher shayne-fletcher changed the title Calc module deps no ignore pkgs module dependency analysis improvements Jul 23, 2024
@shayne-fletcher shayne-fletcher force-pushed the calc-module-deps-no-ignore-pkgs branch 5 times, most recently from 36381b3 to 96a68d4 Compare July 24, 2024 15:31
@shayne-fletcher shayne-fletcher marked this pull request as ready for review July 24, 2024 15:41
@shayne-fletcher shayne-fletcher requested a review from a team as a code owner July 24, 2024 15:41
@shayne-fletcher shayne-fletcher force-pushed the calc-module-deps-no-ignore-pkgs branch from 96a68d4 to ee4dd71 Compare July 24, 2024 15:45
@shayne-fletcher
Copy link
Contributor Author

@samuel-williams-da phew! that was a marathon 😄 this is finally ready to go. the last of the big changes.

@samuel-williams-da
Copy link
Contributor

@nycnewman Since this adds new jobs, we'll want to add these also to the required checks

@samuel-williams-da
Copy link
Contributor

Thanks a bunch for all this work @shayne-fletcher! I'll take a look tomorrow morning :)

@samuel-williams-da
Copy link
Contributor

A quick question of curiosity - I see you're now testing 9.0.2, what metric are you using to decide which versions need explicit tests?

@shayne-fletcher
Copy link
Contributor Author

shayne-fletcher commented Jul 24, 2024

A quick question of curiosity - I see you're now testing 9.0.2, what metric are you using to decide which versions need explicit tests?

i'm working towards having a test of each series: 8.8, 8.10, 9.0, 9.2, 9.4., 9.6, 9.8, 9.10. according to that metric we are currently only lacking tests for (flavors) 9.4 9.2 and 9.6 i think.

@samuel-williams-da
Copy link
Contributor

Ah right okay, good to know - thanks!
I wonder if GithubActions allows for a "parent" job that only passes if the rest do, this ends up being a lot of checks in the list that a repo admin (of which I am not) needs to keep up to date

@shayne-fletcher
Copy link
Contributor Author

shayne-fletcher commented Jul 24, 2024

Ah right okay, good to know - thanks! I wonder if GithubActions allows for a "parent" job that only passes if the rest do, this ends up being a lot of checks in the list that a repo admin (of which I am not) needs to keep up to date

i expect now this volley of work is out of the way this list will be static and only extended on new ghc releases (next being ghc-9.12) so once a year? on the other hand, we could, add at the cost of some complexity, fold all of these jobs into a single workflow if that makes any difference? in short, i'm open to rephrasing the workflows to simplify the repo config mgt if that helps.

@samuel-williams-da
Copy link
Contributor

If GA doesn't have something simple for this, I'd rather leave as is, I'd still like to easily know which part has failed.
This isn't that deep, just a passing thought, not a concern for this PR.

@shayne-fletcher
Copy link
Contributor Author

Thanks a bunch for all this work @shayne-fletcher! I'll take a look tomorrow morning :)

morning @samuel-williams-da ! how's it looking? ok to move forward on this one?

Copy link
Contributor

@samuel-williams-da samuel-williams-da left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not entirely sure how you come to the changes needed for the variouus Main.hs files, but they seem fine. It would be helpful to arrange a walk through at some point so we can be on the same page as you when reviewing this code, we may reach out more formally about this after some discussion. (cc: @dylant-da)

ghc-lib-gen.cabal Outdated Show resolved Hide resolved
ghc-lib-gen/src/Ghclibgen.hs Show resolved Hide resolved
copyFile file new_p

calcModuleDeps :: [FilePath] -> [FilePath] -> [FilePath] -> GhcFlavor -> FilePath -> String -> String
calcModuleDeps includeDirs _hsSrcDirs hsSrcIncludes ghcFlavor cabalPackageDb ghcMakeModeOutputFile =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see quite a few options got removed here, why are they not needed anymore?

Copy link
Contributor Author

@shayne-fletcher shayne-fletcher Jul 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the exciting part for me. the fact is that over the course of these last 5 years through all the versions we've supported and the complexity of the procedure as conducted via stack we accumulated a lot of workarounds and hacks that we determined were necessary for the time (and in truth often with a less than perfect understanding of what/why "find a way to keep it working"... "do what you gotta do" ...). now with stack removed and reliance strictly on the cabal solver i've gone back and sought opportunities to remove these things. this is the result!

Copy link
Contributor Author

@shayne-fletcher shayne-fletcher Jul 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to be more explicit about what we've removed exactly here though: the preprocessor constants STAGE=2, GHC_IN_GHCI don't influence the outcome of the ghc -M. they probably never did and have always been redundant. the constant GHCI determines if ghc -M includes GHCi.Run and since the absence of that module does not affect the behavior of ghc-lib-mini-compile-test i judge it ok to exclude that module and drop the constant (less code is better). the ignore-package directives were found to be unnecessary across all combinations tested so far (!) and so could be removed, similarly the -package exceptions has yet to be proven to be needed there (perhaps there's a config we haven't encountered yet that will require adding it back - we'll see [in contrast, i confirm that there's no removing the semaphore-compat package from this list]). the semaphoreCompatBootExists and ghcPackagePath related code got refactored into a better form using the clear-package-db, ..., package-db flags.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh nice! That is exciting! Happy to see simplifications here :)

@shayne-fletcher
Copy link
Contributor Author

I'm not entirely sure how you come to the changes needed for the variouus Main.hs files, but they seem fine. It would be helpful to arrange a walk through at some point so we can be on the same page as you when reviewing this code, we may reach out more formally about this after some discussion. (cc: @dylant-da)

these files are just getting their import lists ordered alphabetically

Co-authored-by: Samuel Williams <[email protected]>
@shayne-fletcher
Copy link
Contributor Author

I'm not entirely sure how you come to the changes needed for the variouus Main.hs files, but they seem fine. It would be helpful to arrange a walk through at some point so we can be on the same page as you when reviewing this code, we may reach out more formally about this after some discussion. (cc: @dylant-da)

these files are just getting their import lists ordered alphabetically

i should be delighted to meet with you and walk through the role and meaning of these files and indeed anything else!

@shayne-fletcher
Copy link
Contributor Author

shayne-fletcher commented Jul 25, 2024

I'm not entirely sure how you come to the changes needed for the variouus Main.hs files, but they seem fine. It would be helpful to arrange a walk through at some point so we can be on the same page as you when reviewing this code, we may reach out more formally about this after some discussion. (cc: @dylant-da)

these files are just getting their import lists ordered alphabetically

in a nutshell, these Main.hs files define the ghc-lib-parser API for a given ghc API (8.8 vs 9.0 vs. ... 9.10) etc. they are the minimal and complete set of GHC source modules required to compile the program ghc-lib-test-mini-hlint see around here https://github.com/shayne-fletcher/ghc-lib/blob/73e1ea48722ae23eeb138b18461adb4a1ab261db/examples/ghc-lib-test-mini-hlint/src/Main.hs#L15 for one place where use is made of them.

@shayne-fletcher
Copy link
Contributor Author

@samuel-williams-da i know these reviews have been hard work. i just want to say thanks and for you to know that i appreciate you.

@shayne-fletcher
Copy link
Contributor Author

@samuel-williams-da @dylant-da might this now get merged please?

This was referenced Jul 27, 2024
@samuel-williams-da
Copy link
Contributor

Apologies, Friday was a company holiday - thanks for this work! I'll merge now

@samuel-williams-da samuel-williams-da merged commit e598618 into digital-asset:master Jul 29, 2024
19 checks passed
@shayne-fletcher shayne-fletcher deleted the calc-module-deps-no-ignore-pkgs branch July 29, 2024 11:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants