Commit Graph

190 Commits

Author SHA1 Message Date
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
Rudi Grinberg f7f22cbf52 Make Path.parent return option
Use _exn whenever we know the parent exists
2018-05-09 17:56:50 +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
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 53202d0a09
Make -j default to the number of CPUs (#726) 2018-04-26 16:10:14 +01:00
Rudi Grinberg f44b8bdb1b Unhardcode _build dir everywhere 2018-04-25 18:22:48 +07:00
Rudi Grinberg b02c61f63c Change the prog arg in Process to Path.t 2018-04-25 16:30:18 +07:00
Rudi Grinberg 7820e29d28 Port Io to use Path.t 2018-04-25 03:25:27 +07:00
Jérémie Dimino 239ff0054e
Remove jbuilder_ prefix for vendored libraries (#720)
It's not useful since we are not installing them. Also unwrap
libraries that are unwrapped upstream.
2018-04-24 14:38:30 +01:00
Rudi Grinberg 98b2ea795c Move String_map to stdune 2018-04-23 12:43:20 +07:00
Rudi Grinberg 530dbfeb81 Move String_set to stdune 2018-04-23 12:08:09 +07:00
Jeremie Dimino 294d693749 Do not load the user configuration file when INSIDE_DUNE is set 2018-04-12 12:43:14 +01:00
Jeremie Dimino 22b024a977 More hacks for external-lib-deps
Fix #644
2018-04-09 06:31:52 +08:00
Jeremie Dimino a1812fccd5 Add INSIDE_DUNE to detect when we are running from unside Dune
And use the following defaults: -j 1 --root . --display quiet
2018-04-03 11:43:07 +08: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 2634477def Change Action to include the context's exec env 2018-03-16 00:44:23 +08:00
Rudi Grinberg bd457ea549 Use Env.t over string array in another place 2018-03-15 18:24:41 +08:00
Rudi Grinberg 7c287a5e0a Change Package.Name.t to interned type 2018-03-03 20:41:29 +07:00
Rudi Grinberg ff05369868 Introduce package name private type 2018-03-03 01:44:03 +07: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
Jérémie Dimino 9e4cc84370
Refactor library management (#516)
Lib module
----------

We have a new module Lib that replaces Lib, parts of Lib_db and parts
of Findlib. It is used to manage all libraries (internal and
extrernal). Lib.t represent a completely resolved library, i.e. where
all the dependencies have been resolved. Lib.Compile is used to
provide what is necessary to build the library itself. Lib.Meta
provides what is necessary to generate the META file for the library.

We also have library databases represented as Lib.DB.t. A library
database is simply a mapping from names to Lib.t values and and
created from a resolve function that looks up a name and return a
Lib.Info.t. A Lib.Info.t is the same as a Lib.t except that
dependencies are not resolved.

A library database can have a parent database that is used to lookup
names that are not found in the current database. In practice we have
the following hierarchy:

1. For every scope, we have a library database that holds all the
   libraries of this scope. In this DB, a library can be referred by
   either it's name or public name

2. the parent of each of these databases is a database that holds all
   the public libraries of the workspace. In this DB libraries must be
   referred by their public name

3. the parent of this DB is for installed libraries

(1) databases are accessible via Scope.libs
    (Super_context.find_scope_by_{name,dir} sctx xxx)
(2) is accessible via Super_context.public_libs sctx
(3) is accessible via Super_context.installed_libs sctx

The dependencies of a library are always resolved inside the DB it is
part of. When we compute a transitive closure, we check that we don't
have two libraries from two different DB with the same name. So for
instance linting Base should now supported.

Jbuild.Scope_info
-----------------

Jbuild.Scope was renamed Jbuild.Scope_info

Scope module
------------

This replaces Lib_db. A Scope.t is now just a pair of a
Jbuild.Scope_info.t and a Lib.DB.t. Scope.DB.t is an object used to
lookup scopes by either name or directory.

We no longer have an external scope or special anonymous
scope. Instead one should use Super_context.installed_libs or
Super_context.public_libs depending on the context.
2018-02-20 11:46:10 +00:00
Jérémie Dimino 5669f57907
Fix display when output is not a tty (#518) 2018-02-15 14:04:00 +00:00
Jérémie Dimino dfb8afb46e
Compute the transitive closure of findlib packages lazily (#507)
We are now computing the transitive closure of findlib packages
lazily. This simplify the code and prepare for subsequent changes to
library management.

Fix #484 at the same time
2018-02-13 17:49:07 +00:00
Jeremie Dimino b46cef533a Make Findlib.package abstract 2018-02-07 18:10:05 +00: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
Jeremie Dimino fae08c79be Allow to set the concurrency level from the config file 2018-02-07 12:11:27 +00:00
Jérémie Dimino 0570e09f9a
Add a configuration file and a quiet mode (#490) 2018-02-07 11:38:21 +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
Rudi Grinberg e61142e885
Merge pull request #460 from ocaml/fix-promote-tests-on-osx
Fix bad interaction between promotion and incremental builds on OSX
2018-02-01 20:15:18 +08: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
Rudi Grinberg 56c6f3bee7 Make target_hint not fail when target is Path.root
fix #468
2018-02-01 16:22:11 +08:00
Jérémie Dimino 437211f74f
Expose the promote mode (#437) 2018-01-25 19:07:46 +00:00
Rudi Grinberg 58f9e9840c Replace janestreet/jbuilder with ocaml/dune
Update all links where necessary
2018-01-23 17:52:44 +08: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
Jeremie Dimino d4dec9b4f5 Change the default of --promote from check to copy
As said in the PR. I forgot to push the commit.
2018-01-15 14:55:17 +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
Jeremie Dimino 6e64156913 Add target support
* Create targets from findlib toolchains by reading findlib configs
* Define targets inside workspace files
* Set cross compilation targets with -x argument
2018-01-01 22:34:41 +08:00
Rudi Grinberg 058643608c
Jbuilder exec rebuilt if possible option (#345)
Make jbuilder exec build its target

Jbuilder will now attempt to rebuild the target before executing it. This option can be turned off by passing in --no-build
2017-12-11 18:23:07 +08:00
François Bobot 13fed1f1ce
Merge pull request #339 from rgrinberg/fix-jbuilder-exec-utop
Fix jbuilder exec from sub dirs & utop
2017-12-01 13:41:21 +01:00
Rudi Grinberg 785beeafac
Add option to force running tests (#320)
Option to force running tests

The mechanism allows for forcing any alias, but only forcing tests is exposed to the user. Aliases are forced by deleting all the alias files that belong to a particular alias. The option for forcing tests is called --force.
2017-11-28 19:03:22 +08:00
Jeremie Dimino ce0ecaf9e0 Restore cwd before execve 2017-11-25 23:25:13 +08:00
Rudi Grinberg 0c2228e7bc
Refactor jbuilder exec path handling (#327)
There's no need for runcwd as initial_cwd is already defined somewhere. Add
Filename.analyze_program_name function to make the clearer.
2017-11-14 15:19:58 +08:00
Rudi Grinberg 9c8ecc9fbc
Improve jbuilder exec (#286)
* Improve jbuilder exec

When the path passed contianed to exec contains a '/', it will be interpreted
relative to the path of a build context (default context when absent)

* Update man page of jbuilder exec

* Add String.drop_prefix

* Make jbuilder exec understand relative/absolute paths

jbuilder exec will now interpret absolute paths as relative to the specified
build context. While relative paths will now be intepreted relative to the cwd
appended to the specified build context.

* Fix jbuilder exec /absolute/path

When the path provided to jbuilder exec is absolute, we should ignore the build
context for looking up the binary.

* Fix exec when ran outside of root

Previously, a call like $ jbuilder exec ./xxx --root=p would raise
an exception. Now ./xxx will be intepreterd relative to --root.

* Fix relative paths when jbuilder is ran outside of --root

* Simplify documentation for jbuilder exec
2017-11-07 21:41:09 +08:00
Rudi Grinberg e23f6fe8bb Use Alias.of_path over Path operations and Alias.make 2017-10-19 08:35:08 +08:00
Jeremie Dimino 30a914278e All aliases on the command line are recursive
Calling 'jbuilder build @path/x' always request the alias `x` in
`path` and all its descendant.

To implement that, change the build system interface to take an
arbitrary request as argument.
2017-10-14 10:37:36 +08:00
David Allsopp 0e46cdd4e3 Clflags.workspace_root needs to be absolute
Since the fix for #262 in 3fb19150 it is necessary for workspace_root to
be absolute. In particular, `jbuilder build -p foo` (which implies
`--root=.`) needs to evaluate what that root is.
2017-09-29 14:14:21 +01:00
Daniel Hillerström 267ea46c4d Fixed a typo in the documentation. 2017-08-06 11:04:57 +01:00
Rudi Grinberg b668d9189f Add a utop subcommand (#183)
Add a utop subcommand that build and execute a utop where all the libraries defined in the current directory are immediately available for interactive use.
2017-08-04 08:59:35 +01:00
Jeremie Dimino 2f801cf17f typo 2017-07-27 12:08:19 +01:00
Jeremie Dimino b1e140eef3 Add --destdir + document --destdir, --prefix and --libdir
Should help #202
2017-07-27 12:06:14 +01:00
Jeremie Dimino cfd43d5282 Simplify a bit the rules for installation of library files 2017-07-25 17:07:24 +01:00
François Bobot 747cf220c6 Install by specifying libdir for opam-installer
- change default findlib directory (ocamlc -where)
2017-07-25 16:44:14 +01:00
Jeremie Dimino 241f1204cb Really fix #137 2017-06-09 15:18:27 +01:00
Jeremie Dimino fff5763a53 Fix #137: fix hint when all missing libs are optional 2017-06-09 14:49:08 +01:00
Jeremie Dimino b74544919a jbuild_types.ml --> jbuild.ml 2017-06-02 14:32:05 +01:00
Anton Bachin e3d879dbd8 Fix some typos in command option docs (#117) 2017-06-02 10:51:32 +01:00
Jeremie Dimino 543354c070 Fix #115 2017-06-01 16:34:04 +01:00
Jeremie Dimino f210b32fd0 Improve the behavior of "jbuilder exec" on Windows 2017-05-31 14:41:45 +01:00
Jeremie Dimino f18afbf8aa Fix jbuilder exec for windows 2017-05-31 11:28:39 +01:00
Jeremie Dimino 65150b4166 Add -debug-backtrace 2017-05-29 14:18:07 +01:00
Jeremie Dimino c73b1f1fe3 Add a --no-buffer option
Following #107
2017-05-29 10:57:04 +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
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 f1f95cda37 Clarify --only-packages 2017-05-26 12:33:55 +01:00
Richard Davison 91d03de221 Add clean subcommand (#89) 2017-05-26 11:32:32 +01:00
Jeremie Dimino 4dd0de1723 Fix #72 2017-05-19 14:16:00 +01:00
Jérémie Dimino 0a2157919c Split more long lines in makefiles 2017-05-19 08:27:21 +01:00
Jérémie Dimino 42cb733c6a Remove --debug-{actions,rules}
They are superseeded by 'jbuilder rules'
2017-05-19 08:27:21 +01:00
Jérémie Dimino 00ddd7f7a2 Improve formatting 2017-05-19 08:27:21 +01:00
Jérémie Dimino fe30935fa2 Rename 'extract-makefile' to 'rules' 2017-05-19 08:27:21 +01:00
Jeremie Dimino d219020b2f added jbuilder extract-makefile 2017-05-18 19:05:01 +01:00
Jeremie Dimino 6f20a3d938 external-lib-deps now suggest an opam command 2017-05-18 14:31:31 +01:00
Jeremie Dimino b2a9d6dc51 Add: jbuilder installed-libraries --not-available 2017-05-17 14:56:53 +01:00
Jeremie Dimino b514644f9b Revert "Add support for hooks"
This reverts commit c937dc9183.
2017-05-09 15:11:09 +01:00
Jérémie Dimino c937dc9183 Add support for hooks 2017-05-09 08:18:10 +01:00
Jeremie Dimino cbc890dc5c Add the version to the exe 2017-05-08 17:19:27 +01:00
Jeremie Dimino add2a063c0 Detect the package name as topkg-jbuilder does 2017-05-08 16:56:21 +01:00
Jeremie Dimino 6d0c8198eb Substitute watermarks for jbuilder itself 2017-05-08 16:56:21 +01:00
Jeremie Dimino dce491e661 Add a subst command for watermarking files 2017-05-08 16:56:21 +01:00
Jeremie Dimino ef6be544a3 Keep the package context after parsing 2017-05-05 11:21:46 +01:00
Jeremie Dimino 83f686a821 Hint for mistyped targets 2017-04-25 16:22:17 +01:00
Jeremie Dimino f134182f82 Fix the lookup of the executable in: jbuilder exec 2017-04-10 18:10:55 +01:00
Jeremie Dimino 72550dc3e0 Add a -p/--for-release-of-packages command line argument
`-p pkgs` is the equivalent of `--root . --only-packages pkgs`
2017-04-10 10:44:49 +01:00
Stephen Dolan 110e4a63d0 Make "build" build @install by default 2017-03-31 10:30:08 +01:00
Adrien Guatto 6ce4d54274 Escape @ in error message 2017-03-30 17:42:07 +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 3ae53de431 Add an "executable" stanza and make it easier to install executables
(executable ...) is easier to use where there is a single executable.

Also add a (package ...) and (public_name <name>)/(public_names
(<names)) to executable/executables stanzas, to make it easier to
install executables.

Closes #33
2017-03-22 15:09:26 +00:00
Jeremie Dimino 3b0c6403ee Fix a bug in Findlib.available
Fix #24
2017-03-15 12:07:20 +00:00
Jeremie Dimino 5366f76fdb Print optional deps as optional with external-lib-deps --missing 2017-03-10 16:35:02 +00:00
Jeremie Dimino d959b0f928 Add a Log module and print out the context in the log file 2017-03-10 12:32:27 +00:00
Jeremie Dimino 4aec06ee46 Better rules for finding the root 2017-03-10 10:41:34 +00:00
Jérémie Dimino 74e015923a Ignore <package>.opam when <package> is empty 2017-03-09 06:41:42 +00:00
Jeremie Dimino 3a86b3fefa Fix root finding
Look for .opam files instead of .install ones...
2017-03-08 12:10:54 +00:00
Jeremie Dimino 581c63f6ca Added --debug-action 2017-03-03 12:46:54 +00:00
Jeremie Dimino 4fa0844e42 Remove build-package in favor of --only-packages 2017-03-02 18:21:19 +00:00
Jeremie Dimino 51ce0c2daf Restrict the scope of internal names
Otherwise building several packages at once doesn't always work
2017-03-02 16:57:28 +00:00