Commit Graph

2242 Commits

Author SHA1 Message Date
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 de0ccfaec4
enabled_if (#819)
# Problem

The problem this PR is trying to solve is a bit specific to dune, but it's likely that it will be encountered by other projects as well. Currently, dune has a complicated script for generating test definitions that make sure tests run only in environments which support them. For example, some tests may not run on win32. A mechanism to enable tests conditionally would fix these problems.

# Proposal

Add an `enabled_if` field to aliases to toggle the execution of the alias. This field will be valued by a little EDSL for expressing boolean expressions. Here's an example of the kind of conditions we'd express with it:

```
(alias
 ((name runtest)
  (deps (foo.exe))
  (action (run ${<}))
  (enabled_if (and (<> ${os} win32) (>= ${ocaml_version} 4.0.5)))))
```

# Progress

This stalled a bit since I'm not sure how to do handle type safety here. Ideally, we only allow numbers and versions to be compared with `>=`, `<`, etc. I guess we really need to annotate which variables are comparable and making sure that we don't compare numbers to strings or versions.
2018-07-31 13:07:57 +02:00
Rudi Grinberg 3e4720e479 CHANGES entry
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-07-31 11:01:08 +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 e59feacb6d
Merge pull request #1067 from ocaml/applicative-map-syntax
Use let%map for applicative code
2018-07-31 10:33:19 +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 a13325e389
Merge pull request #1048 from rgrinberg/jsoo-cctx
Refactor jsoo rules to use Compilation_context.t
2018-07-31 09:36:01 +02:00
Rudi Grinberg 5c93619b47
Merge branch 'master' into jsoo-cctx 2018-07-31 08:56:35 +02:00
Rudi Grinberg ad0b376aeb
Merge pull request #1064 from rgrinberg/jsoo-manual
Move Jsoo content to its own page
2018-07-30 19:03:07 +02:00
Etienne Millon fc5e3e7b59
Merge pull request #1065 from ocaml/test-cat-output
Do not rely on cat output in tests
2018-07-30 17:45:27 +02:00
Etienne Millon 772c1c05ac Do not rely on cat output in tests
The error messages of `cat` can change a bit, for example if a different
locale is set. This uses a shell test instead.

Signed-off-by: Etienne Millon <me@emillon.org>
2018-07-30 17:40:48 +02:00
Rudi Grinberg baa5b773b5
Merge pull request #1038 from rgrinberg/workspace-env-2
Env stanza in workspace files part #2
2018-07-30 17:07:54 +02:00
Rudi Grinberg 89a381530d
Merge branch 'master' into workspace-env-2 2018-07-30 17:07:41 +02:00
cedlemo 7af0af94ed doc: remove %{first-dep} in quick-start.rst
Signed-off-by: Cédric Le Moigne <cedlemo@gmx.com>
2018-07-30 15:30:55 +01:00
Marek Kubica ed5f2c5b40 ocamlyacc does not require parens either
Signed-off-by: Marek Kubica <marek@xivilization.net>
2018-07-30 15:01:43 +01:00
Marek Kubica 371c863a32 Parens not required
Closes #1054
Closes #1056

Signed-off-by: Marek Kubica <marek@xivilization.net>
2018-07-30 15:01:43 +01:00
Marek Kubica f58bca1d06 ocamllex does not need the list of modules to be in a list
Noticed this issue while finding another issue in #1056.

Signed-off-by: Marek Kubica <marek@xivilization.net>
2018-07-30 15:01:43 +01: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 2836a3c6b0 Document the workspace level env stanza
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 c112516a67 Add test setting env for workspace
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 5e7841abf2
Merge pull request #1043 from rgrinberg/module-evaluator
Simplify module evaluator logic
2018-07-30 15:07:48 +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 5f7d1b0285 Fix #1040
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2018-07-30 12:52:07 +01:00
Rudi Grinberg 3615b280f8 Move Jsoo content to its own page
Jsoo is about as independent as other features which have their own section

Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-07-30 11:47:35 +02:00
Rudi Grinberg 78bedda654
Merge pull request #1062 from hongchangwu/update-doc
Update documentation for tests
2018-07-29 21:28:20 +02:00
Hongchang Wu 3b875f0937 Update documentation for tests
Signed-off-by: Hongchang Wu <wuhc85@gmail.com>
2018-07-29 13:01:40 -04: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 4bd1bcbb3a
Merge pull request #1042 from rgrinberg/syntax-1.1
Update latest syntax to 1.1
2018-07-21 20:42:43 +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 4aad02de6f
Merge pull request #1037 from rgrinberg/update-tests-workspace
Add missing dune-project files to tests
2018-07-20 15:20:43 +02:00
Rudi Grinberg fc3400429b
Merge pull request #1036 from rgrinberg/use-correct-version
Use correct version for error message
2018-07-20 15:11:02 +02:00
Rudi Grinberg 5754e7328a Add missing dune-project files to tests
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-07-20 15:07:35 +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 5683909fc3 Update changelog for 1.0.1
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-07-19 23:47:06 +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
Rudi Grinberg a842fdc2d7
Merge pull request #998 from rgrinberg/workspace-env
Add Ability to set Env through a workspace file
2018-07-19 13:26:26 +02: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