Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor!: big rewrite #118

Merged
merged 63 commits into from
Aug 5, 2024
Merged

refactor!: big rewrite #118

merged 63 commits into from
Aug 5, 2024

Conversation

beeb
Copy link
Contributor

@beeb beeb commented Aug 3, 2024

Big refactor to adopt idiomatic Rust patterns and improve the existing public API.

Breaking Changes

Config file

The config file (whichever has a [dependencies] table between foundry.toml and soldeer.toml) now has a [soldeer] section with the following format and defaults:

[soldeer]
# whether soldeer manages remappings
remappings_generated = true

# whether soldeer re-generates all remappings when installing, updating or uninstalling deps
remappings_regenerate = false

# whether to suffix the remapping with the version: `name-a.b.c`
remappings_version = true

# a prefix to add to the remappings ("@" would give `@name`)
remappings_prefix = ""

# where to store the remappings ("txt" for `remappings.txt` or "config" for `foundry.toml`)
# ignored when `soldeer.toml` is used as config (uses `remappings.txt`)
remappings_location = "txt"

Remappings

Remappings are now properly managed by Soldeer if desired. They can be updated inside the foundry.toml file if that file is also used for [dependencies].

Remappings in the [profile.default] are always managed if remappings_generated = true. Other profiles only get managed if they already contain a remappings array.

If remappings_regenerate = false, then existing remappings are not modified by Soldeer, unless a dependency is removed. This allows for remappings customization.

Auth

  • fallible functions now return an AuthError

Commands

  • subcommand VersionDryRun renamed to Version
  • flag clean for subcommand Init is now a bool
  • flag dry_run for subcommand Push is now a bool
  • flag skip_warnings for subcommand Push is now a bool

Config

  • fallible functions now return a ConfigError
  • Dependency is now an enum with variants Http and Git
  • read_config renamed to read_config_deps and takes a AsRef<Path> parameter
  • define_config_file renamed to get_config_path
  • add_to_config: removed params custom_url and via_git, param config_file now named config_path of type AsRef<Path>
  • remappings replaced by remappings_txt and remappings_foundry
  • get_foundry_setup replaced with read_soldeer_config which returns a SoldeerConfig struct
  • delete_config now takes a AsRef<Path> second param

Dependency Downloader

  • fallible functions now return a DownloadError
  • download_dependencies returns a Vec<DownloadResult>
  • download_dependency has a second argument skip_folder_check of type bool and returns a DownloadResult
  • unzip_dependency now takes a single &HttpDependency parameter
  • download_via_git now takes a &GitDependency
  • download_via_http now takes a IntoUrl first param, and &HttpDependency second param

Janitor

  • fallible functions now return a JanitorError
  • cleanup_dependency now takes a full: bool as second parameter which removes the entire dependencies folder and lockfile when true

Soldeer (lib)

  • run returns a SoldeerError in case of issues
  • re-export errors::SoldeerError
  • re-export commands::Subcommands

Lock

  • fallible functions now return a LockError

Remote

  • fallible functions now return a DownloadError
  • get_dependency_url_remote now takes a single &Dependency parameter
  • get_project_id now accepts &str as input

Utils

  • define_security_file_location now returns a Result<PathBuf, std::io::Error>
  • check_dotfiles now accepts AsRef<Path> as input
  • check_dotfiles_recursive now accepts AsRef<Path> as input
  • get_download_tunnel replaced with get_url_type
  • sha256_digestnow takes a single &HttpDependency as input

Versioning

  • fallible functions now return a PublishError
  • push_version takes &str as first and second parameters

Closes #106
Closes #107
Closes #117
Closes #119
Closes #121

@beeb beeb changed the title refactor: big rewrite of dependencies parsing and more refactor: big rewrite Aug 3, 2024
@beeb beeb marked this pull request as ready for review August 4, 2024 14:00
@beeb beeb changed the title refactor: big rewrite refactor!: big rewrite Aug 4, 2024
@mario-eth mario-eth merged commit eb20e25 into mario-eth:main Aug 5, 2024
5 checks passed
@beeb beeb deleted the refactor-various branch August 5, 2024 07:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants