Skip to content
This repository has been archived by the owner on May 4, 2024. It is now read-only.

Flatten package commands #240

Merged
merged 5 commits into from
Jul 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ jobs:
- name: Use Node.js 14
uses: actions/[email protected]
with:
node-version: '14'
node-version: "14"
- name: Install NPM dependencies
working-directory: language/move-analyzer/editors/code
run: npm install
Expand Down Expand Up @@ -271,4 +271,4 @@ jobs:
- name: Build BasicCoin Move module
run: |
cd ./language/documentation/tutorial/step_1/BasicCoin
docker run -v `pwd`:/project move/cli package build
docker run -v `pwd`:/project move/cli build
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ docker build -t move/cli -f docker/move-cli/Dockerfile .

```
cd ./language/documentation/tutorial/step_1/BasicCoin
docker run -v `pwd`:/project move/cli package build
docker run -v `pwd`:/project move/cli build
```

## Community
Expand Down
6 changes: 3 additions & 3 deletions language/changes/7-packages.md
Original file line number Diff line number Diff line change
Expand Up @@ -267,10 +267,10 @@ NamedAddr = "0xC0FFEE"
## Usage, Artifacts, and Data Structures

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

### Usage

Expand Down
6 changes: 3 additions & 3 deletions language/documentation/book/src/packages.md
Original file line number Diff line number Diff line change
Expand Up @@ -248,10 +248,10 @@ named_addr = "0xC0FFEE"
## Usage, Artifacts, and Data Structures

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

### Usage

Expand Down
18 changes: 9 additions & 9 deletions language/documentation/book/src/unit-testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ fun test_only_function(...) { ... }

## Running Unit Tests

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

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.
Expand All @@ -105,7 +105,7 @@ A test will be marked as timing out if it exceeds the maximum number of instruct
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:

```
$ move package -h
$ move -h
```

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

First create an empty package and change directory into it:
```
$ move package new TestExample; cd TestExample
$ move new TestExample; cd TestExample
```

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

### Running Tests

You can then run these tests with the `move package test` command:
You can then run these tests with the `move test` command:

```
$ move package test
$ move test
BUILDING MoveStdlib
BUILDING TestExample
Running Move unit tests
Expand All @@ -192,7 +192,7 @@ Test result: OK. Total tests: 3; passed: 3; failed: 0
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:

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

```
$ move package test -i 0
$ move test -i 0
CACHED MoveStdlib
BUILDING TestExample
Running Move unit tests
Expand Down Expand Up @@ -238,7 +238,7 @@ Test result: FAILED. Total tests: 3; passed: 0; failed: 3
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:

```
$ move package test -s
$ move test -s
CACHED MoveStdlib
BUILDING TestExample
Running Move unit tests
Expand Down Expand Up @@ -279,7 +279,7 @@ module 0x1::my_module {
we would get get the following output when running the tests:

```
$ move package test -g
$ move test -g
CACHED MoveStdlib
BUILDING TestExample
Running Move unit tests
Expand Down
6 changes: 3 additions & 3 deletions language/documentation/examples/diem-framework/build_all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@

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

