Skip to content

Commit

Permalink
Drop 1st class support for 4.07
Browse files Browse the repository at this point in the history
Signed-off-by: Jeremie Dimino <[email protected]>
  • Loading branch information
jeremiedimino committed Jun 29, 2020
1 parent 264d6e5 commit 3c08b65
Show file tree
Hide file tree
Showing 37 changed files with 33 additions and 479 deletions.
4 changes: 2 additions & 2 deletions .travis-ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
PATH=~/ocaml/bin:$PATH; export PATH
OPAMYES="true"; export OPAMYES

OPAM_VERSION="2.0.5"
OPAM_VERSION="2.0.7"

# This allows a specific version of odoc to be selected if necessary
ODOC="odoc>=1.5.0"
Expand All @@ -29,7 +29,7 @@ opam_install_test_deps () {
menhir \
ocaml-migrate-parsetree \
result.1.4 \
utop.2.4.2 \
"utop>=2.6.0" \
mdx.1.6.0 \
bisect_ppx
# We install Coq separatedly as to be more resistant w.r.t. the 10
Expand Down
10 changes: 5 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,22 @@ matrix:
- os: linux
env: OCAML_VERSION=4.02 OCAML_RELEASE=3 WITH_OPAM=0
stage: Build
- os: linux
env: OCAML_VERSION=4.07 OCAML_RELEASE=1 WITH_OPAM=0
stage: Build
- os: linux
env: OCAML_VERSION=4.08 OCAML_RELEASE=1 WITH_OPAM=0
stage: Build
- os: linux
env: OCAML_VERSION=4.09 OCAML_RELEASE=0 WITH_OPAM=0
stage: Build
- os: linux
env: OCAML_VERSION=4.09 OCAML_RELEASE=0 WITH_OPAM=1
env: OCAML_VERSION=4.10 OCAML_RELEASE=0 WITH_OPAM=0
stage: Build
- os: linux
env: OCAML_VERSION=4.10 OCAML_RELEASE=0 WITH_OPAM=1
stage: Test
addons:
apt:
packages:
- aspcud
- os: osx
env: OCAML_VERSION=4.09 OCAML_RELEASE=0 WITH_OPAM=0
env: OCAML_VERSION=4.10 OCAML_RELEASE=0 WITH_OPAM=0
stage: Build_macOS
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ This feature requires [opam][opam].
Requirements
------------

Dune requires OCaml version 4.07.0 to build itself and can build OCaml
Dune requires OCaml version 4.08.0 to build itself and can build OCaml
projects using ocaml 4.02.3 or greater.

Installation
Expand Down
1 change: 0 additions & 1 deletion bin/dune
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
(name main)
(libraries memo dune_lang fiber stdune unix cache_daemon cache dune
dune_util cmdliner threads.posix build_info dune_csexp)
(preprocess future_syntax)
(bootstrap_info bootstrap-info))

