Skip to content

Commit

Permalink
Minimize the scope of the native_lib feature
Browse files Browse the repository at this point in the history
  • Loading branch information
elinorbgr authored and vberger committed Feb 17, 2019
1 parent 747a286 commit 9f92f61
Show file tree
Hide file tree
Showing 32 changed files with 590 additions and 2,740 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

- Minimize the scope of the `native_lib` features. The code generated by `wayland-scanner` is
now independent of this feature, making `wayland-protocols` also independent of it, and
avoiding it to pollute dependency trees in non-trivial ways.

# 0.22.2 -- 2019-02-16

- [protocols] Update `wlr-protocols` (`data-control` version 2).
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ calloop = "0.4.2"
members = [ "wayland-sys", "wayland-scanner", "wayland-client", "wayland-server", "wayland-protocols", "wayland-commons" ]

[features]
native_lib = ["wayland-client/dlopen", "wayland-server/dlopen", "wayland-protocols/native_lib", "wayland-commons/native_lib", "wayland-sys"]
native_lib = [ "wayland-client/dlopen", "wayland-server/dlopen", "wayland-sys" ]

# Manual list of the tests, required because some need `harness = false`

Expand Down
83 changes: 0 additions & 83 deletions tests/<

This file was deleted.

48 changes: 8 additions & 40 deletions tests/scanner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,8 @@ use wayland_scanner::Side;

const PROTOCOL: &'static str = include_str!("./scanner_assets/protocol.xml");

const C_INTERFACES_TARGET: &'static str = include_str!("./scanner_assets/c_interfaces.rs");
const CLIENT_C_CODE_TARGET: &'static str = include_str!("./scanner_assets/client_c_code.rs");
const SERVER_C_CODE_TARGET: &'static str = include_str!("./scanner_assets/server_c_code.rs");
const CLIENT_RUST_CODE_TARGET: &'static str = include_str!("./scanner_assets/client_rust_code.rs");
const SERVER_RUST_CODE_TARGET: &'static str = include_str!("./scanner_assets/server_rust_code.rs");
const CLIENT_CODE_TARGET: &'static str = include_str!("./scanner_assets/client_code.rs");
const SERVER_CODE_TARGET: &'static str = include_str!("./scanner_assets/server_code.rs");

fn print_diff(diffs: &[Difference]) {
println!("Partial diffs found:");
Expand Down Expand Up @@ -113,44 +110,15 @@ fn run_codegen_test(generated_file_path: &Path, expected_output: &str) {
}

#[test]
fn c_interfaces_generation() {
fn client_code_generation() {
let mut tempfile = tempfile::NamedTempFile::new().unwrap();
wayland_scanner::generate_c_interfaces_streams(Cursor::new(PROTOCOL.as_bytes()), &mut tempfile);
run_codegen_test(tempfile.path(), C_INTERFACES_TARGET);
wayland_scanner::generate_code_streams(Cursor::new(PROTOCOL.as_bytes()), &mut tempfile, Side::Client);
run_codegen_test(tempfile.path(), CLIENT_CODE_TARGET);
}

#[test]
fn client_c_code_generation() {
fn server_code_generation() {
let mut tempfile = tempfile::NamedTempFile::new().unwrap();
wayland_scanner::generate_c_code_streams(Cursor::new(PROTOCOL.as_bytes()), &mut tempfile, Side::Client);
run_codegen_test(tempfile.path(), CLIENT_C_CODE_TARGET);
}

#[test]
fn server_c_code_generation() {
let mut tempfile = tempfile::NamedTempFile::new().unwrap();
wayland_scanner::generate_c_code_streams(Cursor::new(PROTOCOL.as_bytes()), &mut tempfile, Side::Server);
run_codegen_test(tempfile.path(), SERVER_C_CODE_TARGET);
}

#[test]
fn client_rust_code_generation() {
let mut tempfile = tempfile::NamedTempFile::new().unwrap();
wayland_scanner::generate_rust_code_streams(
Cursor::new(PROTOCOL.as_bytes()),
&mut tempfile,
Side::Client,
);
run_codegen_test(tempfile.path(), CLIENT_RUST_CODE_TARGET);
}

#[test]
fn server_rust_code_generation() {
let mut tempfile = tempfile::NamedTempFile::new().unwrap();
wayland_scanner::generate_rust_code_streams(
Cursor::new(PROTOCOL.as_bytes()),
&mut tempfile,
Side::Server,
);
run_codegen_test(tempfile.path(), SERVER_RUST_CODE_TARGET);
wayland_scanner::generate_code_streams(Cursor::new(PROTOCOL.as_bytes()), &mut tempfile, Side::Server);
run_codegen_test(tempfile.path(), SERVER_CODE_TARGET);
}
110 changes: 0 additions & 110 deletions tests/scanner_assets/c_interfaces.rs

This file was deleted.

Loading

0 comments on commit 9f92f61

Please sign in to comment.