Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

buildRustCrate: add support for renaming crates #68296

Merged
merged 1 commit into from
Sep 10, 2019

Commits on Sep 8, 2019

  1. buildRustCrate: add support for renaming crates

    Before this change, buildRustCrate always called rustc with
    
    --extern libName=[...]libName[...]
    
    However, Cargo permits using a different name under which a dependency
    is known to a crate. For example, rand 0.7.0 uses:
    
    [dependencies]
    getrandom_package = { version = "0.1.1", package = "getrandom", optional = true }
    
    Which introduces the getrandom dependency such that it is known as
    getrandom_package to the rand crate. In this case, the correct extern
    flag is of the form
    
    --extern getrandom_package=[...]getrandom[...]
    
    which is currently not supported. In order to support such cases, this
    change introduces a crateRenames argument to buildRustCrate. This
    argument is an attribute set of dependencies that should be renamed. In
    this case, crateRenames would be:
    
    {
      "getrandom" = "getrandom_package";
    }
    
    The extern options are then built such that if the libName occurs as
    an attribute in this set, it value will be used as the local
    name. Otherwise libName will be used as before.
    danieldk committed Sep 8, 2019
    Configuration menu
    Copy the full SHA
    85c6d72 View commit details
    Browse the repository at this point in the history