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

Make publishing libthemis-src easier #419

Merged
merged 8 commits into from
Mar 11, 2019
Merged

Commits on Mar 7, 2019

  1. Whitelist libthemis-src crate files

    Remove unnecessary symlinks and whitelist the files which should go into
    libthemis-src crate. This ensures that we do not package anything extra.
    
    Unfortunately, it is still impossible to simply symlink the whole repo
    as libthemis-src/themis because Cargo is too smart. It sees a Cargo.toml
    in the repo root, thinks that this is some internal crate, and refuses
    to copy the whole "themis" subdirectory (despite that "include" list
    does not include themis/Cargo.toml). Well, maybe some day...
    ilammy committed Mar 7, 2019
    Configuration menu
    Copy the full SHA
    9e36304 View commit details
    Browse the repository at this point in the history
  2. Compile-time check for Themis source code

    Just make sure that Cargo got it right and really copied Themis source
    code into the package. It kinda likes to ignore symlinks on some systems
    so double-check that. (I have been burnt by this once and published
    a crate without Themis source code in it.)
    
    "cargo package" does not run unit-tests so make this check a part of the
    regular build. Try including a file into a dummy constant. If the file
    is missing you will get an error message like this when packaging:
    
           Compiling libthemis-src v0.0.3
        error: couldn't read src/../themis/Makefile: No such file or directory (os error 2)
          --> src/lib.rs:54:33
           |
        54 | const _THEMIS_MAKEFILE: &[u8] = include_bytes!("../themis/Makefile");
           |                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    
        error: aborting due to previous error
    
        error: failed to verify package tarball
    
        Caused by:
          Could not compile `libthemis-src`.
    
        To learn more, run the command again with --verbose.
    
    Rust constants are true compile-time constants so this does not
    introduce any run-time overhead, does not use additional storage, etc.
    ilammy committed Mar 7, 2019
    Configuration menu
    Copy the full SHA
    6075d88 View commit details
    Browse the repository at this point in the history
  3. Do not include submakefiles when building Rust

    We don't really need JNI, AFL, or Themis tests when building a vendored
    version of Themis from libthemis-src crate. Guard makefile inclusions
    with a CARGO variable defined by Cargo when building Rust code. It will
    be propagated into the make invocation.
    ilammy committed Mar 7, 2019
    Configuration menu
    Copy the full SHA
    dc60134 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    a99639d View commit details
    Browse the repository at this point in the history
  5. New Cargo.toml layout

    Actually, once we're here, reshuffle Cargo.toml files a bit in order to
    use standard file layout for Rust projects. Now the root Cargo.toml is
    a _virtual package_ which contains only a workspace. All Themis crates
    are now located in "src/wrappers/themis/rust" which is a bit easier to
    understand.
    
    This layout also allows us to avoid specifying all tests and examples
    explicitly. We use symlinks instead to keep the files at their expected
    locations.
    
    The root virtual package specifies only "themis" as a default member,
    meaning that commands like "cargo test" will affect "themis" by default.
    You'll need to specify other crates explicitly to act on them.
    ilammy committed Mar 7, 2019
    Configuration menu
    Copy the full SHA
    e00a210 View commit details
    Browse the repository at this point in the history

Commits on Mar 11, 2019

  1. Configuration menu
    Copy the full SHA
    1d28280 View commit details
    Browse the repository at this point in the history
  2. Separate crate for rust-themis integration tools

    New crate layout does not make it easy to build integration tools
    which previously were a part of examples, but now they are not.
    Instead of hacking around, just add a new binary crate for them
    which depends on "themis" and build them separately when we need
    to run integration tests.
    
    Stop (ab)using "cargo install" for separating test binaries. It seems
    that cargo install does not work for crates that are not available on
    crates.io (even if --path) is used. Therefore just "cargo build" the
    binaries and find them in the target directory. This should be good
    enough for testing tools.
    
    The new crate is a part of the workspace so it will be checked and
    tested by CI along with all other Rust code. It just does not have
    a particular version and is marked as non-publishable to prevent
    accidental pushing of it to crates.io
    ilammy committed Mar 11, 2019
    Configuration menu
    Copy the full SHA
    4bf67a0 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    340c81d View commit details
    Browse the repository at this point in the history