Commit Graph

863 Commits

Author SHA1 Message Date
Jeremie Dimino b219f28a8a Format fix 2018-03-09 20:43:57 +00:00
Jérémie Dimino 1feab6b2a6
Allow to specify additional libraries for the test runner (#600) 2018-03-09 19:51:02 +00:00
David Allsopp b604871aab Limit number of simultaneously opened fds (#578)
Non-optimal solution: only handles the common case.
2018-03-08 18:28:14 +00:00
Jérémie Dimino b029d32dfb
fix String_with_vars.sexp_of_t (#595) 2018-03-07 15:01:46 +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 98bb8adf83 fix 2018-03-07 09:40:08 +00:00
Jeremie Dimino cc845e5fdb Make all variables accessible in jbuild files 2018-03-07 09:40:08 +00:00
Jeremie Dimino 21a980a5d1 Update configurator 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 0b6a7eee2f Recent versions of ocaml expose 'ext_exe' 2018-03-07 09:40:08 +00:00
Jeremie Dimino 9c178480ea Update configurator 2018-03-07 09:40:08 +00:00
Jeremie Dimino d415ed5f6c Expose a few more variables 2018-03-07 09:40:08 +00:00
Jeremie Dimino 1ff05d52e2 Refactor a bit the variables in super_context.ml 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
Jeremie Dimino 232acdd92f Libraries and executables can allow overlapping dependencies 2018-03-06 12:59:01 +00:00
Jeremie Dimino a5f9a9e063 Detect overlapping libraries 2018-03-06 12:59:01 +00:00
Rudi Grinberg c8355b454c Generalize Ordered_set_lang to return a custom map
This simplifes all the conversion from and to Module.Name.Map.t
2018-03-06 18:45:38 +07:00
Rudi Grinberg ddefafa58b Introduce private type for module name 2018-03-06 18:45:38 +07:00
Jeremie Dimino 6eace337bc typo 2018-03-05 18:06:41 +00:00
Jérémie Dimino cd6812f269
Accept and ignore ppx.driver fields (#588) 2018-03-05 17:59:56 +00:00
Jérémie Dimino 4857ed444a
Reduce interleaving in the scheduler (#586) 2018-03-05 17:52:21 +00:00
Rudi Grinberg 5ded45faf0
Merge pull request #584 from rgrinberg/improve-error-modules
Improve error in modules partition
2018-03-05 23:47:19 +07:00
Jeremie Dimino 348d2b1a1e display tweaks 2018-03-05 16:24:24 +00:00
Rudi Grinberg 719cf5eea0 Improve error in modules partition
Specify how to fix the error (by writing modules fields)
2018-03-05 23:11:45 +07:00
Jeremie Dimino 3edc029bf4 ws 2018-03-05 15:05:24 +00:00
Rudi Grinberg 75fe147da9
Merge pull request #577 from rgrinberg/menhir-own-module
Move menhir rules to own module
2018-03-05 21:30:17 +07:00
Jeremie Dimino a1beb25d12 Add a bit more doc to Build 2018-03-05 14:14:09 +00:00
Jeremie Dimino 1a4362b0b1 Document Arg_spec a bit more 2018-03-05 14:00:29 +00:00
Jeremie Dimino 4c2768e805 style + doc 2018-03-05 14:00:21 +00:00
Rudi Grinberg 6d5c2de689 Change menhir flags to use ordered set language
Consistent with how flags are handled elsewhere in jbuilder
2018-03-05 20:03:16 +07:00
Rudi Grinberg f06519e231 Implement menhir rules from scrath
Rather than changing them to user_rules and then compiling those.
2018-03-05 19:56:27 +07:00
Rudi Grinberg 288de19920 Move menhir rules to own module 2018-03-05 18:32:25 +07:00
Rudi Grinberg 09aa2cd1cf
Merge pull request #574 from diml/workaround-broken-builtins
Add a simple workaround for #563
2018-03-05 16:34:34 +07:00
Rudi Grinberg 7c287a5e0a Change Package.Name.t to interned type 2018-03-03 20:41:29 +07:00
Jeremie Dimino d1feb062b6 Add a workaround for broken META file for builtin packages
Fixes #563
2018-03-03 11:33:40 +00:00
Rudi Grinberg ff05369868 Introduce package name private type 2018-03-03 01:44:03 +07:00
Rudi Grinberg e4aac2da97 Improve error message for missing scopes 2018-03-02 15:55:48 +07:00
Jeremie Dimino de99d84f73 Ignore errors while generating the .merlin file
Fix #568
Fix #51
2018-03-01 23:34:43 +00:00
Jeremie Dimino 1b279f30bf Make Merlin.t abstract 2018-03-01 23:30:06 +00:00
Jeremie Dimino 39ac04a535 Add Build.catch 2018-03-01 23:30:06 +00:00
Jeremie Dimino 2e7f881d4c Fix #567
The alias module needs an implementation for non-jbuilder users.
2018-03-01 20:47:08 +00:00
Rudi Grinberg 7790d6bd4c Fix DB.all returning non unique libs (#565)
DB.all will return duplicate libraries in cases when it has 2 names for the same
library. This fix changes all to return a set of values. This is to indicate and
guarantee the uniqueness.
2018-03-01 11:53:27 +00:00
Rudi Grinberg 66a907be58
Merge pull request #467 from ocaml/import-configurator
Import configurator
2018-03-01 12:28:32 +07:00
Jeremie Dimino d5ebd0e9be Allow to capture the library a backend is attached to 2018-02-28 19:08:03 +00:00
Jeremie Dimino 17f4567014 Still build a Lib.t value for hidden libraries
This makes everything else simpler
2018-02-28 19:08:03 +00:00
Rudi Grinberg 3e73397638 Port configurator to dune 2018-02-28 23:37:20 +07:00
Rudi Grinberg 9b6abc4014 Initial import of configurator
This is the original source imported
2018-02-28 23:36:35 +07:00
Rudi Grinberg 070fd95cac Add configurator build
For now the library is private
2018-02-28 23:33:16 +07:00
Jérémie Dimino 55675598c4 Extend ocamlc_config for configurator
* Add make to create ocamlc_config.t
* Add function to get bindings
2018-02-28 23:32:24 +07:00
Rudi Grinberg 9a6d9a3aa9 Extend stdlib for configurator 2018-02-28 23:31:24 +07:00
Jérémie Dimino 45535f7afd
Extracted SC.PP as Preprocessing (#560) 2018-02-28 12:26:34 +00:00
Rudi Grinberg d01a684f71 Move SC.Doc to Odoc module
It longer has a rason to exist in super context.
2018-02-28 17:24:37 +07:00
Rudi Grinberg 02c5b005dd Move intallation and META rules to install_rules module 2018-02-28 12:21:25 +07:00
Rudi Grinberg 5ecf354127 Add a sub-system for inline tests (#547)
To support frameworks such as ppx_inline_test, ppx_expect and qtest
2018-02-27 19:06:12 +00:00
Xavier Clerc c324736d11 Support upcoming ppxlib (was "ppx_base") (#554) 2018-02-27 12:56:47 +00:00
Jeremie Dimino 4dc8d2456f Pass obj_dir explicitely to Exe.build_and_link and don't return it
The only place where we used the default value was gen_rules
2018-02-26 16:05:48 +00:00
Jérémie Dimino 138c920069 Add support for sub-systems
- Add a Sub_system module that allows to register sub-systems
  that are implemented in a single file
- Add a Syntax module to deal with versioned syntaxes

Other changes:
- Add location to all library dependencies in jbuild files, to report
  properly located errors
- Change the type of functions in Lib to return (_, exn) result
  rather than (_, Lib.Error.t With_required_by.t) result, which was
  hard to use
- Remove With_required_by.t as it was unused
- Rename With_required_by to Dep_path
- Cleanup a bit the Exe module, move a lot of stuff that was specific to
  executable stanzas in gen_rules.ml
- Add String_with_vars.Unexpanded.sexp_of_t
- Rework a bit the code in Lib, in particular factorize the code
  for taking the transitive closure of libraries
- Add an ?extra_vars argument to functions that expand variables
  in Super_context
- Fix the printing of dependency path
- Merge the handling of dependency path between the build system and
  the Lib module
2018-02-26 16:05:48 +00:00
Rudi Grinberg 95c254a6a0 Revert "Add support for upcoming ppx_base. (#541)"
This reverts commit 032cb62af6.
2018-02-26 21:07:02 +07:00
Rudi Grinberg 31ea39949b Make prefix_rules accessible through Super_context 2018-02-26 15:54:15 +07:00
Jérémie Dimino 0c30689404 Make Ocamldep.rules already_used arg optional
String_set.empty is a good default value
2018-02-26 15:53:19 +07:00
Jérémie Dimino 6e7d297ea3 Introduce short syntax for sexps 2018-02-26 15:53:19 +07:00
Jérémie Dimino 5a73753095 Extend interned module with a Table type 2018-02-26 15:53:19 +07:00
Jérémie Dimino 9943acb4dc Add utility functions to result
all and concat_map
2018-02-26 15:53:19 +07:00
Jérémie Dimino e77bd30681 prefix_rules should append rather than overwrite the prefix 2018-02-26 15:53:19 +07:00
Rudi Grinberg 3fd3d5b44c Don't pass lib_name if lib is already passed
We can easily get the library name
2018-02-26 14:55:40 +07:00
Rudi Grinberg 290bcceb17 s/capitalize_ascii/capitalize/ 2018-02-26 01:39:16 +07:00
Rudi Grinberg 1cb005bb50 Add a way to customize obj dir for executables
Use this function to simplify the obj dir for the utop runner
2018-02-26 01:30:02 +07:00
Rudi Grinberg b4e0c04368 Revert "Use _utop.ml to avoid creating a separate dir for utop rules"
This reverts commit 9ec894eda0.
2018-02-26 01:30:02 +07: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
Jérémie Dimino 4cf7dc558b
Fix generation of the alias module with 4.02 (#549) 2018-02-25 12:58:40 +00:00
Christophe Troestler fbafb3d47a Make Atom.t private and consequences (#524) 2018-02-24 23:33:26 +00:00
Jérémie Dimino 361773fdb6 Remove gen_dot_merlin flag
It's no longer necessary after switching to the new Exe api. The new API will
not generate a .merlin file for utop.
2018-02-24 18:25:14 +07:00
Rudi Grinberg 4c9da64290
Merge pull request #537 from rgrinberg/use-fake-module-name
Use .utop.ml to avoid creating a separate dir for utop rules
2018-02-23 12:10:28 +07:00
Xavier Clerc 032cb62af6 Add support for upcoming ppx_base. (#541) 2018-02-22 20:38:27 +00:00
Rudi Grinberg 9ec894eda0 Use _utop.ml to avoid creating a separate dir for utop rules 2018-02-22 17:34:39 +07:00
Jeremie Dimino 41b5017eb2 Fix #534 2018-02-21 13:35:47 +00:00
Rudi Grinberg 80ed205e38 Refactor utop module to use the new exe module 2018-02-21 16:44:31 +07:00
Jeremie Dimino db345be90b Trivial fix 2018-02-20 18:55:52 +00:00
Jérémie Dimino 2a531c5d24
Detect when a module is used by several stanzas (#532)
- print a warning
- don't generate several rules for the .d files
- Added tests for multiple rules for .ml.d
2018-02-20 16:44:25 +00:00
Jérémie Dimino 19f1c6f6b3
Add an Exe module to build and link executables (#533) 2018-02-20 16:38:22 +00:00
Rudi Grinberg d8e4145dba Warn instead of error on harmless fake modules
E.g. (modules (:standard \ does_not_exist)) is harmless
2018-02-20 20:23:28 +07: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
Jeremie Dimino 26dc6d2b13 Share some computations on pps when preprocessing modules 2018-02-19 16:04:47 +00:00
Rudi Grinberg a6e6136f3a
Merge pull request #521 from rgrinberg/build-only-public-docs
Change @doc to only build public docs
2018-02-19 19:00:27 +07:00
Rudi Grinberg 55e8dd99e2 Move reading/reading ocamlc -config to own module 2018-02-18 10:14:38 +07:00
Christophe Troestler 75ab3946f6
Distinguish quoted and unquoted variables
Now only quoted strings support concatenation of text and a split-variable.
2018-02-17 23:44:32 +01:00
Rudi Grinberg d28c6e4456 Change @doc to only build public docs
Private docs can still be built using the new @doc-private alias
2018-02-16 16:22:28 +07:00
Jérémie Dimino 5669f57907
Fix display when output is not a tty (#518) 2018-02-15 14:04:00 +00:00
Christophe Troestler 67c9363c7d Use more precise combinators "atom" and "quoted_string" 2018-02-15 00:45:06 +01:00
Christophe Troestler b48a9fec53 Usexp: Properly quote atoms when pretty printing 2018-02-15 00:43:08 +01:00
Christophe Troestler 8e9ec4a52a Do not accept the quoted form "->" in place of -> 2018-02-15 00:43:08 +01:00
Christophe Troestler 0cbd1c7450 Usexp: factorize pp of atoms & fix serialization 2018-02-15 00:43:08 +01:00
Christophe Troestler 453ce1eb56 String_with_vars: Use a functor to create generic expansion fun
This required to remove the labeled ~dir arguments in Action because
one would have had to use the same label for the expansion context in
String_with_vars, which would have been odd for generic expansion
functions.
2018-02-15 00:43:08 +01:00
Christophe Troestler a91cf637ae Trigger an error for unquoted concatenations with list variables
Thus x${v} where v is a variable that returns several values must
necessarily be quoted: "x${v}".
2018-02-15 00:43:08 +01:00
Christophe Troestler 754aa59cc3 String_with_vars: Distinguish quoted and unquoted strings
This implies that an atom can only contain a single variable, such as
${@}, and not something like xxx${@}xxx.  The internal representation
was changed not to be able to represent the latter.
2018-02-15 00:43:08 +01:00
Christophe Troestler cc9c71661e Fix Jérémie Dimino remarks 2018-02-15 00:43:08 +01:00
Christophe Troestler f9e17f76e0 Requires that atoms are unquoted is some contexts 2018-02-15 00:43:08 +01:00
Christophe Troestler 73f529ae82 Rename String to Quoted_string 2018-02-15 00:43:08 +01:00
Christophe Troestler 75ad9736f8 Move usexp in src/ as it diverged from parsexp 2018-02-15 00:43:08 +01:00
Christophe Troestler c27cb3541e Let the parser distinguish quoted strings
Fixes https://github.com/ocaml/dune/issues/408
2018-02-15 00:43:08 +01:00
Christophe Troestler e8e3698e15 String_with_vars: represent quoted vars differently from unquoted ones
Define the representation for quoted variables, adapt the test of
strings made of a single variable, and add a constructor.
[String_with_vars.t] is not yet able to use that representation
because the necessary information is not available from the parser.
2018-02-15 00:43:08 +01:00
Christophe Troestler 3e2dc2517d Document the interface of String_with_vars 2018-02-15 00:43:08 +01:00
Jeremie Dimino c569984af1 Rewrite the findlib predicate stuff
- intern predicate names
- add a Variant module
2018-02-13 19:04:30 +00:00
Jeremie Dimino 77ef63773f 4.02 compat 2018-02-13 19:04:21 +00:00
Jeremie Dimino a1f70209bf Fix previous commit 2018-02-13 18:52:58 +00:00
Jérémie Dimino bd0593c11a
Fix printing of errors (#513)
The status line wasn't properly cleared
2018-02-13 18:31:21 +00:00
Jérémie Dimino dfb8afb46e
Compute the transitive closure of findlib packages lazily (#507)
We are now computing the transitive closure of findlib packages
lazily. This simplify the code and prepare for subsequent changes to
library management.

Fix #484 at the same time
2018-02-13 17:49:07 +00:00
Jérémie Dimino 8e27f1966d
Fix #485 (#512) 2018-02-13 15:56:59 +00:00
Jérémie Dimino 2fb65c05ba
Fix #330 (#510) 2018-02-13 12:49:50 +00:00
Rudi Grinberg 0d62c34e42
Make Lib.t abstract (#498)
* Make Lib.t abstract

This requires removing the external/internal separation in most places in the
source code. Briefly, these are:

* Special casing of external libs for incremental compilation in jsoo
* .merlin generation
* stamp file generation
* transitive closure having a flag for walking external libs
* checking if a lib is a driver (checking various names)

These cases are fixed by introducing an src_dir, obj_dir abstractions, and the
ability to check if a library is local.
2018-02-13 18:36:15 +08:00
Rudi Grinberg 2b442c6019 Change .merlin generation to not use PKG
We know the build directory of exteranl packages, hence we should simply use it
as the build and source dir (B and S respectively).
2018-02-13 00:08:45 +08:00
Rudi Grinberg 8781c81bd3 Fix the top closure for internal libs
keying by the private name isn't enough. We include the dir in the key, because
private names are unique per dir.
2018-02-12 19:55:39 +08:00
Rudi Grinberg baa009a0fb Fix map of private installable libraries
It should be keyed by a unique name because the old key - the internal name,
isn't unique. Also take this change to fix the instalable -> installable typo.
2018-02-12 19:55:39 +08:00
Rudi Grinberg 0873ae2b10
Remove primed Lib_db.find_scope (#505)
Two versions aren't really necessary as mostly the primed version was used.
2018-02-10 22:38:28 +08:00
Rudi Grinberg fd6e8ad91f Remove {anonymous,external}_scope from Super_context
These were re-exported to avoid access libs directly, but there's already an
accessor to do that, so these functions weren't used consistently anyway.
2018-02-10 00:15:26 +08:00
Hugo Heuzard dad2458879 install all sources 2018-02-08 23:09:55 +08:00
Jeremie Dimino e22dee5f75 tweaks 2018-02-08 11:01:54 +00:00
Rudi Grinberg c33269b914 Deduplicate closure and closed_ppx_runtime_deps_of (#499) 2018-02-08 10:58:02 +00:00
Jérémie Dimino b3838284c6
Better support for mli/rei only modules (#489) 2018-02-08 10:12:46 +00:00
Rudi Grinberg f083b6a2cd Get rid of useless find_internal' function
It was only used to define find_internal
2018-02-08 11:58:40 +08:00
Jérémie Dimino 763feda683 Move the addition of <lib>.a dependencies to Lib.archive_files (#493)
Move the addition of <lib>.a dependencies to Lib.archive_files

And refactor a bit the code
2018-02-08 03:21:11 +08:00
Jeremie Dimino b46cef533a Make Findlib.package abstract 2018-02-07 18:10:05 +00:00
Jeremie Dimino f949588742 Actions printed by "jbuilder rules" are now using relative paths
This seems more natural
2018-02-07 18:10:05 +00:00
Jeremie Dimino a794de8b2b Refactoring 2018-02-07 14:19:58 +00:00
Jeremie Dimino b17b476048 Set the obj_dir for executables 2018-02-07 12:34:01 +00:00
Grégoire Henry 0f0c0c2997 Compatibility layer: add link from `obj.cmi` -> `.foo.objs/obj.cmi` 2018-02-07 12:33:57 +00:00
Grégoire Henry fda3c7f680 Implement #427 2018-02-07 12:33:52 +00:00
Jeremie Dimino fae08c79be Allow to set the concurrency level from the config file 2018-02-07 12:11:27 +00:00
Jérémie Dimino 0570e09f9a
Add a configuration file and a quiet mode (#490) 2018-02-07 11:38:21 +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
Jérémie Dimino d4c9eb6ba0
Do not pass -I <stdlib-dir> (#488) 2018-02-06 11:49:44 +00:00
Jérémie Dimino 80c0bfc879
Split calls to ocamldep (#486)
Instead of doing a single call to ocamldep, do one per file. This is
needed to support "menhir --infer".

This should also make compilation go further when there are files with
syntax errors.
2018-02-06 11:48:04 +00:00
Rudi Grinberg a1c02df143
Build_system.prefix_rules (#479)
* Build_system.prefix_rules

Add a way to implicitly add a build prefix to all rules added by the given
function

* Make sure that on_load_dir callbacks handle the prefix right

* Make sure that prefix_rules prefixes don't contain targets

* Move prefix validation to user facing function

* document prefix_rules
2018-02-05 18:38:42 +08:00
Rudi Grinberg e61142e885
Merge pull request #460 from ocaml/fix-promote-tests-on-osx
Fix bad interaction between promotion and incremental builds on OSX
2018-02-01 20:15:18 +08:00
Jeremie Dimino f17e61dd3a Fix #469 2018-02-01 10:17:51 +00:00
Jeremie Dimino 143145b19c Remove old stuff about updated files
This dates from the time we were using timestamps for incremental
compilation.
2018-02-01 08:23:36 +00:00
Jeremie Dimino b9c4dd2339 Remove files from the digest cache when promoting them.
This is to avoid problems with incremental compilation on OSX.

Fix #456
2018-02-01 08:23:25 +00:00
Rudi Grinberg 3bf3c91105 Verify that scope by path lookup uses valid dirs
The dirs must be sub directories of the anonymous_scope path. Which is the build
root of the context of the lib db.
2018-01-31 19:18:55 +08:00
Rudi Grinberg 4272d34fa6 Fix scoping related odoc rules
the lib component isn't just a library name. It can contain the scope as well
which we should resolve correctly
2018-01-31 03:43:39 +08:00
Rudi Grinberg a29f144bc1 Use correct scopes for generating ppx preprocessors
Use the intenral scope whenever there's an internal lib in the preprocessors.
Otherwise use the external scope.
2018-01-31 00:48:58 +08:00
Rudi Grinberg dcb3845fc4 Associate the empty scope name to the anonymous scope 2018-01-31 00:48:58 +08:00
Rudi Grinberg 1013db83b5 Add Lib.public_name 2018-01-31 00:48:58 +08:00
Rudi Grinberg ce65e27045 Add Lib_db.Scope.name 2018-01-31 00:48:58 +08:00
Rudi Grinberg 91f6a67850 Add ability to look up scopes by external name 2018-01-31 00:48:57 +08:00
Rudi Grinberg 672120b3b8 Introduce explicit scopes for Lib_db
This commit introduces explicit scopes in Lib_db and refactors dune to use these
scopes where appropriate. Briefly, they are appropriate whenever we previously
used a directory to resolve the scope with Lib_db.find ~dir and friends. So a
Lib_db.Scope.t replaces a (dir, Lib_db.t) pair.

This allows to be explicit about the anonymous and external scope. Which is
important when building ppx drivers.

We also harmonize the error handling with the Findlib module. In both cases
we use a flat string list of errors. Rather than the more specific type we had
before in Findlib.
2018-01-30 19:21:40 +08:00
Rudi Grinberg a3ff5e5f30
Merge pull request #368 from rgrinberg/fanout-cleanup
replace double fanout with fanout3
2018-01-29 23:16:06 +08:00
Rudi Grinberg a02b6472e7 replace double fanout with fanout3 2018-01-29 23:13:02 +08:00
Rudi Grinberg aeb186fd3b Remove the path argument from Record_lib_deps
it can always be inferred from when we can construct the rule. But to do that,
we have to pass it along to internal_rule.
2018-01-29 22:53:14 +08:00
David Allsopp b6eec7a33d Correct promote-until-clean atom 2018-01-26 16:51:28 +00:00
Jérémie Dimino 437211f74f
Expose the promote mode (#437) 2018-01-25 19:07:46 +00:00
Rudi Grinberg 27e31a3196 Avoid catching wildcard exceptions when calling Findlib.find
But to avoid making the catch statements verbose, move all findlib exceptions to
a variant.
2018-01-25 22:00:52 +08:00
Jérémie Dimino c066efd196
Add the transitive dependencies of used ppx rewriters (#450) 2018-01-25 11:22:50 +00:00
Jeremie Dimino 062cca21e5 Fix #447 2018-01-25 10:13:18 +00:00
Jeremie Dimino ad9b82e92a Compute the transitive closure of ppx runtime deps only when needed
We only need it when the kind is ppx_rewriter or ppx_deriver.
2018-01-24 18:12:50 +00:00
Rudi Grinberg ab18b13a04 Fix META generation wrt scope
We should respect the scope of the current internal library to generate the META
2018-01-24 16:32:10 +08:00
Jérémie Dimino ba5ffbc414
Fix meta generation for ppx runtime deps (#441)
Use the transitive closure for the deprecated ppx method
2018-01-23 16:03:59 +00:00
Rudi Grinberg 58f9e9840c Replace janestreet/jbuilder with ocaml/dune
Update all links where necessary
2018-01-23 17:52:44 +08:00
David Allsopp 6873478307 Display a warning for bad jbuild-ignore lines (#389)
jbuild-ignore should only refer to directories in the current directory
(unlike .gitignore): referring to subdirectories doesn't work.

Signed-off-by: David Allsopp <david.allsopp@metastack.com>
2018-01-23 09:14:22 +00:00
Rudi Grinberg a34f71f922
Merge pull request #410 from rgrinberg/new-odoc-minimal
New odoc rules (minimal)
2018-01-23 02:58:06 +08:00
Rudi Grinberg 6cce747141 Make odoc work with multiple libraries defined in the same dir 2018-01-23 02:56:23 +08:00
Thomas Refis 815c332dc5 odoc: handle .mld files 2018-01-23 02:56:23 +08:00
Jeremie Dimino 13843f93dd Fix #436 2018-01-22 13:12:29 +00:00
David Allsopp 61b3e5f189 Use /Fo instead of -o when invoking CL
The -o option in the Microsoft C Compiler is deprecated (and has been for
a very long time). The warning is tedious, so use /Fo instead. The only
problem with this is that "-o foo.obj" must become "/Fofoo.obj" with no
space, which requires a little support in Arg_spec.

Signed-off-by: David Allsopp <david.allsopp@metastack.com>
2018-01-22 12:17:28 +00:00
Jérémie Dimino f9837a278b
Detect recursive includes (#435)
Fix #432
2018-01-22 11:32:40 +00:00
David Allsopp d2706b448b Remove readonly attribute on Windows before unlink
The legacy DOS readonly attribute is a tedious difference on Windows,
because a user may have permission to delete a file, but unlink fails
because the attribute is set.

Signed-off-by: David Allsopp <david.allsopp@metastack.com>
2018-01-22 11:14:18 +00:00
Jeremie Dimino b401284b84 Restore .merlin-exists trick
This is needed so that command don't depend on the contents of the .merlin
2018-01-19 22:54:05 +00:00
Jeremie Dimino 8b11b494d2 Fix Path.pp 2018-01-19 22:44:30 +00:00
Jeremie Dimino 92c7927432 Fix Path.explode 2018-01-19 22:43:40 +00:00
Jérémie Dimino 5651eb80b5
Better behavior when aliases have targets (#426)
Ignore the targets and report a warning.
2018-01-19 22:17:11 +00:00
Jeremie Dimino 92f9ce4edb Fix the order of files in (diff file.ml file.ml.ppx-corrected)
The generated correction must come after for promotion to work.
2018-01-19 15:32:29 +00:00
Jérémie Dimino 9dd5ab74e4
[WIP] Load rules lazily (#370)
* Change jbuilder to load rules lazily

Rules are now loaded on a per directory basis as needed. This speed up
the start up time on large workspaces.

Does various refactoring as well.

* Simplify the handling of META files

We no longer generate a META.foo.from-jbuilder file. Nobody is using
this feature and it's making the new code more complicated.
2018-01-19 08:50:06 +00:00
Jérémie Dimino b06aad431e
Replace promote actions by diff actions + promote command (#421)
* Remove (promote ...) and (promote-if ...)
* Remove `--promote ...`
* Add (diff ...) and (diff? ...)
* Add `jbuilder promote` and `--auto-promote`
* Fix #423
2018-01-18 11:32:20 +00:00
hhugo 9347d4a767 tailrec split_lines (#416) 2018-01-17 13:34:53 +00:00
Jérémie Dimino 314da72d3c
Better signature for Artifacts.file_of_lib (#418) 2018-01-16 13:40:04 +00:00
Jérémie Dimino 49edf8ed65
Accept correction files produced by ppx_driver (#415)
* Accept correction files produced by ppx_driver so that [@@deriving_inline] works
* Change promote-if so that it doesn't promote the file when the source file doesn't exist in the source tree
2018-01-16 12:28:02 +00:00
Jeremie Dimino d4dec9b4f5 Change the default of --promote from check to copy
As said in the PR. I forgot to push the commit.
2018-01-15 14:55:17 +00:00
Jeremie Dimino ce901a4731 Fix the build 2018-01-15 13:50:08 +00:00
Jérémie Dimino af5d7f5e6f
Report better errors for globs pointing to non-existing directories (#413)
Fix #412
2018-01-15 13:28:32 +00:00
Jérémie Dimino eab1ff6c7b
Add promote actions and include stanzas (#402)
Add a promote action that allows to copy over generated files as
source files and an include stanza allowing to include a file in a
jbuild file.
2018-01-15 13:24:25 +00:00
Christophe Troestler f8617b5721 Let "concat" or "split" be a quality of the variable (#336)
* Let variables say whether they are Concat or Split

To concatenate the contents of a split variable, put it in a string:
"${var} ".

Fixes #300

See also https://github.com/janestreet/jbuilder/issues/408

* Issue a deprecation warning for ${!...}

* Treat ${CC}, ${<}, ${^} and ${read-lines:...} as split vars

* Change ${!^} into ${^} for this project jbuild rules
2018-01-15 09:32:40 +00:00
Jérémie Dimino d3410e0659 Refactor alias handling
* Improve documentation of alias module
* Add add_alias helper function to help create rules in alias
2018-01-13 19:51:24 +08:00
Jérémie Dimino a1026f46d1 Add action helpers
Add constructor functions for Actions
2018-01-13 19:51:18 +08:00
Jérémie Dimino e28344a24b
Do not use the transitive closure in generated META files (#405) 2018-01-12 16:41:23 +00:00
Rudi Grinberg 92d4cbb7be
Merge pull request #404 from janestreet/make-lint-standard
Make lint alias standard
2018-01-12 15:46:26 +08:00
Rudi Grinberg 6bd46a76f8 Make lint alias standard 2018-01-11 16:20:19 +08:00
Rudi Grinberg 3776acd8d2 Fix c_compiler parsing for OCaml >= 4.06.0 (#393) 2018-01-10 16:54:25 +00:00
Rudi Grinberg ca1c8dd897 Add -null option to linters
Since the omp driver doesn't support this option yet, we must add it
conditionally. This is a temporary workaround.
2018-01-10 22:45:50 +08:00
Rudi Grinberg 1fc0ef0ab1 Add lint rules 2018-01-10 22:45:50 +08:00
Rudi Grinberg 6d2152e7b1 Add Alias.add_{stamp,action}_dep
These functions will be useful to construct alias elsewhere
2018-01-10 22:45:50 +08:00
Rudi Grinberg bfbfc0bf30 Change lint option to be the same as preprocessing 2018-01-10 22:45:50 +08:00
Rudi Grinberg 66fc8db600 add lint alias 2018-01-10 22:45:49 +08:00
Rudi Grinberg 897c1e2e5e Add helper functions
* Path.Set.sexp_of_t
* Module.iter
* List.last
2018-01-10 22:45:31 +08:00
Jeremie Dimino 469079f9c6 Connect usexp errors to the error reporter
Fix #384
2018-01-09 09:55:01 +00:00
Rudi Grinberg 1ff8a7989c Cross compilation support
In a host/target setup, all binaries that are built (including preprocessors)
are ran using the host *for* building targets. Final target artifacts are
compiled using the target toolchain
2018-01-01 22:34:41 +08: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 afb602d7ef Add add_install_prefix function
To control installation prefix
2018-01-01 21:48:25 +08:00
Jeremie Dimino 86dc606fef Add Utils.install_file
Determines the .install depending on the toolchain for x compilation
2018-01-01 21:48:25 +08:00
Jeremie Dimino 5d451e7034 Add cstr_record 2018-01-01 21:48:25 +08:00