Commit Graph

127 Commits

Author SHA1 Message Date
Rudi Grinberg b9be63f4b7 small simplification
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-07-10 01:32:26 +07:00
Rudi Grinberg a0a92d9adb Introduce a Dir primitive to Value
This is like Path but users will know not to infer dependencies from it

Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-07-08 16:33:18 +07:00
Jérémie Dimino e56fba9a57
Do not use opam-installer to copy files (#941)
Instead of calling opam-installer, manually parse .install files and copy the files.

Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2018-07-03 10:10:09 +01:00
Rudi Grinberg bc09b8fc81 Change Action.Promotion to use Utils.Persistent
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-06-28 17:15:34 +06:30
Jeremie Dimino f9f5503e81 Change the signature of Of_peek.peek
It is always used the same way: `peek raw`, and sometimes preceded by
a `eos`. Remove the old `peek` and add:

- `peek_exn` which is the same the old `peek raw`
- `peek` which returns `None` if the end of sequence is reached

Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2018-06-28 11:26:42 +01:00
Rudi Grinberg 2257a2057b Add templates to Usexp.t directly
Templates are now directly in dune's sexp language. The syntax is change to %{}
from ${} and $(). Old templates are still supported in jbuild files.

Other changes in this PR:

* Removal of ! patterns in variables
* Strict expansion for templates in dune files. Missing vars are now an error
* Using the correct syntax to parse included files in dune
* Improvements to the tests
* Syntax aware pretty printing of sexps. Now you must pass Dune vs. Jbuild to
  print sexps

Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-06-28 09:46:10 +06:30
Jeremie Dimino daa4be3dd8 Add Stanza.file_kind
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2018-06-25 08:14:27 +01:00
Jeremie Dimino f46a6aae53 Make (diff ...) work on Windows
- make (diff ...) trailing cr on Win32
- add a (cmp ...) action for comparing binary files
- add a test and run it in AppVeyor

Fix #844

Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2018-06-25 08:14:27 +01: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
Jeremie Dimino 14e6b1e038 Reduce the number of of_sexp_error... functions
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2018-06-19 11:29:27 +01:00
Jeremie Dimino 30d20d6143 Use a single S-expression parser monad
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2018-06-19 11:29:27 +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
Jérémie Dimino 3c74bf07e8
Use the same monad to parse all list of S-expressions (#882)
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2018-06-14 08:51:27 +01:00
Rudi Grinberg 6ebff9d388 Move Value.t list functions to Value.L
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-06-06 23:42:33 +07:00
Rudi Grinberg 9221b1ed6c Change echo to be variadic
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-06-06 23:42:33 +07:00
Rudi Grinberg 589943df60 Simplify String_with_vars
Make it expand only to Value.t since the string only version wasn't really used.
Variable expansions are now Value.t list. Which also gives the flexibility for a
value to expand to a collection of more than 1 value.

Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-06-06 23:42:33 +07:00
Rudi Grinberg 588129d582 Move Var_expansion to own module
These variables can occur outside actions so such expansions shouldn't live
under Var_expansion.

Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-06-06 23:42:33 +07:00
Rudi Grinberg eab7c46bdb Add flag to allow/disallow multivalue expansions
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-06-06 23:42:33 +07:00
Rudi Grinberg 9545d9a854 Add length function to exapnsions
This is useful for an error message that includes the number of items we've
expanded to.

Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-06-06 23:41:57 +07:00
Rudi Grinberg bb58cf8599 s/false/true/
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-06-06 23:41:57 +07:00
Rudi Grinberg c1d6faef79 Remove Concat_or_split
Thie property will now be determined from the context

Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-06-06 23:41:57 +07: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 52d0f3f552 Change return values of SW expansions
The nested either types obscure the meaning of the return values

Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-06-02 12:11:08 +07:00
Rudi Grinberg f07dff5696
Merge branch 'master' into sexpable 2018-06-01 02:33:54 +07:00
Etienne Millon e97d0c5ad6 Rename Path.readdir to Path.readdir_unsorted (#828)
As `Sys.readdir`, it returns entries in an nondeterministic order.
This can cause problems if caller relies on the list being sorted.

See #820.

Signed-off-by: Etienne Millon <etienne@cryptosense.com>
2018-05-31 14:52:10 +01:00
Rudi Grinberg 5bfacf766a Move sexpable signature to Stdune.Sexp
Also tweak Syntax.Version to match this signature

Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-05-31 13:17:52 +07:00
Rudi Grinberg f838c89d74 Remove aliases of Path.{Set,Map}
They save very little in terms of typing but grepping harder than it should be

Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-05-24 17:34:32 +07:00
Rudi Grinberg d600db2158 Change Build_job to be set
The elements are unique and the order isn't well defined anyway

Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-05-24 10:44:47 +07:00
Jeremie Dimino b48b1a168b Simplify the API for capturing the location of constructors 2018-05-23 14:24:41 +01:00
Jeremie Dimino d22eebf5a1 Simplify the API for parsing remaining arguments of constructors 2018-05-23 14:24:41 +01:00
Rudi Grinberg 8cea102d3c Fix type of Path.reach_for_running
It should return a string rather than a path. Also, make Process.run use it
rather than relying on the caller to do it.
2018-05-17 20:23:48 +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 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 a1835c7fa0 s/relative_build_dir/relative_to_build_dir/ 2018-04-25 20:16:19 +07:00
Rudi Grinberg f44b8bdb1b Unhardcode _build dir everywhere 2018-04-25 18:22:48 +07:00
Rudi Grinberg 62aa5acab3 Remove some path conversion from Action 2018-04-25 16:37:38 +07:00
Rudi Grinberg 63af8747a7 Change std_output_to and opened_file to use Path.t 2018-04-25 16:33:25 +07:00
Rudi Grinberg e310f17237 Get rid of Path.is_file 2018-04-25 16:18:32 +07:00
Rudi Grinberg 5eb444e357 Change Process.run's ~dir argument to use Path.t
This also requires Scheduler.with_chdir to use Path.t as well
2018-04-25 13:25:07 +07:00
Rudi Grinberg 7820e29d28 Port Io to use Path.t 2018-04-25 03:25:27 +07:00
Rudi Grinberg 79e434c658 Move sexp's io functions to Io.Sexp
to avoid circular dependencies when adding Path.t to Io
2018-04-24 23:21:42 +07:00
Rudi Grinberg 24041593da Move Code_error to Stdune.Exn
This exception is useful outside of jbuilder
2018-04-23 14:04:15 +07:00
Rudi Grinberg 530dbfeb81 Move String_set to stdune 2018-04-23 12:08:09 +07:00
Etienne Millon 40624e744b Build transitive dependencies with ocamldep
This uses two different extensions:

- `.d` corresponds to the raw `ocamldep` output.
- `.all-deps` corresponds to this output, merged with the dependencies
of all the interfaces mentioned in the earlier.

This also means that `.all-deps` files will contain output from multiple
files.
2018-04-17 15:51:29 +01:00
Rudi Grinberg 9414913286 Add test to make sure that ${null} isn't a target 2018-04-17 10:58:53 +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 dea2ac77ca No optional args for context 2018-03-15 18:24:36 +08:00
Rudi Grinberg e604c69510 Remove env_extra in Action
It's simply to just use Env.t everywhere. Also, there's no need to have the env
in the execution context since it's not used for anything. Only the env that is
passed directly is used.
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 35d4153641 Make Env.t abstract 2018-03-12 18:43:02 +07:00