Commit Graph

1443 Commits

Author SHA1 Message Date
Rudi Grinberg 317388fd95 Refactor code to to have a dedicated type for Library.name
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-08-08 15:07:26 +03:00
Rudi Grinberg 6260dad66b Remove comment that was comitted accidentally
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-08-08 15:07:26 +03:00
Rudi Grinberg 12bf6bda4a Fix #1107
-opaque should be passed for mli only modules or for all modules when opaque
 mode is on

Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-08-07 13:05:37 +03:00
Etienne Millon 4bacf48a89 Extract predicates for compiler versions
Instead of comparing on the version numbers, add some predicates in a
new `Ocaml_version` module that describe the compiler behavior.

Signed-off-by: Etienne Millon <me@emillon.org>
2018-08-06 11:49:03 +00:00
Rudi Grinberg 7c597d80e7
Merge pull request #1096 from rgrinberg/missing-loc
Missing loc
2018-08-06 14:30:15 +03:00
Rudi Grinberg fe6fae0ff0 Avoid using a _ pattern where it's not necessary
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-08-05 22:00:05 +03:00
Jeremie Dimino 0e6dda2032 Adapt the design of multi directory libraries
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2018-08-05 21:58:21 +03:00
Rudi Grinberg 66f2004f8f Add rule locs to failed rules
this will add a location that will point to the rule that failed

Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-08-04 20:03:58 +03:00
Rudi Grinberg a064b59692 Track locations when executing programs
Only works for searched programs for now

Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-08-04 13:16:58 +03:00
Rudi Grinberg 7fb18ebbd3 Decouple error detection from reporting in modules field
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-08-03 16:29:38 +03:00
Rudi Grinberg 3667db05fc Move module validation to own function
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-08-03 11:48:32 +03:00
Rudi Grinberg 51ca4f7659 Simplify returning modules in Dir_contents.eval
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-08-03 11:42:30 +03:00
Rudi Grinberg 1597b61df9 Move 4.03 minium version check for opaque to top level
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-08-02 15:30:35 +02:00
Rudi Grinberg bde4943692 Make file_deps and file_deps_with_exts share code
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-08-02 15:26:45 +02:00
Rudi Grinberg 9f43a88950 Remove opaque from Lib.t
Only use Compilation_context.t for controlling this

Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-08-02 15:26:45 +02:00
Rudi Grinberg e09bbfcd6e Fix opaque calculation for includes
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-08-02 15:26:45 +02:00
Rudi Grinberg b394896c1f Make opaque information available to compilation context
Subsequently, use it as a flag when calculating rules and includes

Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-08-02 15:26:45 +02:00
Rudi Grinberg 8a03e7099a Hard code opaque mode
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-08-02 13:13:39 +02:00
Jérémie Dimino b05e28569e
Add support for staged ppx rewriters such as ones using the typer (#1080)
Fix #193

Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2018-08-02 12:11:59 +01:00
Louis Roché a5d0941b14 replace jbuilder with dune
* when printing context
* in meta comments
* error messages

Signed-off-by: Louis Roché <louis@louisroche.net>
2018-08-02 12:41:35 +02:00
Jérémie Dimino 29d1689f87
Fix bug in Dir_contents (#1085)
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2018-08-02 10:58:42 +01:00
Jérémie Dimino 5aa9a07f1a
Fix merlin generation in presence of include_subdirs (#1083)
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2018-08-02 09:27:55 +01:00
Etienne Millon f553a84af0 Use if_list
Signed-off-by: Etienne Millon <me@emillon.org>
2018-08-01 15:12:13 +00:00
Etienne Millon 6ed0b1b498 Only expose `if_eos`
Signed-off-by: Etienne Millon <me@emillon.org>
2018-08-01 15:12:13 +00:00
Etienne Millon 6298d283ba Add switch_file_kind
This expresses all the cases where we dispatch based on the syntax
version.

Signed-off-by: Etienne Millon <me@emillon.org>
2018-08-01 15:12:13 +00:00
Etienne Millon d9e7f54277 Workspace.Context.Opam: parse name to an option
This makes it possible to parse it using the applicative API.

Signed-off-by: Etienne Millon <me@emillon.org>
2018-08-01 15:12:13 +00:00
Jérémie Dimino 282c0b3c41
Add support for multi directory libraries and executables (#1034)
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2018-08-01 15:23:26 +01:00
Rudi Grinberg 6eb20866f6 Move info to lib
This cuts down on a lot of duplication between the library and info

Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-08-01 13:48:57 +02:00
Rudi Grinberg 6e29bd10ef Remove String_map module
We can just use String.Map

Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-08-01 11:59:33 +02:00
Jérémie Dimino 3c5fddf5fe
Add module Lib_deps_info (#1077)
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2018-08-01 09:01:43 +01:00
Frédéric Bour b4d8d4b355 modules_without_implementation suggestion uses old (pre-dune) syntax
Signed-off-by: Frédéric Bour <def@fb.com>
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-08-01 09:58:32 +02:00
Rudi Grinberg 3f2d260be7 Add Ordering.to_string
it was useful for debugging

Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-07-31 13:45:25 +02:00
Rudi Grinberg a425e0ad94 Define alias as empty if it's disabled
this is so that others can still depend on it

Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-07-31 13:44:59 +02:00
Rudi Grinberg 4f0d056b8b Fix Op.eval in blang
Neq is compatible with Lt/Gt

Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-07-31 13:44:39 +02:00
Rudi Grinberg 3d9612f95c Add enabled_if to aliases/tests
This field controls whether the alias/test will be run or not. Boolean
expressions are defined using the Blang.t type. This type represents simple
boolean expressions that become useful when we allow to interpolate variables
into them.

Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-07-31 10:59:35 +02:00
Etienne Millon 4823795fd1 Use let%map for applicative code
This converts easy instances of applicative code. The rewrite rule is
generally speaking:

```ocaml
e1 >>= pat1 ->
e2 >>= pat2 ->
e3 >>| pat3 ->
r
```

to:

```ocaml
let%map pat1 = e1
and pat2 = e2
and pat3 = e3
in
r
```

Signed-off-by: Etienne Millon <me@emillon.org>
2018-07-31 10:25:58 +02:00
Rudi Grinberg 835a44ff1e
Make name and names fields optional when public_name or public_names are present (#1041)
Make name field optional when public_name is specified

When name is omitted, it will be defaulted to public_name

This feature is 1.1 only.
2018-07-31 10:15:31 +02:00
Rudi Grinberg 5c93619b47
Merge branch 'master' into jsoo-cctx 2018-07-31 08:56:35 +02:00
Rudi Grinberg 024438e3cc Represent env_nodes using a record rather than a list
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-07-30 15:12:17 +02:00
Rudi Grinberg bd860d29e7 Pass the workspace env to context creation
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-07-30 15:12:17 +02:00
Rudi Grinberg 61d33114ee Bump latest version to 1.1
And make this version a pre-req for the env field in workspaces

Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-07-30 15:12:17 +02:00
Rudi Grinberg 8cda4349fa Use toplevel env stanza from workspace file
This should be the top most env stanza when it's available

Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-07-30 15:12:17 +02:00
Rudi Grinberg 200f9d0a52 Add toplevel env stanza to workspace files
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-07-30 15:12:17 +02:00
Rudi Grinberg 4697a7f9f4 Refactor jsoo rules to use Compilation_context
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-07-30 15:12:08 +02:00
Rudi Grinberg a898448510 Fix typo in comment
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-07-30 15:12:08 +02:00
Rudi Grinberg 7eb7c6e21a Simplify module OSL evaluation
Use Ordered_set_lang.Make_loc to automatically book keep the location for us.
Also cut down on some module name to string conversions that was just making the
code noisy. The fake_modules detection has been changed to hide the mutabiility
from the main algorithm

Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-07-30 14:33:24 +02:00
Rudi Grinberg 4970448edf Add Module.uncapitalize
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-07-30 14:33:24 +02:00
Rudi Grinberg 093cefc58b Add Loc preserving version of Ordered_set_lang.Make
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-07-30 14:33:24 +02:00
Rudi Grinberg 50eacb0690 Add signature to Modules_field_evaluator
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-07-30 14:33:24 +02:00
Jeremie Dimino 8d5bd6819f Small refactoring of jbuild_load.ml
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2018-07-24 15:14:14 +02:00
Rudi Grinberg 845d3a4713 Update latest syntax to 1.1
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-07-21 20:39:13 +02:00
Rudi Grinberg 2b72c80fbc Use correct version for error message
Error.deleted_in would use the current version rather than the deleted version
for the error message

Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-07-20 14:02:58 +02:00
Rudi Grinberg 5835e5b64c
Merge pull request #1035 from diml/move-pp-files-back
Move back .pp files to the source directory
2018-07-19 23:00:27 +02:00
Rudi Grinberg eb0cb1d4c8
Merge pull request #1033 from diml/i-must-not-segfault
Exceptions are the little-death that brings total obliteration
2018-07-19 22:40:12 +02:00
Jeremie Dimino 213e093b07 Move back .pp files to the source directory
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2018-07-19 15:59:29 +01:00
Jeremie Dimino 0ad983c729 You get a quote from Dune if you can make Dune crash
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2018-07-19 12:22:18 +01:00
Rudi Grinberg 1f0bee0cf7 Rename base to common
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-07-19 13:11:42 +02:00
Rudi Grinberg 14030a8ad5 Remove unused open
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-07-19 12:14:25 +02:00
Rudi Grinberg 655c10164d Use syntax extension for parsing stanza
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-07-18 14:34:18 +02:00
Rudi Grinberg 78e18716ce Rename Shared_stanaza to Dune_env
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-07-18 14:34:18 +02:00
Rudi Grinberg 78786e09d4 Initialize env_node from Super_context.create
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-07-18 14:34:18 +02:00
Rudi Grinberg a82e783f15 re-arrange short match to go to the top
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-07-18 14:34:18 +02:00
Rudi Grinberg 4860461ba3 Pun inherit_from field
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-07-18 14:34:18 +02:00
Rudi Grinberg b12517debb Move Env stanza to Shared_stanza module
To break dependency cycles. This shared_stanza module doesn't have any
dependencies on actions.

Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-07-18 14:34:18 +02:00
Rudi Grinberg 4769f9df9f Plumb through env node
workspace -> context -> super context

Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-07-18 14:34:18 +02:00
Rudi Grinberg 61d7e49e07 Move env stanza parsing to Env.t
This will be necessary to allow this stanza in Workspace

Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-07-18 14:34:18 +02:00
Rudi Grinberg 20fe7a9d20 Refactor workspace type
Make the opam workspace include the shared fields from a base type

Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-07-18 14:34:18 +02:00
Rudi Grinberg c7bd8bc556 Move sandboxed back to Action
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-07-18 14:27:09 +02:00
Rudi Grinberg 1b71d57bba Move promotion to own module
It's not really related to actions

Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-07-18 14:27:09 +02:00
Rudi Grinberg bf2d842075 Split executable parts of Action into Action_exec
This is required for breaking the dep cycle between the context and the Action module

Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-07-18 14:27:09 +02:00
Rudi Grinberg 621c666610 Remove extra is standard check that is already done in Osl.eval
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-07-18 13:12:50 +02:00
Jeremie Dimino 5dd218c0b8 Switch jbuild.ml to applicative parsing and let%map
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2018-07-18 11:02:43 +01:00
Jeremie Dimino 6b0a02bec9 Remove one functor
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2018-07-18 10:58:45 +01:00
Jeremie Dimino 881540662a Move all code dealing with scanning directories into its own module
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2018-07-18 10:58:45 +01:00
Rudi Grinberg 2690415242 Manual dependency sort in super_context
Code is re-arranged so that evaling the OSL can access the Expander module

Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-07-17 23:10:48 +02:00
Rudi Grinberg e421884bd4 Add signature to Super_context.Env
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-07-17 23:10:48 +02:00
Jeremie Dimino d94a7fe869 Simplify Build_system.eval_glob
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2018-07-17 13:29:49 +01:00
Jeremie Dimino 02ed099693 Make it work during bootstrap
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2018-07-17 11:37:22 +01:00
Jeremie Dimino 9734b2e6d0 Make the preprocessor more generic
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2018-07-17 11:37:22 +01:00
Jeremie Dimino bad0294db3 Add a textual preprocessor implementing a let%map syntax
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2018-07-17 11:37:22 +01:00
Jeremie Dimino c52d0676e8 Fix #1019
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2018-07-16 14:04:07 +01:00
Jeremie Dimino 9f7fa5ec68 Fix a typo
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2018-07-16 14:04:07 +01:00
Jeremie Dimino c3008af5cf Fix #1008
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2018-07-16 08:58:27 +01:00
Rudi Grinberg 2ec21d7b94 Pass extra params to with_expander
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-07-13 15:30:55 +02:00
Rudi Grinberg 62e7684f3b Make the types of expanders uniform everywhere
No labels, and consistent parameter order

Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-07-13 15:30:55 +02:00
Rudi Grinberg 0db9356692 Fix code error in expansion
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-07-13 15:30:55 +02:00
Jeremie Dimino b0e39d30f0 Deforest a bit
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2018-07-13 15:30:55 +02:00
Rudi Grinberg 39c1cef128 Allow to expand multiple values in OSL
Variables that expand to multiple values will be interpreted correctly as
OSL elements

Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-07-13 15:30:55 +02:00
Rudi Grinberg 72bbd06a1d Generalize expansion to be in own module
The result is Super_context.Expander which can be used for expandding OSL as well

Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-07-13 15:30:55 +02:00
Rudi Grinberg 6c6a5b7866 Move Resolved_forms to own module
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-07-13 15:30:55 +02:00
Rudi Grinberg d90ca2c343 Little tweaks to Dir_contents
Make the type private and explicitly ignore the mlds field

Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-07-13 15:17:19 +02:00
Jeremie Dimino e7e28b2044 Move stanzas_per_dir to super_context.ml
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2018-07-13 15:17:19 +02:00
Jeremie Dimino b6108d7091 Move a few functions from gen_rules.ml to simple_rules.ml
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2018-07-13 15:17:19 +02:00
Jeremie Dimino 5974be475a Refactor a bit the functions computing directories contents
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2018-07-13 15:17:19 +02:00
Jeremie Dimino 3effc2fbdf Make targets_dir argument of SC.Action.run non-optional
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2018-07-12 14:55:38 +01:00
Jeremie Dimino c0a6438fcc Fix reason support by keeping the original extension
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2018-07-12 14:55:38 +01:00
Jeremie Dimino e6e4589c47 Small simplification
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2018-07-12 14:55:38 +01:00
Jeremie Dimino c0f9c32475 Generate all the .pp files in the object directory
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2018-07-12 14:55:38 +01:00
Jeremie Dimino 4d4eb5919e Change Module.File.name to Module.File.path
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2018-07-12 14:55:38 +01:00
Jeremie Dimino b8679d2791 Simplify naming of reason ast files
We don't need to preserve the .ml/.mli extension anymore.

Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2018-07-12 14:55:38 +01:00