diff --git a/Cargo.lock b/Cargo.lock index 64b12fb..a3088db 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2261,9 +2261,9 @@ dependencies = [ [[package]] name = "gix-path" -version = "0.10.9" +version = "0.10.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d23d5bbda31344d8abc8de7c075b3cf26e5873feba7c4a15d916bce67382bd9" +checksum = "38d5b8722112fa2fa87135298780bc833b0e9f6c56cc82795d209804b3a03484" dependencies = [ "bstr", "gix-trace", @@ -3193,7 +3193,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4" dependencies = [ "cfg-if", - "windows-targets 0.52.6", + "windows-targets 0.48.5", ] [[package]] diff --git a/crates/heat-sdk-cli/src/cli_commands/package/mod.rs b/crates/heat-sdk-cli/src/cli_commands/package/mod.rs index 652e003..1c3856b 100644 --- a/crates/heat-sdk-cli/src/cli_commands/package/mod.rs +++ b/crates/heat-sdk-cli/src/cli_commands/package/mod.rs @@ -61,8 +61,10 @@ pub(crate) fn handle_command(args: PackageArgs, context: HeatCliContext) -> anyh let mut registered_functions = Vec::::new(); for flag in flags { // function token stream to readable string - let itemfn = syn_serde::json::from_slice::(flag.token_stream).expect("Should be able to parse token stream."); - let syn_tree: syn::File = syn::parse2(itemfn.into_token_stream()).expect("Should be able to parse token stream."); + let itemfn = syn_serde::json::from_slice::(flag.token_stream) + .expect("Should be able to parse token stream."); + let syn_tree: syn::File = + syn::parse2(itemfn.into_token_stream()).expect("Should be able to parse token stream."); let code_str = prettyplease::unparse(&syn_tree); registered_functions.push(RegisteredHeatFunction { mod_path: flag.mod_path.to_string(), diff --git a/crates/heat-sdk-cli/src/cli_commands/run/remote/training.rs b/crates/heat-sdk-cli/src/cli_commands/run/remote/training.rs index 86fc527..3ccaf56 100644 --- a/crates/heat-sdk-cli/src/cli_commands/run/remote/training.rs +++ b/crates/heat-sdk-cli/src/cli_commands/run/remote/training.rs @@ -50,7 +50,7 @@ pub struct RemoteTrainingRunArgs { short = 'r', long = "runner", help = "The runner group name.", - required = true, + required = true )] pub runner: String, } @@ -84,8 +84,10 @@ pub(crate) fn handle_command( let mut registered_functions = Vec::::new(); for flag in flags { // function token stream to readable string - let itemfn = syn_serde::json::from_slice::(flag.token_stream).expect("Should be able to parse token stream."); - let syn_tree: syn::File = syn::parse2(itemfn.into_token_stream()).expect("Should be able to parse token stream."); + let itemfn = syn_serde::json::from_slice::(flag.token_stream) + .expect("Should be able to parse token stream."); + let syn_tree: syn::File = + syn::parse2(itemfn.into_token_stream()).expect("Should be able to parse token stream."); let code_str = prettyplease::unparse(&syn_tree); registered_functions.push(RegisteredHeatFunction { mod_path: flag.mod_path.to_string(), @@ -99,7 +101,8 @@ pub(crate) fn handle_command( functions: registered_functions, }; - let project_version = heat_client.upload_new_project_version(context.package_name(), heat_metadata, crates)?; + let project_version = + heat_client.upload_new_project_version(context.package_name(), heat_metadata, crates)?; heat_client.start_remote_job( args.runner, diff --git a/crates/heat-sdk-cli/src/util/cargo/dependency.rs b/crates/heat-sdk-cli/src/util/cargo/dependency.rs index 2ba8680..c15d786 100644 --- a/crates/heat-sdk-cli/src/util/cargo/dependency.rs +++ b/crates/heat-sdk-cli/src/util/cargo/dependency.rs @@ -6,6 +6,7 @@ use serde::ser; use super::interning::InternedString; +/// From cargo: https://github.com/rust-lang/cargo/blob/57622d793935a662b5f14ca728a2989c14833d37/src/cargo/core/dependency.rs#L102 #[derive(PartialEq, Eq, Hash, Ord, PartialOrd, Clone, Debug, Copy)] pub enum DepKind { Normal, @@ -13,6 +14,7 @@ pub enum DepKind { Build, } +/// From cargo: https://github.com/rust-lang/cargo/blob/57622d793935a662b5f14ca728a2989c14833d37/src/cargo/core/dependency.rs#L108 impl DepKind { pub fn kind_table(&self) -> &'static str { match self { @@ -23,6 +25,7 @@ impl DepKind { } } +//From cargo: https://github.com/rust-lang/cargo/blob/57622d793935a662b5f14ca728a2989c14833d37/src/cargo/core/dependency.rs#L118 impl ser::Serialize for DepKind { fn serialize(&self, s: S) -> Result where @@ -37,6 +40,8 @@ impl ser::Serialize for DepKind { } } +/// From cargo: https://github.com/rust-lang/cargo/blob/57622d793935a662b5f14ca728a2989c14833d37/src/cargo/core/summary.rs#L355 +/// /// FeatureValue represents the types of dependencies a feature can have. #[derive(Clone, Debug, Ord, PartialOrd, Eq, PartialEq, Hash)] pub enum FeatureValue { @@ -55,6 +60,7 @@ pub enum FeatureValue { }, } +/// From cargo: https://github.com/rust-lang/cargo/blob/57622d793935a662b5f14ca728a2989c14833d37/src/cargo/core/summary.rs#L371 impl FeatureValue { pub fn new(feature: InternedString) -> FeatureValue { match feature.split_once('/') { @@ -95,6 +101,7 @@ impl FeatureValue { } } +/// From cargo: https://github.com/rust-lang/cargo/blob/57622d793935a662b5f14ca728a2989c14833d37/src/cargo/core/summary.rs#L411 impl fmt::Display for FeatureValue { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { use self::FeatureValue::*; diff --git a/crates/heat-sdk-cli/src/util/cargo/features.rs b/crates/heat-sdk-cli/src/util/cargo/features.rs index b1e3432..92476a2 100644 --- a/crates/heat-sdk-cli/src/util/cargo/features.rs +++ b/crates/heat-sdk-cli/src/util/cargo/features.rs @@ -1,10 +1,12 @@ -#![allow(dead_code)] +#![allow(unused)] use std::{fmt, str::FromStr}; use cargo_metadata::semver; use serde::{Deserialize, Serialize}; +/// From Cargo: https://github.com/rust-lang/cargo/blob/57622d793935a662b5f14ca728a2989c14833d37/src/cargo/core/features.rs#L186 +/// /// The edition of the compiler ([RFC 2052]) /// /// The following sections will guide you how to add and stabilize an edition. @@ -61,6 +63,8 @@ pub enum Edition { Edition2024, } +/// From Cargo: https://github.com/rust-lang/cargo/blob/57622d793935a662b5f14ca728a2989c14833d37/src/cargo/core/features.rs#L198 +/// Some unused impls were removed. impl Edition { /// The latest edition that is unstable. /// @@ -157,6 +161,7 @@ impl Edition { } } +/// From Cargo: https://github.com/rust-lang/cargo/blob/57622d793935a662b5f14ca728a2989c14833d37/src/cargo/core/features.rs#L313 impl fmt::Display for Edition { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match *self { @@ -168,6 +173,7 @@ impl fmt::Display for Edition { } } +/// From Cargo: https://github.com/rust-lang/cargo/blob/57622d793935a662b5f14ca728a2989c14833d37/src/cargo/core/features.rs#L324 impl FromStr for Edition { type Err = anyhow::Error; fn from_str(s: &str) -> Result { diff --git a/crates/heat-sdk-cli/src/util/cargo/interning.rs b/crates/heat-sdk-cli/src/util/cargo/interning.rs index 0363a2f..612cc22 100644 --- a/crates/heat-sdk-cli/src/util/cargo/interning.rs +++ b/crates/heat-sdk-cli/src/util/cargo/interning.rs @@ -1,3 +1,7 @@ +// This file is copied 1 for 1 from Cargo's source code. +// The original file can be found at: +// https://github.com/rust-lang/cargo/blob/57622d793935a662b5f14ca728a2989c14833d37/src/cargo/util/interning.rs + use serde::{Serialize, Serializer}; use serde_untagged::UntaggedEnumVisitor; use std::borrow::Borrow; diff --git a/crates/heat-sdk-cli/src/util/cargo/mod.rs b/crates/heat-sdk-cli/src/util/cargo/mod.rs index 5fb9060..1508cae 100644 --- a/crates/heat-sdk-cli/src/util/cargo/mod.rs +++ b/crates/heat-sdk-cli/src/util/cargo/mod.rs @@ -1,5 +1,10 @@ //! All of the code in this directory is heavily inspired by the [Cargo source code](https://github.com/rust-lang/cargo) //! and modified to fit the needs of the heat-sdk-cli project. +//! +//! In files that are entirely copied from Cargo, a link to the original source code is included in the top of the file as a comment. +//! In files that are partially copied from Cargo or include functions/definitons from multiple different files in Cargo, a link to the source code of the original functions/definitions is included in the comments above the copied code. +//! +//! Definitions and functions that are not copied from Cargo do not have a link to the original source code. mod dependency; mod features; diff --git a/crates/heat-sdk-cli/src/util/cargo/package.rs b/crates/heat-sdk-cli/src/util/cargo/package.rs index 0513aa6..3da9609 100644 --- a/crates/heat-sdk-cli/src/util/cargo/package.rs +++ b/crates/heat-sdk-cli/src/util/cargo/package.rs @@ -4,8 +4,6 @@ use std::{ path::{Path, PathBuf}, }; -use anyhow::Context; -use cargo_util_schemas::manifest::{self, RegistryName, StringOrBool}; use colored::Colorize; use heat_sdk::schemas::{CrateMetadata, Dep, PackagedCrateData}; @@ -14,17 +12,22 @@ use crate::{print_err, print_info, print_warn, util}; use sha2::Digest as _; use sha2::Sha256; +/// Based on the struct ArchiveFile from Cargo: https://github.com/rust-lang/cargo/blob/57622d793935a662b5f14ca728a2989c14833d37/src/cargo/ops/cargo_package.rs#L48 +/// rel_str member was removed struct ArchiveFile { rel_path: std::path::PathBuf, contents: FileContents, } +/// From Cargo: https://github.com/rust-lang/cargo/blob/57622d793935a662b5f14ca728a2989c14833d37/src/cargo/ops/cargo_package.rs#L58 enum FileContents { /// Absolute path to a file on disk OnDisk(PathBuf), Generated(GeneratedFile), } +/// Based on the enum GeneratedFile from Cargo: https://github.com/rust-lang/cargo/blob/57622d793935a662b5f14ca728a2989c14833d37/src/cargo/ops/cargo_package.rs#L65 +/// VcsInfo variant was removed enum GeneratedFile { /// Generates `Cargo.toml` by rewriting the original. Manifest, @@ -276,7 +279,9 @@ pub fn package( Ok(dsts) } -/// Heavily based on cargo's prepare_archive function +/// Heavily based on cargo's prepare_archive function: https://github.com/rust-lang/cargo/blob/57622d793935a662b5f14ca728a2989c14833d37/src/cargo/ops/cargo_package.rs#L220 +/// +/// /// Performs pre-archiving checks and builds a list of files to archive. fn prepare_archive(root: &Path) -> anyhow::Result> { // here cargo would verify the package metadata @@ -289,7 +294,9 @@ fn prepare_archive(root: &Path) -> anyhow::Result> { Ok(archive_files) } -/// Heavily based on cargo's build_ar_list function +/// Heavily based on cargo's build_ar_list function: https://github.com/rust-lang/cargo/blob/57622d793935a662b5f14ca728a2989c14833d37/src/cargo/ops/cargo_package.rs#L248 +/// +/// Builds list of files to archive fn build_ar_list(pkg_dir: &Path, files: Vec) -> anyhow::Result> { const ORIGINAL_MANIFEST_FILENAME: &str = "Cargo.toml.orig"; @@ -371,7 +378,9 @@ fn build_ar_list(pkg_dir: &Path, files: Vec) -> anyhow::Result, @@ -427,7 +436,11 @@ fn create_package( Ok((filename, dst_path.into(), checksum)) } -/// Heavily based on cargo's tar function +/// Heavily based on cargo's tar function: https://github.com/rust-lang/cargo/blob/57622d793935a662b5f14ca728a2989c14833d37/src/cargo/ops/cargo_package.rs#L712 +/// +/// Compresses and packages a list of [`ArchiveFile`]s and writes into the given file. +/// +/// Returns the uncompressed size of the contents of the new archive file. fn tar( pkg: &Package, ar_files: Vec, @@ -449,7 +462,7 @@ fn tar( .map(|ar_file| ar_file.rel_path.clone()) .collect::>(); - let publish_toml = prepare_toml_for_publish( + let publish_toml = super::toml::prepare_toml_for_publish( &pkg.manifest.resolved_toml, workspace_toml, pkg.manifest_path.parent().unwrap(), @@ -493,259 +506,7 @@ fn tar( Ok(uncompressed_size) } -pub fn prepare_toml_for_publish( - me: &cargo_util_schemas::manifest::TomlManifest, - workspace: &cargo_util_schemas::manifest::TomlManifest, - package_root: &Path, - included: &[PathBuf], -) -> anyhow::Result { - let mut package = me.package().unwrap().clone(); - package.workspace = None; - - if let Some(original_package) = me.package() { - // resolve all workspace fields using the workspace - - let edition = match original_package.resolved_edition() { - Ok(maybe_edition) => maybe_edition.cloned().unwrap_or_else(|| "2015".to_string()), - // Edition inherited from workspace - Err(..) => match &workspace - .workspace - .as_ref() - .unwrap() - .package - .as_ref() - .unwrap() - .edition - { - Some(edition) => edition.clone(), - _ => "2015".to_string(), - }, - }; - package.edition = Some(cargo_util_schemas::manifest::InheritableField::Value( - edition, - )); - - if let Some(license_file) = &package.license_file { - let license_file = license_file - .as_value() - .context("license file should have been resolved before `prepare_for_publish()`")?; - let license_path = Path::new(&license_file); - let abs_license_path = paths::normalize_path(&package_root.join(license_path)); - if let Ok(license_file) = abs_license_path.strip_prefix(package_root) { - package.license_file = Some(manifest::InheritableField::Value( - paths::normalize_path_string_sep( - license_file - .to_str() - .ok_or_else(|| anyhow::format_err!("non-UTF8 `package.license-file`"))? - .to_owned(), - ), - )); - } else { - // This path points outside of the package root. `cargo package` - // will copy it into the root, so adjust the path to this location. - package.license_file = Some(manifest::InheritableField::Value( - license_path - .file_name() - .unwrap() - .to_str() - .unwrap() - .to_string(), - )); - } - } - } - - if let Some(readme) = &package.readme { - let readme = readme - .as_value() - .context("readme should have been resolved before `prepare_for_publish()`")?; - match readme { - manifest::StringOrBool::String(readme) => { - let readme_path = Path::new(&readme); - let abs_readme_path = paths::normalize_path(&package_root.join(readme_path)); - if let Ok(readme_path) = abs_readme_path.strip_prefix(package_root) { - package.readme = Some(manifest::InheritableField::Value(StringOrBool::String( - paths::normalize_path_string_sep( - readme_path - .to_str() - .ok_or_else(|| { - anyhow::format_err!("non-UTF8 `package.license-file`") - })? - .to_owned(), - ), - ))); - } else { - // This path points outside of the package root. `cargo package` - // will copy it into the root, so adjust the path to this location. - package.readme = Some(manifest::InheritableField::Value( - manifest::StringOrBool::String( - readme_path - .file_name() - .unwrap() - .to_str() - .unwrap() - .to_string(), - ), - )); - } - } - manifest::StringOrBool::Bool(_) => {} - } - } - - let lib = if let Some(lib) = &me.lib { - prepare_target_for_publish(lib, included, "library")? - } else { - None - }; - - let bin = prepare_targets_for_publish(me.bin.as_ref(), included, "binary")?; - - let all = |_d: &manifest::TomlDependency| true; - let resolved_toml = cargo_util_schemas::manifest::TomlManifest { - cargo_features: me.cargo_features.clone(), - package: Some(package), - project: me.project.clone(), - profile: me.profile.clone(), - lib, - bin, - // Ignore examples, tests, and benchmarks - example: None, - test: None, - bench: None, - dependencies: map_deps(me.dependencies.as_ref(), all)?, - dev_dependencies: None, - dev_dependencies2: None, - build_dependencies: map_deps(me.build_dependencies(), all)?, - build_dependencies2: None, - features: me.features.clone(), - target: me.target.clone(), - replace: me.replace.clone(), - patch: me.patch.clone(), - workspace: None, - badges: me.badges.clone(), - lints: me.lints.clone(), - _unused_keys: me._unused_keys.clone(), - }; - - Ok(resolved_toml) -} - -fn map_deps( - deps: Option<&BTreeMap>, - filter: impl Fn(&manifest::TomlDependency) -> bool, -) -> anyhow::Result>> { - let Some(deps) = deps else { - return Ok(None); - }; - let deps = deps - .iter() - .filter(|(_k, v)| { - if let manifest::InheritableDependency::Value(def) = v { - filter(def) - } else { - false - } - }) - .map(|(k, v)| Ok((k.clone(), map_dependency(v)?))) - .collect::>>()?; - Ok(Some(deps)) -} - -fn map_dependency( - dep: &manifest::InheritableDependency, -) -> anyhow::Result { - let dep = match dep { - manifest::InheritableDependency::Value(manifest::TomlDependency::Detailed(d)) => { - let mut d = d.clone(); - // Path dependencies become crates.io deps. - // d.path.take(); - if d.path.take().is_some() { - d.registry = Some( - RegistryName::new("local".to_string()) - .expect("Should be able to create registry name"), - ); - } - // else { - // d.registry = Some(RegistryName::new("crates-io".to_string()).expect("Should be able to create registry name")); - // } - // Same with git dependencies. - // d.git.take(); - // d.branch.take(); - // d.tag.take(); - // d.rev.take(); - // registry specifications are elaborated to the index URL - // if let Some(registry) = d.registry.take() { - // d.registry_index = Some(get_registry_index(®istry)?.to_string()); - // } - Ok(d) - } - manifest::InheritableDependency::Value(manifest::TomlDependency::Simple(s)) => { - Ok(manifest::TomlDetailedDependency { - version: Some(s.clone()), - ..Default::default() - }) - } - _ => unreachable!(), - }; - dep.map(manifest::TomlDependency::Detailed) - .map(manifest::InheritableDependency::Value) -} - -fn prepare_target_for_publish( - target: &manifest::TomlTarget, - included: &[PathBuf], - context: &str, -) -> anyhow::Result> { - let path = target - .path - .as_ref() - .unwrap_or_else(|| panic!("previously resolved {:?} path", target)); - let path = paths::normalize_path(&path.0); - if !included.contains(&path) { - let name = target.name.as_ref().expect("previously resolved"); - print_warn!( - "{}", - format!( - "ignoring {context} `{name}` as `{}` is not included in the published package", - path.display() - ) - ); - return Ok(None); - } - - let mut target = target.clone(); - let path = paths::normalize_path_sep(path, context)?; - target.path = Some(manifest::PathValue(path)); - - Ok(Some(target)) -} - -fn prepare_targets_for_publish( - targets: Option<&Vec>, - included: &[PathBuf], - context: &str, -) -> anyhow::Result>> { - let Some(targets) = targets else { - return Ok(None); - }; - - let mut prepared = Vec::with_capacity(targets.len()); - for target in targets { - let Some(target) = prepare_target_for_publish(target, included, context)? else { - continue; - }; - prepared.push(target); - } - - if prepared.is_empty() { - Ok(None) - } else { - Ok(Some(prepared)) - } -} - -/// Heavily based on cargo's list_files function +/// Heavily based on Cargo's _list_files function: https://github.com/rust-lang/cargo/blob/57622d793935a662b5f14ca728a2989c14833d37/src/cargo/sources/path.rs#L458 fn list_files(pkg_path: &Path) -> anyhow::Result> { // todo : handle includes and excludes // for now everything is left empty @@ -827,7 +588,7 @@ fn list_files(pkg_path: &Path) -> anyhow::Result> { Ok(ret) } -/// Taken from cargo's list_files_walk function +/// Taken from cargo's list_files_walk function: https://github.com/rust-lang/cargo/blob/57622d793935a662b5f14ca728a2989c14833d37/src/cargo/sources/path.rs#L531 /// /// Returns [`Some(gix::Repository)`](gix::Repository) if the discovered repository /// (searched upwards from `root`) contains a tracked `/Cargo.toml`. @@ -893,7 +654,7 @@ fn discover_gix_repo(root: &Path) -> anyhow::Result> { Ok(None) } -/// Taken from cargo's list_files_walk function +/// Based on Cargo's list_files_gix function: https://github.com/rust-lang/cargo/blob/c1fa840a85eca53818895901a53fae34247448b2/src/cargo/sources/path.rs#L579 /// /// Lists files relevant to building this package inside this source by /// traversing the git working tree, while avoiding ignored files. @@ -1030,7 +791,7 @@ fn list_files_gix( Ok(files) } -/// Heavily based on cargo's list_files_walk function +/// Taken from Cargo's list_files_walk function: https://github.com/rust-lang/cargo/blob/c1fa840a85eca53818895901a53fae34247448b2/src/cargo/sources/path.rs#L714 /// /// Lists files relevant to building this package inside this source by /// walking the filesystem from the package root path. diff --git a/crates/heat-sdk-cli/src/util/cargo/paths.rs b/crates/heat-sdk-cli/src/util/cargo/paths.rs index 9dad2d5..a685fb1 100644 --- a/crates/heat-sdk-cli/src/util/cargo/paths.rs +++ b/crates/heat-sdk-cli/src/util/cargo/paths.rs @@ -2,6 +2,8 @@ use anyhow::{Context, Result}; use std::fs; use std::path::{Component, Path, PathBuf}; +/// From Cargo: https://github.com/rust-lang/cargo/blob/57622d793935a662b5f14ca728a2989c14833d37/crates/cargo-util/src/paths.rs#L160 +/// /// Reads a file to a string. /// /// Equivalent to [`std::fs::read_to_string`] with better error messages. @@ -12,6 +14,8 @@ pub fn read(path: &Path) -> Result { } } +/// From Cargo: https://github.com/rust-lang/cargo/blob/57622d793935a662b5f14ca728a2989c14833d37/crates/cargo-util/src/paths.rs#L170 +/// /// Reads a file into a bytes vector. /// /// Equivalent to [`std::fs::read`] with better error messages. @@ -19,6 +23,8 @@ pub fn read_bytes(path: &Path) -> Result> { fs::read(path).with_context(|| format!("failed to read `{}`", path.display())) } +/// From Cargo: https://github.com/rust-lang/cargo/blob/57622d793935a662b5f14ca728a2989c14833d37/crates/cargo-util/src/paths.rs#L84 +/// /// Normalize a path, removing things like `.` and `..`. /// /// CAUTION: This does not resolve symlinks (unlike @@ -54,6 +60,8 @@ pub fn normalize_path(path: &Path) -> PathBuf { ret } +/// From Cargo: https://github.com/rust-lang/cargo/blob/57622d793935a662b5f14ca728a2989c14833d37/crates/cargo-util/src/paths.rs#L375 +/// /// Converts a path to UTF-8 bytes. pub fn path2bytes(path: &Path) -> Result<&[u8]> { #[cfg(unix)] @@ -73,6 +81,7 @@ pub fn path2bytes(path: &Path) -> Result<&[u8]> { } } +/// From Cargo: https://github.com/rust-lang/cargo/blob/57622d793935a662b5f14ca728a2989c14833d37/src/cargo/util/toml/mod.rs#L2950 pub fn normalize_path_sep(path: PathBuf, context: &str) -> anyhow::Result { let path = path .into_os_string() @@ -82,6 +91,7 @@ pub fn normalize_path_sep(path: PathBuf, context: &str) -> anyhow::Result String { if std::path::MAIN_SEPARATOR != '/' { path.replace(std::path::MAIN_SEPARATOR, "/") diff --git a/crates/heat-sdk-cli/src/util/cargo/restricted_names.rs b/crates/heat-sdk-cli/src/util/cargo/restricted_names.rs index 2b15344..747f68e 100644 --- a/crates/heat-sdk-cli/src/util/cargo/restricted_names.rs +++ b/crates/heat-sdk-cli/src/util/cargo/restricted_names.rs @@ -1,4 +1,7 @@ -#![allow(dead_code)] +#![allow(unused)] +// This file is copied 1 for 1 from Cargo's source code. +// The original file can be found at: +// https://github.com/rust-lang/cargo/blob/57622d793935a662b5f14ca728a2989c14833d37/src/cargo/util/restricted_names.rs //! Helpers for validating and checking names like package and crate names. diff --git a/crates/heat-sdk-cli/src/util/cargo/toml/mod.rs b/crates/heat-sdk-cli/src/util/cargo/toml/mod.rs index 2cca167..6f222cc 100644 --- a/crates/heat-sdk-cli/src/util/cargo/toml/mod.rs +++ b/crates/heat-sdk-cli/src/util/cargo/toml/mod.rs @@ -9,13 +9,13 @@ use std::{ use lazycell::LazyCell; use cargo_metadata::semver; -use cargo_util_schemas::manifest::{self, RustVersion, StringOrBool}; +use cargo_util_schemas::manifest::{self, RegistryName, RustVersion, StringOrBool}; type CargoResult = anyhow::Result; use anyhow::{bail, Context}; -use crate::print_info; +use crate::{print_info, print_warn}; use super::{ dependency::{DepKind, FeatureValue}, @@ -25,12 +25,16 @@ use super::{ workspace::{resolve_relative_path, WorkspaceConfig, WorkspaceRootConfig}, }; +/// Based on Cargo's Manifest struct: https://github.com/rust-lang/cargo/blob/57622d793935a662b5f14ca728a2989c14833d37/src/cargo/core/manifest.rs#L62 +/// Only small parts of the struct are needed so this is a simplified version of Cargo's Manifest struct. pub struct Manifest { pub _original_toml: manifest::TomlManifest, pub resolved_toml: manifest::TomlManifest, pub workspace: WorkspaceConfig, } +/// Based this Cargo function: https://github.com/rust-lang/cargo/blob/57622d793935a662b5f14ca728a2989c14833d37/src/cargo/util/toml/mod.rs#L146 +/// The function normally does some things if the manifest is embedded, but we won't consider that for now. fn read_toml_string(path: &Path) -> CargoResult { let contents = paths::read(path)?; @@ -45,6 +49,7 @@ fn read_toml_string(path: &Path) -> CargoResult { Ok(contents) } +/// From Cargo: https://github.com/rust-lang/cargo/blob/57622d793935a662b5f14ca728a2989c14833d37/src/cargo/util/toml/mod.rs#L163 fn deserialize_toml( document: &toml_edit::ImDocument, ) -> Result { @@ -59,6 +64,7 @@ fn deserialize_toml( Ok(document) } +/// From Cargo: https://github.com/rust-lang/cargo/blob/57622d793935a662b5f14ca728a2989c14833d37/src/cargo/util/toml/mod.rs#L177 fn stringify(dst: &mut String, path: &serde_ignored::Path<'_>) { use serde_ignored::Path; @@ -84,10 +90,18 @@ fn stringify(dst: &mut String, path: &serde_ignored::Path<'_>) { } } +/// From Cargo: https://github.com/rust-lang/cargo/blob/57622d793935a662b5f14ca728a2989c14833d37/src/cargo/util/toml/mod.rs#L158 fn parse_document(contents: &str) -> Result, toml_edit::de::Error> { toml_edit::ImDocument::parse(contents.to_owned()).map_err(Into::into) } +/// From Cargo: https://github.com/rust-lang/cargo/blob/57622d793935a662b5f14ca728a2989c14833d37/src/cargo/util/toml/mod.rs#L58 +/// This function was modified to: +/// - Add context to the error messages +/// - It does not take a global context anymore and instead takes a path to the manifest file +/// - Ignore manifest features +/// +/// /// Loads a `Cargo.toml` from a file on disk. /// /// This could result in a real or virtual manifest being returned. @@ -96,11 +110,7 @@ fn parse_document(contents: &str) -> Result, toml_ /// within the manifest. For virtual manifests, these paths can only /// come from patched or replaced dependencies. These paths are not /// canonicalized. -pub fn read_manifest( - path: &Path, - // source_id: PackageId, - root_workspace_path: Option<&Path>, -) -> CargoResult { +pub fn read_manifest(path: &Path, root_workspace_path: Option<&Path>) -> CargoResult { let mut warnings = Default::default(); let mut errors = Default::default(); @@ -111,15 +121,7 @@ pub fn read_manifest( let original_toml = deserialize_toml(&document) .with_context(|| format!("Manifest error: failed to deserialize `{}`", path.display()))?; - // let empty = Vec::new(); - // let cargo_features = original_toml.cargo_features.as_ref().unwrap_or(&empty); let workspace_config = to_workspace_config(&original_toml, path)?; - // if let WorkspaceConfig::Root(ws_root_config) = &workspace_config { - // let package_root = path.parent().unwrap(); - // gctx.ws_roots - // .borrow_mut() - // .insert(package_root.to_owned(), ws_root_config.clone()); - // } let resolved_toml = resolve_toml( &original_toml, &workspace_config, @@ -145,6 +147,8 @@ pub fn read_manifest( }) } +/// From Cargo: https://github.com/rust-lang/cargo/blob/57622d793935a662b5f14ca728a2989c14833d37/src/cargo/util/toml/mod.rs#L972 +/// The error context message was slightly modified and the function generics do not have an unused 'a lifetime anymore. fn field_inherit_with( field: manifest::InheritableField, label: &str, @@ -157,8 +161,11 @@ fn field_inherit_with( } } +/// From Cargo: https://github.com/rust-lang/cargo/blob/57622d793935a662b5f14ca728a2989c14833d37/src/cargo/util/toml/mod.rs#L679 const DEFAULT_README_FILES: [&str; 3] = ["README.md", "README.txt", "README"]; +/// From Cargo: https://github.com/rust-lang/cargo/blob/57622d793935a662b5f14ca728a2989c14833d37/src/cargo/util/toml/mod.rs#L683 +/// /// Checks if a file with any of the default README file names exists in the package root. /// If so, returns a `String` representing that name. fn default_readme_from_package_root(package_root: &Path) -> Option { @@ -171,6 +178,8 @@ fn default_readme_from_package_root(package_root: &Path) -> Option { None } +/// From Cargo: https://github.com/rust-lang/cargo/blob/57622d793935a662b5f14ca728a2989c14833d37/src/cargo/util/toml/mod.rs#L665 +/// /// Returns the name of the README file for a [`manifest::TomlPackage`]. fn resolve_package_readme( package_root: &Path, @@ -186,25 +195,8 @@ fn resolve_package_readme( } } -pub fn resolve_build(build: Option<&StringOrBool>, package_root: &Path) -> Option { - const BUILD_RS: &str = "build.rs"; - match build { - None => { - // If there is a `build.rs` file next to the `Cargo.toml`, assume it is - // a build script. - let build_rs = package_root.join(BUILD_RS); - if build_rs.is_file() { - Some(StringOrBool::String(BUILD_RS.to_owned())) - } else { - Some(StringOrBool::Bool(false)) - } - } - // Explicitly no build script. - Some(StringOrBool::Bool(false)) | Some(StringOrBool::String(_)) => build.cloned(), - Some(StringOrBool::Bool(true)) => Some(StringOrBool::String(BUILD_RS.to_owned())), - } -} - +/// From Cargo: https://github.com/rust-lang/cargo/blob/57622d793935a662b5f14ca728a2989c14833d37/src/cargo/util/toml/mod.rs#L523 +/// Removed features handling. fn resolve_package_toml<'a>( original_package: &manifest::TomlPackage, package_root: &Path, @@ -236,7 +228,7 @@ fn resolve_package_toml<'a>( .map(|value| field_inherit_with(value, "authors", || inherit()?.authors())) .transpose()? .map(manifest::InheritableField::Value), - build: resolve_build(original_package.build.as_ref(), package_root), + build: targets::resolve_build(original_package.build.as_ref(), package_root), metabuild: original_package.metabuild.clone(), default_target: original_package.default_target.clone(), forced_target: original_package.forced_target.clone(), @@ -338,14 +330,17 @@ fn resolve_package_toml<'a>( _invalid_cargo_features: Default::default(), }; - // if resolved_package.resolver.as_deref() == Some("3") { - // features.require(Feature::edition2024())?; - // } - Ok(Box::new(resolved_package)) } -/// See [`Manifest::resolved_toml`] for more details +/// From Cargo: https://github.com/rust-lang/cargo/blob/57622d793935a662b5f14ca728a2989c14833d37/src/cargo/util/toml/mod.rs#L266 +/// +/// The [`TomlManifest`] with all fields expanded +/// +/// This is the intersection of what fields need resolving for cargo-publish that also are +/// useful for the operation of cargo, including +/// - workspace inheritance +/// - target discovery fn resolve_toml( original_toml: &manifest::TomlManifest, workspace_config: &WorkspaceConfig, @@ -582,6 +577,7 @@ fn resolve_toml( Ok(resolved_toml) } +/// From Cargo: https://github.com/rust-lang/cargo/blob/57622d793935a662b5f14ca728a2989c14833d37/src/cargo/util/toml/mod.rs#L694 fn resolve_features( original_features: Option<&BTreeMap>>, ) -> CargoResult>>> { @@ -592,6 +588,7 @@ fn resolve_features( Ok(Some(resolved_features)) } +/// From Cargo: https://github.com/rust-lang/cargo/blob/57622d793935a662b5f14ca728a2989c14833d37/src/cargo/util/toml/mod.rs#L728 fn resolve_dependencies<'a>( edition: Edition, orig_deps: Option<&BTreeMap>, @@ -646,6 +643,8 @@ fn resolve_dependencies<'a>( Ok(Some(deps)) } +/// From Cargo: https://github.com/rust-lang/cargo/blob/57622d793935a662b5f14ca728a2989c14833d37/src/cargo/util/toml/mod.rs#L2532 +/// /// Warn about paths that have been deprecated and may conflict. fn deprecated_underscore( old: &Option, @@ -671,6 +670,7 @@ fn deprecated_underscore( Ok(()) } +/// From Cargo: https://github.com/rust-lang/cargo/blob/57622d793935a662b5f14ca728a2989c14833d37/src/cargo/util/toml/mod.rs#L987 fn lints_inherit_with( lints: manifest::InheritableLints, get_ws_inheritable: impl FnOnce() -> CargoResult, @@ -687,6 +687,7 @@ fn lints_inherit_with( } } +/// From Cargo: https://github.com/rust-lang/cargo/blob/57622d793935a662b5f14ca728a2989c14833d37/src/cargo/util/toml/mod.rs#L1003 fn dependency_inherit_with<'a>( dependency: manifest::InheritableDependency, name: &str, @@ -707,6 +708,7 @@ fn dependency_inherit_with<'a>( } } +/// From Cargo: https://github.com/rust-lang/cargo/blob/57622d793935a662b5f14ca728a2989c14833d37/src/cargo/util/toml/mod.rs#L1023 fn inner_dependency_inherit_with<'a>( pkg_dep: manifest::TomlInheritedDependency, name: &str, @@ -772,6 +774,7 @@ fn inner_dependency_inherit_with<'a>( Ok(manifest::TomlDependency::Detailed(merged_dep)) } +/// From Cargo: https://github.com/rust-lang/cargo/blob/57622d793935a662b5f14ca728a2989c14833d37/src/cargo/util/toml/mod.rs#L1088 fn deprecated_ws_default_features( label: &str, ws_def_feat: Option, @@ -795,6 +798,7 @@ fn deprecated_ws_default_features( Ok(()) } +/// From Cargo: https://github.com/rust-lang/cargo/blob/57622d793935a662b5f14ca728a2989c14833d37/src/cargo/util/toml/mod.rs#L812 fn load_inheritable_fields( resolved_path: &Path, workspace_config: &WorkspaceConfig, @@ -832,6 +836,7 @@ fn load_inheritable_fields( } } +/// From Cargo: https://github.com/rust-lang/cargo/blob/57622d793935a662b5f14ca728a2989c14833d37/src/cargo/util/toml/mod.rs#L839 fn inheritable_from_path( workspace_path: PathBuf, root_workspace_path: Option<&Path>, @@ -870,6 +875,7 @@ fn inheritable_from_path( } } +/// From Cargo: https://github.com/rust-lang/cargo/blob/57622d793935a662b5f14ca728a2989c14833d37/src/cargo/util/toml/mod.rs#L202 fn to_workspace_config( original_toml: &manifest::TomlManifest, manifest_file: &Path, @@ -909,6 +915,7 @@ fn to_workspace_config( Ok(workspace_config) } +/// From Cargo: https://github.com/rust-lang/cargo/blob/57622d793935a662b5f14ca728a2989c14833d37/src/cargo/util/toml/mod.rs#L242 fn to_workspace_root_config( resolved_toml: &manifest::TomlWorkspace, manifest_file: &Path, @@ -931,6 +938,7 @@ fn to_workspace_root_config( ) } +/// From Cargo: https://github.com/rust-lang/cargo/blob/57622d793935a662b5f14ca728a2989c14833d37/src/cargo/util/toml/mod.rs#L869 /// Defines simple getter methods for inheritable fields. macro_rules! package_field_getter { ( $(($key:literal, $field:ident -> $ret:ty),)* ) => ( @@ -946,6 +954,7 @@ macro_rules! package_field_getter { ) } +/// From Cargo: https://github.com/rust-lang/cargo/blob/57622d793935a662b5f14ca728a2989c14833d37/src/cargo/util/toml/mod.rs#L884 /// A group of fields that are inheritable by members of the workspace #[derive(Clone, Debug, Default)] pub struct InheritableFields { @@ -957,6 +966,7 @@ pub struct InheritableFields { _ws_root: PathBuf, } +/// From Cargo: https://github.com/rust-lang/cargo/blob/57622d793935a662b5f14ca728a2989c14833d37/src/cargo/util/toml/mod.rs#L894-L895 impl InheritableFields { package_field_getter! { // Please keep this list lexicographically ordered. @@ -1034,3 +1044,262 @@ impl InheritableFields { &self._ws_root } } + +/// From Cargo: https://github.com/rust-lang/cargo/blob/57622d793935a662b5f14ca728a2989c14833d37/src/cargo/util/toml/mod.rs#L2846 +fn map_deps( + deps: Option<&BTreeMap>, + filter: impl Fn(&manifest::TomlDependency) -> bool, +) -> anyhow::Result>> { + let Some(deps) = deps else { + return Ok(None); + }; + let deps = deps + .iter() + .filter(|(_k, v)| { + if let manifest::InheritableDependency::Value(def) = v { + filter(def) + } else { + false + } + }) + .map(|(k, v)| Ok((k.clone(), map_dependency(v)?))) + .collect::>>()?; + Ok(Some(deps)) +} + +/// From Cargo: https://github.com/rust-lang/cargo/blob/57622d793935a662b5f14ca728a2989c14833d37/src/cargo/util/toml/mod.rs#L2868 +fn map_dependency( + dep: &manifest::InheritableDependency, +) -> anyhow::Result { + let dep = match dep { + manifest::InheritableDependency::Value(manifest::TomlDependency::Detailed(d)) => { + let mut d = d.clone(); + // Path dependencies become crates.io deps. + // d.path.take(); + if d.path.take().is_some() { + d.registry = Some( + RegistryName::new("local".to_string()) + .expect("Should be able to create registry name"), + ); + } + // else { + // d.registry = Some(RegistryName::new("crates-io".to_string()).expect("Should be able to create registry name")); + // } + // Same with git dependencies. + // d.git.take(); + // d.branch.take(); + // d.tag.take(); + // d.rev.take(); + // registry specifications are elaborated to the index URL + // if let Some(registry) = d.registry.take() { + // d.registry_index = Some(get_registry_index(®istry)?.to_string()); + // } + Ok(d) + } + manifest::InheritableDependency::Value(manifest::TomlDependency::Simple(s)) => { + Ok(manifest::TomlDetailedDependency { + version: Some(s.clone()), + ..Default::default() + }) + } + _ => unreachable!(), + }; + dep.map(manifest::TomlDependency::Detailed) + .map(manifest::InheritableDependency::Value) +} + +/// From Cargo: https://github.com/rust-lang/cargo/blob/57622d793935a662b5f14ca728a2989c14833d37/src/cargo/util/toml/mod.rs#L2926 +fn prepare_target_for_publish( + target: &manifest::TomlTarget, + included: &[PathBuf], + context: &str, +) -> anyhow::Result> { + let path = target + .path + .as_ref() + .unwrap_or_else(|| panic!("previously resolved {:?} path", target)); + let path = paths::normalize_path(&path.0); + if !included.contains(&path) { + let name = target.name.as_ref().expect("previously resolved"); + print_warn!( + "{}", + format!( + "ignoring {context} `{name}` as `{}` is not included in the published package", + path.display() + ) + ); + return Ok(None); + } + + let mut target = target.clone(); + let path = paths::normalize_path_sep(path, context)?; + target.path = Some(manifest::PathValue(path)); + + Ok(Some(target)) +} + +pub fn prepare_targets_for_publish( + targets: Option<&Vec>, + included: &[PathBuf], + context: &str, +) -> anyhow::Result>> { + let Some(targets) = targets else { + return Ok(None); + }; + + let mut prepared = Vec::with_capacity(targets.len()); + for target in targets { + let Some(target) = prepare_target_for_publish(target, included, context)? else { + continue; + }; + prepared.push(target); + } + + if prepared.is_empty() { + Ok(None) + } else { + Ok(Some(prepared)) + } +} + +/// From Cargo: https://github.com/rust-lang/cargo/blob/57622d793935a662b5f14ca728a2989c14833d37/src/cargo/util/toml/mod.rs#L2613 +/// Prepares the manifest for publishing. +/// - Path and git components of dependency specifications are removed. +/// - License path is updated to point within the package. +pub fn prepare_toml_for_publish( + me: &cargo_util_schemas::manifest::TomlManifest, + workspace: &cargo_util_schemas::manifest::TomlManifest, + package_root: &Path, + included: &[PathBuf], +) -> anyhow::Result { + let mut package = me.package().unwrap().clone(); + package.workspace = None; + + if let Some(original_package) = me.package() { + // resolve all workspace fields using the workspace + + let edition = match original_package.resolved_edition() { + Ok(maybe_edition) => maybe_edition.cloned().unwrap_or_else(|| "2015".to_string()), + // Edition inherited from workspace + Err(..) => match &workspace + .workspace + .as_ref() + .unwrap() + .package + .as_ref() + .unwrap() + .edition + { + Some(edition) => edition.clone(), + _ => "2015".to_string(), + }, + }; + package.edition = Some(cargo_util_schemas::manifest::InheritableField::Value( + edition, + )); + + if let Some(license_file) = &package.license_file { + let license_file = license_file + .as_value() + .context("license file should have been resolved before `prepare_for_publish()`")?; + let license_path = Path::new(&license_file); + let abs_license_path = paths::normalize_path(&package_root.join(license_path)); + if let Ok(license_file) = abs_license_path.strip_prefix(package_root) { + package.license_file = Some(manifest::InheritableField::Value( + paths::normalize_path_string_sep( + license_file + .to_str() + .ok_or_else(|| anyhow::format_err!("non-UTF8 `package.license-file`"))? + .to_owned(), + ), + )); + } else { + // This path points outside of the package root. `cargo package` + // will copy it into the root, so adjust the path to this location. + package.license_file = Some(manifest::InheritableField::Value( + license_path + .file_name() + .unwrap() + .to_str() + .unwrap() + .to_string(), + )); + } + } + } + + if let Some(readme) = &package.readme { + let readme = readme + .as_value() + .context("readme should have been resolved before `prepare_for_publish()`")?; + match readme { + manifest::StringOrBool::String(readme) => { + let readme_path = Path::new(&readme); + let abs_readme_path = paths::normalize_path(&package_root.join(readme_path)); + if let Ok(readme_path) = abs_readme_path.strip_prefix(package_root) { + package.readme = Some(manifest::InheritableField::Value(StringOrBool::String( + paths::normalize_path_string_sep( + readme_path + .to_str() + .ok_or_else(|| { + anyhow::format_err!("non-UTF8 `package.license-file`") + })? + .to_owned(), + ), + ))); + } else { + // This path points outside of the package root. `cargo package` + // will copy it into the root, so adjust the path to this location. + package.readme = Some(manifest::InheritableField::Value( + manifest::StringOrBool::String( + readme_path + .file_name() + .unwrap() + .to_str() + .unwrap() + .to_string(), + ), + )); + } + } + manifest::StringOrBool::Bool(_) => {} + } + } + + let lib = if let Some(lib) = &me.lib { + prepare_target_for_publish(lib, included, "library")? + } else { + None + }; + + let bin = prepare_targets_for_publish(me.bin.as_ref(), included, "binary")?; + + let all = |_d: &manifest::TomlDependency| true; + let resolved_toml = cargo_util_schemas::manifest::TomlManifest { + cargo_features: me.cargo_features.clone(), + package: Some(package), + project: me.project.clone(), + profile: me.profile.clone(), + lib, + bin, + // Ignore examples, tests, and benchmarks + example: None, + test: None, + bench: None, + dependencies: map_deps(me.dependencies.as_ref(), all)?, + dev_dependencies: None, + dev_dependencies2: None, + build_dependencies: map_deps(me.build_dependencies(), all)?, + build_dependencies2: None, + features: me.features.clone(), + target: me.target.clone(), + replace: me.replace.clone(), + patch: me.patch.clone(), + workspace: None, + badges: me.badges.clone(), + lints: me.lints.clone(), + _unused_keys: me._unused_keys.clone(), + }; + + Ok(resolved_toml) +} diff --git a/crates/heat-sdk-cli/src/util/cargo/toml/targets.rs b/crates/heat-sdk-cli/src/util/cargo/toml/targets.rs index 64635a0..f57621e 100644 --- a/crates/heat-sdk-cli/src/util/cargo/toml/targets.rs +++ b/crates/heat-sdk-cli/src/util/cargo/toml/targets.rs @@ -29,6 +29,7 @@ const DEFAULT_TEST_DIR_NAME: &str = "tests"; const DEFAULT_BENCH_DIR_NAME: &str = "benches"; const DEFAULT_EXAMPLE_DIR_NAME: &str = "examples"; +/// From Cargo: https://github.com/rust-lang/cargo/blob/57622d793935a662b5f14ca728a2989c14833d37/src/cargo/util/toml/targets.rs#L127 pub fn resolve_lib( original_lib: Option<&TomlLibTarget>, package_root: &Path, @@ -78,6 +79,7 @@ pub fn resolve_lib( Ok(Some(lib)) } +/// From Cargo: https://github.com/rust-lang/cargo/blob/57622d793935a662b5f14ca728a2989c14833d37/src/cargo/util/toml/targets.rs#L231 #[allow(clippy::too_many_arguments)] pub fn resolve_bins( toml_bins: Option<&Vec>, @@ -145,6 +147,7 @@ pub fn resolve_bins( } } +/// From Cargo: https://github.com/rust-lang/cargo/blob/57622d793935a662b5f14ca728a2989c14833d37/src/cargo/util/toml/targets.rs#L333 fn legacy_bin_path(package_root: &Path, name: &str, has_lib: bool) -> Option { if !has_lib { let rel_path = Path::new("src").join(format!("{}.rs", name)); @@ -166,6 +169,7 @@ fn legacy_bin_path(package_root: &Path, name: &str, has_lib: bool) -> Option>, package_root: &Path, @@ -192,6 +196,7 @@ pub fn resolve_examples( Ok(targets) } +/// From Cargo: https://github.com/rust-lang/cargo/blob/57622d793935a662b5f14ca728a2989c14833d37/src/cargo/util/toml/targets.rs#L412 pub fn resolve_tests( toml_tests: Option<&Vec>, package_root: &Path, @@ -218,6 +223,7 @@ pub fn resolve_tests( Ok(targets) } +/// From Cargo: https://github.com/rust-lang/cargo/blob/57622d793935a662b5f14ca728a2989c14833d37/src/cargo/util/toml/targets.rs#L462 pub fn resolve_benches( toml_benches: Option<&Vec>, package_root: &Path, @@ -261,6 +267,7 @@ pub fn resolve_benches( Ok(targets) } +/// From Cargo: https://github.com/rust-lang/cargo/blob/57622d793935a662b5f14ca728a2989c14833d37/src/cargo/util/toml/targets.rs#L735 fn is_resolved(toml_targets: Option<&Vec>, autodiscover: Option) -> bool { if autodiscover != Some(false) { return false; @@ -274,6 +281,7 @@ fn is_resolved(toml_targets: Option<&Vec>, autodiscover: Option Option { let lib = Path::new("src").join("lib.rs"); if package_root.join(&lib).exists() { @@ -381,6 +391,7 @@ fn inferred_lib(package_root: &Path) -> Option { } } +/// From Cargo: https://github.com/rust-lang/cargo/blob/57622d793935a662b5f14ca728a2989c14833d37/src/cargo/util/toml/targets.rs#L647 fn inferred_bins(package_root: &Path, package_name: &str) -> Vec<(String, PathBuf)> { let main = "src/main.rs"; let mut result = Vec::new(); @@ -394,6 +405,7 @@ fn inferred_bins(package_root: &Path, package_name: &str) -> Vec<(String, PathBu result } +/// From Cargo: https://github.com/rust-lang/cargo/blob/57622d793935a662b5f14ca728a2989c14833d37/src/cargo/util/toml/targets.rs#L660 fn infer_from_directory(package_root: &Path, relpath: &Path) -> Vec<(String, PathBuf)> { let directory = package_root.join(relpath); let entries = match fs::read_dir(directory) { @@ -408,6 +420,7 @@ fn infer_from_directory(package_root: &Path, relpath: &Path) -> Vec<(String, Pat .collect() } +/// From Cargo: https://github.com/rust-lang/cargo/blob/57622d793935a662b5f14ca728a2989c14833d37/src/cargo/util/toml/targets.rs#L674 fn infer_any(package_root: &Path, entry: &DirEntry) -> Option<(String, PathBuf)> { if entry.file_type().map_or(false, |t| t.is_dir()) { infer_subdirectory(package_root, entry) @@ -418,6 +431,7 @@ fn infer_any(package_root: &Path, entry: &DirEntry) -> Option<(String, PathBuf)> } } +/// From Cargo: https://github.com/rust-lang/cargo/blob/57622d793935a662b5f14ca728a2989c14833d37/src/cargo/util/toml/targets.rs#L684 fn infer_file(package_root: &Path, entry: &DirEntry) -> Option<(String, PathBuf)> { let path = entry.path(); let stem = path.file_stem()?.to_str()?.to_owned(); @@ -428,6 +442,7 @@ fn infer_file(package_root: &Path, entry: &DirEntry) -> Option<(String, PathBuf) Some((stem, path)) } +/// From Cargo: https://github.com/rust-lang/cargo/blob/57622d793935a662b5f14ca728a2989c14833d37/src/cargo/util/toml/targets.rs#L694 fn infer_subdirectory(package_root: &Path, entry: &DirEntry) -> Option<(String, PathBuf)> { let path = entry.path(); let main = path.join("main.rs"); @@ -447,6 +462,7 @@ fn is_not_dotfile(entry: &DirEntry) -> bool { entry.file_name().to_str().map(|s| s.starts_with('.')) == Some(false) } +/// From Cargo: https://github.com/rust-lang/cargo/blob/57622d793935a662b5f14ca728a2989c14833d37/src/cargo/util/toml/targets.rs#L713 #[allow(clippy::too_many_arguments)] fn toml_targets_and_inferred( toml_targets: Option<&Vec>, @@ -544,6 +560,7 @@ https://github.com/rust-lang/cargo/issues/5330", toml_targets } +/// From Cargo: https://github.com/rust-lang/cargo/blob/57622d793935a662b5f14ca728a2989c14833d37/src/cargo/util/toml/targets.rs#L809 fn inferred_to_toml_targets(inferred: &[(String, PathBuf)]) -> Vec { inferred .iter() @@ -555,6 +572,8 @@ fn inferred_to_toml_targets(inferred: &[(String, PathBuf)]) -> Vec { .collect() } +/// From Cargo: https://github.com/rust-lang/cargo/blob/57622d793935a662b5f14ca728a2989c14833d37/src/cargo/util/toml/targets.rs#L873 +/// /// Build an error message for a target path that cannot be determined either /// by auto-discovery or specifying. /// @@ -639,6 +658,7 @@ or specify {kind}.path if you want to use a non-default path.", ) } +/// From Cargo: https://github.com/rust-lang/cargo/blob/57622d793935a662b5f14ca728a2989c14833d37/src/cargo/util/toml/targets.rs#L946 fn target_path( target: &TomlTarget, inferred: &[(String, PathBuf)], @@ -694,8 +714,9 @@ Cargo doesn't know which to use because multiple target files found at `{}` and } } +/// From Cargo: https://github.com/rust-lang/cargo/blob/57622d793935a662b5f14ca728a2989c14833d37/src/cargo/util/toml/targets.rs#L1003 +/// /// Returns the path to the build script if one exists for this crate. -#[allow(unused)] pub fn resolve_build(build: Option<&StringOrBool>, package_root: &Path) -> Option { const BUILD_RS: &str = "build.rs"; match build { @@ -715,6 +736,7 @@ pub fn resolve_build(build: Option<&StringOrBool>, package_root: &Path) -> Optio } } +/// From Cargo: https://github.com/rust-lang/cargo/blob/57622d793935a662b5f14ca728a2989c14833d37/src/cargo/util/toml/targets.rs#L1022 fn name_or_panic(target: &TomlTarget) -> &str { target .name @@ -722,6 +744,7 @@ fn name_or_panic(target: &TomlTarget) -> &str { .unwrap_or_else(|| panic!("target name is required")) } +/// From Cargo: https://github.com/rust-lang/cargo/blob/57622d793935a662b5f14ca728a2989c14833d37/src/cargo/util/toml/targets.rs#L1029 fn validate_lib_name(target: &TomlTarget, warnings: &mut Vec) -> CargoResult<()> { validate_target_name(target, "library", "lib", warnings)?; let name = name_or_panic(target); @@ -732,6 +755,7 @@ fn validate_lib_name(target: &TomlTarget, warnings: &mut Vec) -> CargoRe Ok(()) } +/// From Cargo: https://github.com/rust-lang/cargo/blob/57622d793935a662b5f14ca728a2989c14833d37/src/cargo/util/toml/targets.rs#L1039 fn validate_bin_name(bin: &TomlTarget, warnings: &mut Vec) -> CargoResult<()> { validate_target_name(bin, "binary", "bin", warnings)?; let name = name_or_panic(bin).to_owned(); @@ -745,6 +769,7 @@ fn validate_bin_name(bin: &TomlTarget, warnings: &mut Vec) -> CargoResul Ok(()) } +/// From Cargo: https://github.com/rust-lang/cargo/blob/57622d793935a662b5f14ca728a2989c14833d37/src/cargo/util/toml/targets.rs#L1052 fn validate_target_name( target: &TomlTarget, target_kind_human: &str, @@ -774,6 +799,7 @@ fn validate_target_name( Ok(()) } +/// From Cargo: https://github.com/rust-lang/cargo/blob/57622d793935a662b5f14ca728a2989c14833d37/src/cargo/util/toml/targets.rs#L1081 fn validate_bin_proc_macro( target: &TomlTarget, edition: Edition, @@ -793,6 +819,7 @@ fn validate_bin_proc_macro( Ok(()) } +/// From Cargo: https://github.com/rust-lang/cargo/blob/57622d793935a662b5f14ca728a2989c14833d37/src/cargo/util/toml/targets.rs#L1100 fn validate_proc_macro( target: &TomlTarget, kind: &str, @@ -810,6 +837,7 @@ fn validate_proc_macro( ) } +/// From Cargo: https://github.com/rust-lang/cargo/blob/57622d793935a662b5f14ca728a2989c14833d37/src/cargo/util/toml/targets.rs#L1117 fn validate_bin_crate_types( target: &TomlTarget, edition: Edition, @@ -832,6 +860,7 @@ fn validate_bin_crate_types( Ok(()) } +/// From Cargo: https://github.com/rust-lang/cargo/blob/57622d793935a662b5f14ca728a2989c14833d37/src/cargo/util/toml/targets.rs#L1139 fn validate_crate_types( target: &TomlTarget, kind: &str, diff --git a/crates/heat-sdk-cli/src/util/cargo/version.rs b/crates/heat-sdk-cli/src/util/cargo/version.rs index 5716903..0f00101 100644 --- a/crates/heat-sdk-cli/src/util/cargo/version.rs +++ b/crates/heat-sdk-cli/src/util/cargo/version.rs @@ -1,4 +1,8 @@ #![allow(unused)] +// This file is copied 1 for 1 from Cargo's source code. +// The original file can be found at: +// https://github.com/rust-lang/cargo/blob/57622d793935a662b5f14ca728a2989c14833d37/src/cargo/version.rs + //! Code for representing cargo's release version number. use std::fmt; diff --git a/crates/heat-sdk-cli/src/util/cargo/workspace.rs b/crates/heat-sdk-cli/src/util/cargo/workspace.rs index 634d424..109daf4 100644 --- a/crates/heat-sdk-cli/src/util/cargo/workspace.rs +++ b/crates/heat-sdk-cli/src/util/cargo/workspace.rs @@ -13,6 +13,8 @@ use super::paths::normalize_path; use super::toml::InheritableFields; +/// From Cargo: https://github.com/rust-lang/cargo/blob/57622d793935a662b5f14ca728a2989c14833d37/src/cargo/core/workspace.rs#L133 +/// /// Configuration of a workspace in a manifest. #[derive(Debug, Clone)] pub enum WorkspaceConfig { @@ -25,6 +27,9 @@ pub enum WorkspaceConfig { Member { root: Option }, } +/// From Cargo: https://github.com/rust-lang/cargo/blob/57622d793935a662b5f14ca728a2989c14833d37/src/cargo/core/workspace.rs#L143 +/// +/// Only modification is the debug print macro from cargo {debug!} to here {print_debug!}. impl WorkspaceConfig { pub fn inheritable(&self) -> Option<&InheritableFields> { match self { @@ -62,6 +67,9 @@ impl WorkspaceConfig { } } +/// From Cargo: https://github.com/rust-lang/cargo/blob/57622d793935a662b5f14ca728a2989c14833d37/src/cargo/core/workspace.rs#L1938 +/// +/// The only modification is the debug print macro from cargo {debug!} to here {print_debug!}. fn read_root_pointer(member_manifest: &Path, root_link: &str) -> PathBuf { let path = member_manifest .parent() @@ -72,6 +80,8 @@ fn read_root_pointer(member_manifest: &Path, root_link: &str) -> PathBuf { paths::normalize_path(&path) } +/// From Cargo: https://github.com/rust-lang/cargo/blob/57622d793935a662b5f14ca728a2989c14833d37/src/cargo/core/workspace.rs#L185 +/// /// Intermediate configuration of a workspace root in a manifest. /// /// Knows the Workspace Root path, as well as `members` and `exclude` lists of path patterns, which @@ -86,6 +96,7 @@ pub struct WorkspaceRootConfig { custom_metadata: Option, } +/// From Cargo (with a few functions removed): https://github.com/rust-lang/cargo/blob/57622d793935a662b5f14ca728a2989c14833d37/src/cargo/core/workspace.rs#L1776 impl WorkspaceRootConfig { /// Creates a new Intermediate Workspace Root configuration. pub fn new( @@ -133,6 +144,7 @@ impl WorkspaceRootConfig { } } +/// From Cargo: https://github.com/rust-lang/cargo/blob/57622d793935a662b5f14ca728a2989c14833d37/src/cargo/core/workspace.rs#L1863 pub fn resolve_relative_path( label: &str, old_root: &Path, diff --git a/crates/heat-sdk/src/client.rs b/crates/heat-sdk/src/client.rs index b257645..2f42cd5 100644 --- a/crates/heat-sdk/src/client.rs +++ b/crates/heat-sdk/src/client.rs @@ -8,7 +8,9 @@ use serde::Serialize; use crate::errors::sdk::HeatSdkError; use crate::experiment::{Experiment, TempLogStore, WsMessage}; use crate::http::{EndExperimentStatus, HttpClient}; -use crate::schemas::{CrateVersionMetadata, ExperimentPath, HeatCodeMetadata, PackagedCrateData, ProjectPath}; +use crate::schemas::{ + CrateVersionMetadata, ExperimentPath, HeatCodeMetadata, PackagedCrateData, ProjectPath, +}; use crate::websocket::WebSocketClient; /// Credentials to connect to the Heat server diff --git a/crates/heat-sdk/src/http/client.rs b/crates/heat-sdk/src/http/client.rs index 04683e9..98f61ef 100644 --- a/crates/heat-sdk/src/http/client.rs +++ b/crates/heat-sdk/src/http/client.rs @@ -422,7 +422,7 @@ impl HttpClient { let body = RunnerQueueJobParamsSchema { runner_group_name: runner_group_name.to_string(), project_version, - command + command, }; self.http_client diff --git a/crates/heat-sdk/src/http/schemas.rs b/crates/heat-sdk/src/http/schemas.rs index 36b0e1a..aca354a 100644 --- a/crates/heat-sdk/src/http/schemas.rs +++ b/crates/heat-sdk/src/http/schemas.rs @@ -50,9 +50,11 @@ pub struct CodeUploadUrlsSchema { pub urls: HashMap, } +type RunnerJobCommand = String; + #[derive(Debug, Serialize)] pub struct RunnerQueueJobParamsSchema { pub runner_group_name: String, pub project_version: u32, - pub command: String, + pub command: RunnerJobCommand, } diff --git a/crates/tracel/temp.json b/crates/tracel/temp.json deleted file mode 100644 index 48ebc14..0000000 --- a/crates/tracel/temp.json +++ /dev/null @@ -1,830 +0,0 @@ -{ - "packages": [ - { - "name": "guide-cli", - "version": "0.1.0", - "crate_metadata": { - "deps": [ - { - "kind": "normal", - "name": "burn", - "target": null, - "features": [ - "vision", - "train" - ], - "optional": false, - "registry": null, - "version_req": "*", - "default_features": true, - "explicit_name_in_toml": null - }, - { - "kind": "normal", - "name": "tracel", - "target": null, - "features": [ - "heat-sdk", - "heat-sdk-cli" - ], - "optional": false, - "registry": "local", - "version_req": "^0.1.0", - "default_features": true, - "explicit_name_in_toml": null - } - ], - "name": "guide-cli", - "vers": "0.1.0", - "links": null, - "badges": {}, - "readme": null, - "authors": [], - "license": null, - "features": {}, - "homepage": null, - "keywords": [], - "categories": [], - "repository": null, - "description": null, - "readme_file": "README.md", - "license_file": null, - "documentation": null - } - }, - { - "name": "tracel", - "version": "0.1.0", - "crate_metadata": { - "deps": [ - { - "kind": "normal", - "name": "heat-sdk", - "target": null, - "features": [], - "optional": true, - "registry": "local", - "version_req": "^0.1.0", - "default_features": true, - "explicit_name_in_toml": null - }, - { - "kind": "normal", - "name": "heat-sdk-cli", - "target": null, - "features": [], - "optional": true, - "registry": "local", - "version_req": "^0.1.0", - "default_features": true, - "explicit_name_in_toml": null - }, - { - "kind": "normal", - "name": "heat-sdk-cli-macros", - "target": null, - "features": [], - "optional": true, - "registry": "local", - "version_req": "^0.1.0", - "default_features": true, - "explicit_name_in_toml": null - } - ], - "name": "tracel", - "vers": "0.1.0", - "links": null, - "badges": {}, - "readme": null, - "authors": [], - "license": null, - "features": { - "default": [ - "heat-sdk" - ], - "heat-sdk": [ - "dep:heat-sdk", - "dep:heat-sdk-cli-macros" - ], - "heat-sdk-cli": [ - "dep:heat-sdk-cli", - "heat-sdk-cli-macros/build-cli" - ] - }, - "homepage": null, - "keywords": [], - "categories": [], - "repository": "https://github.com/tracel-ai/tracel", - "description": null, - "readme_file": "../../README.md", - "license_file": null, - "documentation": null - } - }, - { - "name": "heat-sdk", - "version": "0.1.0", - "crate_metadata": { - "deps": [ - { - "kind": "normal", - "name": "burn", - "target": null, - "features": [ - "train" - ], - "optional": false, - "registry": null, - "version_req": "*", - "default_features": true, - "explicit_name_in_toml": null - }, - { - "kind": "normal", - "name": "derive-new", - "target": null, - "features": [], - "optional": false, - "registry": null, - "version_req": "^0.6.0", - "default_features": false, - "explicit_name_in_toml": null - }, - { - "kind": "normal", - "name": "log", - "target": null, - "features": [], - "optional": false, - "registry": null, - "version_req": "^0.4.21", - "default_features": true, - "explicit_name_in_toml": null - }, - { - "kind": "normal", - "name": "reqwest", - "target": null, - "features": [ - "blocking", - "json" - ], - "optional": false, - "registry": null, - "version_req": "^0.12.4", - "default_features": true, - "explicit_name_in_toml": null - }, - { - "kind": "normal", - "name": "rmp-serde", - "target": null, - "features": [], - "optional": false, - "registry": null, - "version_req": "^1.3.0", - "default_features": true, - "explicit_name_in_toml": null - }, - { - "kind": "normal", - "name": "serde", - "target": null, - "features": [ - "derive", - "alloc" - ], - "optional": false, - "registry": null, - "version_req": "^1.0.200", - "default_features": false, - "explicit_name_in_toml": null - }, - { - "kind": "normal", - "name": "serde_json", - "target": null, - "features": [], - "optional": false, - "registry": null, - "version_req": "^1.0.64", - "default_features": true, - "explicit_name_in_toml": null - }, - { - "kind": "normal", - "name": "thiserror", - "target": null, - "features": [], - "optional": false, - "registry": null, - "version_req": "^1.0.30", - "default_features": true, - "explicit_name_in_toml": null - }, - { - "kind": "normal", - "name": "tracing", - "target": null, - "features": [], - "optional": false, - "registry": null, - "version_req": "^0.1.40", - "default_features": true, - "explicit_name_in_toml": null - }, - { - "kind": "normal", - "name": "tracing-core", - "target": null, - "features": [], - "optional": false, - "registry": null, - "version_req": "^0.1.32", - "default_features": true, - "explicit_name_in_toml": null - }, - { - "kind": "normal", - "name": "tracing-subscriber", - "target": null, - "features": [], - "optional": false, - "registry": null, - "version_req": "^0.3.18", - "default_features": true, - "explicit_name_in_toml": null - }, - { - "kind": "normal", - "name": "tungstenite", - "target": null, - "features": [], - "optional": false, - "registry": null, - "version_req": "^0.21.0", - "default_features": true, - "explicit_name_in_toml": null - }, - { - "kind": "normal", - "name": "uuid", - "target": null, - "features": [ - "v4", - "fast-rng", - "macro-diagnostics", - "serde" - ], - "optional": false, - "registry": null, - "version_req": "^1.9.1", - "default_features": true, - "explicit_name_in_toml": null - } - ], - "name": "heat-sdk", - "vers": "0.1.0", - "links": null, - "badges": {}, - "readme": null, - "authors": [], - "license": null, - "features": {}, - "homepage": null, - "keywords": [], - "categories": [], - "repository": "https://github.com/tracel-ai/tracel/tree/main/crates/heat-sdk", - "description": null, - "readme_file": "../../README.md", - "license_file": null, - "documentation": null - } - }, - { - "name": "heat-sdk-cli", - "version": "0.1.0", - "crate_metadata": { - "deps": [ - { - "kind": "normal", - "name": "anyhow", - "target": null, - "features": [], - "optional": false, - "registry": null, - "version_req": "^1.0.81", - "default_features": true, - "explicit_name_in_toml": null - }, - { - "kind": "normal", - "name": "cargo-util-schemas", - "target": null, - "features": [], - "optional": false, - "registry": null, - "version_req": "^0.4.0", - "default_features": true, - "explicit_name_in_toml": null - }, - { - "kind": "normal", - "name": "cargo_metadata", - "target": null, - "features": [], - "optional": false, - "registry": null, - "version_req": "^0.18", - "default_features": true, - "explicit_name_in_toml": null - }, - { - "kind": "normal", - "name": "clap", - "target": null, - "features": [ - "derive", - "derive", - "cargo" - ], - "optional": false, - "registry": null, - "version_req": "^4.5.4", - "default_features": true, - "explicit_name_in_toml": null - }, - { - "kind": "normal", - "name": "colored", - "target": null, - "features": [], - "optional": false, - "registry": null, - "version_req": "^2.1.0", - "default_features": true, - "explicit_name_in_toml": null - }, - { - "kind": "normal", - "name": "curl", - "target": null, - "features": [], - "optional": false, - "registry": null, - "version_req": "^0.4.46", - "default_features": true, - "explicit_name_in_toml": null - }, - { - "kind": "normal", - "name": "flate2", - "target": null, - "features": [ - "zlib" - ], - "optional": false, - "registry": null, - "version_req": "^1.0.30", - "default_features": false, - "explicit_name_in_toml": null - }, - { - "kind": "normal", - "name": "gensym", - "target": null, - "features": [], - "optional": false, - "registry": null, - "version_req": "^0.1.1", - "default_features": true, - "explicit_name_in_toml": null - }, - { - "kind": "normal", - "name": "gix", - "target": null, - "features": [ - "dirwalk" - ], - "optional": false, - "registry": null, - "version_req": "^0.64.0", - "default_features": false, - "explicit_name_in_toml": null - }, - { - "kind": "normal", - "name": "heat-sdk", - "target": null, - "features": [], - "optional": false, - "registry": "local", - "version_req": "^0.1.0", - "default_features": true, - "explicit_name_in_toml": null - }, - { - "kind": "normal", - "name": "ignore", - "target": null, - "features": [], - "optional": false, - "registry": null, - "version_req": "^0.4.22", - "default_features": true, - "explicit_name_in_toml": null - }, - { - "kind": "normal", - "name": "inventory", - "target": null, - "features": [], - "optional": false, - "registry": null, - "version_req": "^0.3", - "default_features": true, - "explicit_name_in_toml": null - }, - { - "kind": "normal", - "name": "itertools", - "target": null, - "features": [], - "optional": false, - "registry": null, - "version_req": "^0.13.0", - "default_features": true, - "explicit_name_in_toml": null - }, - { - "kind": "normal", - "name": "lazycell", - "target": null, - "features": [], - "optional": false, - "registry": null, - "version_req": "^1.3.0", - "default_features": true, - "explicit_name_in_toml": null - }, - { - "kind": "normal", - "name": "once_cell", - "target": null, - "features": [], - "optional": false, - "registry": null, - "version_req": "^1.19", - "default_features": true, - "explicit_name_in_toml": null - }, - { - "kind": "normal", - "name": "paste", - "target": null, - "features": [], - "optional": false, - "registry": null, - "version_req": "^1.0", - "default_features": true, - "explicit_name_in_toml": null - }, - { - "kind": "normal", - "name": "prettyplease", - "target": null, - "features": [], - "optional": false, - "registry": null, - "version_req": "^0.2.20", - "default_features": true, - "explicit_name_in_toml": null - }, - { - "kind": "normal", - "name": "proc-macro2", - "target": null, - "features": [], - "optional": false, - "registry": null, - "version_req": "^1.0.86", - "default_features": true, - "explicit_name_in_toml": null - }, - { - "kind": "normal", - "name": "quote", - "target": null, - "features": [], - "optional": false, - "registry": null, - "version_req": "^1.0.36", - "default_features": true, - "explicit_name_in_toml": null - }, - { - "kind": "normal", - "name": "serde", - "target": null, - "features": [ - "derive", - "alloc", - "derive" - ], - "optional": false, - "registry": null, - "version_req": "^1.0.200", - "default_features": false, - "explicit_name_in_toml": null - }, - { - "kind": "normal", - "name": "serde-untagged", - "target": null, - "features": [], - "optional": false, - "registry": null, - "version_req": "^0.1.6", - "default_features": true, - "explicit_name_in_toml": null - }, - { - "kind": "normal", - "name": "serde_ignored", - "target": null, - "features": [], - "optional": false, - "registry": null, - "version_req": "^0.1.1", - "default_features": true, - "explicit_name_in_toml": null - }, - { - "kind": "normal", - "name": "serde_json", - "target": null, - "features": [], - "optional": false, - "registry": null, - "version_req": "^1.0.64", - "default_features": true, - "explicit_name_in_toml": null - }, - { - "kind": "normal", - "name": "strum", - "target": null, - "features": [ - "derive" - ], - "optional": false, - "registry": null, - "version_req": "^0.26.2", - "default_features": true, - "explicit_name_in_toml": null - }, - { - "kind": "normal", - "name": "syn", - "target": null, - "features": [ - "extra-traits", - "full" - ], - "optional": false, - "registry": null, - "version_req": "^2.0.71", - "default_features": true, - "explicit_name_in_toml": null - }, - { - "kind": "normal", - "name": "syn-serde", - "target": null, - "features": [ - "json" - ], - "optional": false, - "registry": null, - "version_req": "^0.3.0", - "default_features": true, - "explicit_name_in_toml": null - }, - { - "kind": "normal", - "name": "tar", - "target": null, - "features": [], - "optional": false, - "registry": null, - "version_req": "^0.4.40", - "default_features": false, - "explicit_name_in_toml": null - }, - { - "kind": "normal", - "name": "toml", - "target": null, - "features": [], - "optional": false, - "registry": null, - "version_req": "^0.8.16", - "default_features": true, - "explicit_name_in_toml": null - }, - { - "kind": "normal", - "name": "toml_edit", - "target": null, - "features": [], - "optional": false, - "registry": null, - "version_req": "^0.22.15", - "default_features": true, - "explicit_name_in_toml": null - }, - { - "kind": "normal", - "name": "unicase", - "target": null, - "features": [], - "optional": false, - "registry": null, - "version_req": "^2.7.0", - "default_features": true, - "explicit_name_in_toml": null - }, - { - "kind": "normal", - "name": "url", - "target": null, - "features": [], - "optional": false, - "registry": null, - "version_req": "^2.5.2", - "default_features": true, - "explicit_name_in_toml": null - }, - { - "kind": "normal", - "name": "walkdir", - "target": null, - "features": [], - "optional": false, - "registry": null, - "version_req": "^2", - "default_features": true, - "explicit_name_in_toml": null - } - ], - "name": "heat-sdk-cli", - "vers": "0.1.0", - "links": null, - "badges": {}, - "readme": null, - "authors": [], - "license": null, - "features": {}, - "homepage": null, - "keywords": [], - "categories": [], - "repository": null, - "description": null, - "readme_file": "../../README.md", - "license_file": null, - "documentation": null - } - }, - { - "name": "heat-sdk-cli-macros", - "version": "0.1.0", - "crate_metadata": { - "deps": [ - { - "kind": "normal", - "name": "proc-macro2", - "target": null, - "features": [], - "optional": false, - "registry": null, - "version_req": "^1.0.86", - "default_features": true, - "explicit_name_in_toml": null - }, - { - "kind": "normal", - "name": "quote", - "target": null, - "features": [], - "optional": false, - "registry": null, - "version_req": "^1.0.36", - "default_features": true, - "explicit_name_in_toml": null - }, - { - "kind": "normal", - "name": "serde", - "target": null, - "features": [ - "derive" - ], - "optional": false, - "registry": null, - "version_req": "^1.0.204", - "default_features": true, - "explicit_name_in_toml": null - }, - { - "kind": "normal", - "name": "strum", - "target": null, - "features": [ - "derive", - "derive" - ], - "optional": false, - "registry": null, - "version_req": "^0.26.2", - "default_features": true, - "explicit_name_in_toml": null - }, - { - "kind": "normal", - "name": "syn", - "target": null, - "features": [ - "extra-traits", - "full" - ], - "optional": false, - "registry": null, - "version_req": "^2.0.71", - "default_features": true, - "explicit_name_in_toml": null - }, - { - "kind": "normal", - "name": "syn-serde", - "target": null, - "features": [ - "json" - ], - "optional": false, - "registry": null, - "version_req": "^0.3.1", - "default_features": true, - "explicit_name_in_toml": null - }, - { - "kind": "normal", - "name": "toml", - "target": null, - "features": [], - "optional": false, - "registry": null, - "version_req": "^0.8.15", - "default_features": true, - "explicit_name_in_toml": null - }, - { - "kind": "normal", - "name": "uuid", - "target": null, - "features": [ - "v4", - "fast-rng", - "macro-diagnostics", - "serde" - ], - "optional": false, - "registry": null, - "version_req": "^1.9.1", - "default_features": true, - "explicit_name_in_toml": null - } - ], - "name": "heat-sdk-cli-macros", - "vers": "0.1.0", - "links": null, - "badges": {}, - "readme": null, - "authors": [], - "license": null, - "features": { - "build-cli": [] - }, - "homepage": null, - "keywords": [], - "categories": [], - "repository": null, - "description": null, - "readme_file": "../../README.md", - "license_file": null, - "documentation": null - } - } - ], - "root_package_name": "guide-cli" - } \ No newline at end of file