Skip to content

Exercice external libraries #2

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 33 commits into
base: a7977b52
Choose a base branch
from

Conversation

hernoufM
Copy link

Loading exercise dependencies feature. Here is a clipping from exercise_format :

External libraries

Additionally, you could define external libraries to your exercise in meta.json that becomes available in the set of .mls and at the toplevel of exercise. To do that mention library name and imported interfaces in additional field in meta.json.

…
"max_score" : [ 0 .. n ],
“lib_deps”: [
    { “lib” : ”lib1”, “cmis” : [“cmi1”, …] },
    …
]

A .cmi should be mentioned without extension part. Listing explicitly cmis for a library allows you to restrict students to use only those interfaces that are mentioned, at the same time leaving the opportunity for teachers to use all possible modules when compiling exercises (i.e. in prelude, prepare, solution and test files). Order between cmis is assumed, but not for libraries. So if you want to load several libraries that could depend on some of them, make sure that you lists them in the correct order (library with no dependencies should be listed first). Libraries should be able to be compiled to JavaScript.

AltGr and others added 30 commits April 1, 2022 14:33
to cmi, cma and js.
Includes changes to the toploop to handle the dynamic loading.
Finally :)
This should give a nice economy of bandwidth since the uncyphered compilation
artifacts will compress much better.
instead of just "open". This restores the toplevel output on values defined in
Prelude, and forbids access to the interface of Prepare (which were two small
regressions with pre-compilation)
(now that it works!)
…ister_sampler` calls

* New transformation has been added that inserts `let () = Introspection.register_sampler name fun`
  for each toplevel binding prefixed with `sample_*` in test.ml.

* Compilation units stored in `demo-repository/exercises/exercise_name/` during the
  precompilation are no longer staged.
Previous patch on byte/js selection broke static servers. This restores
the compatible API by using GET args to filter the answer (on a static
server, no filtering will be done but that just means a little more
bandwidth usage)
Functorising to add parameters so that it can be used to inject printer
registerers as well, for example
Containing just the names of the ocamlfind libraries to link in
and facility to link them during the `build` step.

NOTE: the helper library is going to be included in every exercise. A
lighter approach could be to keep loading it separately, e.g. after
loading the cma/js file from a directory holding static content on the
server (and removing the `.cma` from the compilation line in
`precompile_exercise.ml`).

This will probably fit well once we include such a mechanism for loading
custom libraries as the prelude to exercises, the main difference being
that the latter will also need the `cmi` files.
Now an optional library that demonstrates the use of grader libraries.
sync'ing with printer handling and the newer ppx that has the module name
`learn-ocaml build` now requires write access to the repository since it writes
compilation artefacts in-place.
@AltGr AltGr force-pushed the a7977b52 branch 3 times, most recently from 81ff75a to a86b256 Compare October 30, 2023 13:46
@AltGr AltGr force-pushed the a7977b52 branch 3 times, most recently from 0a507b6 to 6ce797f Compare November 3, 2023 12:56
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