(rule
Expand Down
62 changes: 10 additions & 52 deletions boot/duneboot.ml
Original file line number Diff line number Diff line change
Expand Up @@ -970,7 +970,7 @@ let write_args file args =
output_string ch (String.concat ~sep:"\n" args);
close_out ch

let get_dependencies ~pp libraries =
let get_dependencies libraries =
let alias_files =
List.fold_left libraries ~init:[] ~f:(fun acc (_, alias_file, _) ->
match alias_file with
Expand All @@ -981,7 +981,7 @@ let get_dependencies ~pp libraries =
List.map ~f:(fun (x, _, _) -> x) libraries |> List.concat
in
write_args "source_files" all_source_files;
ocamldep (pp @ mk_flags "-map" alias_files @ [ "-args"; "source_files" ])
ocamldep (mk_flags "-map" alias_files @ [ "-args"; "source_files" ])
>>| fun dependencies ->
let all_source_files =
List.fold_left alias_files ~init:(StringSet.of_list all_source_files)
Expand Down Expand Up @@ -1053,18 +1053,17 @@ let sort_files dependencies ~main =
loop (Filename.basename main);
List.rev !res

let common_build_args name ~pp ~external_includes ~external_libraries =
let common_build_args name ~external_includes ~external_libraries =
List.concat
[ [ "-o"; Filename.concat ".." (name ^ ".exe"); "-g" ]
; ( match Config.mode with
| Byte -> [ Config.output_complete_obj_arg ]
| Native -> [] )
; pp
; external_includes
; external_libraries
]

let build ~ocaml_config ~pp ~dependencies ~c_files
let build ~ocaml_config ~dependencies ~c_files
{ target = name, main; external_libraries; _ } =
let ext_obj =
try StringMap.find "ext_obj" ocaml_config with Not_found -> ".o"
Expand Down Expand Up @@ -1094,7 +1093,6 @@ let build ~ocaml_config ~pp ~dependencies ~c_files
Process.run ~cwd:build_dir Config.compiler
(List.concat
[ [ "-c"; "-g"; "-no-alias-deps"; "-w"; "-49" ]
; pp
; external_includes
; [ file ]
]))));
Expand All @@ -1120,20 +1118,20 @@ let build ~ocaml_config ~pp ~dependencies ~c_files
write_args "compiled_ml_files" compiled_ml_files;
Process.run ~cwd:build_dir Config.compiler
(List.concat
[ common_build_args name ~pp ~external_includes ~external_libraries
[ common_build_args name ~external_includes ~external_libraries
; obj_files
; [ "-args"; "compiled_ml_files" ]
])

let build_with_single_command ~ocaml_config:_ ~pp ~dependencies ~c_files
let build_with_single_command ~ocaml_config:_ ~dependencies ~c_files
{ target = name, main; external_libraries; _ } =
let external_libraries, external_includes =
resolve_externals external_libraries
in
write_args "mods_list" (sort_files dependencies ~main);
Process.run ~cwd:build_dir Config.compiler
(List.concat
[ common_build_args name ~pp ~external_includes ~external_libraries
[ common_build_args name ~external_includes ~external_libraries
; [ "-no-alias-deps"; "-w"; "-49" ]
; c_files
; [ "-args"; "mods_list" ]
Expand All @@ -1147,62 +1145,22 @@ let rec rm_rf fn =
| _ -> Unix.unlink fn
| exception Unix.Unix_error (ENOENT, _, _) -> ()

(** {2 ocaml-syntax-shims} *)

let build_syntax_shims () =
if Config.ocaml_version >= (4, 08) then
Fiber.return []
else
let cwd = "src/ocaml-syntax-shims" in
Fiber.fork_and_join
(fun () ->
Process.run_and_capture ~cwd "ocaml"
[ "select-impl"; Sys.ocaml_version ])
(fun () ->
Process.run_and_capture ~cwd "ocaml"
[ "select-shims"; Sys.ocaml_version ])
>>= fun (impl, shims) ->
let build_dir = build_dir ^/ "pp" in
Unix.mkdir build_dir 0o777;
List.iter [ ("pp", impl); ("shims", shims) ] ~f:(fun (name, selector) ->
let dst = build_dir ^/ name ^ ".ml" in
if selector = "nop" then
close_out (open_out dst)
else
copy (cwd ^/ sprintf "%s.%s.ml" name selector) dst);
copy_lexer (cwd ^/ "let_trail.mll") (build_dir ^/ "let_trail.ml") ~header:""
>>= fun () ->
copy (cwd ^/ "let_trail.mli") (build_dir ^/ "let_trail.mli");
Process.run ~cwd:build_dir Config.compiler
[ "-o"
; "pp.exe"
; "-I"
; "+compiler-libs"
; "ocamlcommon" ^ Config.ocaml_archive_ext
; "shims.ml"
; "let_trail.mli"
; "let_trail.ml"
; "pp.ml"
]
>>| fun () -> [ "-pp"; "." ^/ "pp" ^/ "pp.exe" ^ " -dump-ast" ]

(** {2 Bootstrap process} *)
(** {2 Bootstrap process *)
let main () =
rm_rf build_dir;
Unix.mkdir build_dir 0o777;
Config.ocaml_config () >>= fun ocaml_config ->
build_syntax_shims () >>= fun pp ->
assemble_libraries task >>= fun libraries ->
let c_files =
List.map ~f:(fun (_, _, c_files) -> c_files) libraries |> List.concat
in
get_dependencies ~pp libraries >>= fun dependencies ->
get_dependencies libraries >>= fun dependencies ->
let build =
if concurrency = 1 || Sys.win32 then
build_with_single_command
else
build
in
build ~ocaml_config ~pp ~dependencies ~c_files task
build ~ocaml_config ~dependencies ~c_files task

let () = Fiber.run (main ())
2 changes: 1 addition & 1 deletion bootstrap.ml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ open Printf
(* This program performs version checking of the compiler and switches to the
secondary compiler if necessary. The script should execute in OCaml 4.02! *)

let min_supported_natively = (4, 07)
let min_supported_natively = (4, 08)

let verbose, keep_generated_files, debug =
let anon s = raise (Arg.Bad (sprintf "don't know what to do with %s\n" s)) in
Expand Down
2 changes: 1 addition & 1 deletion dune-private-libs.opam
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ doc: "https://dune.readthedocs.io/"
bug-reports: "https://github.com/ocaml/dune/issues"
depends: [
"dune" {>= "2.5"}
"ocaml" {>= "4.07"}
"ocaml" {>= "4.10"}
]
dev-repo: "git+https://github.com/ocaml/dune.git"
build: [
Expand Down
2 changes: 1 addition & 1 deletion dune-project
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ executable was built.
(package
(name dune-private-libs)
(depends
(ocaml (>= 4.07)))
(ocaml (>= 4.10)))
(synopsis "Private libraries of Dune")
(description "\
!!!!!!!!!!!!!!!!!!!!!!
Expand Down
2 changes: 1 addition & 1 deletion dune-workspace.dev
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(lang dune 1.0)

;; This file is used by `make all-supported-ocaml-versions`
(context (opam (switch 4.07.1)))
(context (opam (switch 4.08.1)))
(context (opam (switch 4.09.0)))
(context (opam (switch 4.10.0)))
2 changes: 1 addition & 1 deletion dune.opam
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ build: [
depends: [
# Please keep the lower bound in sync with .travis.yml, dune-project
# and min_ocaml_version in bootstrap.ml
("ocaml" {>= "4.07"} | ("ocaml" {< "4.07~~"} & "ocamlfind-secondary"))
("ocaml" {>= "4.08"} | ("ocaml" {< "4.08~~"} & "ocamlfind-secondary"))
"base-unix"
"base-threads"
]
2 changes: 1 addition & 1 deletion dune.opam.template
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ build: [
depends: [
# Please keep the lower bound in sync with .travis.yml, dune-project
# and min_ocaml_version in bootstrap.ml
("ocaml" {>= "4.07"} | ("ocaml" {< "4.07~~"} & "ocamlfind-secondary"))
("ocaml" {>= "4.08"} | ("ocaml" {< "4.08~~"} & "ocamlfind-secondary"))
"base-unix"
"base-threads"
]
3 changes: 1 addition & 2 deletions otherlibs/action-plugin/src/dune
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,4 @@
(public_name dune-action-plugin)
(libraries dune-private-libs.stdune dune-glob dune-private-libs.dune_csexp)
(synopsis
"[Internal] Monadic interface for defining scripts with dynamic or complex sets of depencencies.")
(preprocess future_syntax))
"[Internal] Monadic interface for defining scripts with dynamic or complex sets of depencencies."))
3 changes: 1 addition & 2 deletions otherlibs/dune-glob/src/dune
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
(libraries dune-private-libs.stdune dune-private-libs.dune_re)
(flags
(:standard -w -50))
(synopsis "The glob language as understood by dune.")
(preprocess future_syntax))
(synopsis "The glob language as understood by dune."))

(ocamllex lexer)
3 changes: 1 addition & 2 deletions plugin/dune
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
(library
(name jbuild_plugin)
(libraries compiler-libs)
(synopsis "Internal Dune library, do not use!")
(preprocess future_syntax))
(synopsis "Internal Dune library, do not use!"))
1 change: 0 additions & 1 deletion src/cache/dune
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@
(name cache)
(public_name dune-private-libs.cache)
(synopsis "[Internal] Dune binary artifact cache protocol")
(preprocess future_syntax)
(libraries stdune threads.posix xdg dune_lang dune_util dune_csexp))
1 change: 0 additions & 1 deletion src/cache_daemon/dune
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
(library
(name cache_daemon)
(preprocess future_syntax)
(libraries dune_util threads.posix cache stdune dune_csexp))
3 changes: 1 addition & 2 deletions src/dune/dune
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
(libraries unix stdune fiber incremental_cycles dag memo xdg dune_re
threads.posix opam_file_format dune_lang cache_daemon cache dune_glob
ocaml_config catapult jbuild_support dune_action_plugin dune_util)
(synopsis "Internal Dune library, do not use!")
(preprocess future_syntax))
(synopsis "Internal Dune library, do not use!"))

