Commit Graph

1443 Commits

Author SHA1 Message Date
Etienne Millon 628914fe28 Rename path to dep in dune files
See #842

Signed-off-by: Etienne Millon <etienne@cryptosense.com>
2018-07-03 15:59:52 +02:00
Rudi Grinberg 63eb0f2312
Merge branch 'master' into subsystem-versioned 2018-07-03 18:59:02 +07:00
Jérémie Dimino e6a5ef9508
Add the lib_root and libexec_root install sections (#947)
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2018-07-03 10:49:18 +01:00
Rudi Grinberg 7a91a2b23b
Merge branch 'master' into subsystem-versioned 2018-07-03 16:49:05 +07:00
Rudi Grinberg e09695e116 Relax versions for subsystems
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-07-03 16:36:11 +07:00
Rudi Grinberg 8e09749f12 Add missing words to syntax error message
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-07-03 16:12:01 +07:00
Rudi Grinberg aee019577b Change fallback check to use ?check param
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-07-03 16:12:01 +07:00
Rudi Grinberg dee6c9aa96 Disable fallback in dune files
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-07-03 16:12:01 +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
Jeremie Dimino 6589464f21 Rewrite lexing of installed dune files
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2018-07-03 09:22:57 +01:00
Rudi Grinberg 04ee6b0b2d Set M.syntax when reading subsystems generated by dune
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-07-03 01:01:06 +07:00
Rudi Grinberg 044c78281d Use parsing context when parsing name, version, raw triple of sub systems
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-07-03 01:01:06 +07:00
Rudi Grinberg 0051aeca29 Do not read .dune files twice
Reuse the same lexer by pushing back some tokens manually

Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-07-03 01:01:06 +07:00
Rudi Grinberg 4af1f189f0 Using Syntax.Verison.t to decide how to generate sub system files
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-07-03 01:01:06 +07:00
Rudi Grinberg 22cf958b0c Add dune_version field for libraries
This field is necessary to know how to generate .dune files for a particular
library.

Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-07-03 01:01:06 +07:00
Rudi Grinberg 9005ca8998 Simplify error handling
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-07-03 01:01:06 +07:00
Rudi Grinberg 01163776ad s/Dune/lang/
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-07-03 01:01:06 +07:00
Rudi Grinberg f6fe5d20bb Generate dune file version correctly
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-07-03 01:01:06 +07:00
Rudi Grinberg 9c0daa24de Don't hard code parsing_context for sub systems
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-07-03 01:01:06 +07:00
Rudi Grinberg ba9335badf Simplify dump_config with Option.map
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-07-03 01:01:06 +07:00
Rudi Grinberg 7b12e12571 Share loc variable
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-07-03 01:01:06 +07:00
Rudi Grinberg bedad1f689 Set version when parsing dune files
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-07-03 01:01:06 +07:00
Rudi Grinberg 8390af90e4 Simplify versioning matching
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-07-03 01:01:06 +07:00
Rudi Grinberg a4bc260241 Loc.of_lexbuf
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-07-03 01:01:06 +07:00
Rudi Grinberg c906801c69 Parse dune files in a versioned way.
We read the first 3 tokens of a dune file and use it recognize if the file was
generated using jbuilder or dune

Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-07-03 01:01:06 +07:00
Rudi Grinberg 179d23ee38 Expose the type of tokens and lexers
This will be necessary for some manual parsing

Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-07-03 01:01:06 +07:00
Rudi Grinberg 67edb7f89e Move make_loc to Loc module and rename it to of_lexbuf
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-07-03 01:01:06 +07:00
Jérémie Dimino 438fef915f
Forbid #require in dune files in OCaml syntax (#938)
And add run_and_read_lines to replace old use cases of Unix.open_process_in

Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2018-07-02 08:17:53 +01:00
Rudi Grinberg f163f6197a
Merge branch 'master' into rename-build-profile 2018-07-02 13:45:00 +07:00
Rudi Grinberg d19e55bd4d Rename %{build_profile} to %{profile}
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-07-02 12:52:48 +07:00
Jeremie Dimino fc9f3357ab Allow some part of a Build.t to be lazy
This is useful for (alias_rec ...) since at definition site we recurse
through all sub-directories. This is especially relevant now that we
have the default alias which defaults to (alias_rec install).

Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2018-07-01 21:50:44 +01:00
Jeremie Dimino 81bcd0f3e1 Add a "default" alias defined as follow:
- if "default" is specified by the user explicitely, use this
  definition
- otherwise assume the following definition:

  (alias
   (name default)
   (deps (alias_rec install)))

Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2018-07-01 21:50:44 +01:00
Jeremie Dimino 0a970aba35 Improve error message for undefined aliases
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2018-07-01 21:50:44 +01:00
Jeremie Dimino 30db63ef71 Support @@alias to build an alias non-recursively
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2018-07-01 21:50:44 +01:00
Jeremie Dimino 79f3506922 Add String_with_vars.text_only
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2018-07-01 21:36:26 +01:00
Jeremie Dimino b4dd6565b2 Add Ordered_set_lang.Unexpanded.fold_strings
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2018-07-01 21:36:26 +01:00
Rudi Grinberg aa981b3206 Fix error message when workspace file doesn't exist
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-07-01 01:46:32 +07:00
Rudi Grinberg 989a1c0058 don't use wildcard match where not necessary
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-07-01 01:46:32 +07:00
Rudi Grinberg 2b307bfe99 Use Option.some_if when checking for workspace file
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-07-01 01:46:32 +07:00
Rudi Grinberg db4aed42d6 Add %{build_profile} variable
Added for testing but could come in handy elsewhere

Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-07-01 01:46:32 +07:00
Jeremie Dimino 80c2d61416 Factorize construction of default workspace configuration
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2018-07-01 01:46:32 +07:00
Jeremie Dimino 9ffa579dbf Restore rule about empty dune-workspace file
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2018-07-01 01:46:32 +07:00
Jeremie Dimino 757400a6a6 Fix error message about unsupported versions
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2018-07-01 01:46:32 +07:00
Jeremie Dimino 3d65c4e378 Version the user configuration file
- dune requires the (lang ...) line
- jbuilder accepts it but fallback to the jbuild syntax if it's not
  present

Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2018-07-01 01:46:32 +07:00
Jeremie Dimino cdcc520430 Disable old syntax for opam contexts in dune-workspace files
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2018-07-01 01:46:32 +07:00
Jeremie Dimino d5ae6dede0 Make dune require a (lang ...) line in dune-workspace files
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2018-07-01 01:46:32 +07:00
Jeremie Dimino 7c6ecc821f Reimplement workspace.ml with the new parsing API
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2018-07-01 01:46:32 +07:00
Jeremie Dimino 19532a8c3d Generalizes handling of files starting with (lang LANG VER)
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2018-07-01 01:46:32 +07:00
Jérémie Dimino 6823fb0d43 Restore eof_reached
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-07-01 01:46:32 +07:00
Jeremie Dimino d6c35e01df Split xxx-workspace file between jbuilder and dune
- jbuilder only looks for jbuild-workspace files
- dune only looks for dune-workspace files

Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2018-07-01 01:45:02 +07:00
Jérémie Dimino e706421893 Add function to parse version header from sexp files
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-07-01 01:34:33 +07:00
Nathan Rebours 23717d1fd6 Drop findlib:x syntax in dune and display an error (#887)
Signed-off-by: Nathan Rebours <nathan@cryptosense.com>
2018-06-29 21:35:41 +01:00
Jérémie Dimino 7e79e2870d
Make the set language more future proof (#930)
- forbid list starting by an atom not starting with - or :
- allow to avoid the toplevel parentheses in dune files

Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2018-06-29 21:11:47 +01:00
Jérémie Dimino 793a0b7c17
Fix the build on 4.02 by emulating -no-keep-locs (#927)
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2018-06-29 07:40:02 +01:00
Rudi Grinberg 8185337876
Merge branch 'master' into persistent-build-files 2018-06-29 11:07:22 +06:30
Rudi Grinberg 79224ff194 Add name to Vfile_kind functor
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-06-28 22:42:55 +06:30
Rudi Grinberg ef5a2144dd Add magic to to_out_string
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-06-28 22:40:00 +06:30
Jeremie Dimino 473dd9b440 Change the default build profile to dev during bootstrap
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2018-06-28 12:40:27 +01:00
Rudi Grinberg 3177404741 Remove extra module from Vfile_kind functor
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-06-28 18:02:50 +06:30
Rudi Grinberg 2071ac1072 Implement Vfile_kind in term of Persistent
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-06-28 18:01:06 +06:30
Rudi Grinberg aa22671b2f Remove Make_full from file_kind signature since it's unused
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-06-28 17:15:34 +06:30
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
Rudi Grinberg 4738b6df89 Make promoted files a set
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-06-28 17:15:34 +06:30
Rudi Grinberg 2a80d034fa Use Util.Persistent to reimplemented promoted files store
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-06-28 17:15:34 +06:30
Jeremie Dimino af6f003d13 Refactor ordered_set_lang.ml
- use the new s-expression parsing API
- simplify the types and the parsing

Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2018-06-28 11:26:42 +01:00
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
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
Jeremie Dimino 16d34f4a07 Add Which_program to know whether we are dune or jbuilder
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2018-06-28 11:23:10 +01:00
Jérémie Dimino 9585c8f79d
Move ocamldep output files to the object directory (#918)
- this avoid the need for the "already_used" business
- this will make it easier to support multi-dir libraries without copy_files

Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2018-06-28 09:46:20 +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
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
Jérémie Dimino 0eb302252e
Improve the syntax of ppx rewriters and flags (#910)
- old syntax: (pps (ppx1 -arg1 ppx2 (-foo x)))
- new syntax: (pps ppx1 -arg ppx2 -- -foo x)

Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2018-06-25 07:56:35 +01:00
Rudi Grinberg 467cecfccc Add sexp conversion to univeral maps
Very useful for debugging

Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-06-21 23:06:39 +06:30
Rudi Grinberg f35d068836 Move Jbuild.syntax to Stanza module
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-06-21 12:54:27 +01:00
Jeremie Dimino 58997d9df7 Present menhir as an extension
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2018-06-20 16:06:38 +01:00
Jeremie Dimino 74c008ea62 Implement automatic edition of the dune-project file for extensions
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2018-06-20 16:06:38 +01:00
Rudi Grinberg c723150026
Merge branch 'master' into faster-bootstrap 2018-06-20 21:09:17 +06:30
Rudi Grinberg 9883c4450b Add jsoo boot file
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-06-20 20:36:04 +06:30
Rudi Grinberg 98f055dbed add menhir.boot.ml
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-06-20 20:32:57 +06:30
Rudi Grinberg 8597f599d0 Add inline_tests.boot file
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-06-20 20:31:52 +06:30
Rudi Grinberg 5a46dc1998 Add jbuild_lexer.boot to speed up bootstrap
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-06-20 20:21:40 +06:30
Rudi Grinberg 15ffc107ff Add mli's to {dune,jbuild}_lexer
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-06-20 20:21:23 +06:30
Rudi Grinberg d6778a50a2 Rename Lexer0 to Lexer_shared
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-06-20 20:16:12 +06:30
Rudi Grinberg cd6d5dba53 Simplify jbuild lexer and move types around
The types should exist in the lexer module where they're used

Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-06-20 20:00:35 +06:30
Rudi Grinberg 1e5dc322e2 Remove some legacy stuff from the new dune lexer
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-06-20 19:50:58 +06:30
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 e3aa13424d Split dune and jbuild lexers
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-06-20 19:29:16 +06:30
Rudi Grinberg f180470158 Remove outdated comment about atoms
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 8a87b5b5bf Move validation to a `print` function
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-06-20 18:23:23 +06:30
Rudi Grinberg a1d714f9d4 Fix definition of is_valid_jbuild
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 5618be7ab0 Fix 4.02.3 compat
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-06-20 18:23:23 +06:30
Rudi Grinberg 46eba2ef98 Improve validation of jbuild atoms
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
Rudi Grinberg a033ddb894
Merge branch 'master' into fix-lexer-include 2018-06-20 18:22:11 +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
Rudi Grinberg 7d33cb2275 Select lexer based on dune vs jbuild
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-06-20 15:38:55 +06:30
Jeremie Dimino 7c5624b448 Add support for declaring when syntactic elements are deleted/removed/renamed
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2018-06-19 16:26:27 +01:00
Jeremie Dimino 3c15e3d041 Add Sexp.kind
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2018-06-19 16:26:27 +01:00
Jeremie Dimino 43f274b323 Refactor syntax versioning management
Now, the version of the main language as well as the version of
extensions is passed through the user context of sexp parsers.

Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2018-06-19 16:26:27 +01:00
Jeremie Dimino 2d1765285a Add Sexp.Of_sexp.capture
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2018-06-19 16:26:27 +01:00
Jeremie Dimino ff46b30a78 Add Sexp.Of_sexp.set_many
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2018-06-19 16:26:27 +01:00
Jeremie Dimino aed6513b05 Add Univ_map.superpose
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2018-06-19 16:26:27 +01:00
Jeremie Dimino 0e6986c2f2 Add Univ_map.singleton
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2018-06-19 16:26:27 +01:00
Jeremie Dimino 3e2567d2c7 Get rid of the old 'let v1 = ...' names
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2018-06-19 16:26:00 +01:00
Jeremie Dimino 5d1d3a2eae Pass the project through the user context
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2018-06-19 16:26:00 +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 4922faf18a Fix 4.02 build
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2018-06-19 16:20:28 +01:00
Jérémie Dimino d483768b93
Move universal maps from Fiber to Stdune (#892)
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2018-06-19 11:32:10 +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 f7b3e8af7d Fix 4.02 compatibility
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
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 63c1703045 Simplify the dune atom char set
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-06-19 15:41:41 +07:00
Rudi Grinberg 8432ee42cf Separate atom_char for jbuild and dune files
Dune files have a more strict definition of atoms

Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-06-19 01:14:19 +07:00
Rudi Grinberg 19908abf4d Add '%' back to the atom char set
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-06-19 00:59:48 +07:00
Rudi Grinberg 5dcefb2e5b Forbid '%' from appearing in atoms
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-06-18 18:31:56 +07:00
Rudi Grinberg bafb710a5b Remove duplication between Atom.is_valid and should_be_atom
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-06-18 18:31:56 +07:00
Rudi Grinberg eb148da6ec Use extension parameter in error message
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-06-15 12:27:02 +07: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
Etienne Millon 96b01c569c Add link_deps field
In some cases, the linking step requires some dependencies. For example,
passing a version script to the linker. The new `(link_deps)` field
uses the dependency DSL already used in other places.

Closes #852

Signed-off-by: Etienne Millon <etienne@cryptosense.com>
2018-06-13 14:38:47 +02:00
Jeremie Dimino 5d6e919f04 Turn warning about modules being used multiple times into errors
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2018-06-13 11:51:41 +01:00
Jeremie Dimino de26077d28 Get rid of compatibility symlinks for Dune directories
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2018-06-13 11:51:41 +01:00
Jeremie Dimino 6abe76c4e7 Get rid of link_executables in dune files (unused)
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2018-06-13 11:51:41 +01:00
Jeremie Dimino e05c81ac56 Get rid of Jbuild.Provides (unused)
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2018-06-13 11:51:41 +01:00
Jeremie Dimino 86b130560e Store the project directory in Jbuild.Library.t
There is no risk of confusion about the interpretation of the root
field anymore since it has type Path.Local.t.

Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2018-06-12 12:09:11 +01:00
Jeremie Dimino f24cf5d110 Make Dune_project.t private
To ensure we can't mutate the mutable fields and that the value is
shared, which is important for the profile_file field for instance.

To make sure we don't confuse the root field for a path in the build
directory, change its type to Path.Local.t.

Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2018-06-12 12:09:11 +01:00
Jeremie Dimino 250b940c32 Start of support for languages and extensions
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2018-06-12 12:09:11 +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
Jérémie Dimino 58a47e4ff8
Set dune language version to 1.0 (#873)
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2018-06-11 16:17:22 +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
Etienne Millon 9c2e4f14e0 Display an error when no installable mode is found
If an executable is only available as a shared object for example,
Dune cannot install it. In that case, it displays an error message.
However, it is still possible to build a private one explicitly.

Signed-off-by: Etienne Millon <etienne@cryptosense.com>
2018-06-07 15:17:34 +02:00
Rudi Grinberg cbc3464a85
Merge branch 'master' into doc-private 2018-06-07 20:09:41 +07:00
Rudi Grinberg eda3088a49 Move stanzas to toplevel value
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-06-07 17:59:43 +07:00
Rudi Grinberg 724acc8c7c Allow libraries in a package to reference each other in odocs
This allows for circular dependencies for libraries in the same package

Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-06-07 17:59:43 +07:00
Rudi Grinberg c842c76036 Rename typ to source
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-06-07 17:59:43 +07:00
Rudi Grinberg da43480dfc Fix html generation for private libs
private-doc should collect html rather than odoc aliases

Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-06-07 17:59:43 +07:00
Rudi Grinberg 794b2c696b Remove unused html_alias field
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-06-07 17:59:43 +07:00
Rudi Grinberg 20d9b509a1 Setup html rules for libraries and not just their parent pacakge
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-06-07 17:59:43 +07:00
Rudi Grinberg c28bc3d75a Simplify odoc generation
Separate package from html docs

Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-06-07 17:59:43 +07:00
Rudi Grinberg 8740554ebf Rename to_html to setup_html
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-06-07 17:59:43 +07:00
Rudi Grinberg acac3e29b3 Do not silently ignore closure errors
cc @diml

Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-06-07 17:59:43 +07:00
Rudi Grinberg a70ccb6d8b Move types outside of gen functor
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-06-07 17:59:43 +07:00
Rudi Grinberg 2c424063ab Remove polymorphic variant that is of questionable use
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-06-07 17:59:43 +07:00
Rudi Grinberg 08c46dff28
Merge branch 'master' into no-private-module-name 2018-06-07 17:51:36 +07:00
Rudi Grinberg bc53047a95
Merge branch 'master' into remove-concat-or-split 2018-06-07 00:13:09 +07:00
Rudi Grinberg 0c048ac0c5 Remove module private type
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-06-07 00:02:21 +07:00
Rudi Grinberg eff7a24390 Add an intern option to control ordering
There are 2 ways to order interned strings:

* Fast but "random"
* Slow but respects the original order

Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-06-06 23:48:11 +07:00
Rudi Grinberg 7d8a7e94aa Fix incorrect concatenation for multivalues in quoted context
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-06-06 23:42:33 +07: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 c96df4dc15 Inline expand_var
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-06-06 23:42:33 +07:00
Rudi Grinberg 9cc8ff920a Special case t.items = [Text _] and t.items = []
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-06-06 23:42:33 +07:00
Rudi Grinberg 243f3437f2 implement expand in terms of partial_expand
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-06-06 23:42:33 +07:00
Rudi Grinberg 774306c396 Remove old usage for Var_expansion in ppx driver
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 ff173b98d8 Share quote handling in partial and normal expansion
The partial expansion had a bug in its condition for a 1 element value list.
This fixes the bug by implementing the condition once and for all.

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 bab65e989d Allow for proper expansoin of vars in super contexts
Multivalues are no longer allowed when unquoted, and paths are no longer
needlessly converted.

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 cadee0e661 Write explicit interface for Expand_to
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 731b61b0b9 Improve the error message with invalid strings
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-06-06 23:41:57 +07:00
Rudi Grinberg 8351fcb466 Move the multivalue error to a function
Since it's used more than once

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 b3870f78b1
Merge branch 'master' into path-table 2018-06-06 23:39:36 +07:00
Jérémie Dimino bb7827a7b2
Make the output of Dune deterministic in tests (#855)
When the root is not the cwd, print a relative path for the "Entering
..." line rather than an absolute one.

Signed-off-by: Jeremie Dimino <jdimino@janestreet.com>
2018-06-06 16:25:04 +01:00
Rudi Grinberg 2a85cbe074
Merge branch 'master' into path-table 2018-06-06 22:24:18 +07:00
Jérémie Dimino 0fafebe9be
Fix generation of the ppx key for jbuild directories (#860)
Signed-off-by: Jeremie Dimino <jdimino@janestreet.com>
2018-06-06 16:17:40 +01:00
Rudi Grinberg 6ada532b10 type specialize (=)
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-06-06 22:15:53 +07:00
Rudi Grinberg 2350bb1161 Use polymorhic equality
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-06-06 19:23:13 +07:00
Rudi Grinberg d4e8e6dbd4 Change all path indexed tables to Path.Table
This will allow to experiment with faster hashing for paths

Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-06-06 13:54:24 +07:00
Rudi Grinberg 3ab6be3cc2 Add a functorized hashtable with all the functions we expect to stdune
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-06-06 13:54:11 +07:00
Rudi Grinberg 3ad4c06f4a Add Path.Table module
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-06-06 13:28:14 +07:00
Jeremie Dimino ec6ca4be67 Refactor handling of backend selection errors + add tests
Signed-off-by: Jeremie Dimino <jdimino@janestreet.com>
2018-06-05 19:19:10 +01:00
Jeremie Dimino 84f1f9b82b Add a hint for ppx rewriters that are not compatible
Signed-off-by: Jeremie Dimino <jdimino@janestreet.com>
2018-06-05 19:19:10 +01:00
Jeremie Dimino cc5e8443c4 Improve the code for building and installing the compat ppx.exe program
Signed-off-by: Jeremie Dimino <jdimino@janestreet.com>
2018-06-05 19:19:10 +01:00
Jeremie Dimino adcf44942f Add a warning for with_lib_deps
I just spent an hour debugging a stupid bug caused by this...

Signed-off-by: Jeremie Dimino <jdimino@janestreet.com>
2018-06-05 19:19:10 +01:00
Jeremie Dimino b5dfb826ef Restore old ppx behavior for directories with jbuild files
Signed-off-by: Jeremie Dimino <jdimino@janestreet.com>
2018-06-05 19:19:10 +01:00
Jeremie Dimino ed583b7651 Add List.assoc
Signed-off-by: Jeremie Dimino <jdimino@janestreet.com>
2018-06-05 19:19:10 +01:00
Jeremie Dimino b35fbbd7b2 Abstract the ppx driver system
- remove hard-coded knowledge of ocaml-migrate-parsetree and ppx_driver
- get the exact driver parameters directly from the driver itself

Signed-off-by: Jeremie Dimino <jdimino@janestreet.com>
2018-06-05 19:19:10 +01:00
Jérémie Dimino 9358bd5d64
Make Module.t private and add Module.make (#853)
Signed-off-by: Jeremie Dimino <jdimino@janestreet.com>
2018-06-05 18:38:27 +01:00
Jeremie Dimino 5b01ed8246 Add support for block strings
Signed-off-by: Jeremie Dimino <jdimino@janestreet.com>
2018-06-04 13:57:27 +01: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
Rudi Grinberg 93070c9a4d
Merge pull request #833 from rgrinberg/return-expand
Change return type of string expansions
2018-06-02 12:22:31 +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
Etienne Millon e45e431588 Fix error message when no package is defined (#836)
Closes #830

Signed-off-by: Etienne Millon <etienne@cryptosense.com>
2018-06-01 14:25:35 +01:00
Rudi Grinberg 576ff5293e Re-indent string_with_vars with ocp-indent
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-06-01 19:48:19 +07:00
Jeremie Dimino f0e448dc36 Strengthen the parsing of the (lang ...) line
It now has to be the first line of the dune-project file and the
lexical conventions are stricter than the rest of the syntax.

This will allow making changes to the lexical conventions of the
language in the future.

Signed-off-by: Jeremie Dimino <jdimino@janestreet.com>
2018-06-01 08:42:45 +01: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 2e86529ece
Merge branch 'master' into little-cleanups 2018-06-01 02:37:09 +07:00
Rudi Grinberg f07dff5696
Merge branch 'master' into sexpable 2018-06-01 02:33:54 +07:00
Rudi Grinberg f9a215921b Wait for deps and sdeps at once
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-06-01 01:28:14 +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 03c5ffb805
Merge branch 'master' into merlin-fix 2018-05-30 21:51:58 +07:00
Etienne Millon 29f711985d Make "path already scanned" message deterministic (#820)
When a symlink loop is detected, the following message is printed:

> Path X has already been scanned. Cannot scan it again through symlink Y

However, the actual symlink that is displayed depends on the order in
with `readdir` outputs the contents (which depends on FS internals).

This sorts the directory list so that the message is deterministic.

It can be tested by adding for example a `List.rev` call after
`Path.readdir`: the affected version will return a different version in
the `github764` test.

Signed-off-by: Etienne Millon <etienne@cryptosense.com>
2018-05-30 12:57:23 +01:00
Jérémie Dimino 171c22614d
Use Marshal for the incremental and digest databases (#817)
Signed-off-by: Jeremie Dimino <jdimino@janestreet.com>
2018-05-30 11:54:04 +01:00
Rudi Grinberg 0d3bdf34fc Small cleanup of merlin generation
Use the the known src/obj dirs as the initial value for accumulation

Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-05-30 14:41:56 +07:00
Rudi Grinberg 8f16afe293 Fix merlin generation
The optional build contexts were being dropped from the obj dirs instead of the
source dirs.

Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-05-30 14:39:47 +07:00
Rudi Grinberg 85e4b13780 Change Paths_glob to return a set of paths
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-05-29 02:24:52 +07:00
Jeremie Dimino d2b66279f6 Use Sys.{win32,cygwin} rather than Sys.os_type
The former functions are optimized away while the latter isn't.

Signed-off-by: Jeremie Dimino <jdimino@janestreet.com>
2018-05-28 17:02:51 +01:00
Jeremie Dimino 547998d6c6 Fix an issue when a file is part of several packages
Signed-off-by: Jeremie Dimino <jdimino@janestreet.com>
2018-05-28 13:47:55 +01:00
Rudi Grinberg 2b7ee377af
Merge branch 'master' into no-interning 2018-05-28 19:18:21 +07:00
Rudi Grinberg 665c251678
Merge branch 'master' into remove-path-set-conversion 2018-05-28 18:38:04 +07:00
Rudi Grinberg 4a0e5a76af Remove more Path <-> List conversion in rules_for_files
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-05-28 18:04:48 +07:00
Rudi Grinberg 836b27ae2b Remove an extra conversion in rules_for_files
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-05-28 17:52:05 +07:00
Rudi Grinberg da8064893c Add No_interning module for easy experimentation
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-05-28 14:51:37 +07:00
Rudi Grinberg 2bb9895817 Make explode_path work in 1 pass
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-05-28 14:38:35 +07:00
Rudi Grinberg da469e66f0 Fix explode_path to work on absolute paths
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-05-28 14:36:40 +07:00
Rudi Grinberg 7b824febf3
Merge branch 'master' into suffix-prefix-fast 2018-05-28 14:30:53 +07:00
Rudi Grinberg fe9e6fb8c9
Make Interned generative again (#808)
I accidentally removed this in the last PR. I think it should probably be brought back.

Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-05-28 14:18:10 +07:00
Rudi Grinberg 6f3467ad96
Merge branch 'master' into suffix-prefix-fast 2018-05-28 14:16:13 +07:00
Jeremie Dimino b31d281949 Add Module_compilation.ocamlc_i
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2018-05-28 08:10:12 +01:00
Jeremie Dimino 3bd9addeb2 Use Compilation_context in menhir
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2018-05-28 08:10:12 +01:00
Jeremie Dimino c9ead23c7d Add Compilation_context
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2018-05-28 08:10:12 +01:00
Jeremie Dimino 69af40dced Compute includes outside of build_modules
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2018-05-28 08:10:12 +01:00
Jeremie Dimino 634cd25b1b Allow to compute the deps of an auxiliary module
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2018-05-28 08:10:12 +01:00
Jeremie Dimino cc7bd5ebb1 Allow modules to be only preprocessed and not linted
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2018-05-28 08:10:12 +01:00
Jeremie Dimino ac1c407cab Split Preproressing.pp_and... in two functions
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2018-05-28 08:10:12 +01:00
Jeremie Dimino 5c4027aff8 Re-work the code to handle (include ...)
Signed-off-by: Jeremie Dimino <jdimino@janestreet.com>
2018-05-28 07:59:05 +01:00
Jeremie Dimino d211272d24 Ignore jbuild_version stanzas
These are no longer necessary as they are super-seeded by (lang
...) stanzas in dune-project files

Signed-off-by: Jeremie Dimino <jdimino@janestreet.com>
2018-05-28 07:59:05 +01:00
Jeremie Dimino cb6baa6c96 Make Stanza.t an open type
Signed-off-by: Jeremie Dimino <jdimino@janestreet.com>
2018-05-28 07:59:05 +01:00
Rudi Grinberg 89b0e397f7 Check suffix and prefix without allocation
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-05-27 01:23:55 +07:00
Rudi Grinberg e5f873da15 Make Interned generative again
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-05-26 17:14:00 +07:00
Rudi Grinberg 88e71c3432
Speed up merlin generation (#805)
Improve merlin generation by minimizing intermediate strings and reusing a buffer.
2018-05-26 11:04:21 +07:00
Rudi Grinberg 15ce5211b8
Merge branch 'master' into remove-extra-conversion 2018-05-25 19:17:38 +07:00
Rudi Grinberg f0e0bf5156 Remove extra set to list conversion
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-05-25 12:06:22 +07:00
Jérémie Dimino 459d17fc13
Merge branch 'master' into odoc-master-titles 2018-05-24 17:37:28 +01:00
Rudi Grinberg d3edc454ac Add initial size to interned
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-05-24 20:51:12 +07:00
Rudi Grinberg cbf2727209 Add a resizing policy for Interned
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-05-24 20:22:13 +07:00
Rudi Grinberg 1aa6209584 Move interned to stdune
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-05-24 18:23:02 +07:00
Rudi Grinberg 274bb70994 Move fmt to stdune
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-05-24 18:22:55 +07:00
Rudi Grinberg 6b130e809c Move int sets and maps to stdune
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-05-24 18:22:36 +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 8e8cda01b2 Replace dyn_paths with dyn_path_set
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-05-24 14:56:39 +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 48cd886bfc Simplify the API for inlined records in constructors 2018-05-23 14:24:41 +01: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
Anil Madhavapeddy b2dd904847 odoc: make indexes work with the development version of odoc
We now generate library titles at level 2 instead of level 1,
and remove trailing fullstop after the `modules` entry.

The development branch of odoc has a more precise parser that
enforces that there is only a single title level field in the
generated odoc.

Closes #791

Signed-off-by: Anil Madhavapeddy <anil@recoil.org>
2018-05-23 10:59:19 +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
Rudi Grinberg fc7d2fef21 Use reach_for_running consistently
Also change the default from to Path.root
2018-05-20 20:48:32 +07:00
Rudi Grinberg a6f2b5be9b Fix exception to be friendly when loc is available
When the loc is available, the error is likely because of an ill-defined user
rule. We should simply reflect the location back to the user.
2018-05-20 13:22:59 +07:00
Rudi Grinberg 9a62e70471 Fix command line printing for errors 2018-05-19 18:11:31 +07:00
Jeremie Dimino cae4948b72 Allow fields that can appear multiple times 2018-05-19 10:14:50 +01:00
Rudi Grinberg 8e72a3a951 Use Path.root as the default 2018-05-17 22:58:21 +07:00
Jeremie Dimino 9d3117d63e Fix bug exposed by previous commit 2018-05-17 15:48:19 +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
Jérémie Dimino ac8bffc1f3
Get rid of Jbuild.Scope_info and use Dune_project instead (#776) 2018-05-16 16:21:08 +01:00
Rudi Grinberg da827f7946
Merge pull request #769 from rgrinberg/fix-764
Detect circular sym links
2018-05-16 21:58:22 +07:00
Jeremie Dimino 2192a549f4 Use dev/inode to detect loops 2018-05-16 14:23:01 +01:00
Jérémie Dimino 95d9cf0415
Refactor Jbuild.Scope_info.Name and Dune_project.name (#775) 2018-05-15 14:07:02 +01:00
Rudi Grinberg ac078fcdbb add cycle and max depth to symlink following 2018-05-15 19:29:20 +07:00
Rudi Grinberg 540a22315b Refactor symlink following
Correctly resolve relative symlinks and add better error handling. Also move the
logic to the path module.
2018-05-15 17:33:51 +07:00
Rudi Grinberg 7580b8e16f Detect circular sym links
Fix #764
2018-05-15 17:33:27 +07:00
Jérémie Dimino 60c7f6fde4
Collect projects in the file tree directly (#774) 2018-05-15 09:46:07 +01:00
François Pottier d444aeefea Cleanup of [src/menhir.ml]. (#770)
This is purely for the sake of readability;
there should be no change in functionality.
Code is now shared between the case where [--base]
is used and the case where it isn't.
2018-05-14 13:07:48 +01:00
Jeremie Dimino 76ab05d620 Use Utils.executable_object_directory instead of inlining it in gen_rules.ml 2018-05-14 13:06:32 +01:00
Jérémie Dimino bc19e14b35
Add ignored_subdirs stanza (#767) 2018-05-12 15:38:22 +02:00
Rudi Grinberg 3a8e4cf54d Fix off by 1 in Path.is_descendant 2018-05-11 10:30:21 +07:00
Rudi Grinberg a57013c3f3 Add check for relative path in Local.relative
this is to prevent an infinite loop in explode_path
2018-05-11 09:37:39 +07:00
Jeremie Dimino bffd5407ce Fix #734 2018-05-10 11:31:39 +01:00
Jeremie Dimino ef7a5519aa Fix #761 2018-05-10 11:27:56 +01:00
Jeremie Dimino 7c1e1923a0 Fix #759 2018-05-09 16:32:35 +01: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 7e9be66e6f Don't check if path is root directly 2018-05-09 17:54:52 +07:00
Rudi Grinberg 28f451f33c
Merge pull request #757 from rgrinberg/path-refactors
Path refactorings.
2018-05-09 17:53:56 +07:00
Rudi Grinberg ad4bc43a9f
Merge pull request #755 from rgrinberg/rm-rf-safety
Rm -rf safety
2018-05-09 17:45:06 +07:00
Rudi Grinberg c563fc1db8 Re-implement many path functions using kind
This will make it easier to port them to symbolic paths as this check is also
necessary there.
2018-05-09 17:33:05 +07:00
Rudi Grinberg 92b351de30 Small refactoring to call Path.absolute one less time 2018-05-09 17:32:36 +07:00
Rudi Grinberg 46d74e1a96 Implement Path.explode_exn in terms of Path.explode 2018-05-09 17:32:33 +07:00
Rudi Grinberg 65385bbaa4 Remove Path.drop_prefix
not used anywhere
2018-05-09 17:29:19 +07:00
Rudi Grinberg 47d54854e4 Safety feature for Path.rm_rf 2018-05-09 17:11:09 +07:00
Jérémie Dimino 5ac3acf195
Add File_tree.Dir.dune_file (#749) 2018-05-09 09:18:01 +01:00
Rudi Grinberg 78612e0649 Move of_user_written_path to Alias0.T
This is done to avoid double check of the path being in build dir
2018-05-09 08:10:41 +07:00
Rudi Grinberg 8eba040b92 Rename Alias.of_path to Alias.of_user_written_path
And add a loc argument for correct error messages
2018-05-09 08:05:57 +07:00
Rudi Grinberg 84831308f0 Make sure that Alias0.dir always goes through dir check
the directory must always be inside the build dir, so we make sure that any way
to create the record validates this invariant
2018-05-09 08:05:57 +07:00
Rudi Grinberg 0f648f1387 Make sure Alias0.dir is always in the build_dir 2018-05-09 08:05:57 +07:00
Rudi Grinberg 4c7a78e5d6 Pass some missing loc's when using Path.relative 2018-05-09 08:01:57 +07:00
Jérémie Dimino e6650a322f
Better error message for #745 (#748) 2018-05-08 16:28:50 +01: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
Jérémie Dimino 4d8ca489be
Add support for environment & build profiles (#419) 2018-05-04 16:49:25 +01:00
Jeremie Dimino dc0a6d4401 Rename all jbuild files 2018-05-04 12:26:26 +01:00
Jeremie Dimino 70abc5544d Add support for dune files 2018-05-04 12:26:26 +01:00
Jeremie Dimino cb4e167232 Get rid of jbuild_file_in
This function will be wrong once we support both dune and jbuild
files. Use more precise locations instead.
2018-05-03 13:54:47 +01:00
Jeremie Dimino db91543e3f Support version stanzas in dune-project files 2018-05-03 11:07:45 +01:00
Jeremie Dimino 8d4e1904a2 Refactor dune-project parsing 2018-05-03 11:07:45 +01: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
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
Jérémie Dimino b54c438fda
Scan the file-system lazily (#732)
Fix #228
Fix #718
2018-05-01 16:55:31 +01:00
Rudi Grinberg 5f237e3a4d Add pretty printers to Findlib.Conf.t 2018-05-01 19:37:51 +07:00
Rudi Grinberg ec3a3bf673 Remove interpret' 2018-05-01 18:50:51 +07:00