Skip to content

Commit

Permalink
Merge branch 'main' into melange/non-melange-lib-error
Browse files Browse the repository at this point in the history
* main: (54 commits)
  doc: how we write `to_dyn` and `equal` (ocaml#6621)
  test(cache): test output of man pages
  test: dune utop for (subdir ..) (ocaml#6629)
  refactor: improve style of utop rules (ocaml#6628)
  test: depend on utop (ocaml#6627)
  refactor(stdune): Add Appendable_list.cons (ocaml#6624)
  doc: tighten wording in README.md
  test: add a repro case for ocaml#6607 (ocaml#6612)
  doc: cleanup status badges in README.md (ocaml#6618)
  doc(README): rewrap paragraphs and cleanup links
  coq: more resilient config query
  fix: link time code gen (ocaml#6606)
  fix(melange): run melc ppx with merlin (ocaml#6476)
  feature(melange): add compile_flags (ocaml#6569)
  refactor: move `modules: Modules.t` from `Dune_package.Lib` to `Lib_info` (ocaml#6605)
  Set CLICOLOR_FORCE=0 (ocaml#6608)
  fix: declare deps for ccomp detection (ocaml#6610)
  refactor: assume Cmdliner.Arg.conv is abstract (ocaml#6609)
  refactor: gen_rules pattern matching (ocaml#6604)
  Add CI for MSVC using dkml-workflows (ocaml#6540)
  ...
  • Loading branch information
jchavarri committed Dec 5, 2022
2 parents 15dce27 + 3d3cb17 commit 81c1aed
Show file tree
Hide file tree
Showing 115 changed files with 7,631 additions and 648 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
*.rst text eol=lf
*.c text eol=lf
*.t text eol=lf -linguist-detectable
*.ps1 text working-tree-encoding=UTF-16 eol=crlf
dune text eol=lf
dune.inc text eol=lf
.gitignore text eol=lf
Expand Down
30 changes: 30 additions & 0 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,36 @@ jobs:
run: opam install ./dune-configurator.opam
if: ${{ matrix.configurator == true }}

dkml:
strategy:
fail-fast: false
matrix:
include:
- gh_os: windows-2019
abi_pattern: win32-windows_x86
dkml_host_abi: windows_x86
- gh_os: windows-2019
abi_pattern: win32-windows_x86_64
dkml_host_abi: windows_x86_64
runs-on: ${{ matrix.gh_os }}
name: MSVC / ${{ matrix.dkml_host_abi }}

steps:
- uses: actions/checkout@v3

- name: Setup DKML on a Windows host
if: startsWith(matrix.dkml_host_abi, 'windows_')
uses: ./ci/setup-dkml/gh-windows/pre

- name: Build and test the package on Windows host
if: startsWith(matrix.dkml_host_abi, 'windows_')
shell: msys2 {0}
run: ci/build-test.sh

- name: Teardown DKML on a Windows host
if: startsWith(matrix.dkml_host_abi, 'windows_')
uses: ./ci/setup-dkml/gh-windows/post

nix:
name: Nix
strategy:
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,7 @@ result

.DS_Store
nix/profiles/

# dkml desktop CI
/msys64
/.ci
13 changes: 13 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
Unreleased
----------

- Format dune files when they are named `dune-file`. This occurs when we enable
the alternative file names project option. (#6566, @rgrinberg)

- Do not shadow library interface modules (#6549, fixes #6545, @rgrinberg)

- Move `$ dune ocaml-merlin -dump-config=$dir` to `$ dune ocaml merlin
dump-config $dir`. (#6547, @rgrinberg)

- Allow compilation rules to be impacted by `(env ..)` stanzas that modify the
environment or set binaries. (#6527, @rgrinberg)

Expand All @@ -25,8 +33,13 @@ Unreleased
- Remove "Entering Directory" messages for `$ dune install`. (#6513,
@rgrinberg)

- Add CI testing with MSVC (#6540, fixes #6535, @jonahbeckford)

- Fix configurator when using the MSVC compiler (#6538, fixes #6537, @nojb)

- Fix missing dependencies when detecting the kind of C compiler we're using
(#6610, fixes #6415, @emillon)

3.6.0 (2022-11-14)
------------------

Expand Down
49 changes: 45 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ ocamlformat.$$(awk -F = '$$1 == "version" {print $$2}' .ocamlformat) \
"ppx_expect.v0.15.0" \
ppx_inline_test \
ppxlib \
result \
ctypes \
"utop>=2.6.0" \
"melange>=0.3.0" \
"mel>=0.3.0" \
"melange>=0.3.1" \
"mel>=0.3.1"

# Dependencies recommended for developing dune locally,
# but not wanted in CI
DEV_DEPS := \
"dkml-workflows>=1.1.0" \
patdiff

TEST_OCAMLVERSION := 4.14.0
Expand Down Expand Up @@ -74,11 +74,16 @@ dev-depext:

.PHONY: melange
melange:
opam pin add melange https://github.com/melange-re/melange.git#2f7a184400fd5d62c9160528a7ab4ce81874c024
opam pin add melange-compiler-libs https://github.com/melange-re/melange-compiler-libs.git#426463a77d0b70ecf0108c98e6a86d325cd01472
opam pin add melange https://github.com/melange-re/melange.git#685e546e290d317a884a4d48c7835467422c6426

dev-deps: melange
opam install -y $(TEST_DEPS)

.PHONY: dev-deps-sans-melange
dev-deps-sans-melange:
opam install -y $(TEST_DEPS)

.PHONY: dev-switch
dev-switch:
opam update
Expand Down Expand Up @@ -106,6 +111,9 @@ test-melange: $(BIN)
test-all: $(BIN)
$(BIN) build @runtest @runtest-js @runtest-coq @runtest-melange

test-all-sans-melange: $(BIN)
$(BIN) build @runtest @runtest-js @runtest-coq

.PHONY: check
check: $(BIN)
@$(BIN) build @check
Expand Down Expand Up @@ -142,6 +150,39 @@ livedoc:
update-jbuilds: $(BIN)
$(BIN) build @doc/runtest --auto-promote

# you will need to use a dev-switch or do opam install dkml-workflows.
# we run --auto-promote twice since first may fail (ex. missing files with Unable to resolve symlink)
update-dkml: $(BIN)
opam exec -- generate-setup-dkml-scaffold
$(BIN) build @gen-dkml --auto-promote || $(BIN) build @gen-dkml --auto-promote
rm -rf ci/setup-dkml/gh-darwin ci/setup-dkml/gh-linux ci/setup-dkml/gl
rm -rf ci/setup-dkml/pc/setup-dkml-darwin_*.sh ci/setup-dkml/pc/setup-dkml-linux_*.sh
$(BIN) build @ci/fmt --auto-promote || $(BIN) build @ci/fmt --auto-promote

# assumes MSYS2 or Cygwin, and Visual Studio. Do not use 'with-dkml make ...'
desktop-ci-windows_x86:
if command -v pwsh; then \
pwsh ./ci/setup-dkml/pc/setup-dkml-windows_x86.ps1; \
else \
powershell ./ci/setup-dkml/pc/setup-dkml-windows_x86.ps1; \
fi
/usr/bin/env PATH=/usr/bin \
dkml_host_abi=windows_x86 abi_pattern=win32-windows_x86_64; \
opam_root=.ci/o exe_ext=.exe \
/bin/sh ci/build-test.sh

# assumes MSYS2 or Cygwin, and Visual Studio. Do not use 'with-dkml make ...'
desktop-ci-windows_x86_64:
if command -v pwsh; then \
pwsh ./ci/setup-dkml/pc/setup-dkml-windows_x86_64.ps1; \
else \
powershell ./ci/setup-dkml/pc/setup-dkml-windows_x86_64.ps1; \
fi
/usr/bin/env PATH=/usr/bin \
dkml_host_abi=windows_x86 abi_pattern=win32-windows_x86_64 \
opam_root=.ci/o exe_ext=.exe \
/bin/sh ci/build-test.sh

# If the first argument is "run"...
ifeq (dune,$(firstword $(MAKECMDGOALS)))
# use the rest as arguments for "run"
Expand Down
128 changes: 58 additions & 70 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,35 +1,26 @@
Dune - A Composable Build System
================================

Dune is a build system designed for OCaml/Reason projects only. It
focuses on providing the user with a consistent experience and takes
care of most low-level details of OCaml compilations. It's merely necessary
to provide a description of your project, and Dune will
do the rest.

It implements a scheme that's inspired from the one used inside Jane
Street and adapted to the open source world. It has matured over a
long time and is used daily by hundreds of developers, meaning
it's highly tested and productive.

Dune comes with a [manual][manual]. If you want to get started
without reading too much, look at the [quick start
guide][quick-start] or watch [this introduction video][video].

The [example][example] directory contains examples of projects using
dune.

[![Main workflow](https://github.com/ocaml/dune/actions/workflows/workflow.yml/badge.svg)](https://github.com/ocaml/dune/actions/workflows/workflow.yml)
[![AppVeyor status][appveyor-img]][appveyor]
[![Main workflow][workflow-badge]][workflow]
[![Release][release-img]][release]

Dune is a build system for OCaml. It provides a consistent experience and takes
care of the low-level details of OCaml compilation. You need only to provide a
description of your project, and Dune will do the rest.

Dune implements a scheme that's inspired from the one used inside Jane Street
and adapted to the open source world. It has matured over a long time and is
used daily by hundreds of developers, meaning it's highly tested and productive.

Dune comes with a [manual][manual]. If you want to get started without reading
too much, look at the [quick start guide][quick-start] or watch [this
introduction video][video].

The [example][example] directory contains examples of projects using Dune.

[manual]: https://dune.readthedocs.io/en/latest/
[quick-start]: https://dune.readthedocs.io/en/latest/quick-start.html
[example]: https://github.com/ocaml/dune/tree/master/example
[appveyor]: https://ci.appveyor.com/project/diml/dune/branch/master
[appveyor-img]: https://ci.appveyor.com/api/projects/status/rsxayce22e8f2jkp?svg=true
[release]: https://github.com/ocaml/dune/releases
[release-img]: https://img.shields.io/github/release/ocaml/dune.svg
[merlin]: https://github.com/ocaml/merlin
[opam]: https://opam.ocaml.org
[issues]: https://github.com/ocaml/dune/issues
Expand All @@ -39,76 +30,70 @@ dune.
Overview
--------

Dune reads project metadata from `dune` files, which are either
static files in a simple S-expression syntax or OCaml scripts. It uses
this information to setup build rules, generate configuration files
for development tools such as [Merlin][merlin], handle installation,
etc.
Dune reads project metadata from `dune` files, which are static files with a
simple S-expression syntax. It uses this information to setup build rules,
generate configuration files for development tools such as [Merlin][merlin],
handle installation, etc.

Dune itself is fast, has very low overhead, and supports parallel
builds on all platforms. It has no system dependencies. OCaml is all you need
to build Dune and packages using Dune. You don't need
`make` or `bash`, as long as the packages themselves don't use `bash`
explicitly.
Dune itself is fast, has very little overhead, and supports parallel builds on
all platforms. It has no system dependencies. OCaml is all you need to build
Dune and packages using Dune.

In particular, one can install OCaml on Windows with a binary installer
and then use only the Windows Console to build Dune and packages
using Dune.
In particular, one can install OCaml on Windows with a binary installer and then
use only the Windows Console to build Dune and packages using Dune.

Strengths
---------

### Composable

Take *n* repositories that use Dune and arrange them in any way on the
file system. The result is still a single repository that Dune
knows how to build at once.
Dune is composable, meaning that multiple Dune projects can be arranged
together, leading to a single build that Dune knows how to execute. This allows
for monorepos of projects.

This make simultaneous development on multiple packages trivial.
Dune makes simultaneous development on multiple packages a trivial task.

### Gracefully Handles Multi-Package Repositories

Dune knows how to handle repositories containing several
packages. When building via [Opam][opam], it is able to correctly use
libraries that were previously installed, even if they are already
present in the source tree.
Dune knows how to handle repositories containing several packages. When building
via [opam][opam], it is able to correctly use libraries that were previously
installed, even if they are already present in the source tree.

The magic invocation is:

```sh
$ dune build --only-packages <package-name> @install
```

### Building Against Several Configurations at Once

Dune can build a given source code repository against
several configurations simultaneously. This helps maintaining packages
across several versions of OCaml, as you can test them all at once
without hassle.
Dune can build a given source code repository against several configurations
simultaneously. This helps maintaining packages across several versions of
OCaml, as you can test them all at once without hassle.

In particular, this makes it easy to handle [cross-compilation](https://dune.readthedocs.io/en/latest/cross-compilation.html).
In particular, this makes it easy to handle
[cross-compilation][cross-compilation]. This feature requires [opam][opam].

This feature requires [Opam][opam].
[cross-compilation]: https://dune.readthedocs.io/en/latest/cross-compilation.html

Requirements
------------

Dune requires OCaml version 4.08.0 to build itself and can build OCaml
projects using OCaml 4.02.3 or greater.
Dune requires OCaml version 4.08.0 to build itself and can build OCaml projects
using OCaml 4.02.3 or greater.

Installation
------------

We recommended installing Dune via the [Opam package manager][opam]:
We recommended installing Dune via the [opam package manager][opam]:

```sh
$ opam install dune
```

If you are new to Opam, make sure to run `eval $(opam config env)` to
make `dune` available in your `PATH`. The `dune` binary is self-contained
and relocatable, so you can safely copy it somewhere else to
make it permanently available.
If you are new to opam, make sure to run `eval $(opam config env)` to make
`dune` available in your `PATH`. The `dune` binary is self-contained and
relocatable, so you can safely copy it somewhere else to make it permanently
available.

You can also build it manually with:

Expand All @@ -125,22 +110,21 @@ $ ./dune.exe build -p dune --profile dune-bootstrap
$ ./dune.exe install dune
```

The first command builds the `dune.exe` binary. The second builds the
additional files installed by Dune, such as the *man* pages, and
the last simply installs all of that on the system.
The first command builds the `dune.exe` binary. The second builds the additional
files installed by Dune, such as the *man* pages, and the last simply installs
all of that on the system.

**Please note**: unless you ran the optional `./configure` script, you can
simply copy `dune.exe` anywhere and it will just work. `dune` is
fully relocatable and discovers its environment at runtime rather than
hard-coding it at compilation time.
simply copy `dune.exe` anywhere and it will just work. `dune` is fully
relocatable and discovers its environment at runtime rather than hard-coding it
at compilation time.

Support
-------

If you have questions about Dune, you can send an email to
ocaml-core@googlegroups.com or [open a ticket on GitHub][issues].


Migration from Jbuilder
-----------------------

Expand All @@ -150,7 +134,11 @@ described in the [manual](http://dune.readthedocs.io/en/latest/migration.html).
Status
------

Dune is fairly stable and used by the majority of packages on
Opam. Note that Dune retains backward compatibility with Jbuilder, and
in particular, existing Jbuilder projects will continue to be buildable
with Dune.
Dune is fairly stable and used by the majority of packages on opam. Note that
Dune retains backward compatibility with Jbuilder, and in particular, existing
Jbuilder projects will continue to be buildable with Dune.

[workflow-badge]: https://github.com/ocaml/dune/actions/workflows/workflow.yml/badge.svg
[workflow]: https://github.com/ocaml/dune/actions/workflows/workflow.yml
[release]: https://github.com/ocaml/dune/releases
[release-img]: https://img.shields.io/github/release/ocaml/dune.svg
8 changes: 4 additions & 4 deletions bin/arg.ml
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,15 @@ module Dep = struct

let parser s =
match parse_alias s with
| Some dep -> `Ok dep
| Some dep -> Ok dep
| None -> (
match
Dune_lang.Decoder.parse dep_parser Univ_map.empty
(Dune_lang.Parser.parse_string ~fname:"command line"
~mode:Dune_lang.Parser.Mode.Single s)
with
| x -> `Ok x
| exception User_error.E msg -> `Error (User_message.to_string msg))
| x -> Ok x
| exception User_error.E msg -> Error (User_message.to_string msg))

let string_of_alias ~recursive sv =
let prefix = if recursive then "@" else "@@" in
Expand All @@ -88,7 +88,7 @@ module Dep = struct
in
Format.pp_print_string ppf s

let conv = (parser, printer)
let conv = conv' (parser, printer)

let to_string_maybe_quoted t =
String.maybe_quoted (Format.asprintf "%a" printer t)
Expand Down
Loading

0 comments on commit 81c1aed

Please sign in to comment.