From e075fef89f1ef6d09e85201ace4a7a53385a78c1 Mon Sep 17 00:00:00 2001 From: superherointj <5861043+superherointj@users.noreply.github.com> Date: Tue, 8 Jun 2021 18:20:38 -0300 Subject: [PATCH] reason: ppxlib migration (#126066) * reason: refactoring * reason: add superherointj as maintainer * reason: ppxlib migration Migrate from ocaml-migrate-parsetree to ppxlib fixing conflicts in downstream dependencies. * reason: add downloadPage to meta * reason: removed maintainer volth by his request * reason: add test hello --- pkgs/development/compilers/reason/default.nix | 34 +++++++++++++++---- .../compilers/reason/tests/hello/default.nix | 23 +++++++++++++ .../compilers/reason/tests/hello/dune | 4 +++ .../reason/tests/hello/helloreason.opam | 0 .../reason/tests/hello/helloreason.re | 6 ++++ 5 files changed, 61 insertions(+), 6 deletions(-) create mode 100644 pkgs/development/compilers/reason/tests/hello/default.nix create mode 100644 pkgs/development/compilers/reason/tests/hello/dune create mode 100644 pkgs/development/compilers/reason/tests/hello/helloreason.opam create mode 100644 pkgs/development/compilers/reason/tests/hello/helloreason.re diff --git a/pkgs/development/compilers/reason/default.nix b/pkgs/development/compilers/reason/default.nix index a65748d06422..dbc6f40a68ce 100644 --- a/pkgs/development/compilers/reason/default.nix +++ b/pkgs/development/compilers/reason/default.nix @@ -1,5 +1,5 @@ -{ lib, stdenv, makeWrapper, fetchFromGitHub, ocaml, findlib, dune_2 -, fix, menhir, menhirLib, menhirSdk, merlin-extend, ppx_tools_versioned, utop, cppo +{ lib, callPackage, stdenv, makeWrapper, fetchFromGitHub, ocaml, findlib, dune_2 +, fix, menhir, menhirLib, menhirSdk, merlin-extend, ppxlib, utop, cppo, ppx_derivers }: stdenv.mkDerivation rec { @@ -13,11 +13,28 @@ stdenv.mkDerivation rec { sha256 = "0m6ldrci1a4j0qv1cbwh770zni3al8qxsphl353rv19f6rblplhs"; }; - nativeBuildInputs = [ makeWrapper menhir ]; + nativeBuildInputs = [ + makeWrapper + menhir + ]; - propagatedBuildInputs = [ menhirLib merlin-extend ppx_tools_versioned ]; + buildInputs = [ + cppo + dune_2 + findlib + fix + menhir + menhirSdk + ocaml + ppxlib + utop + ]; - buildInputs = [ ocaml findlib dune_2 cppo fix utop menhir menhirSdk ]; + propagatedBuildInputs = [ + menhirLib + merlin-extend + ppx_derivers + ]; buildFlags = [ "build" ]; # do not "make tests" before reason lib is installed @@ -29,11 +46,16 @@ stdenv.mkDerivation rec { --prefix OCAMLPATH : "$OCAMLPATH:$OCAMLFIND_DESTDIR" ''; + passthru.tests = { + hello = callPackage ./tests/hello { }; + }; + meta = with lib; { homepage = "https://reasonml.github.io/"; + downloadPage = "https://github.com/reasonml/reason"; description = "Facebook's friendly syntax to OCaml"; license = licenses.mit; inherit (ocaml.meta) platforms; - maintainers = [ maintainers.volth ]; + maintainers = with maintainers; [ superherointj ]; }; } diff --git a/pkgs/development/compilers/reason/tests/hello/default.nix b/pkgs/development/compilers/reason/tests/hello/default.nix new file mode 100644 index 000000000000..9b551a0a1ee5 --- /dev/null +++ b/pkgs/development/compilers/reason/tests/hello/default.nix @@ -0,0 +1,23 @@ +{ lib, buildDunePackage, reason }: + +buildDunePackage rec { + pname = "helloreason"; + version = "0.0.1"; + + src = ./.; + + useDune2 = true; + + buildInputs = [ + reason + ]; + + doCheck = true; + + doInstallCheck = true; + postInstallCheck = '' + $out/bin/${pname} | grep -q "Hello From Reason" > /dev/null + ''; + + meta.timeout = 60; +} diff --git a/pkgs/development/compilers/reason/tests/hello/dune b/pkgs/development/compilers/reason/tests/hello/dune new file mode 100644 index 000000000000..578a56dc6de4 --- /dev/null +++ b/pkgs/development/compilers/reason/tests/hello/dune @@ -0,0 +1,4 @@ +(executable + (name helloreason) + (public_name helloreason) + (libraries reason)) diff --git a/pkgs/development/compilers/reason/tests/hello/helloreason.opam b/pkgs/development/compilers/reason/tests/hello/helloreason.opam new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/pkgs/development/compilers/reason/tests/hello/helloreason.re b/pkgs/development/compilers/reason/tests/hello/helloreason.re new file mode 100644 index 000000000000..795bd314dcfb --- /dev/null +++ b/pkgs/development/compilers/reason/tests/hello/helloreason.re @@ -0,0 +1,6 @@ +let sayHello = () => { + let fromWhom = "From Reason"; + print_endline("Hello " ++ fromWhom); +}; + +sayHello();