Skip to content

Commit 4f8ebde

Browse files
authored
Merge pull request #357 from online-judge-tools/translate-rust-usage
Translate documents for Rust
2 parents fc08cd5 + ab7b5ea commit 4f8ebde

File tree

2 files changed

+34
-7
lines changed

2 files changed

+34
-7
lines changed

.verify-helper/docs/static/document.ja.md

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -69,22 +69,19 @@ NIMFLAGS = ["--warning:on", "--opt:none"]
6969
- `kind = "none"`
7070

7171
デフォルトの動作です。
72+
それぞれのターゲットに関連する `.rs` ファイルはすべてひとまとまりとして扱われ、それぞれのターゲット内のファイルの間の依存関係などについては調べません。
7273

7374
```toml
7475
[languages.rust.list_dependencies_backend]
7576
kind = "none"
7677
```
7778

78-
- あるターゲットの root source file であるならば、そのターゲット及びローカルにある依存クレートの、
79-
- どのターゲットの root source file でもなければ、自身を含むターゲットの、
80-
81-
`.rs`ファイルすべてを列挙して返します。
82-
83-
ターゲットに関連する `.rs` ファイルはすべてひとまとまりとして扱われ、「モジュール間の依存関係」等については調べません。
79+
- あるターゲットの root source file であるようなソースファイルについては、そのターゲット及びローカルにある依存クレートの `.rs` ファイルすべてを依存ファイルとして扱います。
80+
- どのターゲットの root source file でもないようなソースファイルについては、自身を含むターゲットの `.rs` ファイルすべてを依存ファイルとして扱います。
8481

8582
- `kind = "cargo-udeps"`
8683

87-
基本的に `kind = "none"` と同じですが、 `$PATH` 内にある [cargo-udeps](https://github.com/est31/cargo-udeps) を使い「パッケージからクレートへの依存」からさらに「クレート間の依存」を絞り込みます
84+
基本的に `kind = "none"` と同じですが、 `$PATH` 内にある [cargo-udeps](https://github.com/est31/cargo-udeps) を利用します。クレート間の依存関係を解析し、より適切なファイル間の依存関係を求めます
8885

8986
```toml
9087
[languages.rust.list_dependencies_backend]

.verify-helper/docs/static/document.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ Summary:
1616
| Ruby | `.rb` | `.test.rb` | `# verification-helper: [KEY] [VALUE]` | :heavy_check_mark: / :x: / :warning: | [hello_world.test.rb](https://github.com/online-judge-tools/verification-helper/blob/master/examples/ruby/hello_world.test.rb) |
1717
| Go | `.go` | `.test.go` | `// verification-helper: [KEY] [VALUE]` | :heavy_check_mark: / :x: / :warning: | [helloworld.test.go](https://github.com/online-judge-tools/verification-helper/blob/master/examples/go/helloworld.test.go) |
1818
| Java | `.java` | `_test.java` | `// verification-helper: [KEY] [VALUE]` | :heavy_check_mark: / :x: / :warning: | [HelloWorld_test.java](https://github.com/online-judge-tools/verification-helper/blob/master/examples/java/HelloWorld_test.java) |
19+
| Rust | `.rs` | special | `// verification-helper: [KEY] [VALUE]` | :heavy_check_mark: / :x: / :warning: | [itp1-1-a.rs](https://github.com/online-judge-tools/verification-helper/blob/master/examples/rust/verification/src/bin/aizu-online-judge-itp1-1-a.rs) |
1920

2021
### Settings for C++
2122

@@ -59,6 +60,35 @@ NIMFLAGS = ["--warning:on", "--opt:none"]
5960

6061
There is no config now.
6162

63+
### Settings for Rust
64+
65+
`oj-verify` uses [root source files](https://docs.rs/cargo_metadata/0.12.0/cargo_metadata/struct.Target.html#structfield.src_path) of [binary targets](https://doc.rust-lang.org/cargo/reference/cargo-targets.html#binaries) or [example targets](https://doc.rust-lang.org/cargo/reference/cargo-targets.html#examples) (excluding targets which `crate-type` is specified) which have the [`PROBLEM`](#available-macro-definitions) attribute
66+
67+
You can customize the method to list depending files with `languages.rust.list_dependencies_backend` of `.verify-helper/config.toml`.
68+
69+
- `kind = "none"`
70+
71+
This is the default behavoir.
72+
For each target, all `.rs` files in the target is treated as a block. The dependency relationship of files in each target are not analyzed.
73+
74+
```toml
75+
[languages.rust.list_dependencies_backend]
76+
kind = "none"
77+
```
78+
79+
- For a file which is a root source file of a target, the file depends all `.rs` files in its target and all depending local crates.
80+
- For a file which is not a root source file of any targets, the file depends all `.rs` files in its target.
81+
82+
- `kind = "cargo-udeps"`
83+
84+
This method is similar to `kind = "none"`, but uses [cargo-udeps](https://github.com/est31/cargo-udeps) in `$PATH` to narrow down dependencies. It computes the dependency relationship of files using the dependencies relationship between crates.
85+
86+
```toml
87+
[languages.rust.list_dependencies_backend]
88+
kind = "cargo-udeps"
89+
toolchain = "nightly-yyyy-mm-dd" # defaults to "nightly"
90+
```
91+
6292
### Settings for other languages
6393

6494
You can use languages other than above (e.g. AWK [examples/awk/circle.test.awk](https://github.com/online-judge-tools/verification-helper/blob/master/examples/awk/circle.test.awk)). Please write commands to compile and execute in the config file `.verify-helper/config.toml` (e.g. [.verify-helper/config.toml](https://github.com/kmyk/online-judge-verify-helper/blob/master/.verify-helper/config.toml)).

0 commit comments

Comments
 (0)