Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rust-analyzer-unwrapped: optional proc-macro-srv-cli #263871

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions pkgs/development/tools/rust/rust-analyzer/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
, cmake
, libiconv
, useMimalloc ? false
, enableProcMacroSrvCli ? false
, doCheck ? true
, nix-update-script
}:
Expand All @@ -23,8 +24,11 @@ rustPlatform.buildRustPackage rec {
sha256 = "sha256-9ScvChrqG35GXwO6cFzZOgsq/5PdrUZDCTBRgkhoShk=";
};

cargoBuildFlags = [ "--bin" "rust-analyzer" "--bin" "rust-analyzer-proc-macro-srv" ];
cargoTestFlags = [ "--package" "rust-analyzer" "--package" "proc-macro-srv-cli" ];
cargoBuildFlags = [ "--bin" "rust-analyzer" ]
++ lib.optionals enableProcMacroSrvCli [ "--bin" "rust-analyzer-proc-macro-srv" ];
cargoTestFlags = [ "--package" "rust-analyzer" ]
++ lib.optionals enableProcMacroSrvCli [ "--package" "proc-macro-srv-cli" ];
RUSTC_BOOTSTRAP = enableProcMacroSrvCli;

# Code format check requires more dependencies but don't really matter for packaging.
# So just ignore it.
Expand All @@ -37,7 +41,8 @@ rustPlatform.buildRustPackage rec {
libiconv
];

buildFeatures = lib.optional useMimalloc "mimalloc";
buildFeatures = lib.optional useMimalloc "mimalloc"
++ lib.optional enableProcMacroSrvCli "sysroot-abi";

CFG_RELEASE = version;

Expand All @@ -47,11 +52,17 @@ rustPlatform.buildRustPackage rec {
'';

doInstallCheck = true;
installCheckPhase = ''
installCheckPhase = let
checkProcMacroSrvCli = ''
RUST_ANALYZER_INTERNALS_DO_NOT_USE='this is unstable' \
$out/bin/rust-analyzer-proc-macro-srv < /dev/null
'';
in ''
runHook preInstallCheck
versionOutput="$($out/bin/rust-analyzer --version)"
echo "'rust-analyzer --version' returns: $versionOutput"
[[ "$versionOutput" == "rust-analyzer ${version}" ]]
${lib.optionalString enableProcMacroSrvCli checkProcMacroSrvCli}
runHook postInstallCheck
'';

Expand Down