rescript-editor-analysis: refactor
Use the Dune builder rather than than a generic derivation.
This commit is contained in:
@@ -5,8 +5,16 @@
|
||||
callPackage,
|
||||
}:
|
||||
let
|
||||
version = "1.62.0";
|
||||
rescript-editor-analysis = callPackage ./rescript-editor-analysis.nix { inherit version; };
|
||||
extVersion = "1.62.0";
|
||||
rescript-editor-analysis = callPackage ./rescript-editor-analysis.nix { };
|
||||
|
||||
# Ensure the versions match
|
||||
version =
|
||||
if rescript-editor-analysis.version == extVersion then
|
||||
rescript-editor-analysis.version
|
||||
else
|
||||
throw "analysis and extension versions must match";
|
||||
|
||||
arch =
|
||||
if stdenv.hostPlatform.isLinux then
|
||||
"linux"
|
||||
@@ -16,7 +24,8 @@ let
|
||||
throw "Unsupported system: ${stdenv.system}";
|
||||
analysisDir = "server/analysis_binaries/${arch}";
|
||||
in
|
||||
vscode-utils.buildVscodeMarketplaceExtension rec {
|
||||
|
||||
vscode-utils.buildVscodeMarketplaceExtension {
|
||||
mktplcRef = {
|
||||
name = "rescript-vscode";
|
||||
publisher = "chenglou92";
|
||||
@@ -27,6 +36,7 @@ vscode-utils.buildVscodeMarketplaceExtension rec {
|
||||
# For rescript-language-server
|
||||
passthru.rescript-editor-analysis = rescript-editor-analysis;
|
||||
|
||||
strictDeps = true;
|
||||
postPatch = ''
|
||||
rm -r ${analysisDir}
|
||||
ln -s ${rescript-editor-analysis}/bin ${analysisDir}
|
||||
@@ -39,6 +49,7 @@ vscode-utils.buildVscodeMarketplaceExtension rec {
|
||||
lib.maintainers.dlip
|
||||
lib.maintainers.jayesh-bhoot
|
||||
];
|
||||
platforms = lib.platforms.linux ++ lib.platforms.darwin;
|
||||
license = lib.licenses.mit;
|
||||
};
|
||||
}
|
||||
|
||||
+7
-17
@@ -1,16 +1,14 @@
|
||||
{
|
||||
lib,
|
||||
stdenv,
|
||||
fetchFromGitHub,
|
||||
ocaml,
|
||||
ocamlPackages,
|
||||
dune_3,
|
||||
version,
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation {
|
||||
pname = "rescript-editor-analysis";
|
||||
inherit version;
|
||||
ocamlPackages.buildDunePackage rec {
|
||||
pname = "analysis";
|
||||
version = "1.62.0";
|
||||
|
||||
minimalOCamlVersion = "4.10";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "rescript-lang";
|
||||
@@ -19,20 +17,11 @@ stdenv.mkDerivation {
|
||||
hash = "sha256-v+qCVge57wvA97mtzbxAX9Fvi7ruo6ZyIC14O8uWl9Y=";
|
||||
};
|
||||
|
||||
strictDeps = true;
|
||||
nativeBuildInputs = [
|
||||
ocaml
|
||||
dune_3
|
||||
ocamlPackages.cppo
|
||||
];
|
||||
|
||||
buildPhase = ''
|
||||
dune build -p analysis
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
install -D -m0555 _build/default/analysis/bin/main.exe $out/bin/rescript-editor-analysis.exe
|
||||
'';
|
||||
|
||||
meta = {
|
||||
description = "Analysis binary for the ReScript VSCode plugin";
|
||||
homepage = "https://github.com/rescript-lang/rescript-vscode";
|
||||
@@ -41,5 +30,6 @@ stdenv.mkDerivation {
|
||||
lib.maintainers.jayesh-bhoot
|
||||
];
|
||||
license = lib.licenses.mit;
|
||||
mainProgram = "rescript-editor-analysis";
|
||||
};
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ buildNpmPackage rec {
|
||||
|
||||
# https://github.com/rescript-lang/rescript-vscode/blob/1.62.0/.github/workflows/ci.yml#L182-L183
|
||||
mkdir analysis_binaries/${platformDir}
|
||||
cp ${rescript-editor-analysis}/bin/* analysis_binaries/${platformDir}/
|
||||
cp ${lib.getExe rescript-editor-analysis} analysis_binaries/${platformDir}/
|
||||
|
||||
# https://github.com/rescript-lang/rescript-vscode/blob/1.62.0/package.json#L252
|
||||
esbuild src/cli.ts --bundle --sourcemap --outfile=out/cli.js --format=cjs --platform=node --loader:.node=file --minify
|
||||
|
||||
@@ -8173,10 +8173,9 @@ with pkgs;
|
||||
inherit (callPackage ../development/tools/replay-io { })
|
||||
replay-io replay-node-cli;
|
||||
|
||||
rescript-language-server = let
|
||||
version = "1.62.0";
|
||||
rescript-editor-analysis = callPackage ../applications/editors/vscode/extensions/chenglou92.rescript-vscode/rescript-editor-analysis.nix { inherit version; };
|
||||
in callPackage ../by-name/re/rescript-language-server/package.nix { inherit rescript-editor-analysis; };
|
||||
rescript-language-server = callPackage ../by-name/re/rescript-language-server/package.nix {
|
||||
rescript-editor-analysis = vscode-extensions.chenglou92.rescript-vscode.rescript-editor-analysis;
|
||||
};
|
||||
|
||||
rnginline = with python3Packages; toPythonApplication rnginline;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user