-
Fixed
--exclude-atcoder-202301-crates
. (#200)Previously, it was for the "7/3 freeze".
-
Added
--exclude-atcoder-202301-crates
. (#197)--exclude-atcoder-202301-crates Alias for `--exclude {crates available on AtCoder 202301}`
-
Added
--toolchain-for-proc-macro-srv
. (#195)--toolchain-for-proc-macro-srv <TOOLCHAIN> Toolchain for expanding procedural macros
-
Updated the embedded Rust Analyzer to
2023-07-31
(0.0.166
). (#195)For Rust <1.64,
--toolchain-for-proc-macro-srv
is required for macro expansion.❯ cargo +1.42.0 equip 2>&1 | tail -n 1 Rust ≧1.64.0 is required for expanding procedural macros. Specify one with `--toolchain-for-proc-macro-srv`
This update should fix the issue where macro expansion segfaults.
-
Renamed
--toolchain
to--toolchain-for-udeps
. (#195)❯ cargo equip --toolchain nightly warning: `--toolchain` was renamed to `--toolchain-for-udeps`
-
cargo-equip now warns for
resolver = "2"
andedition = "2015"
. (#196)Note that both has been unsupported.
warning: Currently cargo-equip only support Feature Resovler v1, and may go search more crates than real Cargo does. Please watch https://github.com/qryxip/cargo-equip/issues/94
warning: Rust 2015 is unsupported
-
Updated prettytable. (#193 by @ichyo)
Now cargo-equip built with recent Rust works.
-
Adapted the new reserving syntax in Rust 2021 when minifying. (qryxip/rustminify#7 by @mizar, #198).
This fix also affects Rust 2018. The output might be few characters longer.
- Ignores workspace members when checking licenses. (#184)
-
Embedded rust-analyzer for expanding procedural macros. (#183)
Previously, cargo-equip downloaded rust-analyzer(.exe) from GitHub Releases and used it.
-
Requires additional 1.48+ toolchain for compiling proc-macro crates when cargo-equip is used for an old toolchain such as 1.42. (#183)
Previously, 1.47 was compatible.
-
(also applied to the previous versions unless
--locked
) Updated syn to v1.0.83.- Now accepts some nightly-only syntaxes
- Now accepts trailing
+
in TypeParamBounds.
-
Now outputs from
lib
/bin
crates arecheck
ed withouttest
flag. (#177)Previously,
#[test]
s without#[cfg(test)]
are unintentionallycheck
ed. -
Fixed a problem where file paths are not masked in the
# License and Copyright Notices
section. (#178 by @SGThr7)
-
Added
--mod-path <MODULE_PATH>
option. (#159)+ --mod-path <MODULE_PATH> Expand the libraries to the module [default: crate::__cargo_equip]
-
Added
--mine <DOMAIN_AND_USERNAME>...
option. (#169)+ --mine <DOMAIN_AND_USERNAME>... + Do not include license and copyright notices for the users. + + Supported formats: + * github.com/{username} + * gitlab.com/{username}
-
Enabled running for a
lib
crate. (#156)Now you can easily produce standalone Rust source files like
my_library.rs
.❯ cargo metadata --format-version 1 | jq -r .resolve.root | awk '{ print $1, $2 }' proconio 0.4.3 ❯ cargo equip --minify libs --remove docs -o ./proconio.rs
-
Changed potition of the generated doc comment. (#161)
-//! # Bundled libraries -//! ⋮ use __cargo_equip::prelude::*; fn main() {} +/// # Bundled libraries +/// ⋮ #[allow(unused)] mod __cargo_equip { // ⋮ }
-
cargo-equip no longer uses
package.authors
to skip Copyright and License Notices. (#164)Instead, add
--mine github.com/your-username
to the arguments. -
Now uses rust-analyzer
2021-07-12
for Rust 1.47 and2021-08-09
for Rust 1.48+. (#163)
-
#[macro_export]
ed macros will remain in textual scope. (#170)#[macro_export] -macro_rules! hello { +macro_rules! /*hello*/__cargo_equip_macro_lib_hello { () => { ::std::println!("Hello!") }; } +macro_rules!hello{($($tt:tt)*)=>(crate::__cargo_equip_macro_lib_hello!{$($tt)*})}
-
Improved the minification function. (#153, #157)
-let _=| |(); +let _=||();
-
(also applied to the previous versions unless
--locked
) Updated syn to v1.0.74. (#155) -
Enabled reading license files from
git
/path
package sources. (#156)Previously cargo-equip reaches a
todo!
. -
Now handles
path
dependencies correctly when checking an output. (#156, #166)
-
Improved the help. (#143)
Now you can read the detailed help with
--help
whilecargo equip -h
still prints a short and concise overview. -
Changed the format. (#144)
- Moved
__bundled
to__cargo_equip::crates
. - Moved
__bundled::*::__macros
to__cargo_equip::macros
. - Now creates
__cargo_equip::prelude
and glob-uses it instead of declaring__prelude_for_main_crate!
. - Unified
__bundled::*::{__external_local_inner_macros, __pseudo_extern_prelude}
into__cargo_equip::preludes
.
//! # Bundled libraries //! ︙ pub use __cargo_equip::prelude::*; // ︙ // The following code was expanded by `cargo-equip`. mod __cargo_equip { pub(crate) mod crates {/* … */} pub(crate) mod macros {/* … */} pub(crate) mod prelude {/* … */} mod preludes {/* … */} } #[cfg_attr(any(), rustfmt::skip)] const _: () = { // ︙ };
- Moved
-
Updated rust-analyzer to
2021-06-28
. (#145)
-
--resolve-cfgs
--rustfmt
--check
by default. (#139)Instead, added
--no-resolve-cfgs
,--no-rustfmt
, and--no-check
.❯ cargo-equip --resolve-cfgs --rustfmt --check warning: `--resolve-cfgs` is deprecated. `#[cfg(..)]`s are resolved by default warning: `--rustfmt` is deprecated. the output is formatted by default warning: `--check` is deprecated. the output is checked by default
-
Removed the warning message for
pub(crate)
in libraries. (#138) -
Updated
--exclude-{atcoder, codingame}-crates
. (#140)Added
…#proconio:0.3.8
to--exclude-atcoder-crates
. -
Updated rust-analyzer to
2021-06-21
. (#141)
-
cargo-equip now inserts
#[allow(unused_imports)]
for only seemingly procedural macros.use proconio::{fastout, input};
↓
use proconio::{/*fastout,*/ input}; #[allow(unused_imports)] use proconio::fastout;
-
Scopes for macros are now preserved. (#126)
Now you can
use
macros anywhere.use proconio::input; fn main() { input! { n: usize, } }
-
Dummy macros are now expanded for
proc-macro
crates. (#126)Now you can also
use
procedural macros.use proconio::fastout; #[fastout] fn main() { println!("Hi"); }
-
Now
#[[warn/deny/forbid](missing-(crate-level-)docs)]
attributes are removed when--remove docs
is enabled. (#126)Now you can remove doc comments from smallvec.
-
Modules in main crates are now supported. (#129)
mod sub { use smallvec::{smallvec, SmallVec}; pub(crate) fn f() { let _: SmallVec<[(); 0]> = smallvec![]; } }
-
Dropped the support for Rust 2015. (#126)
-
#[allow(unused_imports)]
will be always inserted. (#126) -
Updated rust-analyzer to
2021-05-31
. (#130)
-
Fixed order of
#[macro_exported]
macros. (#126) -
Fixed a problem where
attr
s for attribute macros contain parentheses. (#130)#[memoise(n <= 10)] ^ ^
-
Enabled minifying
1. ..x
correctly.
-
Now cargo-equip replaces paths and
use
trees that have leading semicolons. (#113)use ::{lib1::A, lib2::B}
↓
use /*::*/crate::{/*lib1*/__lib1_0_1_0::A, /*lib2*/lib2_0_1_0::B}
-
Updated rust-analyzer to
2021-05-10
. (#114)
-
Removed
#[allow(clippy::deprecated_cfg_attr)]
. (#110)-#[allow(clippy::deprecated_cfg_attr)]#[cfg_attr(rustfmt,rustfmt::skip)]#[allow(unused)]pub mod lib{/* ... */} + #[cfg_attr(any() ,rustfmt::skip)]#[allow(unused)]pub mod lib{/* ... */}
-
Tokens from procedural macros will be minified. (#111)
-
Recognizes
#[macro_export(local_inner_macros)]
. (#105) -
Fixed a problem where
$crate
s are not replaced with$crate::lib_name
in a certain case. (#106) -
Fixed a problem where
--remove
option could not be used for CRLF code. (#106)With the above 3 fixtures, you can bundle proconio.
❯ cat <<EOF >./src/main.rs heredoc> #[macro_use] heredoc> extern crate proconio as _; heredoc> heredoc> #[fastout] heredoc> fn main() { heredoc> input!(abs: [(u64, u64)]); heredoc> for (a, b) in abs { heredoc> println!("{}", a + b); heredoc> } heredoc> } heredoc> EOF ❯ cargo equip \ > --resolve-cfgs \ > --remove docs \ > --minify libs \ > --rustfmt \ > --check \ > -o ./bundled.rs ❯ ./run-cargo-equip.bash -o ./bundled.rs Running `/home/ryo/.cargo/bin/rustup run nightly cargo udeps --output json -p bundle-proconio --bin bundle-proconio` Checking bundle-proconio v0.1.0 (/home/ryo/src/local/bundle-proconio) Finished dev [unoptimized + debuginfo] target(s) in 0.45s info: Loading save analysis from "/home/ryo/src/local/bundle-proconio/target/debug/deps/save-analysis/bundle_proconio-31a013a4acd96cad.json" Running `/home/ryo/.cargo/bin/rustup run stable-x86_64-unknown-linux-gnu cargo check --message-format json -p 'bundle-proconio:0.1.0' --bin bundle-proconio` Checking bundle-proconio v0.1.0 (/home/ryo/src/local/bundle-proconio) Finished dev [unoptimized + debuginfo] target(s) in 0.44s Spawning `/home/ryo/.cache/cargo-equip/rust-analyzer-2021-03-29 proc-macro` Readied `#[derive_readable]` Readied `#[fastout]` Bundling the code warning: found `crate` paths. replacing them with `crate::proconio` Reading the license file of `lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)` Reading the license file of `proconio 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)` Checking cargo-equip-check-output-fs0en4z4r1d3gd3e v0.1.0 (/tmp/cargo-equip-check-output-fs0en4z4r1d3gd3e) Finished dev [unoptimized + debuginfo] target(s) in 0.19s ❯ stat -c %s ./bundled.rs 18024
-
Supports
#[cfg(..)] extern crate ..;
items.Now you can bundle lazy_static.
❯ cat >./src/main.rs <<EOF heredoc> #[macro_use] heredoc> extern crate lazy_static as _; heredoc> heredoc> fn main() { heredoc> println!("{}", *N); heredoc> } heredoc> heredoc> lazy_static! { heredoc> static ref N: u32 = 42; heredoc> } heredoc> EOF ❯ cargo equip \ > --resolve-cfgs \ > --check \ > --remove docs \ > --minify libs \ > --rustfmt \ > -o ./bundled.rs Running `/home/ryo/.cargo/bin/rustup run nightly cargo udeps --output json -p bundle-proconio --bin bundle-proconio` Checking bundle-proconio v0.1.0 (/home/ryo/src/local/bundle-proconio) Finished dev [unoptimized + debuginfo] target(s) in 0.43s info: Loading save analysis from "/home/ryo/src/local/bundle-proconio/target/debug/deps/save-analysis/bundle_proconio-65ed1cd2cb2d0758.json" Bundling the code Reading the license file of `lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)` Checking cargo-equip-check-output-7l11rus91rnoie88 v0.1.0 (/tmp/cargo-equip-check-output-7l11rus91rnoie88) Finished dev [unoptimized + debuginfo] target(s) in 0.45s ❯ stat -c %s ./bundled.rs 4353 ❯ rustc --edition 2018 -o /tmp/bundled ./bundled.rs && /tmp/bundled 42
-
Clones Git repositories if license files are not found in
manifest_dir
s.
- cargo-equip won't error for unresolved
extern crate
items.
-
Enabled using
aarch64
rust-analyzers. (#99) -
Enabled running for
example
targets. (#100)❯ cargo equip -h | head -n 9 | tail -5 USAGE: cargo equip [OPTIONS] cargo equip [OPTIONS] --src <PATH> cargo equip [OPTIONS] --bin <NAME> cargo equip [OPTIONS] --example <NAME>
❯ cargo equip … --example atcoder-abc188-a
- Updated rust-analzyer to
2021-03-29
. (#99)
lib
/proc-macro
crates in the same packages will be included. (#100)
-
Changed the process order for
bin
crates. (#92)extern crate
items are replaced after procedural macros are expanded.let foo = /*foo!()*/{ /*extern crate foo as __foo ;*/ use crate::foo as __foo; __foo::Foo::new() };
-
Added
https://github.com/rust-lang/crates.io-index#proconio:0.3.7
to--exclude-atcoder-crates
. (#97)
-
cargo-equip now expand procedural macros using
rust-analyzer(.exe)
.#[macro_use] extern crate memoise as _; #[macro_use] extern crate proconio_derive as _; #[fastout] fn main() { for i in 0..=100 { println!("{}", fib(i)); } } #[memoise(n <= 100)] fn fib(n: i64) -> i64 { if n == 0 || n == 1 { return n; } fib(n - 1) + fib(n - 2) }
↓
Output
//! # Procedural macros //! //! - `memoise 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)` licensed under `BSD-3-Clause` //! - `proconio-derive 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)` licensed under `MIT OR Apache-2.0` /*#[macro_use] extern crate memoise as _;*/ /*#[macro_use] extern crate proconio_derive as _;*/ /*#[fastout] fn main() { for i in 0..=100 { println!("{}", fib(i)); } }*/ fn main() { let __proconio_stdout = ::std::io::stdout(); let mut __proconio_stdout = ::std::io::BufWriter::new(__proconio_stdout.lock()); #[allow(unused_macros)] macro_rules ! print { ($ ($ tt : tt) *) => { { use std :: io :: Write as _ ; :: std :: write ! (__proconio_stdout , $ ($ tt) *) . unwrap () ; } } ; } #[allow(unused_macros)] macro_rules ! println { ($ ($ tt : tt) *) => { { use std :: io :: Write as _ ; :: std :: writeln ! (__proconio_stdout , $ ($ tt) *) . unwrap () ; } } ; } let __proconio_res = { for i in 0..=100 { println!("{}", fib(i)); } }; <::std::io::BufWriter<::std::io::StdoutLock> as ::std::io::Write>::flush( &mut __proconio_stdout, ) .unwrap(); return __proconio_res; } /*#[memoise(n <= 100)] fn fib(n: i64) -> i64 { if n == 0 || n == 1 { return n; } fib(n - 1) + fib(n - 2) }*/ thread_local ! (static FIB : std :: cell :: RefCell < Vec < Option < i64 > > > = std :: cell :: RefCell :: new (vec ! [None ; 101usize])); fn fib_reset() { FIB.with(|cache| { let mut r = cache.borrow_mut(); for r in r.iter_mut() { *r = None } }); } fn fib(n: i64) -> i64 { if let Some(ret) = FIB.with(|cache| { let mut bm = cache.borrow_mut(); bm[(n) as usize].clone() }) { return ret; } let ret: i64 = (|| { if n == 0 || n == 1 { return n; } fib(n - 1) + fib(n - 2) })(); FIB.with(|cache| { let mut bm = cache.borrow_mut(); bm[(n) as usize] = Some(ret.clone()); }); ret } // The following code was expanded by `cargo-equip`. #[allow(clippy::deprecated_cfg_attr)]#[cfg_attr(rustfmt,rustfmt::skip)]#[allow(unused)]pub mod memoise{} #[allow(clippy::deprecated_cfg_attr)]#[cfg_attr(rustfmt,rustfmt::skip)]#[allow(unused)]pub mod proconio_derive{}
watt
crate no longer necessary.rust-analyzer(.exe)
is automatically downloaded.proc-macro
crates need to be compile with Rust 1.47.0+. If version of the active toolchain is less than 1.47.0, cargo-equip finds an alternative toolchain and uses it for compilingproc-macro
s.- procedural macros re-exported with
pub use $name::*;
are also able to be expanded.
-
Enabled handling non-
Meta
attribute macros such as#[memoise(n <= 100)]
. -
Fixed a problem where
extern crate
items in abin
crate are not removed properly.
- Fixed inability to
cargo install cargo-equip
without--locked
. (#79)
-
Enabled expanding procedural macros. (#76)
The
proc_macro
crates need to use watt and havepackage.metadata
like this.[package.metadata.cargo-equip.watt.proc-macro] input = "$OUT_DIR/macros_impl.wasm" [package.metadata.cargo-equip.watt.proc-macro-attribute] fastout = "$OUT_DIR/macros_impl.wasm"
[dependencies] qryxip-competitive-fastout = { git = "https://github.com/qryxip/competitive-programming-library" }
#[macro_use] extern crate fastout as _; #[fastout] fn main() { for i in 0..10 { println!("{}", i); } }
-
Changed the format of
"# Bundled libraries"
. (#77)//! # Bundled libraries //! //! - `ac-library-rs-parted-internal-math 0.1.0 (git+https://github.com/qryxip/ac-library-rs-parted#0b35cf2fd575eaf8ace84340722d6cefb7e82d14)` licensed under `CC0-1.0` as `crate::__ac_library_rs_parted_internal_math_0_1_0` //! - `ac-library-rs-parted-modint 0.1.0 (git+https://github.com/qryxip/ac-library-rs-parted#0b35cf2fd575eaf8ace84340722d6cefb7e82d14)` licensed under `CC0-1.0` as `crate::acl_modint` //! - `local 0.0.0 (path+██████████████████████████████████████████████████)` published in **missing** licensed under `CC0-1.0` as `crate::local` //! - `qryxip-competitive-input 0.0.0 (git+https://github.com/qryxip/competitive-programming-library#0d98777f6af8d6174419bf9b9a202c7f023d6857)` licensed under `CC0-1.0` as `crate::input` //! - `qryxip-competitive-tonelli-shanks 0.0.0 (git+https://github.com/qryxip/competitive-programming-library#0d98777f6af8d6174419bf9b9a202c7f023d6857)` licensed under `CC0-1.0` as `crate::tonelli_shanks` //! - `qryxip-competitive-xorshift 0.0.0 (git+https://github.com/qryxip/competitive-programming-library#0d98777f6af8d6174419bf9b9a202c7f023d6857)` licensed under `CC0-1.0` as `crate::__qryxip_competitive_xorshift_0_0_0` //! //! # Procedural macros //! //! - `qryxip-competitive-fastout 0.0.0 (git+https://github.com/qryxip/competitive-programming-library#0d98777f6af8d6174419bf9b9a202c7f023d6857)` licensed under `CC0-1.0`
-
Changed the format of
"# Bundled libraries"
. (#72)//! - `ac-library-rs-parted-internal-math 0.1.0 (git+https://github.com/qryxip/ac-library-rs-parted#3fc14c009609d8f0a3db8332493dafe457c3460f)` as `crate::__ac_library_rs_parted_internal_math_0_1_0` (license: `CC0-1.0`, repository: https://github.com/qryxip/ac-library-rs-parted) //! - `ac-library-rs-parted-modint 0.1.0 (git+https://github.com/qryxip/ac-library-rs-parted#3fc14c009609d8f0a3db8332493dafe457c3460f)` as `crate::acl_modint` (license: `CC0-1.0`, repository: https://github.com/qryxip/ac-library-rs-parted) //! - `maplit 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)` as `crate::maplit` (license: `MIT/Apache-2.0`, repository: https://github.com/bluss/maplit) //! - `qryxips-competitive-programming-library-buffered-print 0.0.0 (path+█████████████████████████████████████████████████████████████████████████████████████)` as `crate::buffered_print` (license: `CC0-1.0`, repository: https://github.com/qryxip/oj-verify-playground) //! - `qryxips-competitive-programming-library-input 0.0.0 (path+████████████████████████████████████████████████████████████████████████████)` as `crate::input` (license: `CC0-1.0`, repository: https://github.com/qryxip/oj-verify-playground) //! - `qryxips-competitive-programming-library-tonelli-shanks 0.0.0 (path+███████████████████████████████████████████████████████████████████████████████████████)` as `crate::tonelli_shanks` (license: `CC0-1.0`, repository: https://github.com/qryxip/oj-verify-playground) //! - `qryxips-competitive-programming-library-xorshift 0.0.0 (path+████████████████████████████████████████████████████████████████████████████)` as `crate::__qryxips_competitive_programming_library_xorshift_0_0_0` (license: `CC0-1.0`, repository: https://github.com/qryxip/oj-verify-playground)
-
Added
--exclude-atcoder-crates
,--exclude-codingame-crates
, and--exclude <SPEC>...
options. (#68)--exclude <SPEC>... Exclude library crates from bundling --exclude-atcoder-crates Alias for `--exclude https://github.com/rust-lang/crates.io-index#alga:0.9.3 ..` --exclude-codingame-crates Alias for `--exclude https://github.com/rust-lang/crates.io-index#chrono:0.4.9 ..`
-
Changed format of the "# Bundled libraries". (#64)
//! # Bundled libraries //! //! - `ac-library-rs-parted-internal-math v0.1.0` → `crate::__ac_library_rs_parted_internal_math_0_1_0` (source: `git+https://github.com/qryxip/ac-library-rs-parted#3fc14c009609d8f0a3db8332493dafe457c3460f`, license: `CC0-1.0`) //! - `ac-library-rs-parted-modint v0.1.0` → `crate::acl_modint` (source: `git+https://github.com/qryxip/ac-library-rs-parted#3fc14c009609d8f0a3db8332493dafe457c3460f`, license: `CC0-1.0`) //! - `input v0.0.0` → `crate::input` (source: `git+https://github.com/qryxip/oj-verify-playground#63ddefa84d96b16cdb7f85e70dcdc4f283f57391`, license: `CC0-1.0`) //! - `output v0.0.0` → `crate::output` (source: `git+https://github.com/qryxip/oj-verify-playground#63ddefa84d96b16cdb7f85e70dcdc4f283f57391`, license: `CC0-1.0`) //! - `tonelli_shanks v0.0.0` → `crate::tonelli_shanks` (source: `git+https://github.com/qryxip/oj-verify-playground#63ddefa84d96b16cdb7f85e70dcdc4f283f57391`, license: `CC0-1.0`) //! - `xorshift v0.0.0` → `crate::__xorshift_0_0_0` (source: `git+https://github.com/qryxip/oj-verify-playground#63ddefa84d96b16cdb7f85e70dcdc4f283f57391`, license: `CC0-1.0`)
-
Now cargo-equip adds "License and copyright notices" to the output when you are using other people's libraries. (#64, #68)
//! # License and Copyright Notices //! //! - `maplit 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)` //! //! ```text //! Copyright (c) 2015 //! //! Permission is hereby granted, free of charge, to any //! person obtaining a copy of this software and associated //! documentation files (the "Software"), to deal in the //! Software without restriction, including without //! limitation the rights to use, copy, modify, merge, //! publish, distribute, sublicense, and/or sell copies of //! the Software, and to permit persons to whom the Software //! is furnished to do so, subject to the following //! conditions: //! //! The above copyright notice and this permission notice //! shall be included in all copies or substantial portions //! of the Software. //! //! THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF //! ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED //! TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A //! PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT //! SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY //! CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION //! OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR //! IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER //! DEALINGS IN THE SOFTWARE. //! ```
Currently, only
CC0-1.0
,Unlicense
,MIT
andApache-2.0
are supported. -
Now cargo-equip considers platform specific dependencies. (#66)
-
The 39 crate available on AtCoder are no longer automatically excluded from bundling. (#68)
Enable
--exlude-atcoder-crates
to exclude them.note: attempted to bundle with the following crate(s), which are available on AtCoder. to exclude them from bundling, run with `--exclude-atcoder-crates` - `im-rc 14.3.0 (registry+https://github.com/rust-lang/crates.io-index)` - `rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)`
-
extern crate {core, alloc, std};
will be just ignored. (#67) -
Replaced
-p <libraries>...
forcargo check
with--bin <binary>
when obtaining$OUT_DIR
s. (#69)Previously,
cargo check
sometimes failed.
-
cargo-equip now creates "pseudo extern prelude" in each library. (#60)
Unless you use AIZU ONLINE JUDGE or yukicoder, you no longer need to declare
extern crate
in libraries.+mod __pseudo_extern_prelude { + pub(super) use crate::{another_lib1, another_lib2}; +} +use self::__pseudo_extern_prelude::*; + use another_lib1::A; use another_lib2::B;
-
Declaring
extern crate .. as ..
in a root module will produce a warning. (#58)To make your libraries compatible with Rust 2015, create a sub module and declare in it.
mod extern_crates { pub(super) extern crate __another_lib as another_lib; } use self::extern_crates::another_lib::foo::Foo;
-
Changed
#[allow(dead_code)]
to#[allow(unused)]
. (#60)unused
is a group ofdead-code
,unused-imports
, and so on.-#[allow(dead_code)] +#[allow(unused)] mod my_lib { // ... }
-
Now libraries are expanded as
pub mod
. (#58)#[allow(unused)] -mod my_lib { +pub mod my_lib { // ... }
-
Now you can skip the processes except
--check
. (#48)#![cfg_attr(cargo_equip, cargo_equip::skip)]
-
Enabled expanding code generated in
custom-build
. (#49)::core::include!(::core::concat!(::core::env!("OUT_DIR", "/generated.rs")));
Now you can use qryxip/ac-library-rs-parted with cargo-equip.
- Fixed the problem where cargo-equip did not treat
proc-macro
crate as libraries. (#50)
-
Now it gives pseudo
extern_crate_name
s like"__internal_lib_0_1_0"
to dependencies of dependencies. (#43)You no longer need to include all of the libraries in
[dependencies]
. -
Supports
extern crate $name as $rename
inbin
s. (#41)extern crate foo as foo_;
-
Now it correctly processes outputs of cargo-udeps. (#43)
The names are
name_in_toml
s. Previously they were treated asextern_crate_name
s.
-
cargo-equip no longer consider modules. (#41)
Split your library into separate small crates.
. ├── input │ ├── Cargo.lock │ ├── Cargo.toml │ └── src │ └── lib.rs ├── output │ ├── Cargo.lock │ ├── Cargo.toml │ └── src │ └── lib.rs ⋮
-
Stopped erasing non
mod
items just below eachlib
crates. (#41) -
Now cargo-equip inserts
pub use crate::{ exported_macros }
just below eachmod lib_name
. -
Stopped excluding
$ crate :: ident !
parts inmacro_rules!
. (#41) -
Now processes
#[macro_use] extern crate $name as _;
inbin
s. (#41)// in main source code #[macro_use] extern crate input as _;
↓
// in main source code /*#[macro_use] extern crate input as _;*/
-
#![cfg_attr(cargo_equip, cargo_equip::equip)]
no longer requried. (#41)-#![cfg_attr(cargo_equip, cargo_equip::equip)]
-
#![cfg_attr(cargo_equip, cargo_equip::use_another_lib)]
no longer requried. (#41)-#[cfg_attr(cargo_equip, cargo_equip::use_another_lib)] extern crate __another_lib as another_lib;
-
#![cfg_attr(cargo_equip, cargo_equip::translate_dolalr_crates)]
no longer requried. (#41)-#[cfg_attr(cargo_equip, cargo_equip::translate_dollar_crates)] #[macro_export] macro_rules! foo { .. }
-
Added
--resolve-cfgs
option. (#35)This option removes:
#[cfg(always_true_condition)]
(e.g.cfg(feature = "enabled-feature")
)- Items with
#[cfg(always_false_condition)]
(e.g.cfg(test)
,cfg(feature = "disable-feature")
)
-
Removed
--remove test-items
option. (#35)Use
--resolve-cfgs
instead.
-
Fixed the minification function. (#33)
Previously,
x < -y
was converted intox<-y
.
- Improved the minification function. (#31)
- Now cargo-equip replaces
crate
path prefixes in library code withcrate::extern_crate_name_in_main_crate
. (#29)
-
Changed the process of bundling. (#27)
Now cargo-equip "expands" each
mod
s inlib.rs
, remove unused ones, then minify the code bylib
. -
#[cfg_attr(cargo_equip, cargo_equip::equip)]
now targets root modules instead ofuse
statements. (#27)All of the
use
statements in the crate root that start with::
are expanded.#![cfg_attr(cargo_equip, cargo_equip::equip)] use ::__foo::{a::A, b::B}; use ::__bar::{c::C, d::D};
-
Renamed
--minify mods
to--minify libs
. (#27)
-
Enabled writing
package.metadata.cargo-equip.module-dependencies
also in libraries. (#25)They are merged into one graph.
[package.metadata.cargo-equip.module-dependencies] "crate::a" = [] "crate::b" = ["crate::b"] "crate::c" = ["::__another_lib::d"] "::__another_lib::d" = ["::__another_lib::e"]
-
Now cargo-equip supports libraries that depend on each other. (#23)
Statements like this will be converted to
use crate::..;
.#[cfg_attr(cargo_equip, cargo_equip::use_another_lib)] extern crate __another_lib as another_lib;
-
Each library will be expanded in
mod
. (#23)More constraints were introduced. See README-ja for more details.
#[allow(dead_code)] pub mod __lib { pub mod a {} pub mod b {} pub mod c {} }
-
cargo-equip will use
[package.metadata.cargo-equip.module-dependencies]
in the main crate. (#23)Package metadata in libraries is no longer read.
And the format was also changed.
[package.metadata.cargo-equip.module-dependencies] "::__atcoder::convolution" = ["::__atcoder::internal_bit", "::__atcoder::modint"] "::__atcoder::internal_bit" = [] "::__atcoder::internal_math" = [] "::__atcoder::internal_queue" = [] "::__atcoder::internal_scc" = [] "::__atcoder::internal_type_traits" = [] "::__atcoder::lazysegtree" = ["::__atcoder::internal_bit", "::__atcoder::segtree"] "::__atcoder::math" = ["::__atcoder::internal_math"] "::__atcoder::maxflow" = ["::__atcoder::internal_type_traits", "::__atcoder::internal_queue"] "::__atcoder::mincostflow" = ["::__atcoder::internal_type_traits"] "::__atcoder::modint" = ["::__atcoder::internal_math"] "::__atcoder::scc" = ["::__atcoder::internal_scc"] "::__atcoder::segtree" = ["::__atcoder::internal_bit", "::__atcoder::internal_type_traits"] "::__atcoder::twosat" = ["::__atcoder::internal_scc"]
-
Renamed
--oneline
option to--minify
.--oneline
remains as an alias for--minify
. (#21)With
--minify
option, cargo-equip removes spaces as much as possible.#[allow(clippy::deprecated_cfg_attr)]#[cfg_attr(rustfmt,rustfmt::skip)]pub mod factorial{pub fn factorial(n:u64)->u64{match n{0=>1,n=>n*factorial(n-1),}}}
- Fixed the problem where
--remove comments
ruined code that contains tuple types. (#19)
--remove
option now works for code that contains non-ASCII characters. (#16)
-
Added
--remove
option. (#13)Now you can remove
- Items with
#[cfg(test)]
- Doc comments (
//! ..
,/// ..
,/** .. */
,#[doc = ".."]
) - Comments (
// ..
,/* .. */
)
from the output.
pub mod a { //! A. /// A. pub struct A; // aaaaa #[cfg(test)] mod tests { #[test] fn it_works() { assert_eq!(2 + 2, 4); } } }
↓
pub mod a { pub struct A; }
- Items with
-
Enabled bundling multiple libraries.
#[cfg_attr(cargo_equip, cargo_equip::equip)] use ::{ __lib1::{a::A, b::B, c::C}, __lib2::{d::D, e::E, f::F}, };
-
cargo_equip_marker
is no longer required.#[cfg_attr(cargo_equip, cargo_equip::equip)] use ::__my_lib::{a::A, b::B, c::C};
- Appends the
"# Bundled libralies"
section to existing doc comment. - Changed the format of
"# Bundled libralies"
.
- Now it includes the used module list in the output.
--check
option will work with{ path = ".." }
dependencies.