-
Notifications
You must be signed in to change notification settings - Fork 99
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
export fpm model to TOML and JSON #879
Conversation
3ebbcf4
to
ba27a3b
Compare
I will have a look at this in a couple of hours. Thanks for your work @perazz |
The failing tests are fixed by maintenance PR #976 |
Thanks for the heads up. I will have a look at all the open prs and leave reviews. Sorry it took so long. |
@gnikit @arteevraina @henilp105 please advise whether it'd be beneficial to include this feature in the upcoming release. |
@perazz I would leave it for the next release. I would also like to understand a bit better the use of this. The TOML manifest can be converted to JSON/YAML with one of the Python/JS libs, I am not sure if fpm should be the one providing these fime format model conversions. I think what fpm really needs is the serialisation of the build process, much like Cmake's |
That could be an interesting extension @gnikit, however, this feature was designed such that the internal model representation could be exported and parsed by an external tool: for example the registry (cc @arteevraina @henilp105) should be able to check that all files necessary to the build are present, that no malicious changes occurred during upload of the package, etc., without actually performing any builds. |
@perazz I think we should add it to the next release as we still haven't implemented the upload of fpm model during package upload , we have completed the package verification on the registry side currently supporting linux, windows and mac builds. |
I see, that makes sense, thanks for the explanation. Then, I am not sure if my review should carry any substantial weight in this PR since I have been only tangentially involved in the registry efforts. The only thing that I would say is that because this PR adds almost 5k lines of code in fpm maybe it should be reviewed with a very conservative Fortran eye to try and keep potential bugs and unexpected behaviour to a minimum. |
@gnikit Here are a few hints that should make the review easier (to whom it may concern).
Lines 33 to 57 in a1e71e9
fpm/src/fpm/manifest/fortran.f90 Lines 23 to 26 in a1e71e9
Lines 128 to 169 in a1e71e9
fpm/test/fpm_test/test_manifest.f90 Lines 170 to 172 in a1e71e9
It will be super easy to add new settings classes this way. |
230eeef
to
a1e71e9
Compare
This PR is ready. Just resolving merge conflicts. The CI failure is due to #994 and is unrelated. |
@perazz let's schedule a video call with @henilp105 and @arteevraina and me and review this PR on the call, so that we can merge it. It will go quick that way. |
I have updated the PR so it accounts for the changes in
This is clearly a compiler bug, as |
|
Thank you everyone, let's wait a few days to see if there are further comments, and if not, I will merge due to the requirements for the registry. |
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.
Thanks everyone, merging!
As introduced in #877, we want fpm to pass its internal information to third-party software in a standardized way.
Command-line interface
fpm build --dump FILENAME
(dumps whole model. default: fpm_model.toml)fpm update --dump FILENAME
(dumps updated dependency tree. default: fpm_dependencies.toml)fpm export --manifest fpm.json
(dumps whole manifest without building anything)fpm export --dependencies deps.toml
(dumps dependency tree)fpm export --model model.json
(dumps whole internal model)FILENAME
extension determines format: use JSON if.json
, TOML otherwiseA full fpm_model.toml file of the fpm v0.8.1 project is here.
Relevant discussion in this weekly meeting, starting at 40:25 mins.
Key implementation points:
fpm_model_t
andpackage_t
are fully serialized/deserialized from TOML/JSON streamsfpm_model_t
contains Windows paths and I load it on a Unix machine, they are not updatedserializable_t
to further fpm classes, restart and other features possible