Skip to content

Commit

Permalink
Merge #43
Browse files Browse the repository at this point in the history
43: Give pseudo `extern_crate_name`s to dependencies of dependencies r=qryxip a=qryxip

Like `"__internal_lib_0_1_0"`.

Closes #42.

bors r+


Co-authored-by: Ryo Yamashita <qryxip@gmail.com>
  • Loading branch information
bors[bot] and qryxip authored Nov 6, 2020
2 parents 54ade22 + b423d63 commit f115bdd
Show file tree
Hide file tree
Showing 6 changed files with 171 additions and 171 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

## [Unreleased]

### Added

- Now it gives pseudo `extern_crate_name`s like `"__internal_lib_0_1_0"` to dependencies of dependencies.

You no longer need to include all of the libraries in `[dependencies]`.

### Changed

- Supports `extern crate $name as $rename` in `bin`s.
Expand Down
81 changes: 34 additions & 47 deletions README-ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,27 +21,21 @@ version = "0.0.0"
edition = "2018"

[dependencies]
acl_convolution = { git = "https://github.com/qryxip/ac-library-rs", branch = "split-into-separate-crates" }
acl_dsu = { git = "https://github.com/qryxip/ac-library-rs", branch = "split-into-separate-crates" }
acl_fenwicktree = { git = "https://github.com/qryxip/ac-library-rs", branch = "split-into-separate-crates" }
acl_internal_bit = { git = "https://github.com/qryxip/ac-library-rs", branch = "split-into-separate-crates" }
acl_internal_math = { git = "https://github.com/qryxip/ac-library-rs", branch = "split-into-separate-crates" }
acl_internal_queue = { git = "https://github.com/qryxip/ac-library-rs", branch = "split-into-separate-crates" }
acl_internal_scc = { git = "https://github.com/qryxip/ac-library-rs", branch = "split-into-separate-crates" }
acl_internal_type_traits = { git = "https://github.com/qryxip/ac-library-rs", branch = "split-into-separate-crates" }
acl_lazysegtree = { git = "https://github.com/qryxip/ac-library-rs", branch = "split-into-separate-crates" }
acl_math = { git = "https://github.com/qryxip/ac-library-rs", branch = "split-into-separate-crates" }
acl_maxflow = { git = "https://github.com/qryxip/ac-library-rs", branch = "split-into-separate-crates" }
acl_mincostflow = { git = "https://github.com/qryxip/ac-library-rs", branch = "split-into-separate-crates" }
acl_modint = { git = "https://github.com/qryxip/ac-library-rs", branch = "split-into-separate-crates" }
acl_scc = { git = "https://github.com/qryxip/ac-library-rs", branch = "split-into-separate-crates" }
acl_segtree = { git = "https://github.com/qryxip/ac-library-rs", branch = "split-into-separate-crates" }
acl_string = { git = "https://github.com/qryxip/ac-library-rs", branch = "split-into-separate-crates" }
acl_twosat = { git = "https://github.com/qryxip/ac-library-rs", branch = "split-into-separate-crates" }
input = { path = "/path/to/input" }
output = { path = "/path/to/output" }
tonelli_shanks = { path = "/path/to/tonelli_shanks" }
xorshift = { path = "/path/to/xorshift" }
acl_convolution = { git = "https://github.com/qryxip/ac-library-rs", branch = "split-into-separate-crates" }
acl_dsu = { git = "https://github.com/qryxip/ac-library-rs", branch = "split-into-separate-crates" }
acl_fenwicktree = { git = "https://github.com/qryxip/ac-library-rs", branch = "split-into-separate-crates" }
acl_lazysegtree = { git = "https://github.com/qryxip/ac-library-rs", branch = "split-into-separate-crates" }
acl_math = { git = "https://github.com/qryxip/ac-library-rs", branch = "split-into-separate-crates" }
acl_maxflow = { git = "https://github.com/qryxip/ac-library-rs", branch = "split-into-separate-crates" }
acl_mincostflow = { git = "https://github.com/qryxip/ac-library-rs", branch = "split-into-separate-crates" }
acl_modint = { git = "https://github.com/qryxip/ac-library-rs", branch = "split-into-separate-crates" }
acl_scc = { git = "https://github.com/qryxip/ac-library-rs", branch = "split-into-separate-crates" }
acl_segtree = { git = "https://github.com/qryxip/ac-library-rs", branch = "split-into-separate-crates" }
acl_string = { git = "https://github.com/qryxip/ac-library-rs", branch = "split-into-separate-crates" }
acl_twosat = { git = "https://github.com/qryxip/ac-library-rs", branch = "split-into-separate-crates" }
input = { path = "/path/to/input" }
output = { path = "/path/to/output" }
tonelli_shanks = { path = "/path/to/tonelli_shanks" }
# ...
```

Expand Down Expand Up @@ -78,14 +72,14 @@ fn main() {
cargo equip --resolve-cfgs --remove docs --minify libs --rustfmt --check -o ./bundled.rs
Running `/home/ryo/.cargo/bin/rustup run nightly cargo udeps --output json -p solve --bin solve`
Checking solve v0.0.0 (/home/ryo/src/local/a/solve)
Finished dev [unoptimized + debuginfo] target(s) in 0.30s
info: Loading save analysis from "/home/ryo/src/local/a/solve/target/debug/deps/save-analysis/solve-4eea33c8603d6001.json"
Finished dev [unoptimized + debuginfo] target(s) in 0.13s
info: Loading save analysis from "/home/ryo/src/local/a/solve/target/debug/deps/save-analysis/solve-e3698634e08ed722.json"
Bundling the code
Checking cargo-equip-check-output-do7dy7m13pba4nbx v0.1.0 (/tmp/cargo-equip-check-output-do7dy7m13pba4nbx)
Finished dev [unoptimized + debuginfo] target(s) in 0.35s
Checking cargo-equip-check-output-99qzpt0pl701s8e6 v0.1.0 (/tmp/cargo-equip-check-output-99qzpt0pl701s8e6)
Finished dev [unoptimized + debuginfo] target(s) in 0.34s
```

