Code Monkey home page Code Monkey logo

cargo-simple-bundler's People

Contributors

kuretchi avatar qryxip avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

qryxip kagemeka

cargo-simple-bundler's Issues

"Inner macro"s should be handled

"Inner macros" are commonly used, even in the original input! by tanakh.

$ crate :: ident ! parts definitely mean the paths of macro_exported ones. they should be excluded.

#[macro_export]
macro_rules! foo {
    () => {
        $crate::foo_inner!()
    };
}

#[doc(hidden)]
#[macro_export]
macro_rules! foo_inner {
    () => {
        $crate::Foo
    };
}

pub struct Foo;
cargo simple-bundler --manifest-path ../lib/Cargo.toml -e ./src/main.rs
[WARN ] definition of `foo` not found in `crate`. treat as a dependency on the parent
mod lib {
#[macro_export]
macro_rules! foo {
    () => {
        $crate::lib::foo_inner!()
    };
}

#[doc(hidden)]
#[macro_export]
macro_rules! foo_inner {
    () => {
        $crate::lib::Foo
    };
}

pub struct Foo;
}

...Or we may insert pub crate::{ re_export_macros } in crate::lib.

//use lib::foo;

fn main() {
    let _ = foo!();
}

mod lib {
    #![allow(unused_imports)]

    pub(crate) use crate::{foo, foo_inner};

    #[macro_export]
    macro_rules! foo {
        () => {
            $crate::lib::foo_inner!()
        };
    }

    #[doc(hidden)]
    #[macro_export]
    macro_rules! foo_inner {
        () => {
            $crate::lib::Foo
        };
    }

    pub struct Foo;
}

Improve the interface

今までは「ライブラリクレートに対して実行し,必要なコードを抜粋する」コマンドだったのを,「(ライブラリに依存する) バイナリクレートに対して実行し,提出可能なコードを生成する」コマンドにしたい.

Before:

cargo simple-bundler --manifest-path /path/to/lib/one/Cargo.toml -e main.rs >one.rs
cargo simple-bundler --manifest-path /path/to/lib/two/Cargo.toml -e main.rs >two.rs
cat one.rs two.rs main.rs >bundled.rs

After:

cargo simple-bundler --crates one,two >bundled.rs

  • ライブラリ同士の依存関係を考えるか
    • 考えない場合はそれぞれのライブラリに対して今までの処理をしてくっつけるだけで済む
  • ライブラリのソースコードをどのように持ってくるか
    • path (や git) のみ対応 / cargo-clone などを使う
  • 「このライブラリについては依存関係の解析をスキップ」ができるようにする?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.