Commit Graph

58 Commits

Author SHA1 Message Date
Jérémie Dimino dfdb6c09f4
Allow to set the library path at configure time (#575)
This allow to drop the dependency on ocamlfind
2018-03-06 14:56:24 +00:00
Jérémie Dimino 3fd3eb8a12
Split src/import.ml into a new library src/stdune (#548)
- make sure type t always come first
- Map.map, Map.fold, ... never pass the key to the callback while Map.mapi, Map.foldi, ... do
- removed the ~key and ~data labels, I find them useless and annoying
- Set.elements --> Set.to_list
- Map.bindings --> Map.to_list
- Map.of_alist --> Map.of_list
- added Ordering.t for comparison functions
- renamed Inl/Inr to Left/Right. The latter seems clearer
- moved List.longest to String.longest
- added a Pp module with a nicer API than Format
2018-02-25 16:35:25 +00:00
Christophe Troestler fbafb3d47a Make Atom.t private and consequences (#524) 2018-02-24 23:33:26 +00:00
Jérémie Dimino 9e4cc84370
Refactor library management (#516)
Lib module
----------

We have a new module Lib that replaces Lib, parts of Lib_db and parts
of Findlib. It is used to manage all libraries (internal and
extrernal). Lib.t represent a completely resolved library, i.e. where
all the dependencies have been resolved. Lib.Compile is used to
provide what is necessary to build the library itself. Lib.Meta
provides what is necessary to generate the META file for the library.

We also have library databases represented as Lib.DB.t. A library
database is simply a mapping from names to Lib.t values and and
created from a resolve function that looks up a name and return a
Lib.Info.t. A Lib.Info.t is the same as a Lib.t except that
dependencies are not resolved.

A library database can have a parent database that is used to lookup
names that are not found in the current database. In practice we have
the following hierarchy:

1. For every scope, we have a library database that holds all the
   libraries of this scope. In this DB, a library can be referred by
   either it's name or public name

2. the parent of each of these databases is a database that holds all
   the public libraries of the workspace. In this DB libraries must be
   referred by their public name

3. the parent of this DB is for installed libraries

(1) databases are accessible via Scope.libs
    (Super_context.find_scope_by_{name,dir} sctx xxx)
(2) is accessible via Super_context.public_libs sctx
(3) is accessible via Super_context.installed_libs sctx

The dependencies of a library are always resolved inside the DB it is
part of. When we compute a transitive closure, we check that we don't
have two libraries from two different DB with the same name. So for
instance linting Base should now supported.

Jbuild.Scope_info
-----------------

Jbuild.Scope was renamed Jbuild.Scope_info

Scope module
------------

This replaces Lib_db. A Scope.t is now just a pair of a
Jbuild.Scope_info.t and a Lib.DB.t. Scope.DB.t is an object used to
lookup scopes by either name or directory.

We no longer have an external scope or special anonymous
scope. Instead one should use Super_context.installed_libs or
Super_context.public_libs depending on the context.
2018-02-20 11:46:10 +00:00
Rudi Grinberg 55e8dd99e2 Move reading/reading ocamlc -config to own module 2018-02-18 10:14:38 +07:00
Christophe Troestler 67c9363c7d Use more precise combinators "atom" and "quoted_string" 2018-02-15 00:45:06 +01:00
Jérémie Dimino b3838284c6
Better support for mli/rei only modules (#489) 2018-02-08 10:12:46 +00:00
Jérémie Dimino 4e4f651b37
Don't stop on the first error (#477)
Before, jbuilder used to stop its execution after an error was
encountered. Now it continues until all branches have been explored.

To implement this feature, Future was rewritten as a Fiber module with
a simpler semantic.

This patch contains various other refactorings.
2018-02-06 14:39:03 +00:00
Rudi Grinberg 3776acd8d2 Fix c_compiler parsing for OCaml >= 4.06.0 (#393) 2018-01-10 16:54:25 +00:00
Jeremie Dimino 6e64156913 Add target support
* Create targets from findlib toolchains by reading findlib configs
* Define targets inside workspace files
* Set cross compilation targets with -x argument
2018-01-01 22:34:41 +08:00
Jeremie Dimino 3e525d8eec Vendored usexp and switch to it 2017-12-21 13:13:47 +00:00
xclerc e28cc8d070 Fix regression introduced by PR303. 2017-11-06 09:30:50 +01:00
Xavier Clerc 70946320fd Use `=` rather than `String.equal` for better compatibility. 2017-11-03 13:49:47 +00:00
Xavier Clerc 9b04e7e931 Look for architecture size in the output of `ocamlc -config` first. 2017-11-03 13:44:41 +00:00
Xavier Clerc 72a3cb008f Look for `ARCH_SIXTYFOUR` in both `config.h` and `m.h`. 2017-11-02 12:31:14 +00:00
Jeremie Dimino cfd43d5282 Simplify a bit the rules for installation of library files 2017-07-25 17:07:24 +01:00
François Bobot b6498d11c2 Consider that a failing opam is an absent opam 2017-07-25 16:44:14 +01:00
François Bobot 747cf220c6 Install by specifying libdir for opam-installer
- change default findlib directory (ocamlc -where)
2017-07-25 16:44:14 +01:00
François Bobot 9935c838b3 Use lowercase_ascii 2017-07-07 12:27:31 +02:00
David Allsopp 574866af2e Correct detected value for ocaml on Windows 2017-06-15 12:14:56 +02:00
David Allsopp 7ec081419c Don't pass -g to cl; it doesn't like it! (#120)
The Microsoft C compiler doesn't recognise -g. For now, easier just not
to compile with any debugging information on MSVC.

Signed-off-by: David Allsopp <david.allsopp@metastack.com>
2017-06-05 11:40:27 +01:00
Jeremie Dimino c73b1f1fe3 Add a --no-buffer option
Following #107
2017-05-29 10:57:04 +01:00
Jeremie Dimino d01270757f Remove ocamllex/ocamlyacc from the context
They were unused and this prevent jbuilder to be used with
opam-cross-windows.

Fixes #75
2017-05-19 15:24:55 +01:00
Jeremie Dimino a3ee81055d Refactor IO functions and fix invalid IOs in gen_rules 2017-05-18 17:12:32 +01:00
Jeremie Dimino 76db4d5641 Use OCAML_COLOR and stop using OCAMLPARAM when possible 2017-05-10 16:31:44 +01:00
Jeremie Dimino d1d51595d2 Remove overlays for Mode and Cm_kind in Gen_rules 2017-04-28 10:40:09 +01:00
Jeremie Dimino ee43c2718f Environment variable names are not case sensitive on Windows 2017-04-24 12:53:18 +01:00
Jeremie Dimino 4c3036b3cc Don't fail when opam return the same envirnonemt variable several times
Instead, print a warning and take the last bindings.

Fixes #46
2017-03-31 17:45:38 +01:00
Jeremie Dimino 83c1a6f5bd Fix compat with 4.06 2017-03-31 17:31:55 +01:00
François Bobot 5cca590e34 Don't use color feature for ocaml 4.02.3 2017-03-27 18:31:26 +01:00
Jeremie Dimino 48970caca3 Make sure the build of jbuilder doesn't call ocamlfind or opam 2017-03-22 08:19:26 +00:00
Jeremie Dimino 9a8483c615 Give ocamlfind precedence over opam
If ocamlfind is present, don't try to call `opam config var lib`. The
previous behavior was breaking Facebook builds.

Also add ocamlfind as an optional dependency, to avoid race conditions
when installing ocamlfind in parallel.
2017-03-21 10:26:36 +00:00
Jeremie Dimino 34722a921a Ignore all errors while running `ocamlfind printconf path` 2017-03-20 14:34:28 +00:00
Jeremie Dimino df7658914d Fix a bug where the findlib search path contained duplicates 2017-03-10 15:35:43 +00:00
Jeremie Dimino 563cc6059c Add Context.sexp_of_t 2017-03-10 11:22:01 +00:00
Jeremie Dimino 629b4d0044 Use Path.absolute for OCAML_TOPLEVEL_PATH 2017-03-10 10:57:09 +00:00
Jeremie Dimino d5d861b40c Support architectures without natdynlink 2017-03-07 11:36:59 +00:00
Jeremie Dimino 591bc9f724 Fix the setting of CAML_LD_LIBRARY_PATH 2017-03-02 17:40:16 +00:00
Jeremie Dimino 3aef1d6f3c Revert "Rename _build to _jbuild (#13)"
This reverts commit 89c15ca2c5.

Keep _build as the build directory until we get a better consensus.
2017-03-01 16:09:02 +00:00
Rudi Grinberg 89c15ca2c5 Rename _build to _jbuild (#13)
_build is already quite overloaded.
2017-03-01 13:37:05 +00:00
Jeremie Dimino ddd7f182f1 Extend MANPATH in 'jbuilder exec' 2017-03-01 12:56:31 +00:00
Jeremie Dimino c88bf33131 Add jbuilder exec 2017-03-01 12:09:57 +00:00
Jeremie Dimino 6e25a7dfe5 Remove (provides ...) and uses (install ...) instead 2017-03-01 11:20:17 +00:00
Jérémie Dimino ac372ce63a Allow to use installed libraries in jbuild plugins 2017-02-28 06:31:02 +00:00
Jérémie Dimino 2ee522be52 Add a Findlib.t in the context 2017-02-28 06:01:27 +00:00
Jeremie Dimino bd9033f9bb Allow 'ocamlfind printconf path' to fail 2017-02-27 11:38:11 +00:00
Jérémie Dimino 6b4e7b31d8 cleanup 2017-02-26 21:49:41 +00:00
Jérémie Dimino 27a299437d 4.02.3 compatiblity 2017-02-26 21:28:30 +00:00
Jérémie Dimino 304d7becbc Allow to specify which context for merlin 2017-02-26 20:53:32 +00:00
Jérémie Dimino 38421d7e41 Replace meta language by ocaml 2017-02-26 19:49:54 +00:00