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

Experiment with version ranges, -Zminimal-versions #79

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 81 additions & 10 deletions .github/workflows/libloading.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
name: Test libloading
name: libloading

on:
push:
paths-ignore:
- '*.mkd'
- 'LICENSE'
branches:
- master
pull_request:
types: [opened, repoened, synchronize]

Expand All @@ -19,6 +21,8 @@ jobs:
timeout-minutes: 20
steps:
- uses: actions/checkout@v2
- name: Set cfg(ci)
run: echo "RUSTFLAGS=--cfg ci" >> $GITHUB_ENV
- name: Install Rust ${{ matrix.rust_toolchain }}
uses: actions-rs/toolchain@v1
with:
Expand Down Expand Up @@ -58,6 +62,18 @@ jobs:
env:
RUSTDOCFLAGS: --cfg docsrs
if: ${{ matrix.rust_toolchain == 'nightly' }}
- name: Update Minimal Versions
uses: actions-rs/cargo@v1
with:
command: update
args: --manifest-path=Cargo.toml -Zminimal-versions -Zunstable-options
if: ${{ matrix.rust_toolchain == 'nightly' }}
- name: Test Minimal Versions
uses: actions-rs/cargo@v1
with:
command: test
args: --manifest-path=Cargo.toml -Zminimal-versions -Zunstable-options -- --nocapture
if: ${{ matrix.rust_toolchain == 'nightly' }}

windows-gnu-test:
runs-on: windows-latest
Expand All @@ -70,6 +86,8 @@ jobs:
- i686-pc-windows-gnu
steps:
- uses: actions/checkout@v2
- name: Set cfg(ci)
run: echo "RUSTFLAGS=--cfg ci" >> $GITHUB_ENV
- name: Add MSYS2 to the PATH
run: echo "c:/msys64/bin" | Out-File -FilePath $env:GITHUB_PATH -Append
- name: Add 32-bit mingw-w64 to the PATH
Expand All @@ -78,7 +96,7 @@ jobs:
- name: Add 64-bit mingw-w64 to the PATH
run: echo "c:/msys64/mingw64/bin" | Out-File -FilePath $env:GITHUB_PATH -Append
if: startsWith(matrix.rust_target, 'x86_64')
- name: Set TARGET variable
- name: Set $TARGET
run: echo "TARGET=${{ matrix.rust_target}}" | Out-File -FilePath $env:GITHUB_ENV -Append
- name: Install Rust nightly
uses: actions-rs/toolchain@v1
Expand All @@ -87,32 +105,59 @@ jobs:
target: ${{ matrix.rust_target }}
profile: minimal
default: true
- uses: actions-rs/cargo@v1
- name: Update
uses: actions-rs/cargo@v1
with:
command: build
args: --target ${{ matrix.rust_target }} --manifest-path=Cargo.toml
command: update
args: --manifest-path=Cargo.toml
- uses: actions-rs/cargo@v1
with:
command: test
args: --target ${{ matrix.rust_target }} --manifest-path=Cargo.toml
- name: Update Minimal Versions
uses: actions-rs/cargo@v1
with:
command: update
args: --manifest-path=Cargo.toml -Zminimal-versions -Zunstable-options
if: ${{ matrix.rust_toolchain == 'nightly' }}
- name: Test Minimal Versions
uses: actions-rs/cargo@v1
with:
command: test
args: --target ${{ matrix.rust_target }} --manifest-path=Cargo.toml -Zminimal-versions -Zunstable-options -- --nocapture
if: ${{ matrix.rust_toolchain == 'nightly' }}

bare-cross-build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
rust_target:
# BSDs: could be tested with full system emulation
# - x86_64-unknown-dragonfly
# - x86_64-unknown-freebsd
- aarch64-unknown-linux-gnu
- arm-unknown-linux-gnueabihf
- mips64-unknown-linux-gnuabi64
- mips-unknown-linux-gnu
- powerpc64le-unknown-linux-gnu
- powerpc64-unknown-linux-gnu
- powerpc-unknown-linux-gnu
- riscv64gc-unknown-linux-gnu
- s390x-unknown-linux-gnu
- sparc64-unknown-linux-gnu
- sparcv9-sun-solaris
- x86_64-fuchsia
- x86_64-unknown-dragonfly
- x86_64-unknown-freebsd
- x86_64-unknown-haiku
# - x86_64-unknown-netbsd
- x86_64-unknown-netbsd
- x86_64-unknown-openbsd
- x86_64-unknown-redox
- x86_64-fuchsia
timeout-minutes: 20
steps:
- uses: actions/checkout@v2
- name: Set cfg(ci)
run: echo "RUSTFLAGS=--cfg ci" >> $GITHUB_ENV
- name: Set $TARGET
run: echo "TARGET=${{ matrix.rust_target}}" >> $GITHUB_ENV
- name: Install Rust nightly
uses: actions-rs/toolchain@v1
with:
Expand All @@ -132,6 +177,16 @@ jobs:
with:
command: build
args: --target ${{ matrix.rust_target }} --manifest-path=Cargo.toml -Zbuild-std
- name: Update Minimal Versions
uses: actions-rs/cargo@v1
with:
command: update
args: --manifest-path=Cargo.toml -Zminimal-versions -Zunstable-options
- name: Build Minimal Versions
uses: actions-rs/cargo@v1
with:
command: build
args: --manifest-path=Cargo.toml -Zminimal-versions -Zunstable-options