cd "${SCRIPT_DIR}/move-packages/DPN" && cargo run -p df-cli -- package build &&
cd "${SCRIPT_DIR}/move-packages/core" && cargo run -p df-cli -- package build &&
cd "${SCRIPT_DIR}/move-packages/experimental" && cargo run -p df-cli -- package build
cd "${SCRIPT_DIR}/move-packages/DPN" && cargo run -p df-cli -- build &&
cd "${SCRIPT_DIR}/move-packages/core" && cargo run -p df-cli -- build &&
cd "${SCRIPT_DIR}/move-packages/experimental" && cargo run -p df-cli -- build
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@ fn main() -> Result<()> {
let num_natives = natives.len();

let args = DfCli::parse();
match &args.cmd {
match args.cmd {
DfCommands::Command(cmd) => move_cli::run_cli(
natives,
&cost_table(num_natives),
// TODO: implement this
&ErrorMapping::default(),
&args.move_args,
args.move_args,
cmd,
),
}
Expand Down
6 changes: 3 additions & 3 deletions language/documentation/examples/diem-framework/prove_all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@

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

cd "${SCRIPT_DIR}/move-packages/DPN" && cargo run -p df-cli -- package prove &&
cd "${SCRIPT_DIR}/move-packages/core" && cargo run -p df-cli -- package prove &&
cd "${SCRIPT_DIR}/move-packages/experimental" && cargo run -p df-cli -- package prove
cd "${SCRIPT_DIR}/move-packages/DPN" && cargo run -p df-cli -- prove &&
cd "${SCRIPT_DIR}/move-packages/core" && cargo run -p df-cli -- prove &&
cd "${SCRIPT_DIR}/move-packages/experimental" && cargo run -p df-cli -- prove
6 changes: 3 additions & 3 deletions language/documentation/examples/diem-framework/test_all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@

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

cd "${SCRIPT_DIR}/move-packages/DPN" && cargo run -p df-cli -- package test &&
cd "${SCRIPT_DIR}/move-packages/core" && cargo run -p df-cli -- package test &&
cd "${SCRIPT_DIR}/move-packages/experimental" && cargo run -p df-cli -- package test
cd "${SCRIPT_DIR}/move-packages/DPN" && cargo run -p df-cli -- test &&
cd "${SCRIPT_DIR}/move-packages/core" && cargo run -p df-cli -- test &&
cd "${SCRIPT_DIR}/move-packages/experimental" && cargo run -p df-cli -- test
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ In `sources/puzzlie.move`, the function `Puzzle::puzzle` is constructed to take

Use the following command to run Move Prover:
```
move package prove
move prove
```

The following is the expected output of Move Prover:
Expand Down
24 changes: 12 additions & 12 deletions language/documentation/tutorial/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ cargo install --path language/tools/move-cli
You can check that it is working by running the following command:
```bash
move package --help
move --help
```
You should see something like this along with a list and description of a
Expand All @@ -66,7 +66,7 @@ move-package
Execute a package command. Executed in the current directory or the closest containing Move package
USAGE:
move package [OPTIONS] <SUBCOMMAND>
move [OPTIONS] <SUBCOMMAND>
OPTIONS:
--abi Generate ABIs for packages
Expand Down Expand Up @@ -158,18 +158,18 @@ Let's take a look at this function and what it's saying:
* It creates a `Coin` with the given value and stores it under the
`account` using the `move_to` operator.
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/)):
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/)):
```bash
move package build
move build
```
<details>
<summary>Advanced concepts and references</summary>
* You can create an empty Move package by calling:
```bash
move package new <pkg_name>
move new <pkg_name>
```
* Move code can also live a number of other places. More information on the
Move package system can be found in the [Move
Expand Down Expand Up @@ -218,7 +218,7 @@ unit tests in Rust if you're familiar with them -- tests are annotated with
You can run the tests with the `package test` command:
```bash
move package test
move test
```
Let's now take a look at the contents of the [`FirstModule.move`
Expand Down Expand Up @@ -270,7 +270,7 @@ assertion fails the unit test will fail.
#### Exercises
* Change the assertion to `11` so that the test fails. Find a flag that you can
pass to the `move package test` command that will show you the global state when
pass to the `move test` command that will show you the global state when
the test fails. It should look something like this:
```
┌── test_mint_10 ──────
Expand All @@ -293,7 +293,7 @@ assertion fails the unit test will fail.
└──────────────────
```
* Find a flag that allows you to gather test coverage information, and
then play around with using the `move package coverage` command to look at
then play around with using the `move coverage` command to look at
coverage statistics and source coverage.
</details>
Expand Down Expand Up @@ -383,7 +383,7 @@ implementation of the methods inside [`BasicCoin.move`](./step_4/sources/BasicCo
Let's first try building the code using Move package by running the following command
in [`step_4/BasicCoin`](./step_4/BasicCoin) folder:
```bash
move package build
move build
```
### Implementation of methods
Expand Down Expand Up @@ -473,7 +473,7 @@ take a look at some tools we can use to help us write tests.
To get started, run the `package test` command in the [`step_5/BasicCoin`](./step_5/BasicCoin) folder
```bash
move package test
move test
```
You should see something like this:
Expand Down Expand Up @@ -592,7 +592,7 @@ Informally speaking, the block `spec balance_of {...}` contains the property spe
Let's first run the prover using the following command inside [`BasicCoin` directory](./step_7/BasicCoin/):
```bash
move package prove
move prove
```
which outputs the following error information:
Expand Down Expand Up @@ -627,7 +627,7 @@ The prover basically tells us that we need to explicitly specify the condition u
```
After adding this condition, try running the `prove` command again to confirm that there are no verification errors:
```bash
move package prove
move prove
```
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.
Expand Down
10 changes: 5 additions & 5 deletions language/documentation/tutorial/step_2_sol/solution_commands
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Exercise 1
move package test -g
move test -g

# Exercise 2
move package test --coverage
move test --coverage

Followed by:

move package coverage summary
move package coverage summary --summarize-functions
move package coverage source --module BasicCoin
move coverage summary
move coverage summary --summarize-functions
move coverage source --module BasicCoin
2 changes: 1 addition & 1 deletion language/evm/examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ This directory contains (a growing set of) examples of "Move-on-EVM", a programm
- [ERC1155.move](./sources/ERC1155.move) contains an implementation of ERC1155 which is the standard for multi-tokens.
- [TestUniswap.move](./sources/TestUniswap.move) and [TestUniswapLiquidity.move](./sources/TestUniswapLiquidity.move) are the sample client modules of `Uniswap`.

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.
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.
4 changes: 2 additions & 2 deletions language/evm/hardhat-move/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ async function locateMoveExecutablePath(): Promise<Result<string, Error>> {

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

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

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Copyright (c) The Move Contributors
// SPDX-License-Identifier: Apache-2.0

use move_cli::package::{cli, cli::UnitTestResult};
use move_cli::base::test::{run_move_unit_tests, UnitTestResult};
use move_core_types::account_address::AccountAddress;
use move_table_extension::table_natives;
use move_unit_test::UnitTestingConfig;
Expand All @@ -16,7 +16,7 @@ fn run_tests_for_pkg(path_to_pkg: impl Into<String>) {
natives.append(&mut table_natives(
AccountAddress::from_hex_literal("0x2").unwrap(),
));
let res = cli::run_move_unit_tests(
let res = run_move_unit_tests(
&pkg_path,
move_package::BuildConfig {
test_mode: true,
Expand Down
Loading