Skip to content

Commit 6667c67

Browse files
sahithiacnbors-diem
authored andcommitted
Flatten package commands
Closes: #440
1 parent 2e3f914 commit 6667c67

File tree

94 files changed

+891
-872
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+891
-872
lines changed

.github/workflows/ci-test.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ jobs:
334334
- name: Use Node.js 14
335335
uses: actions/setup-node@v2.4.0
336336
with:
337-
node-version: '14'
337+
node-version: "14"
338338
- name: Install NPM dependencies
339339
working-directory: language/move-analyzer/editors/code
340340
run: npm install
@@ -394,4 +394,4 @@ jobs:
394394
- name: Build BasicCoin Move module
395395
run: |
396396
cd ./language/documentation/tutorial/step_1/BasicCoin
397-
docker run -v `pwd`:/project move/cli package build
397+
docker run -v `pwd`:/project move/cli build

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ docker build -t move/cli -f docker/move-cli/Dockerfile .
2424

2525
```
2626
cd ./language/documentation/tutorial/step_1/BasicCoin
27-
docker run -v `pwd`:/project move/cli package build
27+
docker run -v `pwd`:/project move/cli build
2828
```
2929

3030
## Community

language/changes/7-packages.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -267,10 +267,10 @@ NamedAddr = "0xC0FFEE"
267267
## Usage, Artifacts, and Data Structures
268268

269269
The Move package system comes with a command line option as part of the Move
270-
CLI `move package <package_flags> <command> <command_flags>`. Unless a
270+
CLI `move <flags> <command> <command_flags>`. Unless a
271271
particular path is provided, all package commands will run in the current working
272-
directory. The full list of commands and flags for the Move Package CLI can be found by
273-
running `move package --help`.
272+
directory. The full list of commands and flags for the Move CLI can be found by
273+
running `move --help`.
274274

275275
### Usage
276276

language/documentation/book/src/packages.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -248,10 +248,10 @@ named_addr = "0xC0FFEE"
248248
## Usage, Artifacts, and Data Structures
249249

250250
The Move package system comes with a command line option as part of the Move
251-
CLI `move package <package_flags> <command> <command_flags>`. Unless a
251+
CLI `move <flags> <command> <command_flags>`. Unless a
252252
particular path is provided, all package commands will run in the current working
253-
directory. The full list of commands and flags for the Move Package CLI can be found by
254-
running `move package --help`.
253+
directory. The full list of commands and flags for the Move CLI can be found by
254+
running `move --help`.
255255

256256
### Usage
257257

language/documentation/book/src/unit-testing.md

+9-9
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ fun test_only_function(...) { ... }
9595

9696
## Running Unit Tests
9797

