Skip to content

ci: fix pipeline #320

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

Merged
merged 1 commit into from
Oct 20, 2024
Merged
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
15 changes: 7 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,27 +64,26 @@ jobs:
- name: Cache LLVM and Clang
id: cache-llvm
uses: actions/cache@v3
if: "!contains(matrix.os, 'windows')"
# Macos build doesn't work with clang < 18. As a build for version 18 is not available, we skip the setup
if: "!contains(matrix.os, 'windows') && !contains(matrix.os, 'macos')"
with:
path: ${{ runner.temp }}/llvm-${{ matrix.clang }}
key: ${{ matrix.os }}-llvm-${{ matrix.clang }}
- name: Setup LLVM & Clang
id: clang
uses: KyleMayes/install-llvm-action@v1
if: "!contains(matrix.os, 'windows')"
uses: KyleMayes/install-llvm-action@v2
# Macos build doesn't work with clang < 18. As a build for version 18 is not available, we skip the setup
if: "!contains(matrix.os, 'windows') && !contains(matrix.os, 'macos')"
with:
version: ${{ matrix.clang }}
directory: ${{ runner.temp }}/llvm-${{ matrix.clang }}
cached: ${{ steps.cache-llvm.outputs.cache-hit }}
- name: Configure Clang
if: "!contains(matrix.os, 'windows')"
# Macos build doesn't work with clang < 18. As a build for version 18 is not available, we skip the setup
if: "!contains(matrix.os, 'windows') && !contains(matrix.os, 'macos')"
run: |
echo "LIBCLANG_PATH=${{ runner.temp }}/llvm-${{ matrix.clang }}/lib" >> $GITHUB_ENV
echo "LLVM_VERSION=${{ steps.clang.outputs.version }}" >> $GITHUB_ENV
echo "LLVM_CONFIG_PATH=${{ runner.temp }}/llvm-${{ matrix.clang }}/bin/llvm-config" >> $GITHUB_ENV
- name: Configure Clang (macOS only)
if: "contains(matrix.os, 'macos')"
run: echo "SDKROOT=$(xcrun --show-sdk-path)" >> $GITHUB_ENV
# Build
- name: Build
env:
Expand Down
1 change: 1 addition & 0 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ fn check_php_version(info: &PHPInfo) -> Result<()> {

const PHP_83_API_VER: u32 = 20230831;

println!("cargo::rustc-check-cfg=cfg(php80, php81, php82, php83, php_zts, php_debug, docs)");
println!("cargo:rustc-cfg=php80");

if (PHP_81_API_VER..PHP_82_API_VER).contains(&version) {
Expand Down
1 change: 1 addition & 0 deletions crates/cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@ impl Remove {
.read(true)
.write(true)
.create(true)
.truncate(false)
.open(php_ini)
.with_context(|| "Failed to open `php.ini`")?;

Expand Down
15 changes: 3 additions & 12 deletions crates/macros/src/method.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,6 @@ pub enum Arg {
Typed(function::Arg),
}

#[derive(Debug)]
pub struct AttrArgs {
pub defaults: HashMap<String, Lit>,
pub optional: Option<String>,
pub visibility: Visibility,
}

#[derive(Debug, Clone)]
pub struct Method {
/// Method name
Expand All @@ -51,7 +44,7 @@ pub struct ParsedMethod {

#[derive(Debug, Clone, Copy)]
pub enum MethodType {
Receiver { mutable: bool },
Receiver,
ReceiverClassObject,
Static,
}
Expand Down Expand Up @@ -176,7 +169,7 @@ pub fn parser(
}
} else {
let this = match method_type {
MethodType::Receiver { .. } => quote! { this. },
MethodType::Receiver => quote! { this. },
MethodType::ReceiverClassObject | MethodType::Static => quote! { Self:: },
};

Expand Down Expand Up @@ -309,9 +302,7 @@ fn build_args(
if receiver.reference.is_none() {
bail!("`self` parameter must be a reference.");
}
Ok(Arg::Receiver(MethodType::Receiver {
mutable: receiver.mutability.is_some(),
}))
Ok(Arg::Receiver(MethodType::Receiver))
}
FnArg::Typed(ty) => {
let mut this = false;
Expand Down
4 changes: 2 additions & 2 deletions src/builders/class.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,8 @@ impl ClassBuilder {
///
/// * `T` - The type which will override the Zend object. Must implement
/// [`RegisteredClass`]
/// which can be derived using the [`php_class`](crate::php_class) attribute
/// macro.
/// which can be derived using the [`php_class`](crate::php_class) attribute
/// macro.
///
/// # Panics
///
Expand Down
6 changes: 6 additions & 0 deletions src/class.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,12 @@ impl<T> ClassMetadata<T> {
}
}

impl<T> Default for ClassMetadata<T> {
fn default() -> Self {
Self::new()
}
}

impl<T: RegisteredClass> ClassMetadata<T> {
/// Returns an immutable reference to the object handlers contained inside
/// the class metadata.
Expand Down
16 changes: 8 additions & 8 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ pub use ext_php_rs_derive::php_extern;
///
/// - Most primitive integers ([`i8`], [`i16`], [`i32`], [`i64`], [`u8`],
/// [`u16`], [`u32`], [`u64`],
/// [`usize`], [`isize`])
/// [`usize`], [`isize`])
/// - Double-precision floating point numbers ([`f64`])
/// - [`bool`]
/// - [`String`]
Expand All @@ -164,9 +164,9 @@ pub use ext_php_rs_derive::php_extern;
/// values.
/// - [`Option<T>`] where `T: FromZval`. When used as a parameter, the parameter
/// will be
/// deemed nullable, and will contain [`None`] when `null` is passed. When used
/// as a return type, if [`None`] is returned the [`Zval`] will be set to null.
/// Optional parameters *must* be of the type [`Option<T>`].
/// deemed nullable, and will contain [`None`] when `null` is passed. When used
/// as a return type, if [`None`] is returned the [`Zval`] will be set to null.
/// Optional parameters *must* be of the type [`Option<T>`].
///
/// Additionally, you are able to return a variant of [`Result<T, E>`]. `T` must
/// implement [`IntoZval`] and `E` must implement `Into<PhpException>`. If an
Expand Down Expand Up @@ -324,14 +324,14 @@ pub use ext_php_rs_derive::php_function;
///
/// - `#[defaults(key = value, ...)]` for setting defaults of method variables,
/// similar to the
/// function macro. Arguments with defaults need to be optional.
/// function macro. Arguments with defaults need to be optional.
/// - `#[optional(key)]` for setting `key` as an optional argument (and
/// therefore the rest of the
/// arguments).
/// arguments).
/// - `#[public]`, `#[protected]` and `#[private]` for setting the visibility of
/// the method,
/// defaulting to public. The Rust visibility has no effect on the PHP
/// visibility.
/// defaulting to public. The Rust visibility has no effect on the PHP
/// visibility.
///
/// Methods can take a immutable or a mutable reference to `self`, but cannot
/// consume `self`. They can also take no reference to `self` which indicates a
Expand Down
1 change: 0 additions & 1 deletion src/types/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ use std::{
ffi::CString,
fmt::{Debug, Display},
iter::FromIterator,
u64,
};

use crate::{
Expand Down
4 changes: 2 additions & 2 deletions tests/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ pub fn get_module(module: ModuleBuilder) -> ModuleBuilder {
#[cfg(test)]
mod integration {
use std::env;
use std::path::PathBuf;

use std::process::Command;
use std::sync::Once;

Expand All @@ -139,7 +139,7 @@ mod integration {

pub fn run_php(file: &str) -> bool {
setup();
let mut path = PathBuf::from(env::current_dir().expect("Could not get cwd"));
let mut path = env::current_dir().expect("Could not get cwd");
path.pop();
path.push("target");
path.push("debug");
Expand Down
Loading