cross-ios-build:
runs-on: macos-latest
Expand All @@ -145,6 +200,10 @@ jobs:
timeout-minutes: 20
steps:
- uses: actions/checkout@v2
- name: Set cfg(ci)
run: echo "RUSTFLAGS=--cfg ci" >> $GITHUB_ENV
- name: Set $TARGET
run: echo "TARGET=${{ matrix.rust_target}}" >> $GITHUB_ENV
- name: Install Rust ${{ matrix.rust_toolchain }}
uses: actions-rs/toolchain@v1
with:
Expand All @@ -162,3 +221,15 @@ jobs:
with:
command: build
args: --target=${{ matrix.rust_target }} --manifest-path=Cargo.toml
- name: Update Minimal Versions
uses: actions-rs/cargo@v1
with:
command: update
args: --manifest-path=Cargo.toml -Zminimal-versions -Zunstable-options
if: ${{ matrix.rust_toolchain == 'nightly' }}
- name: Build Minimal Versions
uses: actions-rs/cargo@v1
with:
command: build
args: --target=${{ matrix.rust_target }} --manifest-path=Cargo.toml -Zminimal-versions -Zunstable-options
if: ${{ matrix.rust_toolchain == 'nightly' }}
11 changes: 6 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,20 @@ keywords = ["dlopen", "load", "shared", "dylib"]
categories = ["api-bindings"]

[target.'cfg(windows)'.dependencies.winapi]
version = "0.3"
version = ">=0.3.0, <0.4"
features = [
"winerror",
"errhandlingapi",
"libloaderapi",
]

[target.'cfg(unix)'.dependencies.cfg-if]
version = "1"
version = ">=0.1.10, <2"

[dev-dependencies]
libc = "0.2"
static_assertions = "1.1"
# We make some more rigorous checks in CI
[target.'cfg(ci)'.dependencies]
libc = ">=0.2.7, <0.3"
static_assertions = ">=1.0.0, <2"

[package.metadata.docs.rs]
all-features = true
Expand Down
1 change: 1 addition & 0 deletions src/changelog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

// TODO: for the next breaking release rename `Error::LoadLibraryW` to `Error::LoadLibraryExW`.
// TODO: for the next breaking release use `RTLD_LAZY | RTLD_LOCAL` by default on unix.
// TODO: for the next breaking release build the changelog module for cfg(docsrs) only

/// Release 0.6.5 (2020-10-23)
///
Expand Down
12 changes: 12 additions & 0 deletions src/os/unix/consts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,18 @@ mod posix {
}
}

#[cfg(ci)]
mod verify_consts {
extern crate static_assertions;
extern crate libc;
use self::static_assertions::*;

const_assert_eq!(super::RTLD_LOCAL, libc::RTLD_LOCAL);
const_assert_eq!(super::RTLD_GLOBAL, libc::RTLD_GLOBAL);
const_assert_eq!(super::RTLD_NOW, libc::RTLD_NOW);
const_assert_eq!(super::RTLD_LAZY, libc::RTLD_LAZY);
}

// Other constants that exist but are not bound because they are platform-specific (non-posix)
// extensions. Some of these constants are only relevant to `dlsym` or `dlmopen` calls.
//
Expand Down
13 changes: 0 additions & 13 deletions tests/constants.rs

This file was deleted.

1 change: 1 addition & 0 deletions tests/functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ fn make_helpers() {
} else {
eprintln!("WARNING: $TARGET NOT SPECIFIED! BUILDING HELPER MODULE FOR NATIVE TARGET.");
}
eprintln!("Building helper: {:?}", cmd);
assert!(cmd
.status()
.expect("could not compile the test helpers!")
Expand Down