Releases: qryxip/cargo-equip
v0.13.0
v0.12.2
Changed
v0.12.1
Fixed
-
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
v0.12.0
Added
-
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.
Changed
- cargo-equip won't error for unresolved
extern crate
items.
v0.11.1
Added
-
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
Changed
- Updated rust-analzyer to
2021-03-29
. (#99)
Fixed
lib
/proc-macro
crates in the same packages will be included. (#100)
v0.11.0
Changed
-
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)
v0.10.0
Changed
-
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.
Fixed
-
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.
v0.9.3
v0.9.2
Release v0.9.2
v0.9.1
Release v0.9.1