Skip to content

Upstream build.rs attempts to create a directory #342

Closed Answered by mkatychev
mkatychev asked this question in Q&A
Discussion options

You must be logged in to vote

Following the pattern in tikv/client-rust worked excellently.

I did write an additional macro that made it easier to deal with codegen that would add suffixes:

// src/gen.rs
// crate::gen;
macro_rules! gen_mod {
    ($package: ident) => {
        #[allow(clippy::all)]
        pub mod $package {
            include!(concat!(
                env!("OUT_DIR"),
                concat!("/", stringify!($package), ".rs")
            ));
        }
    };
    ($package: ident, $suffix: literal) => {
        #[allow(clippy::all)]
        pub mod $package {
            include!(concat!(
                env!("OUT_DIR"),
                concat!("/", stringify!($package), $suffix)
            ));
        }

Replies: 3 comments 8 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
8 replies
@mkatychev
Comment options

@ipetkov
Comment options

@mkatychev
Comment options

@ipetkov
Comment options

@mkatychev
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by mkatychev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants