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

Support core v15.0 #309

Merged
merged 9 commits into from
Dec 29, 2022
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
7 changes: 4 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ jobs:
- 'ubuntu-latest'
# - 'macos-latest'
ocaml-version:
- 4.09.1
- 4.10.2
- 4.11.2
- 4.12.1
- 4.13.1
- 4.14.1
with-satysfi:
- false
oldest-dependencies:
Expand Down Expand Up @@ -65,11 +65,12 @@ jobs:
if: matrix.oldest-dependencies
run: |
OCAML_PACKAGE="ocaml.$(opam show --color=never -f version ocaml)"
OCAML_BASE_COMPILER="ocaml-base-compiler.$(opam show --color=never -f version ocaml-base-compiler)"
SATYROGRAPHOS_PACKAGE=satyrographos
# export OPAMEXTERNALSOLVER=builtin-0install
# export OPAMCRITERIA=+removed,+count[version-lag,solution]
opam install opam-0install
opam install --yes $(opam exec -- opam-0install --prefer-oldest "$SATYROGRAPHOS_PACKAGE" "$OCAML_PACKAGE")
opam install --yes $(opam exec -- opam-0install --prefer-oldest "$SATYROGRAPHOS_PACKAGE" "$OCAML_PACKAGE" "$OCAML_BASE_COMPILER")


