From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id uEXAD5thQ2IZkwAAgWs5BA (envelope-from ) for ; Tue, 29 Mar 2022 21:44:27 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id 6MFXCJthQ2LA3QAAG6o9tA (envelope-from ) for ; Tue, 29 Mar 2022 21:44:27 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id B80693C7C4 for ; Tue, 29 Mar 2022 21:44:26 +0200 (CEST) Received: from localhost ([::1]:34592 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nZHlR-0003RI-G5 for larch@yhetil.org; Tue, 29 Mar 2022 15:44:25 -0400 Received: from eggs.gnu.org ([209.51.188.92]:57022) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nZHl5-0003QY-CT for guix-patches@gnu.org; Tue, 29 Mar 2022 15:44:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:39733) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nZHl5-0001Au-4T for guix-patches@gnu.org; Tue, 29 Mar 2022 15:44:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nZHl5-0004xn-1t for guix-patches@gnu.org; Tue, 29 Mar 2022 15:44:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#49946] [PATCH v5 02/27] gnu: Add tree-sitter-cli. Resent-From: Pierre Langlois Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 29 Mar 2022 19:44:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 49946 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 49946@debbugs.gnu.org Cc: Pierre Langlois Received: via spool by 49946-submit@debbugs.gnu.org id=B49946.164858303318896 (code B ref 49946); Tue, 29 Mar 2022 19:44:03 +0000 Received: (at 49946) by debbugs.gnu.org; 29 Mar 2022 19:43:53 +0000 Received: from localhost ([127.0.0.1]:33586 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nZHku-0004ub-KJ for submit@debbugs.gnu.org; Tue, 29 Mar 2022 15:43:53 -0400 Received: from mout.gmx.net ([212.227.17.21]:43943) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nZHkn-0004rp-4T for 49946@debbugs.gnu.org; Tue, 29 Mar 2022 15:43:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1648583019; bh=g6PGgOo/lsbJbHtqrKzLDpI0sQTjUr+6f5XVeUe6Ung=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=PsBi3gO4TZFSZrZVY0d/27ciHhO3jpn9RlxRDmTtnFbv3/fBw2lt/e6l2wns729Lt 9j69LvQVzvYm3GiwM5ztJbSyV0kZ0mGDDvKDljInS1zUQv/ec6WgHGLJc9m1jtEFKj W5+DSypstGUuQMwY4KgopsXGuKEHCJv7OylO7DXU= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from localhost.localdomain ([82.69.64.142]) by mail.gmx.net (mrgmx105 [212.227.17.174]) with ESMTPSA (Nemesis) id 1MgNct-1oFWj73h4J-00hyRP; Tue, 29 Mar 2022 21:43:39 +0200 From: Pierre Langlois Date: Tue, 29 Mar 2022 20:42:53 +0100 Message-Id: <20220329194318.6106-3-pierre.langlois@gmx.com> X-Mailer: git-send-email 2.34.0 In-Reply-To: <20220329194318.6106-1-pierre.langlois@gmx.com> References: <877d9s2qa9.fsf@gmx.com> <20220329194318.6106-1-pierre.langlois@gmx.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:tJIWGRytHi6Abduv2CjOTeHxIzpMcmnSTevyQVQq+llHfelOzJU GzmG3CFdlxydW6p7gmwCG7sd2SIBYaIEjLzzXrRmzVu2to+/NuExUl8H/6EQ+5gLz9cC/KK uANPASQnaQFUJIS4Y64oTgGqTAbIIILKu/hGJlf6XkyHuCr4NtNGJEGooUDf1uJIMTepRuZ cqY9ou439QCpCuoaiLHTA== X-UI-Out-Filterresults: notjunk:1;V03:K0:gpqjNvk3NgM=:EqtB4akX/qPPxdz0Zha2gT quPLcK7XcSv3aMP89abmiOdXkj3AkjppR0IoyiDRftEeQ5Smc9YojgPSWtEW4QjCHEsKLgIEB YhEX7S1meylVqXwi+UUfQFfLf8+Kzjc0luXkytT+5bPvpgrHXsK2l54vNuyEkzs+OxBMJle+z i1k2WTomStvs2g8MRNCDabVr4kWakAyfAreNnacbtELq6fhKWn/b7K863gzSIE9Zk6Z0VqvBq rUj4ebBwCoAgjAufumvxluPBK/clwMbSHCFSf+6I75N3N4dxCI8Z8RWopBk3sOs8y4VRmtSCS tB6H2diyNkeXThg6lv+vXSBrRfzK375mrwr1uQtCh8hhgeIK1+SLXMmn8SlojG3cJHOnK/PvE NQDjPA7YoKQxY6G+R6gfFFLMywlh5RXekV6LkUtaB/FBsn43nayjYYRD+0V7WW501qYHBT97D al+XioUiW4yOyjFJiuPZzX44KwQE97WOdcf+wjaFLzcaJvZgLBZF6Q2WjBFyaeCVIriz3X15U RkzePW+HkAn/8spsDiQ1lk4evrlxBJ8amriN4AIXDxTxeAA4u9Sa/IHJu1s4ZtcllFpuo1SWk lbNs5vYXRBAF+UWQMBD9PqhX9yJ+xJAX2mr/4yWuLy0F2PTggrLOWLXqMOZokyI7Zj6MfgEm5 ifPOeOdR2NedczQTab4RXyeIkFP1KNSlEjIALspwcg2hG2vEa0a6M5XhY8rQzmp+Htpsw5hUV 24vDeelHVfSM8MpTDIFMXAnHqepAM/6fdJkr1k+gtQ77xqPrj/25POrRkzdhdqSEeqDMVXNPf 2e7ijKrLwrBAbyOrTjVXCrrvgCgQzcIWaVKt5QhBmkIYzCdQy++8GcouAzE5GSiGLlH9gjqMR zw73LWASW3C4AnIeXLm08ao3cQz5oEijp71WIH7YMYXFClvuNa9PaMwuAzsiONip9aDQRakTQ Vg2+N1S0y+efnEkjCiHbmjJJUzTbPC8EaWxs+KF4/ovXYejunja7wQlBjjItn78GtiD7UWV6d 3phUZ/pWjRnxZ+9rxyYHca6klTfAv7LXza9riK1LXrbldcDHO3M2DiDF9BJa1I2NzRarLS3qA 3pfcCSlLq/T10o= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1648583066; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=17+Y/+RDnpZxKlx1ugdLQV6Vtv09Dbs8NPPGtsUZCz4=; b=A9HbiQ8YLRnvtl5ESqfOS9itgrvXP2QUiwSUE2RP8lINrF+gdxGNPRbZb6okMMMNZmEcFX l9Jz7kV/F2vMxgIBm21y2xdLCICnFgrcU79ZRRCo8z3GemC+JjKWD/0kZC0irHapSB0ZOE cb5uA6ndwONAP6S18AN6Omb4A1KAl9nu8FpoNdWizTxstDzIB19sAaEhLvcsTxci2oqe/j iFkdAVf0R014n9bAxsG5rtudx756tB5/E6AtfOIB5/uwrxOJ8ebXspMrP5PINsi+QXm3GJ 6WKxV2n2VUDSDlJjBDwsTw1ZgEWsvW91yXKHmJZsTaLIUk9ATBZSXsmHe8p/wA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1648583066; a=rsa-sha256; cv=none; b=SWv00czobp1zyJX/LfQ7vs6Y7xWPUTW70DRhKo+K/ry14lEwedQ+cc9/Pvhqkq2D39N8Nc lQYcPdrXJZZVtVvEMUYttUOgoC2SHwBfNIN/sAqyjXg3ufK8NTuZK2JGxR6atFeM9A5Orh h8Xk0lCHCVCvsWpwaVzMTEaMvfhm2XlRZM43yEJiJAdg3hhSGAOwc5rySOJetDelIPNYX6 l/+tYlA8tZTphM5Tmg4hnAvvaLTiTSwUqa2gD7OA5UyQl11+VG36+ZIYZDhucCAsakiznX lE2lpDpf8AHZF1Rtvs/lFzbTgmLFslmvdF8Ny+8ra+SCuJw7Xjh4imxMDRYhXA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmx.net header.s=badeba3b8450 header.b=PsBi3gO4; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmx.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: 7.33 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmx.net header.s=badeba3b8450 header.b=PsBi3gO4; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmx.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: B80693C7C4 X-Spam-Score: 7.33 X-Migadu-Scanner: scn1.migadu.com X-TUID: IvM7v+HmowmX * gnu/packages/tree-sitter.scm (tree-sitter-cli): New variable. =2D-- gnu/packages/tree-sitter.scm | 79 ++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) diff --git a/gnu/packages/tree-sitter.scm b/gnu/packages/tree-sitter.scm index 7116a10ed7..18c9fe0844 100644 =2D-- a/gnu/packages/tree-sitter.scm +++ b/gnu/packages/tree-sitter.scm @@ -20,10 +20,13 @@ (define-module (gnu packages tree-sitter) #:use-module (guix gexp) #:use-module ((guix licenses) #:prefix license:) + #:use-module (guix build-system cargo) #:use-module (guix build-system gnu) #:use-module (guix git-download) #:use-module (guix packages) #:use-module (guix utils) + #:use-module (gnu packages crates-graphics) + #:use-module (gnu packages crates-io) #:use-module (gnu packages icu4c)) (define-public tree-sitter @@ -76,3 +79,79 @@ (define-public tree-sitter This package includes the @code{libtree-sitter} runtime library. ") (license license:expat))) + +(define-public tree-sitter-cli + (package (inherit tree-sitter) + (name "tree-sitter-cli") + (source (origin + (inherit (package-source tree-sitter)) + (snippet + '(begin + ;; Remove the runtime library code and dynamically link= to + ;; it instead. + (delete-file-recursively "lib/src") + (delete-file "lib/binding_rust/build.rs") + (with-output-to-file "lib/binding_rust/build.rs" + (lambda _ + (format #t "fn main() {~@ + println!(\"cargo:rustc-link-lib=3Dtree-sitt= er\");~@ + }~%"))) + #t)))) + (build-system cargo-build-system) + (inputs (list tree-sitter)) + (arguments + `(;; Running test requires downloading fixtures, see the + ;; script/fetch-fixtures script. + #:tests? #f + ;; We're only packaging the CLI program so we do not need to insta= ll + ;; sources. + #:install-source? #f + #:cargo-inputs + (("rust-ansi-term" ,rust-ansi-term-0.12) + ("rust-anyhow" ,rust-anyhow-1) + ("rust-atty" ,rust-atty-0.2) + ("rust-clap" ,rust-clap-2) + ("rust-difference" ,rust-difference-2) + ("rust-html-escape" ,rust-html-escape-0.2) + ("rust-libloading" ,rust-libloading-0.7) + ("rust-rand" ,rust-rand-0.8) + ("rust-rustc-hash" ,rust-rustc-hash-1) + ("rust-semver" ,rust-semver-1) + ("rust-smallbitvec" ,rust-smallbitvec-2) + ("rust-thiserror" ,rust-thiserror-1) + ("rust-tiny-http" ,rust-tiny-http-0.8) + ("rust-toml" ,rust-toml-0.5) + ("rust-walkdir" ,rust-walkdir-2) + ("rust-webbrowser" ,rust-webbrowser-0.5) + ("rust-which" ,rust-which-4)) + #:cargo-development-inputs + (("rust-pretty-assertions" ,rust-pretty-assertions-0.7)) + #:phases + (modify-phases %standard-phases + (add-after 'unpack 'delete-cargo.lock + (lambda _ (delete-file "Cargo.lock"))) + (replace 'install + (lambda* (#:key outputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out")) + (bin (string-append out "/bin")) + (lib (string-append out "/lib"))) + (mkdir-p bin) + (install-file "target/release/tree-sitter" bin))))))) + (synopsis "Incremental parsing system for programming tools") + (description "Tree-sitter is a parser generator tool and an increment= al +parsing library. It can build a concrete syntax tree for a source file a= nd +efficiently update the syntax tree as the source file is edited. + +Tree-sitter aims to be: + +@enumerate +@item General enough to parse any programming language. +@item Fast enough to parse on every keystroke in a text editor. +@item Robust enough to provide useful results even in the presence of syn= tax +errors. +@item Dependency-free so that the runtime library (which is written in pu= re C) +can be embedded in any application. +@end enumerate + +This package includes the @command{tree-sitter} command-line tool.") + (license license:expat))) =2D- 2.34.0