[Submit Info #28576 - Library-Checker](https://judge.yosupo.jp/submission/28576)
[Submit Info #29030 - Library-Checker](https://judge.yosupo.jp/submission/29030)

## インストール

Expand Down Expand Up @@ -199,33 +193,25 @@ info: Loading save analysis from "/home/ryo/src/local/a/solve/target/debug/deps/

```toml
[dependencies]
acl_convolution = { git = "https://github.com/qryxip/ac-library-rs", branch = "split-into-separate-crates" }
acl_dsu = { git = "https://github.com/qryxip/ac-library-rs", branch = "split-into-separate-crates" }
acl_fenwicktree = { git = "https://github.com/qryxip/ac-library-rs", branch = "split-into-separate-crates" }
acl_internal_bit = { git = "https://github.com/qryxip/ac-library-rs", branch = "split-into-separate-crates" }
acl_internal_math = { git = "https://github.com/qryxip/ac-library-rs", branch = "split-into-separate-crates" }
acl_internal_queue = { git = "https://github.com/qryxip/ac-library-rs", branch = "split-into-separate-crates" }
acl_internal_scc = { git = "https://github.com/qryxip/ac-library-rs", branch = "split-into-separate-crates" }
acl_internal_type_traits = { git = "https://github.com/qryxip/ac-library-rs", branch = "split-into-separate-crates" }
acl_lazysegtree = { git = "https://github.com/qryxip/ac-library-rs", branch = "split-into-separate-crates" }
acl_math = { git = "https://github.com/qryxip/ac-library-rs", branch = "split-into-separate-crates" }
acl_maxflow = { git = "https://github.com/qryxip/ac-library-rs", branch = "split-into-separate-crates" }
acl_mincostflow = { git = "https://github.com/qryxip/ac-library-rs", branch = "split-into-separate-crates" }
acl_modint = { git = "https://github.com/qryxip/ac-library-rs", branch = "split-into-separate-crates" }
acl_scc = { git = "https://github.com/qryxip/ac-library-rs", branch = "split-into-separate-crates" }
acl_segtree = { git = "https://github.com/qryxip/ac-library-rs", branch = "split-into-separate-crates" }
acl_string = { git = "https://github.com/qryxip/ac-library-rs", branch = "split-into-separate-crates" }
acl_twosat = { git = "https://github.com/qryxip/ac-library-rs", branch = "split-into-separate-crates" }
acl_convolution = { git = "https://github.com/qryxip/ac-library-rs", branch = "split-into-separate-crates" }
acl_dsu = { git = "https://github.com/qryxip/ac-library-rs", branch = "split-into-separate-crates" }
acl_fenwicktree = { git = "https://github.com/qryxip/ac-library-rs", branch = "split-into-separate-crates" }
acl_lazysegtree = { git = "https://github.com/qryxip/ac-library-rs", branch = "split-into-separate-crates" }
acl_math = { git = "https://github.com/qryxip/ac-library-rs", branch = "split-into-separate-crates" }
acl_maxflow = { git = "https://github.com/qryxip/ac-library-rs", branch = "split-into-separate-crates" }
acl_mincostflow = { git = "https://github.com/qryxip/ac-library-rs", branch = "split-into-separate-crates" }
acl_modint = { git = "https://github.com/qryxip/ac-library-rs", branch = "split-into-separate-crates" }
acl_scc = { git = "https://github.com/qryxip/ac-library-rs", branch = "split-into-separate-crates" }
acl_segtree = { git = "https://github.com/qryxip/ac-library-rs", branch = "split-into-separate-crates" }
acl_string = { git = "https://github.com/qryxip/ac-library-rs", branch = "split-into-separate-crates" }
acl_twosat = { git = "https://github.com/qryxip/ac-library-rs", branch = "split-into-separate-crates" }
```

準備ができたらコードを書いてください。
`bin`側の制約は以下の2つです。

1. マクロは`use`しない。qualified pathで使うか`#[macro_use]`で使う。

2. 展開されうるクレートはすべて`[dependencies]`に加えることで`extern_crate_name`を与える。

`__inner_lib_z04kve2dww`のような仮の名前を与えることは考えてますがまだ実装していません。
2. `bin`内に`mod`を作る場合、その中では[Extern Prelude](https://doc.rust-lang.org/reference/items/extern-crates.html#extern-prelude)から名前を解決しない。

```rust
#[macro_use]
Expand Down Expand Up @@ -262,6 +248,7 @@ fn main() {
```

コードはこのように展開されます。
`extern_crate_name``bin`側から与えられていないクレートは`"__internal_lib_0_1_0" + &"_".repeat(n)`のような名前が与えられます。

```diff
+//! # Bundled libraries
Expand Down
46 changes: 20 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,27 +21,21 @@ version = "0.0.0"
edition = "2018"

[dependencies]
acl_convolution = { git = "https://github.com/qryxip/ac-library-rs", branch = "split-into-separate-crates" }
acl_dsu = { git = "https://github.com/qryxip/ac-library-rs", branch = "split-into-separate-crates" }
acl_fenwicktree = { git = "https://github.com/qryxip/ac-library-rs", branch = "split-into-separate-crates" }
acl_internal_bit = { git = "https://github.com/qryxip/ac-library-rs", branch = "split-into-separate-crates" }
acl_internal_math = { git = "https://github.com/qryxip/ac-library-rs", branch = "split-into-separate-crates" }
acl_internal_queue = { git = "https://github.com/qryxip/ac-library-rs", branch = "split-into-separate-crates" }
acl_internal_scc = { git = "https://github.com/qryxip/ac-library-rs", branch = "split-into-separate-crates" }
acl_internal_type_traits = { git = "https://github.com/qryxip/ac-library-rs", branch = "split-into-separate-crates" }
acl_lazysegtree = { git = "https://github.com/qryxip/ac-library-rs", branch = "split-into-separate-crates" }
acl_math = { git = "https://github.com/qryxip/ac-library-rs", branch = "split-into-separate-crates" }
acl_maxflow = { git = "https://github.com/qryxip/ac-library-rs", branch = "split-into-separate-crates" }
acl_mincostflow = { git = "https://github.com/qryxip/ac-library-rs", branch = "split-into-separate-crates" }
acl_modint = { git = "https://github.com/qryxip/ac-library-rs", branch = "split-into-separate-crates" }
acl_scc = { git = "https://github.com/qryxip/ac-library-rs", branch = "split-into-separate-crates" }
acl_segtree = { git = "https://github.com/qryxip/ac-library-rs", branch = "split-into-separate-crates" }
acl_string = { git = "https://github.com/qryxip/ac-library-rs", branch = "split-into-separate-crates" }
acl_twosat = { git = "https://github.com/qryxip/ac-library-rs", branch = "split-into-separate-crates" }
input = { path = "/path/to/input" }
output = { path = "/path/to/output" }
tonelli_shanks = { path = "/path/to/tonelli_shanks" }
xorshift = { path = "/path/to/xorshift" }
acl_convolution = { git = "https://github.com/qryxip/ac-library-rs", branch = "split-into-separate-crates" }
acl_dsu = { git = "https://github.com/qryxip/ac-library-rs", branch = "split-into-separate-crates" }
acl_fenwicktree = { git = "https://github.com/qryxip/ac-library-rs", branch = "split-into-separate-crates" }
acl_lazysegtree = { git = "https://github.com/qryxip/ac-library-rs", branch = "split-into-separate-crates" }
acl_math = { git = "https://github.com/qryxip/ac-library-rs", branch = "split-into-separate-crates" }
acl_maxflow = { git = "https://github.com/qryxip/ac-library-rs", branch = "split-into-separate-crates" }
acl_mincostflow = { git = "https://github.com/qryxip/ac-library-rs", branch = "split-into-separate-crates" }
acl_modint = { git = "https://github.com/qryxip/ac-library-rs", branch = "split-into-separate-crates" }
acl_scc = { git = "https://github.com/qryxip/ac-library-rs", branch = "split-into-separate-crates" }
acl_segtree = { git = "https://github.com/qryxip/ac-library-rs", branch = "split-into-separate-crates" }
acl_string = { git = "https://github.com/qryxip/ac-library-rs", branch = "split-into-separate-crates" }
acl_twosat = { git = "https://github.com/qryxip/ac-library-rs", branch = "split-into-separate-crates" }
input = { path = "/path/to/input" }
output = { path = "/path/to/output" }
tonelli_shanks = { path = "/path/to/tonelli_shanks" }
# ...
```

Expand Down Expand Up @@ -78,14 +72,14 @@ fn main() {
cargo equip --resolve-cfgs --remove docs --minify libs --rustfmt --check -o ./bundled.rs
Running `/home/ryo/.cargo/bin/rustup run nightly cargo udeps --output json -p solve --bin solve`
Checking solve v0.0.0 (/home/ryo/src/local/a/solve)
Finished dev [unoptimized + debuginfo] target(s) in 0.30s
info: Loading save analysis from "/home/ryo/src/local/a/solve/target/debug/deps/save-analysis/solve-4eea33c8603d6001.json"
Finished dev [unoptimized + debuginfo] target(s) in 0.13s
info: Loading save analysis from "/home/ryo/src/local/a/solve/target/debug/deps/save-analysis/solve-e3698634e08ed722.json"
Bundling the code
Checking cargo-equip-check-output-do7dy7m13pba4nbx v0.1.0 (/tmp/cargo-equip-check-output-do7dy7m13pba4nbx)
Finished dev [unoptimized + debuginfo] target(s) in 0.35s
Checking cargo-equip-check-output-99qzpt0pl701s8e6 v0.1.0 (/tmp/cargo-equip-check-output-99qzpt0pl701s8e6)
Finished dev [unoptimized + debuginfo] target(s) in 0.34s
```

[Submit Info #28576 - Library-Checker](https://judge.yosupo.jp/submission/28576)
[Submit Info #29030 - Library-Checker](https://judge.yosupo.jp/submission/29030)

## Installation

Expand Down
Loading

0 comments on commit f115bdd

Please sign in to comment.