Skip to content

Update to OCaml 4.12.0#1019

Merged
WardBrian merged 3 commits intostan-dev:masterfrom
WardBrian:ocaml-update
Nov 15, 2021
Merged

Update to OCaml 4.12.0#1019
WardBrian merged 3 commits intostan-dev:masterfrom
WardBrian:ocaml-update

Conversation

@WardBrian
Copy link
Copy Markdown
Member

@WardBrian WardBrian commented Nov 1, 2021

Closes #885, #710, #779, #627

This PR performs the minimal possible update to OCaml 4.12.0. It does not make any of the changes this enables like monadic let bindings or better names in our AST types (#882) - those can come later.

This includes a version bump of core_kernel to v0.14, menhir to 20210929, and ppx_deriving to 5.2.1. Dune is also updated.

Required steps:

  • Add open Core_kernel.Poly to enable polymorphic comparison when needed
  • Update dune files (functionality is the same)
  • Update (and run) ocamlformat - this leads to a large diff - compare before commit.
  • Update dependencies documentation
  • Make sure CI works and all scripts install correct versions Update dockerfiles for 4.12 ci-scripts#13

Windows build requirements:

Submission Checklist

  • Run unit tests
  • Documentation
    • OR, no user-facing changes were made

Release notes

Updated OCaml and build dependencies

Copyright and Licensing

By submitting this pull request, the copyright holder is agreeing to
license the submitted work under the BSD 3-clause license (https://opensource.org/licenses/BSD-3-Clause)

@WardBrian WardBrian changed the title Ocaml update Update to OCaml 4.12.0 Nov 1, 2021
@WardBrian WardBrian force-pushed the ocaml-update branch 4 times, most recently from d9e58a4 to ad3683a Compare November 1, 2021 15:36
@WardBrian
Copy link
Copy Markdown
Member Author

As of the last commit this builds and passes tests in CI. Our docker images for static binaries aren't updated, so it doesn't get all the way through, but close enough for now

@rok-cesnovar
Copy link
Copy Markdown
Member

What is the process of updating to be able to build stanc3 once we merge this? Is it very involved or just upgrading ocaml?

What are the next steps now?

@WardBrian
Copy link
Copy Markdown
Member Author

It’s just opam switch 4.12.0 and then opam install <list of 3-4 packages> (or re-run the install_*.sh scripts).

The core_kernel PR was just approved so it’s just ppx_deriving and then updating our CI machines once that’s available. Then this should be ready

@rok-cesnovar
Copy link
Copy Markdown
Member

Super cool!

@WardBrian
Copy link
Copy Markdown
Member Author

ppx_deriving is now cross-compiling which means I have been able to build and test a windows binary built with OCaml 4.12.0!

Once it is merged into opam-cross-windows this PR will be ready to go.

@serban-nicusor-toptal Is there a way to build docker images which feature different versions of our dependencies without messing up our existing CI? It's not ready yet but hopefully within the next week we will want to do this.

@serban-nicusor-toptal
Copy link
Copy Markdown
Contributor

Hey @WardBrian, of course, we can do that, I think we can just create a new dir here with its Dockerfile/requirements. If you create a PR with it just tag me and I'll add it to the CI.

@WardBrian
Copy link
Copy Markdown
Member Author

Thanks @serban-nicusor-toptal. After this is merged, we'd want these updated images to replace the existing stanc3:static etc, but for testing it would be great to have them separate. Building them will basically just consist of re-running the docker builds but with the scripts from this branch

@WardBrian
Copy link
Copy Markdown
Member Author

@serban-nicusor-toptal I'm updating the scripts/ folder of this repository now. Would you be able to do the build or guide me through it?

The only thing that needs to change in the actual dockerfiles is any reference to js_of_ocaml* should just call scripts/install_js_deps.sh now. Besides that the same dockerfiles can be used with the new scripts

@WardBrian WardBrian marked this pull request as ready for review November 11, 2021 19:19
@WardBrian
Copy link
Copy Markdown
Member Author

@serban-nicusor-toptal - could I actually update this PR to use those dockerfiles for the testing of this, and then after it is merged sort of redo #1020? Just trying to think of the shortest/fewest steps that doesn't require breaking the existing build pipeline while we sort it out

@serban-nicusor-toptal
Copy link
Copy Markdown
Contributor

Just for the record I had a talk with Brian and if this can wait until tomorrow/Monday I think it's best if we can automate it. Our idea is to modify the current ci-scripts pipeline that build the Dockerfiles to receive at least 2 new arguments.
One is stanc3_branch and one is ciscripts_branch, pipeline will checkout these branches, build our Docker images using Dockerfile and scripts from those branches then push each image (here maybe I can also make it optional to build each image) to stanorg/stanc3 Dockerhub with a tag ${dockerfile_name}-${stanc3_branch}. We are also thinking about how to best do the "switch" so we avoid CI failures the best we can.
I'll get working on it.

@WardBrian
Copy link
Copy Markdown
Member Author

I've switched the format from janestreet to the default. This still has most of the changes compared to compact (what we were using before), but it has a few key differences.

In particular, I didn't notice that the Jane Street format enforced every top-level expression being terminated with ;;, which I think is a really ugly thing to have in a code base

@WardBrian
Copy link
Copy Markdown
Member Author

I've just collected all the non-formatting changes into a single commit here.

After trying all the options, I think the one that makes the fewest bad choices in still compact (what we've been using so far), so I've left that. My plan is to try to keep this PR at only those 2 core commits before merging to make the blame easier to navigate after the fact.

@WardBrian
Copy link
Copy Markdown
Member Author

While the CI is still being worked out, this PR is ready for general review. The updates are pretty minimal besides the formatting changes.

@WardBrian WardBrian force-pushed the ocaml-update branch 2 times, most recently from 0faf481 to 2f17844 Compare November 15, 2021 15:11
This will be reverted after merging
@WardBrian
Copy link
Copy Markdown
Member Author

This is passing in CI and ready to merge

Copy link
Copy Markdown
Member

@rok-cesnovar rok-cesnovar left a comment

Choose a reason for hiding this comment

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

Two questions otherwise looks good. Also need to install locally.

@SteveBronder
Copy link
Copy Markdown
Contributor

Besides @rok-cesnovar 's Qs and my lil one I think this looks good!

@WardBrian WardBrian requested review from SteveBronder and rok-cesnovar and removed request for SteveBronder November 15, 2021 18:01
Copy link
Copy Markdown
Member

@rok-cesnovar rok-cesnovar left a comment

Choose a reason for hiding this comment

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

Thanks, @WardBrian and @serban-nicusor-toptal!

This was a gigantic effort!

@WardBrian WardBrian merged commit 2e5562c into stan-dev:master Nov 15, 2021
@WardBrian WardBrian deleted the ocaml-update branch November 24, 2021 16:10
@WardBrian WardBrian restored the ocaml-update branch November 24, 2021 16:10
@WardBrian WardBrian deleted the ocaml-update branch May 10, 2022 13:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cleanup Code simplification or clean-up release/packaging

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants