Can a build script take arguments?

前端 未结 1 354
生来不讨喜
生来不讨喜 2020-12-21 16:12

I was going through the build script documentation and was wondering if I can pass any argument to the script in build.rs from the command line.



        
相关标签:
1条回答
  • 2020-12-21 16:23

    No.

    Documentation suggests passing data to the build script using environment variables.

    There is no documentation indicating that it can be done and the test suite does not test for it. It only tests for environment variables.

    I attempted the method that @Stephan suggests from Passing program arguments through Cargo, however cargo build does not follow the same behavior as cargo run:

    $ cargo build -- uoeuoe
    error: Found argument 'uoeuoe' which wasn't expected, or isn't valid in this context
    
    USAGE:
        cargo.exe build [OPTIONS]
    
    For more information try --help
    
    0 讨论(0)
提交回复
热议问题