(ocamllex dune_lexer ocamlobjinfo)

Expand Down
10 changes: 1 addition & 9 deletions src/dune/watermarks.ml
Original file line number Diff line number Diff line change
Expand Up @@ -127,15 +127,7 @@ let subst_file path ~map =

(* Extending the Dune_project APIs, but adding capability to modify *)
module Dune_project = struct
(* The below incantation hides [Dune_project.t] preventing name conflicts in
OCaml 4.07. It can be replaced simply with [include Dune_project] once we
stop supporting OCaml 4.07. *)
include (
Dune_project :
module type of struct
include Dune_project
end
with type t := Dune_project.t )
include Dune_project

type 'a simple_field =
{ loc : Loc.t
Expand Down
3 changes: 1 addition & 2 deletions src/dune_lang/dune
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
(name dune_lang)
(public_name dune-private-libs.dune-lang)
(synopsis "[Internal] S-expression library")
(libraries stdune)
(preprocess future_syntax))
(libraries stdune))

(ocamllex lexer versioned_file_first_line)
3 changes: 1 addition & 2 deletions src/dune_util/dune
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
(library
(name dune_util)
(public_name dune-private-libs.dune_util)
(libraries stdune)
(preprocess future_syntax))
(libraries stdune))
1 change: 0 additions & 1 deletion src/fiber/dune
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
(library
(name fiber)
(libraries stdune)
(preprocess future_syntax)
(synopsis "Monadic concurrency library"))
3 changes: 1 addition & 2 deletions src/jbuild_support/dune
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
(library
(name jbuild_support)
(libraries stdune dune_lang)
(synopsis "Internal Dune library, do not use!")
(preprocess future_syntax))
(synopsis "Internal Dune library, do not use!"))

(ocamllex lexer)
1 change: 0 additions & 1 deletion src/memo/dune
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
(library
(name memo)
(preprocess future_syntax)
(libraries stdune dune_lang dag fiber)
(synopsis "Function memoizer"))
1 change: 0 additions & 1 deletion src/ocaml-config/dune
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
(library
(name ocaml_config)
(public_name dune-private-libs.ocaml-config)
(preprocess future_syntax)
(libraries stdune dune_lang)
(synopsis "[Internal] Interpret the output of 'ocamlc -config'"))
31 changes: 0 additions & 31 deletions src/ocaml-syntax-shims/dune

This file was deleted.

1 change: 0 additions & 1 deletion src/ocaml-syntax-shims/let_trail.mli

This file was deleted.

Loading

0 comments on commit 3c08b65

Please sign in to comment.