fortran-lang / playground

An interactive Fortran playground
MIT License
34 stars 12 forks source link

Added support for stdlib and fpm #21

Closed ashirrwad closed 2 years ago

ashirrwad commented 2 years ago

I've modified the docker image and altered directory and execution structure so that we use fpm for our executions now. This means we can support any package built via fpm. I've only added support for stdlib as of now. Make sure to build a new image as stated in the README.

ashirrwad commented 2 years ago

@everythingfunctional @milancurcic @arjenmarkus please assist with review.

arjenmarkus commented 2 years ago

Hi Ashirwad,

I will do my best, hopefully I can review it tonight.

Regards,

Arjen

Op di 30 aug. 2022 om 12:08 schreef Ashirwad Mishra < @.***>:

@everythingfunctional https://github.com/everythingfunctional @milancurcic https://github.com/milancurcic @arjenmarkus https://github.com/arjenmarkus please assist with review.

— Reply to this email directly, view it on GitHub https://github.com/fortran-lang/playground/pull/21#issuecomment-1231453169, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAN6YR35SYVABIUUVT4FR43V3XMQDANCNFSM6AAAAAAQAHZ3MY . You are receiving this because you were mentioned.Message ID: @.***>

everythingfunctional commented 2 years ago

A few thoughts on the approach here.

  1. Don't commit the fpm executable to this repository. Have the Dockerfile fetch it from the releases of the fpm repo. You can also name it just fpm. No need to keep the other parts of the name.
  2. The fpm.toml shouldn't be "hard-coded" in the backend. It should be generated by the frontend and sent to the backend based on the libraries selected by the user. Otherwise, the user is always building all the supported libraries whether they use anything from them or not.
  3. The supported libraries should be pre-fetched and included in the Docker environment at known path's. The generated fpm.toml file can then use them directly with an entry under dependencies like stdlib.path = "/fortran/stdlib"
  4. No need to run fpm build and fpm run as separate steps. fpm run will build as necessary.
  5. Don't really need to run fpm new in the Dockerfile. You're not using any of the files it generates. Just do mkdir -p playground/app and you've got everything you actually need.

Note: each of these items is pretty orthogonal, so you can pretty easily address them one at a time in separate commits, which I'd recommend.

ashirrwad commented 2 years ago

@everythingfunctional I've altered the code according to the solution you suggested. We give user option to select libraries via a toggle switch that can be accessed in the frontend. This is selection is then sent to the backend which generates an fpm.toml containing the libraries user has selected, for now we only use stdlib. I've also altered the docker image to fetch fpm, and stdlib directly from source.

We do however keep the build statement as fpm run outputs the build information to STDOUT which is picked up by our backend.

I've also altered a few UI components to make the playground look cleaner.

Please take a look.

everythingfunctional commented 2 years ago

There are probably some improvements that could be made to the UI, but the functionality is there and usable and it works. I'm happy with merging this now. Good work.