Skip to content

Commit

Permalink
Use dynamic_include to include the generated file dune.inc (#1199)
Browse files Browse the repository at this point in the history
* Use `dynamic_include` to include the generated file dune.inc

This PR uses the new feature `dynamic_include` to include our generated
file `dune.inc`. We do not push 'dune.inc' anymore!
  • Loading branch information
Halbaroth authored Aug 9, 2024
1 parent 59dd699 commit 4fdcf81
Show file tree
Hide file tree
Showing 14 changed files with 100 additions and 202,417 deletions.
3 changes: 0 additions & 3 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
# Declare files will always have LF line endings on checkout.
*.sh text eol=lf

# Hide the file in statistics and pull request diffs.
tests/dune.inc linguist-generated
16 changes: 6 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -114,27 +114,23 @@ packages:
# Generate tests
# ==============

# Generate new Dune tests from the problems in
# the directory tests/.
gentest: $(wildcard tests/**/*)
# TODO: There should be an option to gentest to avoid printing the
# dune.inc file and only touch the expected files in this call.
dune exec -- tools/gentest.exe tests >/dev/null
dune build @tests/gentest --auto-promote
# Generate dummy expected file for new tests.
genexpected:
dune exec -- tools/gentest.exe --kind expected tests >/dev/null

# Run non-regression tests.
runtest: gentest bin
runtest: genexpected bin
dune build @runtest @runtest-quick

# Run non-regression tests for the CI.
runtest-ci: gentest bin
runtest-ci: genexpected bin
dune build @runtest @runtest-quick @runtest-ci

# Promote new outputs of the tests.
promote:
dune promote

.PHONY: gentest runtest runtest-ci promote
.PHONY: runtest runtest-ci promote

# ============
# Installation
Expand Down
2 changes: 1 addition & 1 deletion alt-ergo-lib.opam
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ doc: "https://ocamlpro.github.io/alt-ergo"
bug-reports: "https://github.com/OCamlPro/alt-ergo/issues"
depends: [
"ocaml" {>= "4.08.1"}
"dune" {>= "3.0"}
"dune" {>= "3.14"}
"dune-build-info"
"dolmen" {>= "0.10"}
"dolmen_type" {>= "0.10"}
Expand Down
2 changes: 1 addition & 1 deletion alt-ergo-parsers.opam
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ doc: "https://ocamlpro.github.io/alt-ergo"
bug-reports: "https://github.com/OCamlPro/alt-ergo/issues"
depends: [
"ocaml" {>= "4.08.1"}
"dune" {>= "3.0"}
"dune" {>= "3.14"}
"alt-ergo-lib" {= version}
"psmt2-frontend" {>= "0.4"}
"menhir"
Expand Down
2 changes: 1 addition & 1 deletion alt-ergo-plugin-ab-why3.opam
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ homepage: "https://alt-ergo.ocamlpro.com/"
doc: "https://ocamlpro.github.io/alt-ergo"
bug-reports: "https://github.com/OCamlPro/alt-ergo/issues"
depends: [
"dune" {>= "3.0"}
"dune" {>= "3.14"}
"alt-ergo" {= version}
"alt-ergo-lib" {= version}
"alt-ergo-parsers" {= version}
Expand Down
2 changes: 1 addition & 1 deletion alt-ergo.opam
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ doc: "https://ocamlpro.github.io/alt-ergo"
bug-reports: "https://github.com/OCamlPro/alt-ergo/issues"
depends: [
"ocaml" {>= "4.08.1"}
"dune" {>= "3.0"}
"dune" {>= "3.14"}
"alt-ergo-lib" {= version}
"alt-ergo-parsers" {= version}
"menhir"
Expand Down
8 changes: 8 additions & 0 deletions dune
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
(subdir runtest
(dynamic_include ../gentest/dune.inc))

(subdir gentest
(rule
(deps (source_tree ../tests))
(action
(with-stdout-to dune.inc (run ../tools/gentest.exe --kind rule ../tests)))))
2 changes: 1 addition & 1 deletion dune-project
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(lang dune 3.0)
(lang dune 3.14)
(version dev)

; Since we want to generate opam files we need to provide informations ;
Expand Down
2 changes: 1 addition & 1 deletion nix/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import sources.nixpkgs {
overlays = [
(_: pkgs: { inherit sources; })
(_: pkgs: {
ocamlPackages = pkgs.ocaml-ng.ocamlPackages_4_14.overrideScope' (self: super: {
ocamlPackages = pkgs.ocaml-ng.ocamlPackages_4_14.overrideScope (self: super: {
pp_loc = pkgs.callPackage ./pp_loc.nix { };
ocplib-simplex = pkgs.callPackage ./ocplib-simplex.nix { };
dolmen = pkgs.callPackage ./dolmen.nix { };
Expand Down
8 changes: 4 additions & 4 deletions nix/sources.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@
"version": "dev"
},
"nixpkgs": {
"branch": "release-23.11",
"branch": "release-24.05",
"description": "Nix Packages collection",
"homepage": null,
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "205fd4226592cc83fd4c0885a3e4c9c400efabb5",
"sha256": "1f5d2g1p6nfwycpmrnnmc2xmcszp804adp16knjvdkj8nz36y1fg",
"rev": "b260a95463a8f5f9094527c05329d79527e5a4aa",
"sha256": "0qlnwrha950kflbnfsl39mrdkkll3663bssjlxrrm7w1qnbbbp1n",
"type": "tarball",
"url": "https://github.com/NixOS/nixpkgs/archive/205fd4226592cc83fd4c0885a3e4c9c400efabb5.tar.gz",
"url": "https://github.com/NixOS/nixpkgs/archive/b260a95463a8f5f9094527c05329d79527e5a4aa.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"ocplib-simplex": {
Expand Down
23 changes: 0 additions & 23 deletions tests/dune
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,6 @@
(package alt-ergo)
(deps %{bin:alt-ergo}))

(include dune.inc)

(rule
(deps (file ../tools/gentest.exe) (source_tree .))
(action
(with-stdout-to dune.inc.gen (run ../tools/gentest.exe .))))

(rule
(alias gentest)
(action (diff dune.inc dune.inc.gen)))

(rule
(alias runtest)
(action (diff dune.inc dune.inc.gen)))

(rule
(alias runtest-quick)
(action (diff dune.inc dune.inc.gen)))

(rule
(alias runtest-ci)
(action (diff dune.inc dune.inc.gen)))

(test
(package alt-ergo-lib)
(name bitvec_tests)
Expand Down
Loading

0 comments on commit 4fdcf81

Please sign in to comment.