diff options
author | Alex Orlenko <zxteam@protonmail.com> | 2020-01-27 21:21:50 +0000 |
---|---|---|
committer | Alex Orlenko <zxteam@protonmail.com> | 2020-01-27 21:21:50 +0000 |
commit | d5bc9c8c24f220bc08701c8c8da10cb98ac4b291 (patch) | |
tree | 929335b5efe9e71da2721783d66afa9c1bd99c68 | |
parent | 5cd0b645c4997da63b1ad513aaab54523d8fcecc (diff) | |
download | mlua-d5bc9c8c24f220bc08701c8c8da10cb98ac4b291.zip |
Combine lua-vendored and luajit-vendored features into "vendored"
-rw-r--r-- | .github/workflows/main.yml | 43 | ||||
-rw-r--r-- | Cargo.toml | 5 | ||||
-rw-r--r-- | build/find_vendored.rs | 15 | ||||
-rw-r--r-- | build/main.rs | 13 |
4 files changed, 27 insertions, 49 deletions
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 9a29496..bb8b2cb 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -10,7 +10,6 @@ jobs: thing: - stable - macos-x86_64 - # - aarch64-linux - x86_64-msvc include: - thing: stable @@ -21,10 +20,6 @@ jobs: target: x86_64-apple-darwin rust: stable os: macos-latest - - thing: aarch64-linux - target: aarch64-unknown-linux-gnu - rust: stable - os: ubuntu-latest - thing: x86_64-msvc target: x86_64-pc-windows-msvc rust: stable-x86_64-msvc @@ -53,24 +48,20 @@ jobs: if: matrix.thing == 'aarch64-linux' shell: bash - run: rustup target add ${{ matrix.target }} - - name: Build (Lua 5.1/5.2/5.3 and LuaJIT vendored) + - name: Build (Lua 5.3/5.2/5.1 and LuaJIT vendored) run: | - for FEATURE in lua51 lua52 lua53; do + for FEATURE in lua53 lua52 lua51 luajit; do echo "Building $FEATURE" - cargo build --target ${{ matrix.target }} --release --no-default-features --features "$FEATURE lua-vendored" + cargo build --target ${{ matrix.target }} --release --no-default-features --features "$FEATURE vendored" done - echo "Building luajit" - cargo build --target ${{ matrix.target }} --release --no-default-features --features "luajit luajit-vendored" shell: bash - - name: Build (Lua 5.1/5.2/5.3 and LuaJIT via pkg-config) + - name: Build (Lua 5.3/5.2/5.1 and LuaJIT via pkg-config) if: matrix.os == 'ubuntu-latest' run: | - for FEATURE in lua51 lua52 lua53; do + for FEATURE in lua53 lua52 lua51 luajit; do echo "Building $FEATURE" cargo build --target ${{ matrix.target }} --release --no-default-features --features $FEATURE done - echo "Building luajit" - cargo build --target ${{ matrix.target }} --release --no-default-features --features luajit shell: bash test_linux: @@ -83,16 +74,16 @@ jobs: run: rustup update stable --no-self-update && rustup default stable shell: bash - name: Run tests (Lua 5.3 vendored) - run: cargo test --release --no-default-features --features "lua53 lua-vendored" + run: cargo test --release --no-default-features --features "lua53 vendored" shell: bash - name: Run tests (Lua 5.2 vendored) - run: cargo test --release --no-default-features --features "lua53 lua-vendored" + run: cargo test --release --no-default-features --features "lua52 vendored" shell: bash - name: Run tests (Lua 5.1 vendored) - run: cargo test --release --no-default-features --features "lua53 lua-vendored" + run: cargo test --release --no-default-features --features "lua51 vendored" shell: bash - name: Run tests (LuaJIT vendored) - run: cargo test --release --no-default-features --features "luajit luajit-vendored" + run: cargo test --release --no-default-features --features "luajit vendored" shell: bash test_macos: @@ -107,16 +98,16 @@ jobs: echo ::add-path::$HOME/.cargo/bin shell: bash - name: Run tests (Lua 5.3 vendored) - run: cargo test --release --no-default-features --features "lua53 lua-vendored" + run: cargo test --release --no-default-features --features "lua53 vendored" shell: bash - name: Run tests (Lua 5.2 vendored) - run: cargo test --release --no-default-features --features "lua53 lua-vendored" + run: cargo test --release --no-default-features --features "lua52 vendored" shell: bash - name: Run tests (Lua 5.1 vendored) - run: cargo test --release --no-default-features --features "lua53 lua-vendored" + run: cargo test --release --no-default-features --features "lua51 vendored" shell: bash - name: Run tests (LuaJIT vendored) - run: cargo test --release --no-default-features --features "luajit luajit-vendored" + run: cargo test --release --no-default-features --features "luajit vendored" shell: bash test_windows: @@ -129,16 +120,16 @@ jobs: run: rustup update stable --no-self-update && rustup default stable shell: bash - name: Run tests (Lua 5.3 vendored) - run: cargo test --release --no-default-features --features "lua53 lua-vendored" + run: cargo test --release --no-default-features --features "lua53 vendored" shell: bash - name: Run tests (Lua 5.2 vendored) - run: cargo test --release --no-default-features --features "lua53 lua-vendored" + run: cargo test --release --no-default-features --features "lua52 vendored" shell: bash - name: Run tests (Lua 5.1 vendored) - run: cargo test --release --no-default-features --features "lua53 lua-vendored" + run: cargo test --release --no-default-features --features "lua51 vendored" shell: bash - name: Run tests (LuaJIT vendored) - run: cargo test --release --no-default-features --features "luajit luajit-vendored" + run: cargo test --release --no-default-features --features "luajit vendored" shell: bash rustfmt: @@ -25,13 +25,12 @@ members = [ ] [features] -default = ["lua53", "lua-vendored"] +default = ["lua53"] lua53 = [] lua52 = [] lua51 = [] luajit = [] -lua-vendored = ["lua-src"] -luajit-vendored = ["luajit", "luajit-src"] +vendored = ["lua-src", "luajit-src"] [dependencies] num-traits = { version = "0.2.6" } diff --git a/build/find_vendored.rs b/build/find_vendored.rs index a1bb76a..92efe2e 100644 --- a/build/find_vendored.rs +++ b/build/find_vendored.rs @@ -1,23 +1,20 @@ use std::path::PathBuf; -#[cfg(feature = "lua-vendored")] +#[cfg(any(feature = "lua53", feature = "lua52", feature = "lua51"))] use lua_src; -#[cfg(feature = "luajit-vendored")] +#[cfg(feature = "luajit")] use luajit_src; pub fn probe_lua() -> PathBuf { - #[cfg(all(feature = "lua53", feature = "lua-vendored"))] + #[cfg(feature = "lua53")] let artifacts = lua_src::Build::new().build(lua_src::Lua53); - #[cfg(all(feature = "lua52", feature = "lua-vendored"))] + #[cfg(feature = "lua52")] let artifacts = lua_src::Build::new().build(lua_src::Lua52); - #[cfg(all(feature = "lua51", feature = "lua-vendored"))] + #[cfg(feature = "lua51")] let artifacts = lua_src::Build::new().build(lua_src::Lua51); - #[cfg(feature = "luajit-vendored")] + #[cfg(feature = "luajit")] let artifacts = luajit_src::Build::new().build(); - #[cfg(all(feature = "luajit", feature = "lua-vendored"))] - let artifacts = lua_src::Build::new().build(lua_src::Lua51); // Invalid case! Workaround to get panic - artifacts.print_cargo_metadata(); artifacts.include_dir().to_owned() } diff --git a/build/main.rs b/build/main.rs index 851063e..b43d0ed 100644 --- a/build/main.rs +++ b/build/main.rs @@ -5,14 +5,8 @@ use std::io::{Error, ErrorKind, Result}; use std::path::{Path, PathBuf}; use std::process::Command; -#[cfg_attr( - any(feature = "lua-vendored", feature = "luajit-vendored"), - path = "find_vendored.rs" -)] -#[cfg_attr( - not(any(feature = "lua-vendored", feature = "luajit-vendored")), - path = "find_normal.rs" -)] +#[cfg_attr(feature = "vendored", path = "find_vendored.rs")] +#[cfg_attr(not(feature = "vendored"), path = "find_normal.rs")] mod find; trait CommandExt { @@ -87,9 +81,6 @@ fn main() { #[cfg(all(feature = "lua51", feature = "luajit"))] panic!("You can enable only one of the features: lua53, lua52, lua51, luajit"); - #[cfg(all(feature = "lua-vendored", feature = "luajit"))] - panic!("You cannot mix lua-vendored and luajit features"); - let include_dir = find::probe_lua(); build_glue(&include_dir); } |