nix-community / nixdoc

Tool to generate documentation for Nix library functions [maintainer=@infinisil]
GNU General Public License v3.0
129 stars 14 forks source link

WIP: Use the rnix "rowan" branch #20

Closed jD91mZM2 closed 1 year ago

jD91mZM2 commented 6 years ago

Don't merge yet.

I'm currently exploring a library called "rowan" in rnix, which supplies a builder for ASTs making the code prettier, but also makes comments completely separate tokens. Sadly this library is currently slower because it's not using an arena-based approach, but that should hopefully be possible to do in rowan without modifying rnix or this project. Eventually this will become the main version of rnix, so I fixed this project now :smile:

jD91mZM2 commented 6 years ago

CI is broken because of the git dependency, I think you had a patch to carnix for that?

tazjin commented 6 years ago

Interesting, I have to take a more detailed look at what this actually implies, but I have two superficial comments:

  1. Please keep the #[macro_use] annotation, nixdoc should build on NixOS stable which does not have the Rust version that drops this requirement.
  2. Please rewrite the commit message into the format I use (e.g. refactor: Use rowan-based rnix dependency with a body explaining the changes a little bit). I like keeping this uniform so people can see what is going on on a high-level without having to read through PRs.

CI is broken because of the git dependency, I think you had a patch to carnix for that?

Yep, carnix keeps some of the query parameters appended by cargo in the git URL and nix-prefetch-git then fails to clone the repository.

Based on my carnix devel branch, the (kinda brute-force) patch is:

diff --git a/src/prefetch.rs b/src/prefetch.rs
index 0078cb4..dab20c2 100644
--- a/src/prefetch.rs
+++ b/src/prefetch.rs
@@ -182,6 +182,9 @@ impl Crate {

         println!("Prefetching {} ({})", self.name, cached_url);
         debug!("cached_url = {:?}", cached_url);
+
+        let url = url.split("?").next().unwrap();
         let prefetch = Command::new("nix-prefetch-git")
             .args(&[ "--url", url, "--rev", rev ])
             .output();
asymmetric commented 1 year ago

Closed by #36.

:heart: