Can't create a package for a library

example to generate problem :

I have a library with following structure
.
├── Cargo.toml
├── build.rs
└── src
└── lib.rs

inside build.rs I use crate to generate some rust code to be used

    //build.rs
     tonic_build::configure()
            .build_client(true)
            .build_server(true)
            .compile(&["proto/test.proto"], &["proto/"])?;

    //and inside lib.rs I uses the generated code for example
    pub mod my_mod{

        include!(concat!(env!("OUT_DIR"), concat!("/", "test", ".rs")));

    //defined inside test.proto that used to generate test.rs 
    impl Color{
    }
    }

so when I run cargo build all things go well
but when I run cargo package I have compilation error that Color not found so how to force cargo to use build script inside build.rs

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.