vscode-extensions.vadimcn.vscode-lldb: 1.10.0 -> 1.11.4

- Remove custom lldb. The extension uses stock lldb since 1.11.0.
- Build the adapter with clang++.
- Build the adapter without weak linkage.
- Fix tools/prep-package.js failing due to missing devDependencies.
- Update GitHub repo name.
- Make various adjustments after upstream reorg.
This commit is contained in:
Francis Gagné
2025-05-07 23:47:18 +05:30
committed by Masum Reza
parent a7f22e8826
commit d8b50484d3
7 changed files with 49 additions and 94 deletions
@@ -3,16 +3,20 @@
{
autoPatchelfHook,
callPackage,
cargo,
config,
fetchurl,
jdk,
jq,
lib,
libcxxStdenv,
llvmPackages,
llvmPackages_14,
llvmPackages_19,
makeRustPlatform,
moreutils,
protobuf,
python3Packages,
rustc,
stdenv,
vscode-utils,
zlib,
@@ -5119,7 +5123,17 @@ let
};
};
vadimcn.vscode-lldb = callPackage ./vadimcn.vscode-lldb { llvmPackages = llvmPackages_14; };
vadimcn.vscode-lldb = callPackage ./vadimcn.vscode-lldb {
llvmPackages = llvmPackages_19;
# The adapter is meant to be compiled with clang++,
# based on the provided CMake toolchain files.
# <https://github.com/vadimcn/codelldb/tree/master/cmake>
rustPlatform = makeRustPlatform {
stdenv = libcxxStdenv;
inherit cargo rustc;
};
stdenv = libcxxStdenv;
};
valentjn.vscode-ltex = vscode-utils.buildVscodeMarketplaceExtension rec {
mktplcRef = {
@@ -17,48 +17,47 @@ let
if stdenv.hostPlatform.isDarwin then
"/Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/Versions/A/Resources/debugserver"
else
"${lldb.out}/bin/lldb-server";
"${lib.getBin lldb}/bin/lldb-server";
LLVM_TRIPLE = stdenv.hostPlatform.config;
in
rustPlatform.buildRustPackage {
pname = "${pname}-adapter";
inherit version src;
useFetchCargoVendor = true;
cargoHash = "sha256-7tGX8wt2bb1segoWbBEBwZbznOaAiAyh9i/JC5FKUBU=";
cargoHash = "sha256-Nh4YesgWa1JR8tLfrIRps9TBdsAfilXu6G2/kB08co8=";
buildInputs = lib.optionals stdenv.hostPlatform.isDarwin [ lldb ];
# Environment variables, based on <https://github.com/vadimcn/codelldb/blob/master/cargo_config.unix.toml>
# The LLDB_* variables are used in adapter/lldb/build.rs.
"CC_${LLVM_TRIPLE}" = "${stdenv.cc}/bin/cc";
"CXX_${LLVM_TRIPLE}" = "${stdenv.cc}/bin/c++";
LLDB_INCLUDE = "${lib.getDev lldb}/include";
LLDB_LINK_LIB = "lldb";
LLDB_LINK_SEARCH = "${lib.getLib lldb}/lib";
nativeBuildInputs = [ makeWrapper ];
env = lib.optionalAttrs stdenv.hostPlatform.isDarwin { NIX_LDFLAGS = "-llldb -lc++abi"; };
buildAndTestSubdir = "adapter";
buildFeatures = [ "weak-linkage" ];
# There's isn't much point in enabling the `weaklink` feature
# when we provide lldb via Nix.
# buildFeatures = [ "weaklink" ];
cargoBuildFlags = [
"--lib"
"--bin=codelldb"
];
postFixup = ''
mkdir -p $out/share/{adapter,formatters}
# codelldb expects libcodelldb.so to be in the same
# directory as the executable, and can't find it in $out/lib.
# To make codelldb executable as a standalone,
# we put all files in $out/share, and then wrap the binary in $out/bin.
mkdir -p $out/share/{adapter,lang_support}
mv $out/bin/* $out/share/adapter
cp $out/lib/* $out/share/adapter
cp -r adapter/scripts $out/share/adapter
cp -t $out/share/formatters formatters/*.py
cp -t $out/share/lang_support lang_support/*.py
ln -s ${lib.getLib lldb} $out/share/lldb
makeWrapper $out/share/adapter/codelldb $out/bin/codelldb \
--set-default LLDB_DEBUGSERVER_PATH "${lldbServer}"
'';
patches = [ ./patches/adapter-output-shared_object.patch ];
# Tests are linked to liblldb but it is not available here.
# Tests fail to build (as of version 1.11.4).
doCheck = false;
passthru = { inherit lldbServer; };
@@ -17,7 +17,7 @@ assert lib.versionAtLeast python3.version "3.5";
let
publisher = "vadimcn";
pname = "vscode-lldb";
version = "1.10.0";
version = "1.11.4";
vscodeExtUniqueId = "${publisher}.${pname}";
vscodeExtPublisher = publisher;
@@ -25,13 +25,12 @@ let
src = fetchFromGitHub {
owner = "vadimcn";
repo = "vscode-lldb";
repo = "codelldb";
rev = "v${version}";
hash = "sha256-ExSS5HxDmJJtYypRYJNz7nY0D50gjoDBc4CnJMfgVw8=";
hash = "sha256-+Pe7ij5ukF5pLgwvr+HOHjIv1TQDiPOEeJtkpIW9XWI=";
};
# need to build a custom version of lldb and llvm for enhanced rust support
lldb = (import ./lldb.nix { inherit fetchFromGitHub llvmPackages; });
lldb = llvmPackages.lldb;
adapter = (
import ./adapter.nix {
@@ -86,10 +85,9 @@ stdenv.mkDerivation {
patches = [ ./patches/cmake-build-extension-only.patch ];
postPatch = ''
# temporary patch for forgotten version updates
substituteInPlace CMakeLists.txt \
--replace-fail "1.9.2" ${version}
# Make devDependencies available to tools/prep-package.js
preConfigure = ''
cp -r ${nodeDeps}/lib/node_modules .
'';
postConfigure =
@@ -117,7 +115,7 @@ stdenv.mkDerivation {
unzip ./codelldb-bootstrap.vsix 'extension/*' -d ./vsix-extracted
mkdir -p $ext/{adapter,formatters}
mkdir -p $ext/adapter
mv -t $ext vsix-extracted/extension/*
cp -t $ext/ -r ${adapter}/share/*
wrapProgram $ext/adapter/codelldb \
@@ -1,35 +0,0 @@
# Patched lldb for Rust language support.
{
fetchFromGitHub,
llvmPackages,
}:
let
llvmSrc = fetchFromGitHub {
owner = "vadimcn";
repo = "llvm-project";
# codelldb/14.x branch
rev = "4c267c83cbb55fedf2e0b89644dc1db320fdfde7";
hash = "sha256-jM//ej6AxnRYj+8BAn4QrxHPT6HiDzK5RqHPSg3dCcw=";
};
lldbDrv = llvmPackages.lldb.overrideAttrs (oldAttrs: {
passthru = (oldAttrs.passthru or { }) // {
inherit llvmSrc;
};
doInstallCheck = true;
# installCheck for lldb_14 currently broken
# https://github.com/NixOS/nixpkgs/issues/166604#issuecomment-1086103692
# ignore the oldAttrs installCheck
installCheckPhase = ''
versionOutput="$($out/bin/lldb --version)"
echo "'lldb --version' returns: $versionOutput"
echo "$versionOutput" | grep -q 'rust-enabled'
'';
});
in
lldbDrv.override {
monorepoSrc = llvmSrc;
libllvm = llvmPackages.libllvm.override { monorepoSrc = llvmSrc; };
}
@@ -13,7 +13,7 @@ buildNpmPackage {
pname = "${pname}-node-deps";
inherit version src;
npmDepsHash = "sha256-fMKGi+AJTMlWl7SQtZ21hUwOLgqlFYDhwLvEergQLfI=";
npmDepsHash = "sha256-Efeun7AFMAnoNXLbTGH7OWHaBHT2tO9CodfjKrIYw40=";
nativeBuildInputs = [
python3
@@ -1,22 +0,0 @@
From 4f64ad191ec79b9f40843f88e3ac5910720636da Mon Sep 17 00:00:00 2001
From: Changsheng Wu <Congee@users.noreply.github.com>
Date: Fri, 9 Jun 2023 15:41:53 -0400
Subject: [PATCH] Update Cargo.toml
---
adapter/Cargo.toml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/adapter/Cargo.toml b/adapter/Cargo.toml
index bc86723..f5f26ce 100644
--- a/adapter/Cargo.toml
+++ b/adapter/Cargo.toml
@@ -39,7 +39,7 @@ winapi = { version = "0.3.8", features = ["std", "wincon", "namedpipeapi"] }
winreg = "0.6.2"
[lib]
-crate-type = ["staticlib"]
+crate-type = ["dylib", "rlib"]
[[bin]]
name = "codelldb"
@@ -1,7 +1,8 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5cab8b1..0b500d5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -16,13 +16,6 @@
@@ -16,13 +16,6 @@ endif()
set(VERSION "${VERSION}${VERSION_SUFFIX}")
message("Version ${VERSION}")
@@ -15,24 +16,24 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt
if (CMAKE_SYSROOT)
set(CMAKE_C_FLAGS "--sysroot=${CMAKE_SYSROOT} ${CMAKE_C_FLAGS}")
set(CMAKE_CXX_FLAGS "--sysroot=${CMAKE_SYSROOT} ${CMAKE_CXX_FLAGS}")
@@ -102,16 +95,6 @@
configure_file(webpack.config.js ${CMAKE_CURRENT_BINARY_DIR}/webpack.config.js @ONLY)
@@ -116,16 +109,6 @@ configure_file(package.json ${CMAKE_CURRENT_BINARY_DIR}/package.json @ONLY)
configure_file(webpack.config.js ${CMAKE_CURRENT_BINARY_DIR}/webpack.config.js)
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/package-lock.json DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
-# Install node_modules
-execute_process(
- COMMAND ${NPM} ci # like install, but actually respects package-lock file.
- COMMAND ${NPM} --loglevel verbose ci # like install, but actually respects package-lock file.
- WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
- RESULT_VARIABLE Result
-)
-if (NOT ${Result} EQUAL 0)
- message(FATAL_ERROR "npm intall failed: ${Result}")
- message(FATAL_ERROR "npm install failed: ${Result}")
-endif()
-
# Resolve $refs
execute_process(
COMMAND ${WithEnv} NODE_PATH=${CMAKE_CURRENT_BINARY_DIR}/node_modules node ${CMAKE_CURRENT_SOURCE_DIR}/tools/prep-package.js ${CMAKE_CURRENT_BINARY_DIR}/package.json ${CMAKE_CURRENT_BINARY_DIR}/package.json
@@ -169,6 +152,7 @@
@@ -183,6 +166,7 @@ add_custom_target(adapter_tests
add_copy_file(PackageFiles ${CMAKE_CURRENT_SOURCE_DIR}/README.md ${CMAKE_CURRENT_BINARY_DIR}/README.md)
add_copy_file(PackageFiles ${CMAKE_CURRENT_SOURCE_DIR}/CHANGELOG.md ${CMAKE_CURRENT_BINARY_DIR}/CHANGELOG.md)
@@ -40,7 +41,7 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt
add_copy_file(PackageFiles ${CMAKE_CURRENT_SOURCE_DIR}/images/lldb.png ${CMAKE_CURRENT_BINARY_DIR}/images/lldb.png)
add_copy_file(PackageFiles ${CMAKE_CURRENT_SOURCE_DIR}/images/user.svg ${CMAKE_CURRENT_BINARY_DIR}/images/user.svg)
add_copy_file(PackageFiles ${CMAKE_CURRENT_SOURCE_DIR}/images/users.svg ${CMAKE_CURRENT_BINARY_DIR}/images/users.svg)
@@ -185,6 +169,7 @@
@@ -199,6 +183,7 @@ add_custom_target(dev_debugging
set(PackagedFilesBootstrap
README.md
CHANGELOG.md