From f0cd53a2c9873d4f8b0073f1f7b64f5b495408aa Mon Sep 17 00:00:00 2001 From: daimond113 <72147841+daimond113@users.noreply.github.com> Date: Wed, 24 Jul 2024 00:53:34 +0200 Subject: [PATCH] refactor: add debug messages --- Cargo.lock | 130 +++++++++++++++++++-------------------- Cargo.toml | 10 +-- src/cli/install.rs | 21 ++++++- src/cli/mod.rs | 17 ++++- src/download.rs | 4 ++ src/lib.rs | 1 + src/linking/generator.rs | 2 + src/linking/mod.rs | 2 + src/lockfile.rs | 6 +- src/manifest.rs | 14 ++++- src/patches.rs | 4 ++ src/resolver.rs | 11 +++- src/source/pesde/mod.rs | 5 ++ 13 files changed, 149 insertions(+), 78 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 129454b..4ac3ae5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1098,9 +1098,9 @@ dependencies = [ [[package]] name = "gix" -version = "0.63.0" +version = "0.64.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "984c5018adfa7a4536ade67990b3ebc6e11ab57b3d6cd9968de0947ca99b4b06" +checksum = "d78414d29fcc82329080166077e0f7689f4016551fdb334d787c3d040fe2634f" dependencies = [ "gix-actor", "gix-attributes", @@ -1145,7 +1145,6 @@ dependencies = [ "gix-worktree", "gix-worktree-state", "once_cell", - "parking_lot", "regex", "smallvec", "thiserror", @@ -1153,9 +1152,9 @@ dependencies = [ [[package]] name = "gix-actor" -version = "0.31.4" +version = "0.31.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b8ee65074b2bbb91d9d97c15d172ea75043aefebf9869b5b329149dc76501c" +checksum = "a0e454357e34b833cc3a00b6efbbd3dd4d18b24b9fb0c023876ec2645e8aa3f2" dependencies = [ "bstr", "gix-date", @@ -1167,9 +1166,9 @@ dependencies = [ [[package]] name = "gix-attributes" -version = "0.22.2" +version = "0.22.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eefb48f42eac136a4a0023f49a54ec31be1c7a9589ed762c45dcb9b953f7ecc8" +checksum = "e37ce99c7e81288c28b703641b6d5d119aacc45c1a6b247156e6249afa486257" dependencies = [ "bstr", "gix-glob", @@ -1202,9 +1201,9 @@ dependencies = [ [[package]] name = "gix-command" -version = "0.3.7" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c22e086314095c43ffe5cdc5c0922d5439da4fd726f3b0438c56147c34dc225" +checksum = "0d76867867da891cbe32021ad454e8cae90242f6afb06762e4dd0d357afd1d7b" dependencies = [ "bstr", "gix-path", @@ -1214,9 +1213,9 @@ dependencies = [ [[package]] name = "gix-commitgraph" -version = "0.24.2" +version = "0.24.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7b102311085da4af18823413b5176d7c500fb2272eaf391cfa8635d8bcb12c4" +checksum = "133b06f67f565836ec0c473e2116a60fb74f80b6435e21d88013ac0e3c60fc78" dependencies = [ "bstr", "gix-chunk", @@ -1228,9 +1227,9 @@ dependencies = [ [[package]] name = "gix-config" -version = "0.37.0" +version = "0.38.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53fafe42957e11d98e354a66b6bd70aeea00faf2f62dd11164188224a507c840" +checksum = "28f53fd03d1bf09ebcc2c8654f08969439c4556e644ca925f27cf033bc43e658" dependencies = [ "bstr", "gix-config-value", @@ -1249,9 +1248,9 @@ dependencies = [ [[package]] name = "gix-config-value" -version = "0.14.6" +version = "0.14.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbd06203b1a9b33a78c88252a625031b094d9e1b647260070c25b09910c0a804" +checksum = "b328997d74dd15dc71b2773b162cb4af9a25c424105e4876e6d0686ab41c383e" dependencies = [ "bitflags 2.6.0", "bstr", @@ -1262,9 +1261,9 @@ dependencies = [ [[package]] name = "gix-credentials" -version = "0.24.2" +version = "0.24.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c70146183bd3c7119329a3c7392d1aa0e0adbe48d727f4df31828fe6d8fdaa1" +checksum = "91b446df0841c9d74b3f98f21657b892581a4af78904a22e0cbc6144da972eea" dependencies = [ "bstr", "gix-command", @@ -1291,9 +1290,9 @@ dependencies = [ [[package]] name = "gix-diff" -version = "0.44.0" +version = "0.44.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40b9bd8b2d07b6675a840b56a6c177d322d45fa082672b0dad8f063b25baf0a4" +checksum = "1996d5c8a305b59709467d80617c9fde48d9d75fd1f4179ea970912630886c9d" dependencies = [ "bstr", "gix-hash", @@ -1303,9 +1302,9 @@ dependencies = [ [[package]] name = "gix-discover" -version = "0.32.0" +version = "0.33.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc27c699b63da66b50d50c00668bc0b7e90c3a382ef302865e891559935f3dbf" +checksum = "67662731cec3cb31ba3ed2463809493f76d8e5d6c6d245de8b0560438c13450e" dependencies = [ "bstr", "dunce", @@ -1339,9 +1338,9 @@ dependencies = [ [[package]] name = "gix-filter" -version = "0.11.2" +version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00ce6ea5ac8fca7adbc63c48a1b9e0492c222c386aa15f513405f1003f2f4ab2" +checksum = "e6547738da28275f4dff4e9f3a0f28509f53f94dd6bd822733c91cb306bca61a" dependencies = [ "bstr", "encoding_rs", @@ -1360,9 +1359,9 @@ dependencies = [ [[package]] name = "gix-fs" -version = "0.11.1" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3338ff92a2164f5209f185ec0cd316f571a72676bb01d27e22f2867ba69f77a" +checksum = "6adf99c27cdf17b1c4d77680c917e0d94d8783d4e1c73d3be0d1d63107163d7a" dependencies = [ "fastrand", "gix-features", @@ -1371,9 +1370,9 @@ dependencies = [ [[package]] name = "gix-glob" -version = "0.16.3" +version = "0.16.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2a29ad0990cf02c48a7aac76ed0dbddeb5a0d070034b83675cc3bbf937eace4" +checksum = "fa7df15afa265cc8abe92813cd354d522f1ac06b29ec6dfa163ad320575cb447" dependencies = [ "bitflags 2.6.0", "bstr", @@ -1404,9 +1403,9 @@ dependencies = [ [[package]] name = "gix-ignore" -version = "0.11.2" +version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "640dbeb4f5829f9fc14d31f654a34a0350e43a24e32d551ad130d99bf01f63f1" +checksum = "5e6afb8f98e314d4e1adc822449389ada863c174b5707cedd327d67b84dba527" dependencies = [ "bstr", "gix-glob", @@ -1417,9 +1416,9 @@ dependencies = [ [[package]] name = "gix-index" -version = "0.33.0" +version = "0.33.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d8c5a5f1c58edcbc5692b174cda2703aba82ed17d7176ff4c1752eb48b1b167" +checksum = "9a9a44eb55bd84bb48f8a44980e951968ced21e171b22d115d1cdcef82a7d73f" dependencies = [ "bitflags 2.6.0", "bstr", @@ -1467,9 +1466,9 @@ dependencies = [ [[package]] name = "gix-negotiate" -version = "0.13.1" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d57dec54544d155a495e01de947da024471e1825d7d3f2724301c07a310d6184" +checksum = "9ec879fb6307bb63519ba89be0024c6f61b4b9d61f1a91fd2ce572d89fe9c224" dependencies = [ "bitflags 2.6.0", "gix-commitgraph", @@ -1502,9 +1501,9 @@ dependencies = [ [[package]] name = "gix-odb" -version = "0.61.0" +version = "0.61.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e92b9790e2c919166865d0825b26cc440a387c175bed1b43a2fa99c0e9d45e98" +checksum = "20d384fe541d93d8a3bb7d5d5ef210780d6df4f50c4e684ccba32665a5e3bc9b" dependencies = [ "arc-swap", "gix-date", @@ -1522,9 +1521,9 @@ dependencies = [ [[package]] name = "gix-pack" -version = "0.51.0" +version = "0.51.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a8da51212dbff944713edb2141ed7e002eea326b8992070374ce13a6cb610b3" +checksum = "3e0594491fffe55df94ba1c111a6566b7f56b3f8d2e1efc750e77d572f5f5229" dependencies = [ "clru", "gix-chunk", @@ -1579,9 +1578,9 @@ dependencies = [ [[package]] name = "gix-pathspec" -version = "0.7.5" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a76cab098dc10ba2d89f634f66bf196dea4d7db4bf10b75c7a9c201c55a2ee19" +checksum = "d307d1b8f84dc8386c4aa20ce0cf09242033840e15469a3ecba92f10cfb5c046" dependencies = [ "bitflags 2.6.0", "bstr", @@ -1594,9 +1593,9 @@ dependencies = [ [[package]] name = "gix-prompt" -version = "0.8.5" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fddabbc7c51c241600ab3c4623b19fa53bde7c1a2f637f61043ed5fcadf000cc" +checksum = "7e0595d2be4b6d6a71a099e989bdd610882b882da35fb8503d91d6f81aa0936f" dependencies = [ "gix-command", "gix-config-value", @@ -1607,9 +1606,9 @@ dependencies = [ [[package]] name = "gix-protocol" -version = "0.45.1" +version = "0.45.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c140d4c6d209048826bad78f021a01b612830f89da356efeb31afe8957f8bee" +checksum = "bad8da8e89f24177bd77947092199bb13dcc318bbd73530ba8a05e6d6adaaa9d" dependencies = [ "bstr", "gix-credentials", @@ -1636,12 +1635,11 @@ dependencies = [ [[package]] name = "gix-ref" -version = "0.44.1" +version = "0.45.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3394a2997e5bc6b22ebc1e1a87b41eeefbcfcff3dbfa7c4bd73cb0ac8f1f3e2e" +checksum = "636e96a0a5562715153fee098c217110c33a6f8218f08f4687ff99afde159bb5" dependencies = [ "gix-actor", - "gix-date", "gix-features", "gix-fs", "gix-hash", @@ -1658,9 +1656,9 @@ dependencies = [ [[package]] name = "gix-refspec" -version = "0.23.0" +version = "0.23.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dde848865834a54fe4d9b4573f15d0e9a68eaf3d061b42d3ed52b4b8acf880b2" +checksum = "6868f8cd2e62555d1f7c78b784bece43ace40dd2a462daf3b588d5416e603f37" dependencies = [ "bstr", "gix-hash", @@ -1672,9 +1670,9 @@ dependencies = [ [[package]] name = "gix-revision" -version = "0.27.1" +version = "0.27.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63e08f8107ed1f93a83bcfbb4c38084c7cb3f6cd849793f1d5eec235f9b13b2b" +checksum = "01b13e43c2118c4b0537ddac7d0821ae0dfa90b7b8dbf20c711e153fb749adce" dependencies = [ "bstr", "gix-date", @@ -1688,9 +1686,9 @@ dependencies = [ [[package]] name = "gix-revwalk" -version = "0.13.1" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4181db9cfcd6d1d0fd258e91569dbb61f94cb788b441b5294dd7f1167a3e788f" +checksum = "1b030ccaab71af141f537e0225f19b9e74f25fefdba0372246b844491cab43e0" dependencies = [ "gix-commitgraph", "gix-date", @@ -1703,9 +1701,9 @@ dependencies = [ [[package]] name = "gix-sec" -version = "0.10.6" +version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fddc27984a643b20dd03e97790555804f98cf07404e0e552c0ad8133266a79a1" +checksum = "1547d26fa5693a7f34f05b4a3b59a90890972922172653bcb891ab3f09f436df" dependencies = [ "bitflags 2.6.0", "gix-path", @@ -1715,9 +1713,9 @@ dependencies = [ [[package]] name = "gix-submodule" -version = "0.11.0" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "921cd49924ac14b6611b22e5fb7bbba74d8780dc7ad26153304b64d1272460ac" +checksum = "0f2e0f69aa00805e39d39ec80472a7e9da20ed5d73318b27925a2cc198e854fd" dependencies = [ "bstr", "gix-config", @@ -1749,9 +1747,9 @@ checksum = "f924267408915fddcd558e3f37295cc7d6a3e50f8bd8b606cee0808c3915157e" [[package]] name = "gix-transport" -version = "0.42.1" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb0ffa5f869977f5b9566399154055902f05d7e85c787d5eacf551acdd0c4adf" +checksum = "27c02b83763ffe95bcc27ce5821b2b7f843315a009c06f1cd59c9b66c508c058" dependencies = [ "base64", "bstr", @@ -1768,9 +1766,9 @@ dependencies = [ [[package]] name = "gix-traverse" -version = "0.39.1" +version = "0.39.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f20cb69b63eb3e4827939f42c05b7756e3488ef49c25c412a876691d568ee2a0" +checksum = "e499a18c511e71cf4a20413b743b9f5bcf64b3d9e81e9c3c6cd399eae55a8840" dependencies = [ "bitflags 2.6.0", "gix-commitgraph", @@ -1785,9 +1783,9 @@ dependencies = [ [[package]] name = "gix-url" -version = "0.27.3" +version = "0.27.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0db829ebdca6180fbe32be7aed393591df6db4a72dbbc0b8369162390954d1cf" +checksum = "e2eb9b35bba92ea8f0b5ab406fad3cf6b87f7929aa677ff10aa042c6da621156" dependencies = [ "bstr", "gix-features", @@ -1819,9 +1817,9 @@ dependencies = [ [[package]] name = "gix-worktree" -version = "0.34.0" +version = "0.34.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53f6b7de83839274022aff92157d7505f23debf739d257984a300a35972ca94e" +checksum = "26f7326ebe0b9172220694ea69d344c536009a9b98fb0f9de092c440f3efe7a6" dependencies = [ "bstr", "gix-attributes", @@ -1838,9 +1836,9 @@ dependencies = [ [[package]] name = "gix-worktree-state" -version = "0.11.0" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e64b2835892ce553b15aef7f6f7bb1e39e146fdf71eb99609b86710a7786cf34" +checksum = "39ed6205b5f51067a485b11843babcf3304c0799e265a06eb0dde7f69cd85cd8" dependencies = [ "bstr", "gix-features", diff --git a/Cargo.toml b/Cargo.toml index e9c90bb..bdad770 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,10 +11,11 @@ include = ["src/**/*", "Cargo.toml", "Cargo.lock", "README.md", "LICENSE", "CHAN [features] bin = ["clap", "directories", "pretty_env_logger", "reqwest/json", "reqwest/multipart", "indicatif", "indicatif-log-bridge", "inquire", "toml_edit", "colored", "anyhow", "keyring", "open", "gix/worktree-mutation"] -wally-compat = ["zip"] +wally-compat = ["zip", "roblox"] roblox = [] lune = [] luau = [] +patches = ["git2"] [[bin]] name = "pesde" @@ -29,9 +30,7 @@ serde = { version = "1.0.204", features = ["derive"] } toml = "0.8.15" serde_json = "1.0.120" serde_with = "3.9.0" -gix = { version = "0.63.0", default-features = false, features = ["blocking-http-transport-reqwest-rust-tls", "revparse-regex", "credentials"] } -# TODO: remove this when gitoxide adds support for: committing, pushing, adding -git2 = "0.19.0" +gix = { version = "0.64.0", default-features = false, features = ["blocking-http-transport-reqwest-rust-tls", "revparse-regex", "credentials"] } semver = { version = "1.0.23", features = ["serde"] } reqwest = { version = "0.12.5", default-features = false, features = ["rustls-tls", "blocking"] } tar = "0.4.41" @@ -48,6 +47,9 @@ cfg-if = "1.0.0" # secrecy = "0.8.0" chrono = { version = "0.4.38", features = ["serde"] } +# TODO: remove this when gitoxide adds support for: committing, pushing, adding +git2 = { version = "0.19.0", optional = true } + zip = { version = "2.1.5", optional = true } anyhow = { version = "1.0.86", optional = true } diff --git a/src/cli/install.rs b/src/cli/install.rs index 29c1977..1f28be3 100644 --- a/src/cli/install.rs +++ b/src/cli/install.rs @@ -2,7 +2,7 @@ use crate::cli::{reqwest_client, IsUpToDate}; use anyhow::Context; use clap::Args; use indicatif::MultiProgress; -use pesde::{lockfile::Lockfile, Project}; +use pesde::{lockfile::Lockfile, manifest::TargetKind, Project}; use std::{collections::HashSet, sync::Arc, time::Duration}; #[derive(Debug, Args)] @@ -37,6 +37,25 @@ impl InstallCommand { None }; + { + let mut deleted_folders = HashSet::new(); + + for target_kind in TargetKind::VARIANTS { + let folder = manifest.target.kind().packages_folder(target_kind); + + if deleted_folders.insert(folder.to_string()) { + log::debug!("deleting the {folder} folder"); + + if let Some(e) = std::fs::remove_dir_all(project.path().join(&folder)) + .err() + .filter(|e| e.kind() != std::io::ErrorKind::NotFound) + { + return Err(e).context(format!("failed to remove the {folder} folder")); + }; + } + } + } + let old_graph = lockfile.map(|lockfile| { lockfile .graph diff --git a/src/cli/mod.rs b/src/cli/mod.rs index 3184b71..9b35d89 100644 --- a/src/cli/mod.rs +++ b/src/cli/mod.rs @@ -11,7 +11,9 @@ mod auth; mod config; mod init; mod install; +#[cfg(feature = "patches")] mod patch; +#[cfg(feature = "patches")] mod patch_commit; mod publish; mod run; @@ -249,10 +251,12 @@ impl IsUpToDate for Project { }; if manifest.overrides != lockfile.overrides { + log::debug!("overrides are different"); return Ok(false); } if manifest.target.kind() != lockfile.target { + log::debug!("target kind is different"); return Ok(false); } @@ -261,6 +265,7 @@ impl IsUpToDate for Project { } if manifest.name != lockfile.name || manifest.version != lockfile.version { + log::debug!("name or version is different"); return Ok(false); } @@ -274,11 +279,15 @@ impl IsUpToDate for Project { }) .collect::>(); - Ok(manifest + let same_dependencies = manifest .all_dependencies() .context("failed to get all dependencies")? .iter() - .all(|(_, (spec, ty))| specs.contains(&(spec.clone(), *ty)))) + .all(|(_, (spec, ty))| specs.contains(&(spec.clone(), *ty))); + + log::debug!("dependencies are the same: {same_dependencies}"); + + Ok(same_dependencies) } } @@ -350,9 +359,11 @@ pub enum Subcommand { SelfInstall(self_install::SelfInstallCommand), /// Sets up a patching environment for a package + #[cfg(feature = "patches")] Patch(patch::PatchCommand), /// Finalizes a patching environment for a package + #[cfg(feature = "patches")] PatchCommit(patch_commit::PatchCommitCommand), } @@ -366,7 +377,9 @@ impl Subcommand { Subcommand::Install(install) => install.run(project, multi), Subcommand::Publish(publish) => publish.run(project), Subcommand::SelfInstall(self_install) => self_install.run(project), + #[cfg(feature = "patches")] Subcommand::Patch(patch) => patch.run(project), + #[cfg(feature = "patches")] Subcommand::PatchCommit(patch_commit) => patch_commit.run(project), } } diff --git a/src/download.rs b/src/download.rs index f3b20ba..e0515a1 100644 --- a/src/download.rs +++ b/src/download.rs @@ -63,6 +63,8 @@ impl Project { threadpool.execute(move || { let project = project.clone(); + log::debug!("downloading {name}@{version_id}"); + let target = match source.download(&node.pkg_ref, &container_folder, &project, &reqwest) { @@ -73,6 +75,8 @@ impl Project { } }; + log::debug!("downloaded {name}@{version_id}"); + let mut downloaded_graph = downloaded_graph.lock().unwrap(); downloaded_graph .entry(name) diff --git a/src/lib.rs b/src/lib.rs index bd1cde3..4960d6e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -11,6 +11,7 @@ pub mod linking; pub mod lockfile; pub mod manifest; pub mod names; +#[cfg(feature = "patches")] pub mod patches; pub mod resolver; pub mod scripts; diff --git a/src/linking/generator.rs b/src/linking/generator.rs index 1d24531..e84f466 100644 --- a/src/linking/generator.rs +++ b/src/linking/generator.rs @@ -76,8 +76,10 @@ pub fn get_require_path( let path = pathdiff::diff_paths(destination_dir, base_dir).unwrap(); let path = if !use_new_structure { + log::debug!("using old structure for require path"); lib_file.to_path(path) } else { + log::debug!("using new structure for require path"); path }; diff --git a/src/linking/mod.rs b/src/linking/mod.rs index 6a45f3b..5996343 100644 --- a/src/linking/mod.rs +++ b/src/linking/mod.rs @@ -54,6 +54,8 @@ impl Project { } }; + log::debug!("{name}@{version_id} has {} exported types", types.len()); + package_types .entry(name) .or_default() diff --git a/src/lockfile.rs b/src/lockfile.rs index 03ad395..ceef7db 100644 --- a/src/lockfile.rs +++ b/src/lockfile.rs @@ -53,8 +53,10 @@ pub fn insert_node( mut node: DependencyGraphNode, is_top_level: bool, ) { - if !is_top_level { - node.direct.take(); + if !is_top_level && node.direct.take().is_some() { + log::debug!( + "tried to insert {name}@{version} as direct dependency from a non top-level context", + ); } match graph diff --git a/src/manifest.rs b/src/manifest.rs index aa9b315..18da2ef 100644 --- a/src/manifest.rs +++ b/src/manifest.rs @@ -53,6 +53,15 @@ impl FromStr for TargetKind { } impl TargetKind { + pub const VARIANTS: &'static [TargetKind] = &[ + #[cfg(feature = "roblox")] + TargetKind::Roblox, + #[cfg(feature = "lune")] + TargetKind::Lune, + #[cfg(feature = "luau")] + TargetKind::Luau, + ]; + // self is the project's target, dependency is the target of the dependency pub fn is_compatible_with(&self, dependency: &Self) -> bool { if self == dependency { @@ -213,7 +222,7 @@ impl Display for OverrideKey { pub enum ScriptName { #[cfg(feature = "roblox")] RobloxSyncConfigGenerator, - #[cfg(all(feature = "wally-compat", feature = "roblox"))] + #[cfg(feature = "wally-compat")] SourcemapGenerator, } @@ -222,7 +231,7 @@ impl Display for ScriptName { match self { #[cfg(feature = "roblox")] ScriptName::RobloxSyncConfigGenerator => write!(f, "roblox_sync_config_generator"), - #[cfg(all(feature = "wally-compat", feature = "roblox"))] + #[cfg(feature = "wally-compat")] ScriptName::SourcemapGenerator => write!(f, "sourcemap_generator"), } } @@ -254,6 +263,7 @@ pub struct Manifest { pub overrides: BTreeMap, #[serde(default)] pub includes: BTreeSet, + #[cfg(feature = "patches")] #[serde(default, skip_serializing)] pub patches: BTreeMap>, diff --git a/src/patches.rs b/src/patches.rs index 9a74e87..13d5793 100644 --- a/src/patches.rs +++ b/src/patches.rs @@ -90,11 +90,15 @@ impl Project { version_id.version(), ); + log::debug!("applying patch to {name}@{version_id}"); + { let repo = setup_patches_repo(&container_folder)?; repo.apply(&patch, ApplyLocation::Both, None)?; } + log::debug!("patch applied to {name}@{version_id}, removing .git directory"); + std::fs::remove_dir_all(container_folder.join(".git")).map_err(|e| { errors::ApplyPatchesError::GitDirectoryRemovalError(container_folder, e) })?; diff --git a/src/resolver.rs b/src/resolver.rs index 935c6e1..a503ce4 100644 --- a/src/resolver.rs +++ b/src/resolver.rs @@ -39,7 +39,9 @@ impl Project { .remove(&(specifier.clone(), node.ty)) .is_none() { - // this dependency is no longer in the manifest, or it's type has changed + log::debug!( + "dependency {name}@{version} from old dependency graph is no longer in the manifest", + ); continue; } @@ -258,6 +260,13 @@ impl Project { }) }); + if overridden.is_some() { + log::debug!( + "{}overridden specifier found for {dependency_alias} ({dependency_spec})", + "\t".repeat(depth) + ); + } + queue.push_back(( dependency_alias, overridden.cloned().unwrap_or(dependency_spec), diff --git a/src/source/pesde/mod.rs b/src/source/pesde/mod.rs index 00dfd4d..4583d56 100644 --- a/src/source/pesde/mod.rs +++ b/src/source/pesde/mod.rs @@ -250,6 +250,8 @@ impl PackageSource for PesdePackageSource { type DownloadError = errors::DownloadError; fn refresh(&self, project: &Project) -> Result<(), Self::RefreshError> { + log::debug!("refreshing pesde index at {}", self.repo_url); + let path = self.path(project); if path.exists() { let repo = match gix::open(&path) { @@ -311,6 +313,8 @@ impl PackageSource for PesdePackageSource { let entries: IndexFile = toml::from_str(&string) .map_err(|e| Self::ResolveError::Parse(specifier.name.to_string(), e))?; + log::debug!("{} has {} possible entries", specifier.name, entries.len()); + Ok(( PackageNames::Pesde(specifier.name.clone()), entries @@ -358,6 +362,7 @@ impl PackageSource for PesdePackageSource { let mut response = reqwest.get(url); if let Some(token) = &project.auth_config.pesde_token { + log::debug!("using token for pesde package download"); response = response.header("Authorization", format!("Bearer {token}")); }