Commit Graph

87 Commits

Author SHA1 Message Date
Jeremie Dimino 7c6ecc821f Reimplement workspace.ml with the new parsing API
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2018-07-01 01:46:32 +07:00
Jeremie Dimino 0c6edde131 Add a user context to Of_sexp.t
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2018-06-19 16:26:00 +01:00
Rudi Grinberg 065e2bb26f Make Sexp.Of_sexp.t abstract
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-06-19 11:29:27 +01:00
Rudi Grinberg be7e3d6dfc Implement --build-dir and change Path.t to use symbolic paths
The motivation for this change is implement the --build-dir feature. This
feature lets us control the build directory which previously always defaulted to
_build. To accomplish this, Path.t had to be modified to be:

External of External.t | In_source_tree of Local.t | In_build_dir of Local.t

To represent the 3 kinds of paths dune is dealing with. The In_build_dir
constructor in particular, is relative to Path.root or some external path.

A few other refactorings had to be done to support this transition:

* The workspace is now "settable". This means that we no longer have to pass it
  explicitly when converting local to absolute paths.

* Path.is_local no longer makes sense and is renamed to Path.is_managed.
  Roughly, is_managed identifies paths in the build and source directories.

* Path.absoulte has been renamed of_filename_relative_to_initial_cwd

* Path.Local.root is now "." (as opposed to "")

Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-06-02 18:14:44 +07:00
Rudi Grinberg f7f22cbf52 Make Path.parent return option
Use _exn whenever we know the parent exists
2018-05-09 17:56:50 +07:00
Rudi Grinberg 92b351de30 Small refactoring to call Path.absolute one less time 2018-05-09 17:32:36 +07:00
Jérémie Dimino 4d8ca489be
Add support for environment & build profiles (#419) 2018-05-04 16:49:25 +01:00
Rudi Grinberg 25c34c222c Remove all hard coded uses of "_build"
Always route these cases through Path.build_dir
2018-05-02 22:38:50 +07:00
Rudi Grinberg 3e9bc8c0c3 Allow setting ENV vars in findlib.conf per toolchain
This is useful for configuring PKG CONFIG for cross compilation
2018-05-01 00:13:50 +07:00
Rudi Grinberg b02c61f63c Change the prog arg in Process to Path.t 2018-04-25 16:30:18 +07:00
Rudi Grinberg d65845abb8 Pass ocamlc explicitly to configurator using DUNE_CONFIGURATOR 2018-04-11 21:26:51 +07:00
Jeremie Dimino 31858c9680 Don't on side-effects for setting up the environment
Instead of making sure we set global variables and call Unix.putenv in
the right order, pass the environment explicitely everywhere.
2018-04-03 11:43:07 +08:00
Rudi Grinberg 8859a644e9 When executing in the target, use the host's PATH variable 2018-03-23 22:39:06 +08:00
Jérémie Dimino f5f151dc19
Inspect OCAMLPATH when not using `ocamlfind` (#642) 2018-03-20 12:43:51 -04:00
Jeremie Dimino fae09828af Use ; as path separator for OCAMLPATH on Cygwin
Since this is what ocamlfind expects
2018-03-19 19:25:50 -04:00
Rudi Grinberg 68cf393c5f Use Bin.path_sep 2018-03-16 01:45:39 +08:00
Rudi Grinberg 2634477def Change Action to include the context's exec env 2018-03-16 00:44:23 +08:00
Rudi Grinberg bd457ea549 Use Env.t over string array in another place 2018-03-15 18:24:41 +08:00
Rudi Grinberg f4955cdc22 Remove env_extra from Context.t
Rely on diffing
2018-03-12 18:45:47 +07:00
Rudi Grinberg 3193e4902d Make Process.run take Env.t directly 2018-03-12 18:45:47 +07:00
Rudi Grinberg 4b191b2b03 s/Env.get_var/Env.get/ 2018-03-12 18:45:47 +07:00
Rudi Grinberg 206cc69fd9 Simplify Context.create
There's no need for a base_env parameter as it's always Env.initial
2018-03-12 18:45:47 +07:00
Rudi Grinberg 35d4153641 Make Env.t abstract 2018-03-12 18:43:02 +07:00
Rudi Grinberg 8458bf3b15 Move env related functions to Env module 2018-03-12 18:43:02 +07:00
François Bobot feba0827b8 Allow to link executables as static or shared objects (#23)
- Setup the rules to use the `-output-complete-obj` option of OCaml
- Introduce a `best` mode in addition to `byte` and `native`
- Extend the `modes` field of executables to mean "linking modes", and add linking modes for static and shared objects
2018-03-12 11:40:53 +00:00
Jeremie Dimino 0f0b154de6 Remove ranlib, doesn't seem to be available on Windows 2018-03-07 09:40:08 +00:00
Jeremie Dimino 6ee6ed35d2 Ocamlc_config --> Ocaml_config 2018-03-07 09:40:08 +00:00
Jeremie Dimino 3bc21617b2 Refactor ocamlc_config 2018-03-07 09:40:08 +00:00
Jeremie Dimino a95fd29dba Move Ocamlc_config to its own library and refactor it a bit 2018-03-07 09:40:08 +00:00
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