forked from MystenLabs/sui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CLI] Better manifest, more comments, more love (MystenLabs#16191)
## Description Move.toml now features hints on which fields to use and how. ## Test Plan Simple feature, only adds comments. Grammar tested with ChatGPT. ### Type of Change (Check all that apply) - [ ] protocol change - [ ] user-visible impact - [ ] breaking change for a client SDKs - [ ] breaking change for FNs (FN binary must upgrade) - [ ] breaking change for validators or node operators (must upgrade binaries) - [ ] breaking change for on-chain data layout - [ ] necessitate either a data wipe or data migration ### Release notes - Move.toml is now more dev-friendly offering hints and usage examples
- Loading branch information
Showing
3 changed files
with
105 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,27 +58,66 @@ impl New { | |
create_dir_all(path.join(SourcePackageLayout::Sources.path()))?; | ||
let mut w = std::fs::File::create(path.join(SourcePackageLayout::Manifest.path()))?; | ||
writeln!( | ||
&mut w, | ||
"[package] | ||
name = \"{name}\" | ||
w, | ||
r#"[package] | ||
name = "{name}" | ||
# edition = "2024.alpha" # To use the Move 2024 edition, currently in alpha | ||
# license = "" # e.g., "MIT", "GPL", "Apache 2.0" | ||
# authors = ["..."] # e.g., ["Joe Smith ([email protected])", "John Snow ([email protected])"] | ||
[dependencies]" | ||
[dependencies]"# | ||
)?; | ||
for (dep_name, dep_val) in deps { | ||
writeln!(w, "{dep_name} = {dep_val}")?; | ||
} | ||
|
||
writeln!( | ||
w, | ||
" | ||
[addresses]" | ||
r#" | ||
# For remote import, use the `{{ git = "...", subdir = "...", rev = "..." }}`. | ||
# Revision can be a branch, a tag, and a commit hash. | ||
# MyRemotePackage = {{ git = "https://some.remote/host.git", subdir = "remote/path", rev = "main" }} | ||
# For local dependencies use `local = path`. Path is relative to the package root | ||
# Local = {{ local = "../path/to" }} | ||
# To resolve a version conflict and force a specific version for dependency | ||
# override use `override = true` | ||
# Override = {{ local = "../conflicting/version", override = true }} | ||
[addresses]"# | ||
)?; | ||
|
||
// write named addresses | ||
for (addr_name, addr_val) in addrs { | ||
writeln!(w, "{addr_name} = \"{addr_val}\"")?; | ||
} | ||
|
||
writeln!( | ||
w, | ||
r#" | ||
# Named addresses will be accessible in Move as `@name`. They're also exported: | ||
# for example, `std = "0x1"` is exported by the Standard Library. | ||
# alice = "0xA11CE" | ||
[dev-dependencies] | ||
# The dev-dependencies section allows overriding dependencies for `--test` and | ||
# `--dev` modes. You can introduce test-only dependencies here. | ||
# Local = {{ local = "../path/to/dev-build" }} | ||
[dev-addresses] | ||
# The dev-addresses section allows overwriting named addresses for the `--test` | ||
# and `--dev` modes. | ||
# alice = "0xB0B" | ||
"# | ||
)?; | ||
|
||
// custom addition in the end | ||
if !custom.is_empty() { | ||
writeln!(w, "{}", custom)?; | ||
} | ||
|
||
Ok(()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,14 +3,74 @@ External Command `cat P1/Move.toml`: | |
[package] | ||
name = "P1" | ||
|
||
# edition = "2024.alpha" # To use the Move 2024 edition, currently in alpha | ||
# license = "" # e.g., "MIT", "GPL", "Apache 2.0" | ||
# authors = ["..."] # e.g., ["Joe Smith ([email protected])", "John Snow ([email protected])"] | ||
|
||
[dependencies] | ||
|
||
# For remote import, use the `{ git = "...", subdir = "...", rev = "..." }`. | ||
# Revision can be a branch, a tag, and a commit hash. | ||
# MyRemotePackage = { git = "https://some.remote/host.git", subdir = "remote/path", rev = "main" } | ||
|
||
# For local dependencies use `local = path`. Path is relative to the package root | ||
# Local = { local = "../path/to" } | ||
|
||
# To resolve a version conflict and force a specific version for dependency | ||
# override use `override = true` | ||
# Override = { local = "../conflicting/version", override = true } | ||
|
||
[addresses] | ||
|
||
# Named addresses will be accessible in Move as `@name`. They're also exported: | ||
# for example, `std = "0x1"` is exported by the Standard Library. | ||
# alice = "0xA11CE" | ||
|
||
[dev-dependencies] | ||
# The dev-dependencies section allows overriding dependencies for `--test` and | ||
# `--dev` modes. You can introduce test-only dependencies here. | ||
# Local = { local = "../path/to/dev-build" } | ||
|
||
[dev-addresses] | ||
# The dev-addresses section allows overwriting named addresses for the `--test` | ||
# and `--dev` modes. | ||
# alice = "0xB0B" | ||
|
||
Command `new P2 -p other_dir`: | ||
External Command `cat other_dir/Move.toml`: | ||
[package] | ||
name = "P2" | ||
|
||
# edition = "2024.alpha" # To use the Move 2024 edition, currently in alpha | ||
# license = "" # e.g., "MIT", "GPL", "Apache 2.0" | ||
# authors = ["..."] # e.g., ["Joe Smith ([email protected])", "John Snow ([email protected])"] | ||
|
||
[dependencies] | ||
|
||
# For remote import, use the `{ git = "...", subdir = "...", rev = "..." }`. | ||
# Revision can be a branch, a tag, and a commit hash. | ||
# MyRemotePackage = { git = "https://some.remote/host.git", subdir = "remote/path", rev = "main" } | ||
|
||
# For local dependencies use `local = path`. Path is relative to the package root | ||
# Local = { local = "../path/to" } | ||
|
||
# To resolve a version conflict and force a specific version for dependency | ||
# override use `override = true` | ||
# Override = { local = "../conflicting/version", override = true } | ||
|
||
[addresses] | ||
|
||
# Named addresses will be accessible in Move as `@name`. They're also exported: | ||
# for example, `std = "0x1"` is exported by the Standard Library. | ||
# alice = "0xA11CE" | ||
|
||
[dev-dependencies] | ||
# The dev-dependencies section allows overriding dependencies for `--test` and | ||
# `--dev` modes. You can introduce test-only dependencies here. | ||
# Local = { local = "../path/to/dev-build" } | ||
|
||
[dev-addresses] | ||
# The dev-addresses section allows overwriting named addresses for the `--test` | ||
# and `--dev` modes. | ||
# alice = "0xB0B" | ||
|