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

Update to 5.1.1 #13

Merged
merged 5 commits into from
Apr 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions .github/workflows/odoc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,16 @@ jobs:
- name: Checkout tree
uses: actions/checkout@v3

- name: Set-up OCaml 5.0
- name: Set-up OCaml 5.1.1
uses: ocaml/setup-ocaml@v2
with:
ocaml-compiler: "5.0"
ocaml-compiler: "5.1.1"
dune-cache: true

- name: Deploy odoc to GitHub Pages
uses: ocaml/setup-ocaml/deploy-doc@v2
# last version of setup-ocaml with deploy-doc
# TODO: https://github.com/ocaml/setup-ocaml/blob/master/EXAMPLES.md
# #using-the-official-github-pages-actions-to-deploy-odoc-to-github-pages
uses: ocaml/setup-ocaml/[email protected]
with:
destination-dir: ${{ github.head_ref || github.ref_name }}
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
os:
- ubuntu-latest
ocaml-compiler:
- "5.0"
- "5.1.1"

runs-on: ${{ matrix.os }}

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ocaml/opam:debian-12-ocaml-5.0
FROM ocaml/opam:debian-12-ocaml-5.1

WORKDIR /home/opam/less-power/

Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ The LP framework was presented at the OCaml Users and Developers Workshop 2023.

## Install

The framework is currently fixed to OCaml 5.0.0. Hence, from an OCaml 5.0.0. switch, LP can be installed using opam:
The framework is currently fixed to OCaml 5.1.1. Hence, from an OCaml 5.1.1. switch, LP can be installed using opam:

```sh
opam pin add less-power https://github.com/just-max/less-power.git#main
Expand All @@ -18,6 +18,8 @@ Alternatively, the provided Docker image may be used:
docker pull ghcr.io/just-max/less-power:main
```

A specific tag may instead be substituted for `main`.

# Development

To make changes to the framework, first clone this repository. Then add a local pin:
Expand Down Expand Up @@ -45,7 +47,7 @@ opam upgrade --working-dir less-power # make changes available

For running real programming courses, programming exercises built for the Less Power framework are best run with [Artemis](https://github.com/ls1intum/Artemis). Artemis is an interactive learning platform that handles student participation and provides CI-based automated testing.

However, the framework using only standard OCaml tooling, and may be adapted for use with other platforms that offer some from of continuous integration.
However, the framework uses only standard OCaml tooling, and may be adapted for use with other platforms that offer some from of continuous integration.

## Examples

Expand Down
2 changes: 1 addition & 1 deletion dune-project
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"\| and at scale.
)
(depends
(ocaml (= 5.0.0))
(ocaml (= 5.1.1))
(xmlm (and (>= 1.4) (< 1.5)))
(fileutils (and (>= 0.6) (< 0.7)))
(qcheck-core (and (>= 0.21) (< 0.22)))
Expand Down
2 changes: 1 addition & 1 deletion less-power.opam
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ homepage: "https://github.com/just-max/less-power"
bug-reports: "https://github.com/just-max/less-power/issues"
depends: [
"dune" {>= "3.0"}
"ocaml" {= "5.0.0"}
"ocaml" {= "5.1.1"}
"xmlm" {>= "1.4" & < "1.5"}
"fileutils" {>= "0.6" & < "0.7"}
"qcheck-core" {>= "0.21" & < "0.22"}
Expand Down
25 changes: 21 additions & 4 deletions src/ast-check/ast_check.ml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
open Common.Util
open Ocaml_shadow [@@warning "-33"]

module Messages = struct
let array = "This is a use of array syntax, which is not permitted"
Expand Down Expand Up @@ -228,8 +229,20 @@ let ast_violations_transformation ?prohibited ?limit (_ : expansion_ctx) ast =


let file_violations ?prohibited ?limit path =
Pparse.parse_implementation ~tool_name:"lp-ast-check" path
|> ast_violations ?prohibited ?limit

(* hack: for pp_violation to show the error context, we need
the built-in parser to run on the file (the Location module doesn't
expose the functionality we need to do this ourselves) *)
Ocaml_common.Pparse.parse_implementation ~tool_name:"lp-ast-check" path |> ignore;

let open Common.Ctx_util in
let structure =
let< ch = In_channel.with_open_text path in
let lexbuf = Lexing.from_channel ch in
Lexing.set_filename lexbuf path;
Ppxlib.Parse.implementation lexbuf
in
ast_violations ?prohibited ?limit structure

let path_violations ?(follow = FileUtil.Follow) ?prohibited ?limit
?(check1 = FileUtil.True) ?(check = FileUtil.Has_extension "ml") k path =
Expand All @@ -239,8 +252,9 @@ let path_violations ?(follow = FileUtil.Follow) ?prohibited ?limit


let pp_violation ppf vio =
let open Location in
(* convert between Ppxlib and native types (why?) *)
let open Ocaml_common.Location in
(* Ppxlib does not expose the errorf and print_report functions we need,
so we "convert" the Ppxlib location to a native Location.t *)
let loc = {
loc_start = vio.location.Ppxlib.Location.loc_start;
loc_end = vio.location.Ppxlib.Location.loc_end;
Expand All @@ -250,6 +264,9 @@ let pp_violation ppf vio =
let report = errorf ~loc "%a" pp_violation_message vio in
print_report ppf report

(* TODO: drop file_violations, path_violations, and pp_violation,
along with ast_check_bin. The nicer way of doing things is through
a PPX rewriter and we should be able to remove the binary way of doing it *)

let strip_signatures (_ : expansion_ctx) ast =
let open Ppxlib.Ast in
Expand Down
2 changes: 1 addition & 1 deletion src/ast-check/ast_check_bin.ml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ let main (_cmd : string) args =
| vs ->
status := max 1 !status;
let open Fmt in
pr "@[<v>%a@]" (list ~sep:cut (box pp_violation)) vs
pr "@[<v>%a@]" (list ~sep:nop (box pp_violation)) vs
in
args |> List.iter (path_violations k);
!status
Expand Down
6 changes: 4 additions & 2 deletions src/ast-check/dune
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@
common
fmt
fileutils
compiler-libs.common
ppxlib
ppxlib.astlib
ppxlib.traverse_builtins))
ppxlib.traverse_builtins
compiler-libs.common ; native compiler-libs, required as dep. of wrapper
ocaml-compiler-libs.common ; wrapper library
ocaml-compiler-libs.shadow))

(executable
(name ast_check_bin)
Expand Down
3 changes: 3 additions & 0 deletions src/stdlib-variants/signatures/sig_float.ml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ module type SafeFloat = sig
val infinity : float
val neg_infinity : float
val nan : float
val signaling_nan : float
val quiet_nan : float
val pi : float
val max_float : float
val min_float : float
Expand Down Expand Up @@ -179,6 +181,7 @@ module type SafeFloat = sig
val min_num : t -> t -> t
val max_num : t -> t -> t
val min_max_num : float -> float -> float * float
val seeded_hash : int -> t -> int
val hash : t -> int

end
2 changes: 2 additions & 0 deletions src/stdlib-variants/signatures/sig_seq.ml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ module type SafeSeq = sig
val for_all : ('a -> bool) -> 'a t -> bool
val exists : ('a -> bool) -> 'a t -> bool
val find : ('a -> bool) -> 'a t -> 'a option
val find_index : ('a -> bool) -> 'a t -> int option
val find_map : ('a -> 'b option) -> 'a t -> 'b option
val find_mapi : (int -> 'a -> 'b option) -> 'a t -> 'b option
val iter2 : ('a -> 'b -> unit) -> 'a t -> 'b t -> unit
val fold_left2 : ('a -> 'b -> 'c -> 'a) -> 'a -> 'b t -> 'c t -> 'a
val for_all2 : ('a -> 'b -> bool) -> 'a t -> 'b t -> bool
Expand Down
2 changes: 1 addition & 1 deletion src/test-lib/grading.ml
Original file line number Diff line number Diff line change
Expand Up @@ -354,4 +354,4 @@ let grade_cleanup_files_to ?points_step_count ~grading_to ?grading =
(* compat *)
let prettify_results ?grading path =
grade_cleanup_files_to [path] ?grading
~grading_to:Filename.(concat (basename path) "grading.xml")
~grading_to:Filename.(concat (dirname path) "grading.xml")
2 changes: 1 addition & 1 deletion src/test-lib/grading.mli
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ val evaluate_grading :
(** {1 Reading and writing}

Functionality to read tests from JUnit XML files, cleanup the files,
and write evaluated grading to a JUnix XML files. *)
and write evaluated grading to JUnit XML files. *)

(** {2 Reading and cleanup} *)

Expand Down
Loading