Commit Graph

81 Commits

Author SHA1 Message Date
Jeremie Dimino 04f62ecc03 Get rid of uses of %{first-dep}
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2018-07-10 01:32:26 +07:00
Jeremie Dimino 7c345b677f Forbid Path.append _ (In_build_dir _)
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2018-07-09 12:31:39 +01:00
Rudi Grinberg c4545fce18 Get rid of indexed lookups for deps
Have %{first-dep} to replace %{<}

Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-07-06 18:46:10 +07:00
Rudi Grinberg 204b21f4fb Rename %{<} to %{deps[0]} and implement %{deps[i]}
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-07-06 18:46:09 +07:00
Rudi Grinberg c290ad288f Rename scope_root to project_root
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-07-06 18:45:43 +07:00
Rudi Grinberg d7796156fd Use Sexp.Loc.none rather than reinventing in test
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-07-01 00:34:45 +07:00
Jeremie Dimino 2982567639 Make the default build profile be dev
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2018-06-28 11:23:10 +01:00
Rudi Grinberg ec14661a01 Update tests for new variables syntax
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-06-28 09:48:35 +06:30
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
Jérémie Dimino 0f68e56f64
Remove most useless parentheses from the syntax (#915) 2018-06-27 16:38:05 +01:00
Rudi Grinberg d7ab3d962c Harmonize names in dune and jbuild lexers
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-06-20 19:50:50 +06:30
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