- name: Test Satyrographos
Expand Down
3 changes: 2 additions & 1 deletion bin/dune
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
(executable
(name main)
(public_name satyrographos)
(preprocess (pps ppx_deriving.std ppx_jane -allow-unannotated-ignores))
(preprocess (pps ppx_deriving.std ppx_jane))
(libraries
core
core_unix.command_unix
satyrographos_template
satyrographos_command
satyrographos_lockdown
Expand Down
2 changes: 1 addition & 1 deletion bin/main.ml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ let total_command =

(* %%VERSION_NUM%% is expanded by "dune subst" *)
let () =
Command.run ~version:"%%VERSION_NUM%%" total_command
Command_unix.run ~version:"%%VERSION_NUM%%" total_command
7 changes: 4 additions & 3 deletions satyrographos.opam
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ run-test: [
]

depends: [
"ocaml" {>= "4.09.0"}
"ocaml" {>= "4.11.0"}

"conf-diffutils" {with-test}
"dune" {>= "2.7"}
"fileutils"
"json-derivers"
"menhir" {>= "20181006"}
"ppx_import"
"ppx_deriving"
"ppx_deriving_yojson"
"ocamlgraph"
Expand All @@ -45,7 +45,8 @@ depends: [
"yojson"

# Janestreet Libs
"core" {>= "v0.14" & < "v0.15"}
"core" {>= "v0.15" & < "v0.16"}
"core_unix"
"ppx_jane"
"shexp"
]
Expand Down
9 changes: 8 additions & 1 deletion src/autogen/dune
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,11 @@
(name satyrographos_autogen)
(inline_tests)
(preprocess (staged_pps ppx_deriving.std ppx_deriving_yojson ppx_jane))
(libraries core fileutils satyrographos satyrographos_satysfi shexp.process))
(libraries
core
core_unix.time_unix
fileutils
satyrographos
satyrographos_satysfi
shexp.process
))
2 changes: 1 addition & 1 deletion src/autogen/fontsSystem.ml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ module DistinctFontMap = Map.Make(DistinctFont)

let font_list ~outf =
Printf.sprintf "fc-list -f '%s'" fc_format_data (* TODO escape quotes *)
|> Unix.open_process_in
|> Core_unix.open_process_in
|> In_channel.input_all
|> Printf.sprintf "(%s)"
|> Sexp.of_string
Expand Down
2 changes: 1 addition & 1 deletion src/autogen/today.ml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ let generate_persistent () =
(* TODO (gh-98) get the values from the lockfile *)
let datetime = Time.now () in
let tzname =
Time.Zone.local
Time_unix.Zone.local
|> Lazy.force
in
{ datetime =
Expand Down
2 changes: 1 addition & 1 deletion src/buildScript_prim.ml
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ let rebase_file ~src_dir ~library_name =
let append_prefix dst_dir {dst; src} =
let dst_prefix =
if String.is_empty dst_dir
then ident
then Fn.id
else Filename.concat dst_dir in
{dst=dst_prefix dst; src=Filename.concat src_dir src}
in
Expand Down
2 changes: 1 addition & 1 deletion src/command/dune
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
(library
(name satyrographos_command)
(inline_tests)
(preprocess (staged_pps ppx_deriving.std ppx_jane -allow-unannotated-ignores))
(preprocess (staged_pps ppx_deriving.std ppx_jane))
(libraries
core
fileutils
Expand Down
2 changes: 1 addition & 1 deletion src/command/install.ml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ let get_libraries ~outf ~(env: Environment.t) ~libraries =
Format.fprintf outf "Reading runtime dist: %s\n" dist_library_dir;
let dist_library = Library.read_dir ~outf dist_library_dir in
let opam_libraries = match opam_reg with
| None -> StringSet.to_map StringSet.empty ~f:ident
| None -> StringSet.to_map StringSet.empty ~f:Fn.id
| Some reg_opam ->
OpamSatysfiRegistry.list reg_opam
|> StringSet.of_list
Expand Down
13 changes: 11 additions & 2 deletions src/dune
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,17 @@
(name satyrographos)
(synopsis "Internal Satyrographos Library, do not use!")
(inline_tests)
(preprocess (staged_pps ppx_deriving.std ppx_jane))
(libraries core fileutils json-derivers opam-format shexp.process uri uri-sexp yojson))
(preprocess (staged_pps ppx_import ppx_deriving.std ppx_jane))
(libraries
core
core_unix.filename_unix
fileutils
opam-format
shexp.process
uri
uri-sexp
yojson
))

(ocamllex
(modules glob_lexer)
Expand Down
4 changes: 2 additions & 2 deletions src/glob.ml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ open Core
module PrinterSemantics = struct
type glob = string
let star = "*"
let atom = ident
let atom = Fn.id
let range =
sprintf "%d..%d"
let slash s g =
Expand Down Expand Up @@ -50,7 +50,7 @@ module TokenMatcher = struct
then b
else begin
let v =
List.find_map ~f:ident
List.find_map ~f:Fn.id
[b.value; a.value; v;]
in
let merge_children =
Expand Down
7 changes: 1 addition & 6 deletions src/library.ml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,8 @@ module LibraryFiles = struct
end

module Json = struct
(*
include Yojson.Safe
type t = Json_derivers.Yojson.t
let ( sexp_of_t, t_of_sexp, compare, hash ) = Json_derivers.Yojson.( sexp_of_t, t_of_sexp, compare, hash )
*)
let ( to_string, from_file, to_file ) = Yojson.Safe.( to_string, from_file, to_file )
include Json_derivers.Yojson
type t = [%import: Yojson.Safe.t] [@@deriving sexp, compare, hash]
end

module Dependency = Set.Make(String)
Expand Down
9 changes: 2 additions & 7 deletions src/library.mli
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,8 @@ module LibraryFiles : sig
end

module Json : sig
include module type of Json_derivers.Yojson
val to_string :
?buf:Bi_outbuf.t -> ?len:int -> ?std:bool -> t -> string
val from_file :
?buf:Bi_outbuf.t -> ?fname:string -> ?lnum:int -> string -> t
val to_file :
?len:int -> ?std:bool -> string -> t -> unit
include module type of Yojson.Safe
type t = [%import: Yojson.Safe.t] [@@deriving sexp, compare, hash]
end

module Dependency : sig
Expand Down
2 changes: 1 addition & 1 deletion src/location.ml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ let%expect_test "position_of_offset: empty content" =
|> printf !"%d: %{sexp: position}\n" off
in
Sequence.init 6 ~f:test
|> Sequence.iter ~f:ident;
|> Sequence.iter ~f:Fn.id;
[%expect{|
0: ((lnum 0) (cnum 0))
1: ((lnum 0) (cnum 1))
Expand Down
10 changes: 2 additions & 8 deletions src/lockdown/lockdownFile.ml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,8 @@ open Core
let version = "0.0.3"

module Json = struct
(*
include Yojson.Safe
type t = Json_derivers.Yojson.t
let ( sexp_of_t, t_of_sexp, compare, hash ) = Json_derivers.Yojson.( sexp_of_t, t_of_sexp, compare, hash )
*)
include Yojson.Safe
include Json_derivers.Yojson
let to_yojson = ident
include Satyrographos.Library.Json
let to_yojson = Fn.id
let of_yojson x = Result.Ok x
end

Expand Down
2 changes: 1 addition & 1 deletion src/repository.ml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ let remove reg name =
remove_multiple reg [name]

let add_dir reg name dir =
let abs_dir = Filename.realpath dir in
let abs_dir = Filename_unix.realpath dir in
let uri = Uri.make ~scheme:"file" ~path:abs_dir () in
(* Store.add_dir reg.cache name dir; *)
Metadata.add reg.metadata name {
Expand Down
1 change: 1 addition & 0 deletions src/satysfi/dune
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
(preprocess (staged_pps ppx_deriving.std ppx_jane))
(libraries
core
core_unix
fileutils
ocamlgraph
re
Expand Down
2 changes: 1 addition & 1 deletion src/satysfi/migration.ml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
open Core

module Json = Json_derivers.Yojson
module Library = Satyrographos.Library
module Json = Library.Json

let migrate_font_src ~outf (l: Library.t) =
let migrate_font_hash_variant_entry ~outf names = function
Expand Down
2 changes: 1 addition & 1 deletion src/satysfi/satysfiDirs.ml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ let is_runtime_dir dir =

let opam_share_dir ~outf =
try
Unix.open_process_in "opam var share"
Core_unix.open_process_in "opam var share"
|> In_channel.input_all
|> String.strip
|> begin function
Expand Down
2 changes: 1 addition & 1 deletion src/satysfi/version.ml
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ let flag =
| Some x -> x
| None ->
Format.fprintf outf
"Cannot detect SATySFi Version. Please specify with --satysfi-version. Assuming %s"
"Cannot detect SATySFi Version. Please specify it with --satysfi-version. Assuming %s"
(to_string latest_version);
latest_version
]
Expand Down
14 changes: 7 additions & 7 deletions src/store.ml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ let create_new_reg dir =
initialize registry_dir;
read registry_dir
let with_new_reg f =
let dir = Filename.temp_dir "Satyrographos" "Store" in
let dir = Filename_unix.temp_dir "Satyrographos" "Store" in
protect ~f:(fun () -> create_new_reg dir |> f) ~finally:(fun () -> FileUtil.rm ~force:Force ~recurse:true [dir])

let test_library_list ~expect reg =
Expand All @@ -58,7 +58,7 @@ let%test "store: list: empty" = with_new_reg begin fun reg ->
match list reg with [] -> true | _ :: _ -> false
end
let%test_unit "store: add empty dir" = with_new_reg begin fun reg ->
let dir = Filename.temp_dir "Satyrographos" "Library" in
let dir = Filename_unix.temp_dir "Satyrographos" "Library" in
add_dir reg "a" dir;
test_library_list ~expect:["a"] reg;
[%test_result: bool] ~expect:true (mem reg "a");
Expand All @@ -67,7 +67,7 @@ let%test_unit "store: add empty dir" = with_new_reg begin fun reg ->
end

let%test_unit "store: add nonempty dir" = with_new_reg begin fun reg ->
let dir = Filename.temp_dir "Satyrographos" "Library" in
let dir = Filename_unix.temp_dir "Satyrographos" "Library" in
FilePath.concat dir "c" |> FileUtil.touch;
add_dir reg "a" dir;
test_library_list ~expect:["a"] reg;
Expand All @@ -78,20 +78,20 @@ let%test_unit "store: add nonempty dir" = with_new_reg begin fun reg ->
end

let%test_unit "store: add nonempty dir twice" = with_new_reg begin fun reg ->
let dir1 = Filename.temp_dir "Satyrographos" "Library" in
let dir1 = Filename_unix.temp_dir "Satyrographos" "Library" in
FilePath.concat dir1 "c" |> FileUtil.touch;
add_dir reg "a" dir1;
test_library_list ~expect:["a"] reg;
test_library_content ~expect:["c"] reg "a";
let dir2 = Filename.temp_dir "Satyrographos" "Library" in
let dir2 = Filename_unix.temp_dir "Satyrographos" "Library" in
FilePath.concat dir2 "d" |> FileUtil.touch;
add_dir reg "a" dir2;
test_library_list ~expect:["a"] reg;
test_library_content ~expect:["d"] reg "a"
end

let%test_unit "store: added dir must be copied" = with_new_reg begin fun reg ->
let dir = Filename.temp_dir "Satyrographos" "Library" in
let dir = Filename_unix.temp_dir "Satyrographos" "Library" in
FilePath.concat dir "c" |> FileUtil.touch;
add_dir reg "a" dir;
test_library_list ~expect:["a"] reg;
Expand All @@ -105,7 +105,7 @@ let%test_unit "store: added dir must be copied" = with_new_reg begin fun reg ->
end

let%test_unit "store: add the same directory twice with different contents" = with_new_reg begin fun reg ->
let dir = Filename.temp_dir "Satyrographos" "Library" in
let dir = Filename_unix.temp_dir "Satyrographos" "Library" in
FilePath.concat dir "c" |> FileUtil.touch;
add_dir reg "a" dir;
test_library_list ~expect:["a"] reg;
Expand Down
2 changes: 1 addition & 1 deletion test/testcases/command_build__doc_make.ml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ let () =
~outf
~verbose
~buildscript_path:(FilePath.concat temp_dir "pkg/Satyristes")
~build_dir:(FilePath.concat temp_dir "pkg/_build" |> Option.some)
~build_dir:(FilePath.concat temp_dir "pkg/_build" |> Core.Option.some)
~env
~names
in
Expand Down
2 changes: 1 addition & 1 deletion test/testcases/command_build__doc_satysfi.ml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ let () =
~outf
~verbose
~buildscript_path:(FilePath.concat temp_dir "pkg/Satyristes")
~build_dir:(FilePath.concat temp_dir "pkg/_build" |> Option.some)
~build_dir:(FilePath.concat temp_dir "pkg/_build" |> Core.Option.some)
~env
~names
in
Expand Down
2 changes: 1 addition & 1 deletion test/testcases/command_build__doc_with_autogen.ml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ let () =
~outf
~verbose
~buildscript_path:(FilePath.concat temp_dir "pkg/Satyristes")
~build_dir:(FilePath.concat temp_dir "pkg/_build" |> Option.some)
~build_dir:(FilePath.concat temp_dir "pkg/_build" |> Core.Option.some)
~env
~names
in
Expand Down
2 changes: 1 addition & 1 deletion test/testcases/command_build__doc_with_libraries.ml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ let () =
~outf
~verbose
~buildscript_path:(FilePath.concat temp_dir "pkg/Satyristes")
~build_dir:(FilePath.concat temp_dir "pkg/_build" |> Option.some)
~build_dir:(FilePath.concat temp_dir "pkg/_build" |> Core.Option.some)
~env
~names
in
Expand Down
5 changes: 1 addition & 4 deletions test/testcases/command_install__distWithBrokenHash.expected
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
Installing packages
------------------------------------------------------------
Exception:
(Failure
"JSON Error in file @@temp_dir@@/simple_dist/hash/broken.satysfi-hash: Line 1, bytes <zero-or-one>-4:\
\nInvalid token 'abc\
\n'")
Failure("JSON Error in file @@temp_dir@@/simple_dist/hash/broken.satysfi-hash: Line 1, bytes <zero-or-one>-4:\nInvalid token 'abc\n'")
------------------------------------------------------------
@@dest_dir@@
------------------------------------------------------------
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ diff -Nr @@empty_dir@@/dest/fonts/Junicode.ttf @@dest_dir@@/dest/fonts/Junicode.
diff -Nr @@empty_dir@@/dest/hash/fonts.satysfi-hash @@dest_dir@@/dest/hash/fonts.satysfi-hash
0a1
> {"Junicode":<"Single":{"src":"dist/fonts/Junicode.ttf"}>}
\ No newline at end of file
diff -Nr @@empty_dir@@/dest/metadata @@dest_dir@@/dest/metadata
0a1,2
> ((version 1) (libraryName dist) (libraryVersion "") (compatibility ())
Expand Down
1 change: 0 additions & 1 deletion test/testcases/command_install__onlyDist.expected
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ diff -Nr @@empty_dir@@/dest/fonts/Junicode.ttf @@dest_dir@@/dest/fonts/Junicode.
diff -Nr @@empty_dir@@/dest/hash/fonts.satysfi-hash @@dest_dir@@/dest/hash/fonts.satysfi-hash
0a1
> {"Junicode":<"Single":{"src":"dist/fonts/Junicode.ttf"}>}
\ No newline at end of file
diff -Nr @@empty_dir@@/dest/metadata @@dest_dir@@/dest/metadata
0a1,2
> ((version 1) (libraryName dist) (libraryVersion "") (compatibility ())
Expand Down
1 change: 0 additions & 1 deletion test/testcases/command_install__thirdParties.expected
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ diff -Nr @@empty_dir@@/dest/fonts/fonts-theano/TheanoOldStyle-Regular.otf @@dest
diff -Nr @@empty_dir@@/dest/hash/fonts.satysfi-hash @@dest_dir@@/dest/hash/fonts.satysfi-hash
0a1
> {"fonts-theano:TheanoDidot":<"Single":{"src-dist":"fonts-theano/TheanoDidot-Regular.otf"}>,"fonts-theano:TheanoModern":<"Single":{"src-dist":"fonts-theano/TheanoModern-Regular.otf"}>,"fonts-theano:TheanoOldStyle":<"Single":{"src-dist":"fonts-theano/TheanoOldStyle-Regular.otf"}>}
\ No newline at end of file
diff -Nr @@empty_dir@@/dest/metadata @@dest_dir@@/dest/metadata
0a1,9
> ((version 1) (libraryName dist) (libraryVersion 2.0)
Expand Down
Loading