parent
fb4122afb9
commit
89c15ca2c5
|
@ -1,4 +1,4 @@
|
||||||
_build
|
_jbuild
|
||||||
*.install
|
*.install
|
||||||
boot.exe
|
boot.exe
|
||||||
.merlin
|
.merlin
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
* 1.0
|
* 1.0
|
||||||
|
|
||||||
- Generate a log in =_build/log=
|
- Generate a log in =_jbuild/log=
|
||||||
|
|
||||||
- Improve the output of jbuilder, in particular don't mangle the
|
- Improve the output of jbuilder, in particular don't mangle the
|
||||||
output of commands when using =-j N= with =N > 1=
|
output of commands when using =-j N= with =N > 1=
|
||||||
|
|
4
Makefile
4
Makefile
|
@ -1,5 +1,5 @@
|
||||||
INSTALL_ARGS := $(if $(PREFIX),--prefix $(PREFIX),)
|
INSTALL_ARGS := $(if $(PREFIX),--prefix $(PREFIX),)
|
||||||
BIN := ./_build/default/bin/main.exe
|
BIN := ./_jbuild/default/bin/main.exe
|
||||||
|
|
||||||
default: boot.exe
|
default: boot.exe
|
||||||
./boot.exe -j 4 --dev
|
./boot.exe -j 4 --dev
|
||||||
|
@ -19,6 +19,6 @@ all-supported-ocaml-versions:
|
||||||
$(BIN) build @install --workspace jbuild-workspace.dev --root .
|
$(BIN) build @install --workspace jbuild-workspace.dev --root .
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf _build
|
rm -rf _jbuild
|
||||||
|
|
||||||
.PHONY: default install uninstall reinstall clean
|
.PHONY: default install uninstall reinstall clean
|
||||||
|
|
|
@ -72,7 +72,7 @@ format and the third one describes how to use the =jbuilder= command.
|
||||||
takes for granted and doesn't know how to build
|
takes for granted and doesn't know how to build
|
||||||
|
|
||||||
- *build context*: a build context is a subdirectory of the
|
- *build context*: a build context is a subdirectory of the
|
||||||
=<root>/_build= directory. It contains all the build artifacts of
|
=<root>/_jbuild= directory. It contains all the build artifacts of
|
||||||
the workspace built against a specific configuration. Without
|
the workspace built against a specific configuration. Without
|
||||||
specific configuration from the user, there is always a =default=
|
specific configuration from the user, there is always a =default=
|
||||||
build context, which correspond to the environment in which Jbuilder
|
build context, which correspond to the environment in which Jbuilder
|
||||||
|
@ -80,7 +80,7 @@ format and the third one describes how to use the =jbuilder= command.
|
||||||
[[jbuild-workspace]] file
|
[[jbuild-workspace]] file
|
||||||
|
|
||||||
- *build context root*: the root of a build context named =foo= is
|
- *build context root*: the root of a build context named =foo= is
|
||||||
=<root>/_build/<foo>=
|
=<root>/_jbuild/<foo>=
|
||||||
|
|
||||||
- *alias*: an alias is a build target that doesn't produce any file
|
- *alias*: an alias is a build target that doesn't produce any file
|
||||||
and has configurable dependencies. Alias are per-directory and some
|
and has configurable dependencies. Alias are per-directory and some
|
||||||
|
|
|
@ -21,7 +21,7 @@ And build it with:
|
||||||
jbuilder hello_world.exe
|
jbuilder hello_world.exe
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
The executable will be built as =_build/default/hello_world.exe=
|
The executable will be built as =_jbuild/default/hello_world.exe=
|
||||||
|
|
||||||
* Building a hello world program using Lwt
|
* Building a hello world program using Lwt
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ And build it with:
|
||||||
jbuilder hello_world.exe
|
jbuilder hello_world.exe
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
The executable will be built as =_build/default/hello_world.exe=
|
The executable will be built as =_jbuild/default/hello_world.exe=
|
||||||
|
|
||||||
* Defining a library using Lwt and ocaml-re
|
* Defining a library using Lwt and ocaml-re
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ type t =
|
||||||
; file : Path.t
|
; file : Path.t
|
||||||
}
|
}
|
||||||
|
|
||||||
let aliases_path = Path.(relative root) "_build/.aliases"
|
let aliases_path = Path.(relative root) "_jbuild/.aliases"
|
||||||
|
|
||||||
let of_path path =
|
let of_path path =
|
||||||
if not (Path.is_local path) then
|
if not (Path.is_local path) then
|
||||||
|
@ -78,7 +78,7 @@ let rules store ~prefixes ~tree =
|
||||||
List.iter prefixes ~f:(fun prefix ->
|
List.iter prefixes ~f:(fun prefix ->
|
||||||
setup_rec_aliases store ~prefix ~tree);
|
setup_rec_aliases store ~prefix ~tree);
|
||||||
|
|
||||||
(* For each alias @_build/blah/../x, add a dependency: @../x --> @_build/blah/../x *)
|
(* For each alias @_jbuild/blah/../x, add a dependency: @../x --> @_jbuild/blah/../x *)
|
||||||
Hashtbl.fold store ~init:[] ~f:(fun ~key:_ ~data:{ Store. alias; _ } acc ->
|
Hashtbl.fold store ~init:[] ~f:(fun ~key:_ ~data:{ Store. alias; _ } acc ->
|
||||||
match Path.extract_build_context (Name.path alias.name) with
|
match Path.extract_build_context (Name.path alias.name) with
|
||||||
| None -> acc
|
| None -> acc
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
open! Import
|
open! Import
|
||||||
|
|
||||||
let local_install_dir =
|
let local_install_dir =
|
||||||
let dir = Path.(relative root) "_build/install" in
|
let dir = Path.(relative root) "_jbuild/install" in
|
||||||
fun ~context -> Path.relative dir context
|
fun ~context -> Path.relative dir context
|
||||||
|
|
||||||
let local_install_bin_dir ~context =
|
let local_install_bin_dir ~context =
|
||||||
|
|
|
@ -134,7 +134,7 @@ let create ~(kind : Kind.t) ~path ~env ~name ~merlin =
|
||||||
| Some fn -> fn
|
| Some fn -> fn
|
||||||
in
|
in
|
||||||
let build_dir =
|
let build_dir =
|
||||||
Path.of_string (sprintf "_build/%s" name)
|
Path.of_string (sprintf "_jbuild/%s" name)
|
||||||
in
|
in
|
||||||
let ocamlc_config_cmd = sprintf "%s -config" (Path.to_string ocamlc) in
|
let ocamlc_config_cmd = sprintf "%s -config" (Path.to_string ocamlc) in
|
||||||
both
|
both
|
||||||
|
|
|
@ -8,10 +8,10 @@
|
||||||
|
|
||||||
- opam switch contexts, where one opam switch correspond to one context
|
- opam switch contexts, where one opam switch correspond to one context
|
||||||
|
|
||||||
each context is built into a sub-directory of "_build":
|
each context is built into a sub-directory of "_jbuild":
|
||||||
|
|
||||||
- _build/default for the default context
|
- _jbuild/default for the default context
|
||||||
- _build/<switch> for other contexts
|
- _jbuild/<switch> for other contexts
|
||||||
|
|
||||||
jbuild is able to build simultaneously against several contexts. In particular this
|
jbuild is able to build simultaneously against several contexts. In particular this
|
||||||
allow for simple cross-compilation: when an executable running on the host is needed,
|
allow for simple cross-compilation: when an executable running on the host is needed,
|
||||||
|
@ -41,7 +41,7 @@ type t =
|
||||||
building tools used for the compilation that run on the host. *)
|
building tools used for the compilation that run on the host. *)
|
||||||
for_host : t option
|
for_host : t option
|
||||||
|
|
||||||
; (** Directory where artifact are stored, for instance "_build/default" *)
|
; (** Directory where artifact are stored, for instance "_jbuild/default" *)
|
||||||
build_dir : Path.t
|
build_dir : Path.t
|
||||||
|
|
||||||
; (** [PATH] *)
|
; (** [PATH] *)
|
||||||
|
|
|
@ -27,6 +27,7 @@ let root t = t.root
|
||||||
let ignore_file = function
|
let ignore_file = function
|
||||||
| ""
|
| ""
|
||||||
| "_build"
|
| "_build"
|
||||||
|
| "_jbuild"
|
||||||
| ".git"
|
| ".git"
|
||||||
| ".hg"
|
| ".hg"
|
||||||
| "_darcs"
|
| "_darcs"
|
||||||
|
|
|
@ -14,7 +14,7 @@ module Jbuilds = struct
|
||||||
|
|
||||||
type t = one list
|
type t = one list
|
||||||
|
|
||||||
let generated_jbuilds_dir = Path.(relative root) "_build/.jbuilds"
|
let generated_jbuilds_dir = Path.(relative root) "_jbuild/.jbuilds"
|
||||||
|
|
||||||
let ensure_parent_dir_exists path =
|
let ensure_parent_dir_exists path =
|
||||||
match Path.kind path with
|
match Path.kind path with
|
||||||
|
|
|
@ -112,9 +112,9 @@ let report_error ?map_fname ppf exn =
|
||||||
report_error ?map_fname ppf exn ~backtrace
|
report_error ?map_fname ppf exn ~backtrace
|
||||||
|
|
||||||
let create_log () =
|
let create_log () =
|
||||||
if not (Sys.file_exists "_build") then
|
if not (Sys.file_exists "_jbuild") then
|
||||||
Unix.mkdir "_build" 0o777;
|
Unix.mkdir "_jbuild" 0o777;
|
||||||
let oc = open_out_bin "_build/log" in
|
let oc = open_out_bin "_jbuild/log" in
|
||||||
Printf.fprintf oc "# %s\n%!"
|
Printf.fprintf oc "# %s\n%!"
|
||||||
(String.concat (List.map (Array.to_list Sys.argv) ~f:quote_for_shell) ~sep:" ");
|
(String.concat (List.map (Array.to_list Sys.argv) ~f:quote_for_shell) ~sep:" ");
|
||||||
oc
|
oc
|
||||||
|
|
|
@ -234,7 +234,7 @@ let parent t =
|
||||||
else
|
else
|
||||||
Filename.dirname t
|
Filename.dirname t
|
||||||
|
|
||||||
let build_prefix = "_build/"
|
let build_prefix = "_jbuild/"
|
||||||
|
|
||||||
let is_in_build_dir t =
|
let is_in_build_dir t =
|
||||||
String.is_prefix t ~prefix:build_prefix
|
String.is_prefix t ~prefix:build_prefix
|
||||||
|
|
Loading…
Reference in New Issue