98-
Unit tests for a Move package can be run with the [`move package test`
98+
Unit tests for a Move package can be run with the [`move test`
9999
command](./packages.md).
100100

101101
When running tests, every test will either `PASS`, `FAIL`, or `TIMEOUT`. If a test case fails, the location of the failure along with the function name that caused the failure will be reported if possible. You can see an example of this below.
@@ -105,7 +105,7 @@ A test will be marked as timing out if it exceeds the maximum number of instruct
105105
There are also a number of options that can be passed to the unit testing binary to fine-tune testing and to help debug failing tests. These can be found using the the help flag:
106106

107107
```
108-
$ move package -h
108+
$ move -h
109109
```
110110

111111
## Example
@@ -114,7 +114,7 @@ A simple module using some of the unit testing features is shown in the followin
114114

115115
First create an empty package and change directory into it:
116116
```
117-
$ move package new TestExample; cd TestExample
117+
$ move new TestExample; cd TestExample
118118
```
119119

120120
Next add the following to the `Move.toml`:
@@ -173,10 +173,10 @@ module 0x1::my_module {
173173

174174
### Running Tests
175175

176-
You can then run these tests with the `move package test` command:
176+
You can then run these tests with the `move test` command:
177177

178178
```
179-
$ move package test
179+
$ move test
180180
BUILDING MoveStdlib
181181
BUILDING TestExample
182182
Running Move unit tests
@@ -192,7 +192,7 @@ Test result: OK. Total tests: 3; passed: 3; failed: 0
192192
This will only run tests whose fully qualified name contains `<str>`. For example if we wanted to only run tests with `"zero_coin"` in their name:
193193

194194
```
195-
$ move package test -f zero_coin
195+
$ move test -f zero_coin
196196
CACHED MoveStdlib
197197
BUILDING TestExample
198198
Running Move unit tests
@@ -205,7 +205,7 @@ Test result: OK. Total tests: 2; passed: 2; failed: 0
205205
This bounds the number of instructions that can be executed for any one test to `<bound>`:
206206

207207
```
208-
$ move package test -i 0
208+
$ move test -i 0
209209
CACHED MoveStdlib
210210
BUILDING TestExample
211211
Running Move unit tests
@@ -238,7 +238,7 @@ Test result: FAILED. Total tests: 3; passed: 0; failed: 3
238238
With these flags you can gather statistics about the tests run and report the runtime and instructions executed for each test. For example, if we wanted to see the statistics for the tests in the example above:
239239

240240
```
241-
$ move package test -s
241+
$ move test -s
242242
CACHED MoveStdlib
243243
BUILDING TestExample
244244
Running Move unit tests
@@ -279,7 +279,7 @@ module 0x1::my_module {
279279
we would get get the following output when running the tests:
280280

281281
```
282-
$ move package test -g
282+
$ move test -g
283283
CACHED MoveStdlib
284284
BUILDING TestExample
285285
Running Move unit tests

language/documentation/examples/diem-framework/build_all.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44

55
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
66

7-
cd "${SCRIPT_DIR}/move-packages/DPN" && cargo run -p df-cli -- package build &&
8-
cd "${SCRIPT_DIR}/move-packages/core" && cargo run -p df-cli -- package build &&
9-
cd "${SCRIPT_DIR}/move-packages/experimental" && cargo run -p df-cli -- package build
7+
cd "${SCRIPT_DIR}/move-packages/DPN" && cargo run -p df-cli -- build &&
8+
cd "${SCRIPT_DIR}/move-packages/core" && cargo run -p df-cli -- build &&
9+
cd "${SCRIPT_DIR}/move-packages/experimental" && cargo run -p df-cli -- build

language/documentation/examples/diem-framework/crates/cli/src/main.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,13 @@ fn main() -> Result<()> {
4848
let num_natives = natives.len();
4949

5050
let args = DfCli::parse();
51-
match &args.cmd {
51+
match args.cmd {
5252
DfCommands::Command(cmd) => move_cli::run_cli(
5353
natives,
5454
&cost_table(num_natives),
5555
// TODO: implement this
5656
&ErrorMapping::default(),
57-
&args.move_args,
57+
args.move_args,
5858
cmd,
5959
),
6060
}

language/documentation/examples/diem-framework/prove_all.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44

55
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
66

7-
cd "${SCRIPT_DIR}/move-packages/DPN" && cargo run -p df-cli -- package prove &&
8-
cd "${SCRIPT_DIR}/move-packages/core" && cargo run -p df-cli -- package prove &&
9-
cd "${SCRIPT_DIR}/move-packages/experimental" && cargo run -p df-cli -- package prove
7+
cd "${SCRIPT_DIR}/move-packages/DPN" && cargo run -p df-cli -- prove &&
8+
cd "${SCRIPT_DIR}/move-packages/core" && cargo run -p df-cli -- prove &&
9+
cd "${SCRIPT_DIR}/move-packages/experimental" && cargo run -p df-cli -- prove

language/documentation/examples/diem-framework/test_all.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44

55
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
66

7-
cd "${SCRIPT_DIR}/move-packages/DPN" && cargo run -p df-cli -- package test &&
8-
cd "${SCRIPT_DIR}/move-packages/core" && cargo run -p df-cli -- package test &&
9-
cd "${SCRIPT_DIR}/move-packages/experimental" && cargo run -p df-cli -- package test
7+
cd "${SCRIPT_DIR}/move-packages/DPN" && cargo run -p df-cli -- test &&
8+
cd "${SCRIPT_DIR}/move-packages/core" && cargo run -p df-cli -- test &&
9+
cd "${SCRIPT_DIR}/move-packages/experimental" && cargo run -p df-cli -- test

language/documentation/examples/experimental/math-puzzle/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ In `sources/puzzlie.move`, the function `Puzzle::puzzle` is constructed to take
3030

3131
Use the following command to run Move Prover:
3232
```
33-
move package prove
33+
move prove
3434
```
3535

3636
The following is the expected output of Move Prover:

language/documentation/tutorial/README.md

+11-11
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ cargo install --path language/tools/move-cli
5555
You can check that it is working by running the following command:
5656
5757
```bash
58-
move package --help
58+
move --help
5959
```
6060
6161
You should see something like this along with a list and description of a
@@ -153,18 +153,18 @@ Let's take a look at this function and what it's saying:
153153
* It creates a `Coin` with the given value and stores it under the
154154
`account` using the `move_to` operator.
155155
156-
Let's make sure it builds! This can be done with the `package build` command from within the package folder ([`step_1/BasicCoin`](./step_1/BasicCoin/)):
156+
Let's make sure it builds! This can be done with the `build` command from within the package folder ([`step_1/BasicCoin`](./step_1/BasicCoin/)):
157157
158158
```bash
159-
move package build
159+
move build
160160
```
161161
162162
<details>
163163
<summary>Advanced concepts and references</summary>
164164
165165
* You can create an empty Move package by calling:
166166
```bash
167-
move package new <pkg_name>
167+
move new <pkg_name>
168168
```
169169
* Move code can also live a number of other places. More information on the
170170
Move package system can be found in the [Move
@@ -213,7 +213,7 @@ unit tests in Rust if you're familiar with them -- tests are annotated with
213213
You can run the tests with the `package test` command:
214214
215215
```bash
216-
move package test
216+
move test
217217
```
218218
219219
Let's now take a look at the contents of the [`FirstModule.move`
@@ -263,7 +263,7 @@ assertion fails the unit test will fail.
263263
264264
#### Exercises
265265
* Change the assertion to `11` so that the test fails. Find a flag that you can
266-
pass to the `move package test` command that will show you the global state when
266+
pass to the `move test` command that will show you the global state when
267267
the test fails. It should look something like this:
268268
```
269269
┌── test_mint_10 ──────
@@ -286,7 +286,7 @@ assertion fails the unit test will fail.
286286
└──────────────────
287287
```
288288
* Find a flag that allows you to gather test coverage information, and
289-
then play around with using the `move package coverage` command to look at
289+
then play around with using the `move coverage` command to look at
290290
coverage statistics and source coverage.
291291
292292
</details>
@@ -376,7 +376,7 @@ implementation of the methods inside [`BasicCoin.move`](./step_4/BasicCoin/sourc
376376
Let's first try building the code using Move package by running the following command
377377
in [`step_4/BasicCoin`](./step_4/BasicCoin) folder:
378378
```bash
379-
move package build
379+
move build
380380
```
381381
382382
### Implementation of methods
@@ -466,7 +466,7 @@ take a look at some tools we can use to help us write tests.
466466
To get started, run the `package test` command in the [`step_5/BasicCoin`](./step_5/BasicCoin) folder
467467
468468
```bash
469-
move package test
469+
move test
470470
```
471471
472472
You should see something like this:
@@ -576,7 +576,7 @@ Informally speaking, the block `spec balance_of {...}` contains the property spe
576576
577577
Let's first run the prover using the following command inside [`BasicCoin` directory](./step_7/BasicCoin/):
578578
```bash
579-
move package prove
579+
move prove
580580
```
581581
582582
which outputs the following error information:
@@ -611,7 +611,7 @@ The prover basically tells us that we need to explicitly specify the condition u
611611
```
612612
After adding this condition, try running the `prove` command again to confirm that there are no verification errors:
613613
```bash
614-
move package prove
614+
move prove
615615
```
616616
Apart from the abort condition, we also want to define the functional properties. In Step 8, we will give more detailed introduction to the prover by specifying properties for the methods defined the `BasicCoin` module.
617617
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# Exercise 1
2-
move package test -g
2+
move test -g
33

44
# Exercise 2
5-
move package test --coverage
5+
move test --coverage
66

77
Followed by:
88

9-
move package coverage summary
10-
move package coverage summary --summarize-functions
11-
move package coverage source --module BasicCoin
9+
move coverage summary
10+
move coverage summary --summarize-functions
11+
move coverage source --module BasicCoin

language/evm/examples/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ This directory contains (a growing set of) examples of "Move-on-EVM", a programm
1111
- [ERC1155.move](./sources/ERC1155.move) contains an implementation of ERC1155 which is the standard for multi-tokens.
1212
- [TestUniswap.move](./sources/TestUniswap.move) and [TestUniswapLiquidity.move](./sources/TestUniswapLiquidity.move) are the sample client modules of `Uniswap`.
1313

14-
This directory is a Move package. To build the source files, use `move package build`. Moreover, use `move package test` to run the unit tests located in the `tests` directory.
14+
This directory is a Move package. To build the source files, use `move build`. Moreover, use `move test` to run the unit tests located in the `tests` directory.

language/evm/hardhat-move/src/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ async function locateMoveExecutablePath(): Promise<Result<string, Error>> {
153153

154154
class MoveBuildError {
155155
exec_err: ChildProcess.ExecException;
156-
// TODO: right now, `move package build` outputs its build errors to stdout instead of stderr.
156+
// TODO: right now, `move build` outputs its build errors to stdout instead of stderr.
157157
// This may not be ideal and we may want to fix it and then revisit the error definition here.
158158
stdout: string;
159159
stderr: string;
@@ -166,7 +166,7 @@ class MoveBuildError {
166166
}
167167

168168
async function movePackageBuild(movePath: string, packagePath: string): Promise<Result<void, MoveBuildError>> {
169-
let cmd = `${movePath} package build --path ${packagePath} --arch ethereum`;
169+
let cmd = `${movePath} build --path ${packagePath} --arch ethereum`;
170170

171171
let [e, stdout, stderr] = await executeChildProcess(cmd);
172172

language/extensions/move-table-extension/tests/move_unit_tests.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright (c) The Diem Core Contributors
22
// SPDX-License-Identifier: Apache-2.0
33

4-
use move_cli::package::{cli, cli::UnitTestResult};
4+
use move_cli::base::test::{run_move_unit_tests, UnitTestResult};
55
use move_core_types::account_address::AccountAddress;
66
use move_table_extension::table_natives;
77
use move_unit_test::UnitTestingConfig;
@@ -15,7 +15,7 @@ fn run_tests_for_pkg(path_to_pkg: impl Into<String>) {
1515
natives.append(&mut table_natives(
1616
AccountAddress::from_hex_literal("0x2").unwrap(),
1717
));
18-
let res = cli::run_move_unit_tests(
18+
let res = run_move_unit_tests(
1919
&pkg_path,
2020
move_package::BuildConfig {
2121
test_mode: true,

language/move-prover/doc/user/prover-guide.md

+9-9
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,15 @@ alias move="cargo run --release --quiet --package move-cli --"
2929
We assume in the sequel that the Move CLI is reachable from the command line via the `move` command
3030
(defined by an alias as above or by other means).
3131

32-
In order to call the CLI, you must have a [*move package*](https://diem.github.io/move/packages.html). In the simplest
32+
In order to call the CLI, you must have a [*move *](https://diem.github.io/move/packages.html). In the simplest
3333
case, a Move package is defined by a directory with a set of `.move` files in it and a manifest of the name `Move.toml`.
3434
You can create a package `<name>` in a sub-directory by calling `move package new <name>`.
3535

3636
Now, to call the prover simply use one of the following commands:
3737

3838
```shell script
39-
move package -p <path> prove # Prove the sources of the package at <path>
40-
move package prove # Equivalent to `move package -p . prove`
39+
move -p <path> prove # Prove the sources of the package at <path>
40+
move prove # Equivalent to `move -p . prove`
4141
```
4242

4343
### Target Filtering
@@ -47,27 +47,27 @@ often more effective to focus verification on particular files. You do this with
4747
`-t` (`--target`) option:
4848

4949
```shell script
50-
move package prove -t DiemConfig
50+
move prove -t DiemConfig
5151
```
5252

5353
In general, if the string provided via the `-t` option is contained somewhere in the file name of a source, that source
5454
will be included for verification.
5555

5656
> NOTE: the Move prover ensures that there is no semantic difference between verifying modules one-by-one
5757
> or all at once. However, if your goal is to verify all modules, verifying them in a single
58-
> `move package prove` run will be significantly faster then sequentially.
58+
> `move prove` run will be significantly faster then sequentially.
5959
6060
### Prover Options
6161

6262
The prover has a number of options which are not directly handled by the CLI but rather passed through. You pass options
63-
through with an invocation like `move package prove -- <options>`. The most commonly used option is the `-t` (`--trace`)
63+
through with an invocation like `move prove -- <options>`. The most commonly used option is the `-t` (`--trace`)
6464
option which lets the prover produce richer diagnosis when it encounters errors:
6565

6666
```shell script
67-
move package prove -t DiemConfig -- -t
67+
move prove -t DiemConfig -- -t
6868
```
6969

70-
To see the list of all command line options, use `move package prove -- --help`.
70+
To see the list of all command line options, use `move prove -- --help`.
7171

7272
### Prover Configuration File
7373

@@ -113,7 +113,7 @@ proc_cores = 4
113113
> HINT: for local verification, you may want to set proc_cores to an aggressive number
114114
> (your actual cores) to speed up the turn-around cycle.
115115
116-
> NOTE: To let the prover dump all the available toml options, use `move package prove -- --print-config`. This
116+
> NOTE: To let the prover dump all the available toml options, use `move prove -- --print-config`. This
117117
> will, however, contain many more unrelated and potentially defunct experimental options.
118118
119119
## Prover Tests

0 commit comments

Comments
 (0)