Commit Graph

70 Commits

Author SHA1 Message Date
Rudi Grinberg 53d9c64468 Print atom using atom constructor
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-06-20 18:23:23 +06:30
Rudi Grinberg 7d2c7d9579 Parameterize sexp_tests on dune and jbuild syntax
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-06-20 18:23:23 +06:30
Rudi Grinberg 99fbac26ab Remove constructor side validation
And make the tests reflect back Invalid_argument

Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-06-20 18:23:23 +06:30
Rudi Grinberg ad3a95655d Dune & Jbuild validation for atoms
Atoms can now be constructed and pretty printed with a syntax = Jbuild | Dune.
The syntax controls validation that will be used to make sure we are printing
something/reading valid

Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-06-20 18:23:23 +06:30
Jérémie Dimino 94c921f9c4
Rename files_recursively_in to source_tree (#899)
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2018-06-20 10:45:54 +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 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
Rudi Grinberg ec8860d0be Add more tests with regards to escaping
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-06-19 01:00:50 +07:00
Rudi Grinberg a9142840fd Add tests for % and $ chars in atoms
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-06-17 12:49:08 +07:00
Jérémie Dimino 3cf2a0dab1
Add dune-project files to dune tests and remove old jbuild_version stanzas (#875)
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2018-06-12 09:49:39 +01:00
Jérémie Dimino 8727eb6c3c
Strengthen the lexing of escape sequences (#872)
Things like \a are no longer allowed. Before they would be interpreted
as a literal \a. This will allow to introduce new escape sequences in
the future if needed.

Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2018-06-11 16:21:31 +01:00
Etienne Millon 673397a1b9 Display the installable modes
Signed-off-by: Etienne Millon <etienne@cryptosense.com>
2018-06-07 15:40:45 +02:00
Jeremie Dimino b7afc006ee Drop support block and sexp comments in Dune files
They are almost never used and they complicate the language. The
parsing of jbuild files in unchanged.

Signed-off-by: Jeremie Dimino <jdimino@janestreet.com>
2018-06-04 13:57: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
Jeremie Dimino 39e74826f4 Simplify the parser
Replace the current generated parser by an ocamllex lexer + a simple
parser.

The new code is:
- much simpler and smaller
- shouldn't cause ocamlopt to stack overflow anymore on BSD systems
- slightly slower but not that much

Signed-off-by: Jeremie Dimino <jdimino@janestreet.com>
2018-06-01 08:42:45 +01:00
Rudi Grinberg dc254638e3
Merge pull request #780 from ocaml/dup-fields
Allow to define that can appear multiple times
2018-05-21 00:13:58 +07:00
Rudi Grinberg 3548e2f6d4
Merge pull request #777 from rgrinberg/spec-reach-for-running
Add tests for reach_for_running
2018-05-20 23:57:40 +07:00
Jeremie Dimino cae4948b72 Allow fields that can appear multiple times 2018-05-19 10:14:50 +01:00
Jeremie Dimino 9d3117d63e Fix bug exposed by previous commit 2018-05-17 15:48:19 +01:00
Jeremie Dimino 0d27e9f909 Expose a bug in the S-expression record parser 2018-05-17 15:42:40 +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 a834e6f6ba Add tests for reach_for_running 2018-05-17 12:56:35 +07:00
Rudi Grinberg 19825ae012
Merge pull request #751 from rgrinberg/is-in-build-dir-weird-behavior
Path.is_in_build_dir test
2018-05-14 17:01:06 +07:00
Rudi Grinberg 4b798c048c Remove try/with from Path unit tests 2018-05-14 16:48:06 +07:00
Rudi Grinberg dc3310c3a0 Remove try/with from Path unit tests 2018-05-12 22:31:20 +07:00
Rudi Grinberg 33a99884e4 Improve tests of Path.descendant
It should test cases where the paths are build dirs
2018-05-12 12:50:43 +07:00
Rudi Grinberg 3a8e4cf54d Fix off by 1 in Path.is_descendant 2018-05-11 10:30:21 +07:00
Rudi Grinberg b6851d7cd7 Add tests Path.is_descendant
Notabley, Path.is_descendant is broken for some relative paths
2018-05-11 10:24:12 +07:00
Rudi Grinberg 909142cf6c Add tests for Path.drop_build_context 2018-05-11 09:43:30 +07:00
Rudi Grinberg f9f15ceacf Use exceptions over result type in expect test
There's no need to hide stack traces since we turned them off
2018-05-11 09:43:27 +07:00
Rudi Grinberg f4a5413c46 Don't record backtraces 2018-05-11 09:37:31 +07:00
Rudi Grinberg 7a1b3954d7 Change path tests not to include line numbers in stack traces
Only include exception names
2018-05-09 17:58:12 +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 47d54854e4 Safety feature for Path.rm_rf 2018-05-09 17:11:09 +07:00
Rudi Grinberg 08b33331ea Path.rm_rf test 2018-05-09 17:10:41 +07:00
Rudi Grinberg 7d17a30a99 Unit tests for current Path.append behavior 2018-05-09 09:14:21 +07:00
Rudi Grinberg 0f8dcc5848 Change Path.insert_after_build_dir_exn not to hard code _build
Use the build_dir variable rather than the "_build" string and treat the case
Path.build_dir argument differently. Previously this would error:

Path.insert_after_build_dir_exn Path.build_dir "foo"

Now, it will return _build/foo
2018-05-08 18:55:19 +07:00
Rudi Grinberg 6ee133b4dd Tests for insert_after_build_dir_exn 2018-05-08 17:26:14 +07:00
Rudi Grinberg fadc57040b Path.absolute tests 2018-05-08 16:50:49 +07:00
Rudi Grinberg 9dcbc4ce53 Add unit tests for Path.relative 2018-05-07 22:46:28 +07:00
Rudi Grinberg c149043fde Tests for Path.reach 2018-05-07 22:41:43 +07:00
Jeremie Dimino dc0a6d4401 Rename all jbuild files 2018-05-04 12:26:26 +01:00
Jérémie Dimino 325584adfc
Renaming to Dune (#721)
- install two identical binaries: jbuilder and dune
- rename the man pages to dune-*
- change the name in man pages
- change the name of libraries
- add support for dune-project files and add a dune-project file
- add support for dune-workspace files
- start updating the manual
- update the tests
2018-05-02 12:56:12 +01:00
Rudi Grinberg 623ebfc2da Add expectation test to parsing out of findlib toolchain config 2018-05-01 20:16:19 +07:00
Rudi Grinberg 7820e29d28 Port Io to use Path.t 2018-04-25 03:25:27 +07:00
Jeremie Dimino 85f434de2b Improve path.mlt 2018-04-24 13:37:53 +01:00
Rudi Grinberg 6aa1b84fee Move Path to Stdune
* This requires moving Fatal_error and Loc_error to Stdune.Exn as well

* Clflags.workspace_root can no longer be used in Path.to_absolute_filename. We
  just take a parameter instead for now.
2018-04-24 19:33:40 +07:00
Rudi Grinberg 98b2ea795c Move String_map to stdune 2018-04-23 12:43:20 +07:00
Rudi Grinberg a3a9a1c719 Move current configurator API to V1 module 2018-04-11 09:43:37 +07:00