Commit Graph

95 Commits

Author SHA1 Message Date
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
Rudi Grinberg 8458bf3b15 Move env related functions to Env module 2018-03-12 18:43:02 +07:00
David Allsopp b604871aab Limit number of simultaneously opened fds (#578)
Non-optimal solution: only handles the common case.
2018-03-08 18:28:14 +00:00
Jérémie Dimino 3fd3eb8a12
Split src/import.ml into a new library src/stdune (#548)
- make sure type t always come first
- Map.map, Map.fold, ... never pass the key to the callback while Map.mapi, Map.foldi, ... do
- removed the ~key and ~data labels, I find them useless and annoying
- Set.elements --> Set.to_list
- Map.bindings --> Map.to_list
- Map.of_alist --> Map.of_list
- added Ordering.t for comparison functions
- renamed Inl/Inr to Left/Right. The latter seems clearer
- moved List.longest to String.longest
- added a Pp module with a nicer API than Format
2018-02-25 16:35:25 +00:00
Christophe Troestler fbafb3d47a Make Atom.t private and consequences (#524) 2018-02-24 23:33:26 +00:00
Christophe Troestler 67c9363c7d Use more precise combinators "atom" and "quoted_string" 2018-02-15 00:45:06 +01:00
Christophe Troestler 453ce1eb56 String_with_vars: Use a functor to create generic expansion fun
This required to remove the labeled ~dir arguments in Action because
one would have had to use the same label for the expansion context in
String_with_vars, which would have been odd for generic expansion
functions.
2018-02-15 00:43:08 +01:00
Christophe Troestler a91cf637ae Trigger an error for unquoted concatenations with list variables
Thus x${v} where v is a variable that returns several values must
necessarily be quoted: "x${v}".
2018-02-15 00:43:08 +01:00
Christophe Troestler 73f529ae82 Rename String to Quoted_string 2018-02-15 00:43:08 +01:00
Christophe Troestler c27cb3541e Let the parser distinguish quoted strings
Fixes https://github.com/ocaml/dune/issues/408
2018-02-15 00:43:08 +01:00
Christophe Troestler e8e3698e15 String_with_vars: represent quoted vars differently from unquoted ones
Define the representation for quoted variables, adapt the test of
strings made of a single variable, and add a constructor.
[String_with_vars.t] is not yet able to use that representation
because the necessary information is not available from the parser.
2018-02-15 00:43:08 +01:00
Jeremie Dimino f949588742 Actions printed by "jbuilder rules" are now using relative paths
This seems more natural
2018-02-07 18:10:05 +00:00
Jérémie Dimino 4e4f651b37
Don't stop on the first error (#477)
Before, jbuilder used to stop its execution after an error was
encountered. Now it continues until all branches have been explored.

To implement this feature, Future was rewritten as a Fiber module with
a simpler semantic.

This patch contains various other refactorings.
2018-02-06 14:39:03 +00:00
Jeremie Dimino 143145b19c Remove old stuff about updated files
This dates from the time we were using timestamps for incremental
compilation.
2018-02-01 08:23:36 +00:00
Jeremie Dimino b9c4dd2339 Remove files from the digest cache when promoting them.
This is to avoid problems with incremental compilation on OSX.

Fix #456
2018-02-01 08:23:25 +00:00
David Allsopp d2706b448b Remove readonly attribute on Windows before unlink
The legacy DOS readonly attribute is a tedious difference on Windows,
because a user may have permission to delete a file, but unlink fails
because the attribute is set.

Signed-off-by: David Allsopp <david.allsopp@metastack.com>
2018-01-22 11:14:18 +00:00
Jérémie Dimino 5651eb80b5
Better behavior when aliases have targets (#426)
Ignore the targets and report a warning.
2018-01-19 22:17:11 +00:00
Jérémie Dimino 9dd5ab74e4
[WIP] Load rules lazily (#370)
* Change jbuilder to load rules lazily

Rules are now loaded on a per directory basis as needed. This speed up
the start up time on large workspaces.

Does various refactoring as well.

* Simplify the handling of META files

We no longer generate a META.foo.from-jbuilder file. Nobody is using
this feature and it's making the new code more complicated.
2018-01-19 08:50:06 +00:00
Jérémie Dimino b06aad431e
Replace promote actions by diff actions + promote command (#421)
* Remove (promote ...) and (promote-if ...)
* Remove `--promote ...`
* Add (diff ...) and (diff? ...)
* Add `jbuilder promote` and `--auto-promote`
* Fix #423
2018-01-18 11:32:20 +00:00
Jérémie Dimino 49edf8ed65
Accept correction files produced by ppx_driver (#415)
* Accept correction files produced by ppx_driver so that [@@deriving_inline] works
* Change promote-if so that it doesn't promote the file when the source file doesn't exist in the source tree
2018-01-16 12:28:02 +00:00
Jeremie Dimino ce901a4731 Fix the build 2018-01-15 13:50:08 +00:00
Jérémie Dimino eab1ff6c7b
Add promote actions and include stanzas (#402)
Add a promote action that allows to copy over generated files as
source files and an include stanza allowing to include a file in a
jbuild file.
2018-01-15 13:24:25 +00:00
Christophe Troestler f8617b5721 Let "concat" or "split" be a quality of the variable (#336)
* Let variables say whether they are Concat or Split

To concatenate the contents of a split variable, put it in a string:
"${var} ".

Fixes #300

See also https://github.com/janestreet/jbuilder/issues/408

* Issue a deprecation warning for ${!...}

* Treat ${CC}, ${<}, ${^} and ${read-lines:...} as split vars

* Change ${!^} into ${^} for this project jbuild rules
2018-01-15 09:32:40 +00:00
Jérémie Dimino a1026f46d1 Add action helpers
Add constructor functions for Actions
2018-01-13 19:51:18 +08:00
Rudi Grinberg 1ff8a7989c Cross compilation support
In a host/target setup, all binaries that are built (including preprocessors)
are ran using the host *for* building targets. Final target artifacts are
compiled using the target toolchain
2018-01-01 22:34:41 +08:00
David Allsopp 9d3c0b649c Fix copy# for Microsoft C compiler
Microsoft CL doesn't support #n and requires the more strictly correct
directive #line

Signed-off-by: David Allsopp <david.allsopp@metastack.com>
2017-12-22 08:16:09 +01:00
Rudi Grinberg a57c488dd7
Fix jbuilder rule in case of missing binaries (#292)
Make jbuilder rules work even when binaries are missing

* Proper error messages for missing binaries

* Unify Prog_spec and Maybe_prog

both can simply be unified into a path type that has a hint for the error

* Remove scarcely useful in_the_tree parameter

It's always true except for the C compiler. In which case, there's no harm in
making it true.

* Make Artifacts return Action.Prog

The old return value was simply converted to this anyway. It's simpler to just
return the proper error straight up.

* Remove remains of in_the_tree
2017-11-07 21:42:55 +08:00
François Bobot cecf0a2aaf Add (copy_files <glob>) stanza (#35)
Add (copy_files <glob>) and (copy_files# <glob>) stanzas. These
stanzas setup rules for copying files from a sub-directory to the
current directory.

This provides a reasonable way to support multi-directory
library/executables in jbuilder.
2017-09-10 02:31:07 +01:00
Jeremie Dimino 297e82061e Update_file --> Write_file
The difference is not meaningful anymore. Also expose Write_file as
write-file.
2017-08-17 15:13:11 +01:00
Jeremie Dimino 7a8fa99f5a Remove Create_file action
Makes no sense now that we use digests rather than timestamps
2017-08-17 15:13:11 +01:00
Jeremie Dimino 508c90201f Replace timestamp checks by file contents checks 2017-08-17 15:13:11 +01:00
David Allsopp bf3fa0831d Add Sys.force_remove
Sys.force_remove is Sys.remove, except on Windows, where it will remove
the "read-only" attribute and re-try a failed Sys.remove
2017-06-15 12:14:56 +02:00
Jeremie Dimino e4300e7b51 Make (run prog ...) behave the same as (run ${bin:prog} ...)
This just seems like a better default
2017-06-08 10:37:25 +01:00