Skip to content

Commit

Permalink
unrelated ci fix
Browse files Browse the repository at this point in the history
  • Loading branch information
BrettMayson committed Sep 12, 2024
1 parent b91a608 commit dbc5a6a
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 43 deletions.
21 changes: 0 additions & 21 deletions .github/workflows/codecov.yml

This file was deleted.

10 changes: 6 additions & 4 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,16 +87,18 @@ jobs:
uses: dtolnay/rust-toolchain@stable
with:
components: llvm-tools-preview
- name: cargo install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- uses: taiki-e/install-action@cargo-llvm-cov
- uses: taiki-e/install-action@nextest
- name: cargo generate-lockfile
if: hashFiles('Cargo.lock') == ''
uses: actions-rs/cargo@v1
with:
command: generate-lockfile
- name: cargo llvm-cov
run: cargo llvm-cov --locked --all-features --lcov --output-path lcov.info
run: cargo llvm-cov nextest --locked --all-features --lcov --output-path out.lcov
- name: Upload to codecov.io
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
files: out.lcov
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
3 changes: 0 additions & 3 deletions arma-rs-proc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,6 @@ pub fn arma(_attr: TokenStream, item: TokenStream) -> TokenStream {

static mut RV_EXTENSION: Option<Extension> = None;

#[no_mangle]
pub static RVExtensionFeatureFlags: u64 = arma_rs::flags::RV_CONTEXT_NO_DEFAULT_CALL;

#[cfg(all(target_os="windows", target_arch="x86"))]
arma_rs::link_args::windows! {
unsafe {
Expand Down
33 changes: 18 additions & 15 deletions arma-rs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ pub type State = state::TypeMap![Send + Sync];
/// Allows a console to be allocated for the extension.
static CONSOLE_ALLOCATED: std::sync::atomic::AtomicBool = std::sync::atomic::AtomicBool::new(false);

#[no_mangle]
/// Feature flags read on each callExtension call.
pub static RVExtensionFeatureFlags: u64 = flags::RV_CONTEXT_NO_DEFAULT_CALL;

/// Contains all the information about your extension
/// This is used by the generated code to interface with Arma
#[cfg(feature = "extension")]
Expand Down Expand Up @@ -365,42 +369,41 @@ impl ExtensionBuilder {
if module.is_null() {
panic!("GetModuleHandleW failed");
}
let function_name = CString::new("RVExtensionRequestContextProc").expect("CString::new failed");
let function_name =
CString::new("RVExtensionRequestContextProc").expect("CString::new failed");

let func_address = unsafe {
GetProcAddress(module_handle, function_name.as_ptr());
};

if func_address.is_null() {
panic!("Failed to get function address");
}

unsafe {
std::mem::transmute(func_address)
}
unsafe { std::mem::transmute(func_address) }
};

#[cfg(all(not(windows), not(debug_assertions)))]
let request_context = {
let c_name = std::ffi::CString::new("RVExtensionRequestContextProc").expect("CString::new failed");

let handle = unsafe { libc::dlopen(std::ptr::null_mut(), libc::RTLD_LAZY | libc::RTLD_NOLOAD) };

let c_name = std::ffi::CString::new("RVExtensionRequestContextProc")
.expect("CString::new failed");

let handle =
unsafe { libc::dlopen(std::ptr::null_mut(), libc::RTLD_LAZY | libc::RTLD_NOLOAD) };

if handle.is_null() {
panic!("Failed to open handle to current process");
}

let result = unsafe { libc::dlsym(handle, c_name.as_ptr()) };

unsafe { libc::dlclose(handle) };

if result.is_null() {
panic!("Failed to get function address");
}

unsafe {
std::mem::transmute::<*mut libc::c_void, unsafe extern "C" fn()>(result)
}
unsafe { std::mem::transmute::<*mut libc::c_void, unsafe extern "C" fn()>(result) }
};

#[cfg(debug_assertions)]
Expand Down

0 comments on commit dbc5a6a

Please sign in to comment.