Commit Graph

61 Commits

Author SHA1 Message Date
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
Jeremie Dimino 5307a92ddc Do not allow (chdir ...) with dynamic directories
For instance (chdir ${read:foo} ...) is not allowed. This doesn't seem
really useful since we couldn't express the targets anyway and
supporting it complicate the code.
2017-06-08 10:03:11 +01:00
Jérémie Dimino 2e2a707d4b Automatically install executable with extension `.exe` on Windows (#123)
- Automatically add exe extension when installing executables
- Look for local binaries with .exe extension on Windows
2017-06-08 09:59:43 +01:00
Jeremie Dimino a392b59fcd copy-and-add-line-directive --> copy# 2017-06-05 12:11:39 +01:00
Jeremie Dimino a52c8a4cd7 Add location to a few errors 2017-05-31 16:49:54 +01:00
Jeremie Dimino 373e6c2524 Allow ${...:...} for in (do ...) and add more checks
Check that targets written by the user are a superset of inferred
targets.
2017-05-31 10:15:32 +01:00
Jeremie Dimino 81e6ebd09b Simplify inference 2017-05-30 17:39:23 +01:00
Jeremie Dimino acd1e3e571 Do not fail immediately when expanding actions and a program isn't found 2017-05-30 17:35:49 +01:00
Jeremie Dimino 4e7cb253e1 Add support for reading files from actions
- ${read:<filename>}        -> expand to the contents of the file
- ${read-lines:<filename>}  -> expand to the list of lines in the file
- ${read-strings:<filename> -> expand to the list of lines in the file,
  unescaped using OCaml escaping rules

Generalize ${!...} form
2017-05-30 17:02:45 +01:00
Jeremie Dimino a8a43e4b22 Add ${!^} and ${!@} and document them 2017-05-29 19:12:37 +01:00
Jeremie Dimino 1d3341ed28 Add a (mkdir ...) action 2017-05-29 14:51:46 +01:00
Jérémie Dimino 7c9dcbf284 Added deps/targets inference 2017-05-29 07:51:52 +01:00
Jérémie Dimino b9c9b19f0a Refactoring 2017-05-29 07:51:52 +01:00
Jérémie Dimino 73a4cef9f8 Move the context out of Action.t
And add it to the rule. It is never dynamic, so it is simpler this
way, we just set it in Super_context.add_rule.
2017-05-29 07:51:52 +01:00
Jérémie Dimino 7f0a2d7e12 Remove unused function 2017-05-29 07:51:52 +01:00
Jeremie Dimino 500f224098 Delete old odoc artifacts before running odoc 2017-05-26 18:34:49 +01:00
Jeremie Dimino 35ba1bc0f1 Remove the dir field in Action.t
Simplify things for Build.progn
2017-05-26 18:34:49 +01:00
Jeremie Dimino a3ee81055d Refactor IO functions and fix invalid IOs in gen_rules 2017-05-18 17:12:32 +01:00
Jeremie Dimino 87c958f2e0 Add Build.if_file_exists 2017-05-15 09:37:46 +01:00
Jeremie Dimino ee43c2718f Environment variable names are not case sensitive on Windows 2017-04-24 12:53:18 +01:00
Jeremie Dimino 2f4ec1c281 refactoring 2017-04-17 13:20:21 +01:00
Jeremie Dimino 83c1a6f5bd Fix compat with 4.06 2017-03-31 17:31:55 +01:00
Jeremie Dimino ffa1662ce9 Sandbox the build of the alias module with 4.02
To prevent the compiler from reading the cmi of the aliased modules.
2017-03-31 15:15:54 +01:00
Jeremie Dimino b9976773a3 Add support for sandboxing 2017-03-31 15:06:53 +01:00
Stephen Dolan b5ae1b1f52 Quieter output (#40)
Makes the output quieter by default and add a `--verbose` argument. Print a message when waiting for background jobs to finish only it it takes more than 0.5 seconds.
2017-03-30 17:36:58 +01:00
Jeremie Dimino 8e64aa0990 Lookup bash in the PATH
Closes #36
2017-03-24 11:04:24 +00:00
Jeremie Dimino 2a5dc053fb Fix sexp_of_t (Update_file ...) 2017-03-15 09:15:47 +00:00
Jérémie Dimino ba08f27678 Add a few more redirections
- with-{stdout,stderr,outputs}-to
- ignore-{stdout,stderr,outputs}
- variable ${null} for /dev/null or NUL on Win32
2017-03-13 08:10:59 +00:00
Jeremie Dimino 3db4514d3a Delete pending targets when a command fails 2017-03-07 10:14:16 +00:00
Jeremie Dimino 7850bf67f5 Write_file --> Update_file 2017-03-06 14:34:53 +00:00
Jeremie Dimino a26b787456 Fix expansion of user actions 2017-03-06 12:22:44 +00:00
Jeremie Dimino a188fcacf4 Start incremental compilation 2017-03-03 15:26:14 +00:00
Jeremie Dimino 87fa4c080a Fix the use of Path.reach for program names 2017-03-03 13:53:34 +00:00
Jeremie Dimino 65f06e7454 fix 2017-03-03 13:47:51 +00:00
Jeremie Dimino 470d791bac fix 2017-03-03 13:23:44 +00:00