Commit Graph

204 Commits

Author SHA1 Message Date
Joe Hoyle
90cbbc0fca
Specify classes as fully-qualified names in stubs (#156)
* Specify classes as fully-qualified names in stubs

When stubs are generated, the type annotations don't use a loading `\`, which means they are interpreted as relative to the current namespace. That's wrong, as all types are relative to the root namespace.

* rustfmt
2022-10-01 11:23:27 +13:00
Tobias Bengtsson
73902ef017
Merge pull request #153 from joehoyle/add-name-function-macro
Add ability to set function name on php_function macro
2022-09-30 13:04:22 +02:00
Joe Hoyle
18ede97712 Add ability to set function name on php_function macro
This is much the same as `php_class(name="ABC")`
2022-09-30 12:01:35 +02:00
Tobias Bengtsson
199962ce3f
Merge pull request #151 from striezel-stash/gh-action-update
update actions/checkout in GitHub Actions workflows to v3
2022-09-28 23:04:44 +02:00
Tobias Bengtsson
0d8aec2a77
Merge pull request #159 from striezel-stash/run-clippy-only-on-stable
ci: run clippy only on stable Rust channel
2022-09-28 23:02:39 +02:00
Dirk Stolle
a13f2b99cc update actions/checkout in GitHub Actions workflows to v3 2022-09-28 22:11:20 +02:00
Dirk Stolle
ca5a7c21f7 ci: run clippy only on stable Rust channel
Sparked by the comments about nightly clippy breaking the build
too often (see <https://github.com/davidcole1340/ext-php-rs/pull/151#issuecomment-1261151479>),
this change will limit clippy to builds with a stable Rust
version only.
2022-09-28 22:08:10 +02:00
Tobias Bengtsson
81d1861a1d
Merge pull request #158 from striezel-stash/fix-clap-errors
Use arg instead of deprecated clap attribute
2022-09-28 22:01:28 +02:00
Dirk Stolle
7b238eede1 attempt to fix errors related to clap
This should fix the errors from the build at
<https://github.com/davidcole1340/ext-php-rs/actions/runs/3145521955/jobs/5112909446>:

       Compiling clap v4.0.0
    error: Unknown `#[clap(long)]` attribute (`#[arg(long)] exists)
      --> crates/cli/src/lib.rs:92:12
       |
    92 |     #[clap(long)]
       |            ^^^^

    error: Unknown `#[clap(long)]` attribute (`#[arg(long)] exists)
       --> crates/cli/src/lib.rs:115:12
        |
    115 |     #[clap(long)]
        |            ^^^^

    error: Unknown `#[clap(short)]` attribute (`#[arg(short)] exists)
       --> crates/cli/src/lib.rs:134:12
        |
    134 |     #[clap(short, long)]
        |            ^^^^^

    error: could not compile `cargo-php` due to 3 previous errors
    warning: build failed, waiting for other jobs to finish...
    Error: Process completed with exit code 101.

These errors were probably caused by the release of `clap` 4.0.0
a few hours ago.
2022-09-28 21:05:56 +02:00
Tobias Bengtsson
04dd0cc990
Merge pull request #157 from striezel-stash/clippy-strikes-again
fix more causes of clippy warnings
2022-09-28 18:21:08 +02:00
Dirk Stolle
ee45e8dc73 fix more causes of clippy warnings
Clippy linting had more errors:

    error: iterating on a map's values
    Error:   --> crates/macros/src/module.rs:56:36
       |
    56 |       let registered_classes_impls = state
       |  ____________________________________^
    57 | |         .classes
    58 | |         .iter()
    59 | |         .map(|(_, class)| generate_registered_class_impl(class))
       | |________________________________________________________________^
       |
       = note: `-D clippy::iter-kv-map` implied by `-D warnings`
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#iter_kv_map
    help: try
       |
    56 ~     let registered_classes_impls = state
    57 +         .classes.values().map(|class| generate_registered_class_impl(class))
       |

    error: iterating on a map's values
    Error:    --> crates/macros/src/module.rs:366:23
        |
    366 |         let classes = self.classes.iter().map(|(_, class)| class.describe());
        |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `self.classes.values().map(|class| class.describe())`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#iter_kv_map

    error: could not compile `ext-php-rs-derive` due to 2 previous errors
2022-09-28 12:34:12 +02:00
Tobias Bengtsson
9c5d172d28
Merge pull request #152 from striezel-stash/make-clippy-happy
fix causes of some clippy warnings
2022-09-28 11:45:03 +02:00
Dirk Stolle
b192841cfa fix causes of some clippy warnings
Clippy linting had some errors:

    error: boolean to int conversion using if
    Error:   --> src/builders/module.rs:59:29
       |
    59 |                 zend_debug: if PHP_DEBUG { 1 } else { 0 },
       |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with from: `u8::from(PHP_DEBUG)`
       |
       = note: `-D clippy::bool-to-int-with-if` implied by `-D warnings`
       = note: `PHP_DEBUG as u8` or `PHP_DEBUG.into()` can also be valid options
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bool_to_int_with_if

    error: boolean to int conversion using if
    Error:   --> src/builders/module.rs:60:22
       |
    60 |                 zts: if PHP_ZTS { 1 } else { 0 },
       |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with from: `u8::from(PHP_ZTS)`
       |
       = note: `PHP_ZTS as u8` or `PHP_ZTS.into()` can also be valid options
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bool_to_int_with_if

    error: could not compile `ext-php-rs` due to 2 previous errors

This commit tries to fix those.
2022-09-13 00:43:11 +02:00
Tobias Bengtsson
8f1cfece32
Merge pull request #150 from striezel-stash/fix-typos
Fix a few typos
2022-09-12 11:39:39 +02:00
Dirk Stolle
4bb0559ab8 Fix a few typos 2022-09-10 16:40:38 +02:00
Tobias Bengtsson
72f39df4fe
Merge pull request #148 from denzyldick/master
Fixed some typos
2022-08-27 21:32:26 +02:00
Tobias Bengtsson
c0a76e714b
Merge pull request #149 from denzyldick/404
404 /guide doesn't exists.
2022-08-27 21:31:21 +02:00
Denzyl Dick
5b001cc717 404 /guide doesn't exists. 2022-08-27 18:05:24 +02:00
Denzyl Dick
1e4044b423 Fixed some typos 2022-08-26 21:43:01 +02:00
Tobias Bengtsson
70f8badd27
Merge pull request #147 from TobiasBengtsson/master
Release 0.8.0
2022-08-14 12:25:51 +02:00
Tobias Bengtsson
fb9d0797cc Release 0.8.0 2022-08-14 11:50:42 +02:00
Tobias Bengtsson
a40483473b
Merge pull request #139 from TobiasBengtsson/master
Support for BinarySlice to avoid allocation
2022-08-13 18:51:29 +02:00
Tobias Bengtsson
976bc7d686 Fix clippy errors 2022-08-13 18:29:15 +02:00
Tobias Bengtsson
231b3005c4 Support for BinarySlice to avoid allocation 2022-07-10 11:24:27 +02:00
Tobias Bengtsson
b230928bed
Merge pull request #144 from ptondereau/chore/update-deps
Bump dependencies.
2022-06-17 10:14:43 +02:00
Pierre Tondereau
f6207e033c Update clap. 2022-06-16 10:25:04 +02:00
Pierre Tondereau
d1cb7cc114 Update dependancies. 2022-06-14 10:45:27 +02:00
Tobias Bengtsson
b1c32c4dc5
Merge pull request #142 from TobiasBengtsson/bindgen-version060
Switch back to using version for bindgen
2022-06-07 15:18:17 +02:00
Tobias Bengtsson
58a5e1bcd3 Switch back to using version for bindgen 2022-06-07 14:43:42 +02:00
Tobias Bengtsson
ccb81f0cd6
Merge pull request #143 from TobiasBengtsson/fix-clippy-useless-transmute
Fix clippy errors in nightly - useless transmute, useless ref-deref in Windows build
2022-06-07 14:42:57 +02:00
Tobias Bengtsson
993b79ed3f Fix clippy error in Windows build 2022-06-07 13:17:55 +02:00
Tobias Bengtsson
a110c1710c Fix clippy error in nightly - useless transmute 2022-06-07 12:22:23 +02:00
Tobias Bengtsson
b93571e377
Merge pull request #141 from TobiasBengtsson/fix-lifetime-clippy-ci
Fix clippy warning, unused lifetime parameter
2022-06-07 09:22:36 +02:00
Tobias Bengtsson
ab85298b37 Fix clippy warning, unused lifetime parameter 2022-05-30 16:14:32 +02:00
David Cole
faa452ecd1
Added tomlrs-php to examples 2022-03-31 01:52:46 +13:00
David Cole
664981f4fb
Windows support (#128)
* Preliminary Windows support

* Start work on cross-platform build script

* Fix compilation on macOS

* Updated README, tidied up build script

* Check linker version before starting compilation

It doesn't seem like it's possible to change the linker from within the
build script, however, we can retrieve the linker in use and give the
user a suggestion if the linker will not work.

* Switch to using Github repository for bindgen

* Split Windows and Unix implementations into two files

* Fix building on Windows

* Remove `reqwest` and `zip` as dependencies on Unix

* Fix guide tests on Windows

* Started work on Windows CI

* runs -> run

* Use preinstalled LLVM on Windows

* Debugging for Windows CI

* Switch to upstream `rust-bindgen` master branch

* Switch to `rust-lld` for Windows linking

* Don't compile `cargo-php` on Windows

* Switch to using skeptic for tests

* cargo-php: Disable stub generation, fix ext install/remove

The plan is to replace the stub generation by generating them with PHP
code. This is cross-platform and means we don't need to worry about ABI.
We also don't need to embed information into the library.

* cargo-php: Fix on unix OS

* Fix clippy lint

* Updated README

* Re-add CI for Unix + PHP 8.0

* Fix building on thread-safe PHP

* Tidy up build scripts

* Use dynamic lookup on Linux, test with TS Windows

* Define `ZTS` when compiling PHP ZTS

* Combine Windows and Unix CI, fix linking for Win32TS

* Fix exclusions in build CI

* rust-toolchain -> rust

* Set LLVM version

* Only build docs.rs on Ubuntu PHP 8.1

* Fix build on Linux thread-safe

* Update guide example
2022-03-18 16:36:51 +13:00
David Cole
7520720558 Release 0.7.4 2022-03-17 23:57:56 +13:00
David Cole
4468656563
Add ability to pass modifier function for classes (#127) 2022-03-08 15:01:16 +13:00
David Cole
75ea32346c
Fix CI on macOS (#126)
* Attempt to fix CI on macOS by not installing LLVM

* Download LLVM even on macOS

* Only set LIBCLANG_PATH on non-macOS

* Fix yaml

* Try to set SDK path for macOS

* Multi-line run

* Clippy lint

* Only check docs on PHP 8.1

* When running with docs stub, use PHP 8.1

* Only build docs on Ubuntu

* Remove `macos-ci` branch from actions

* Trigger actions
2022-03-06 16:01:27 +13:00
David Cole
a3fbc24aa3 Updated clap, closes #125 2022-03-05 13:03:39 +13:00
David Cole
9c8dd7cd05 Fix cargo-php 2022-02-25 12:37:36 +13:00
David Cole
8a1fecd431 Updated docs.rs bindings 2022-02-24 22:47:56 +13:00
David Cole
a9e1dad59f Add bindings for php_printf 2022-02-24 22:45:32 +13:00
David Cole
16c456de7d 'Fixed' lifetimes for array conversions
Not 100% sure why we were using higher-ranked trait bounds for this. It
doesn't really make sense to me all these months later.
2022-02-22 12:08:35 +13:00
David Cole
a776d3eaae Fix CI on macOS + docs stubs 2022-02-22 11:24:39 +13:00
David Cole
a09b8474bb Merge branch 'zval_shallow_clone' 2022-02-22 11:14:34 +13:00
Torsten Dittmann
32e2af0ba5
Merge pull request #119 from glyphpoch/fix_request_start_shutdown_funcs
Fix request_(startup|shutdown)_function in ModuleBuilder
2022-01-13 23:49:24 +01:00
Torsten Dittmann
08de883aed
Merge pull request #120 from TorstenDittmann/patch-1
readme: fix link to guide
2022-01-10 13:43:23 +01:00
Torsten Dittmann
2315fa6bc1
readme: fix link to guide 2021-12-30 14:29:59 +01:00
glyphpoch
cbc802fbf2 Fix request_(startup|shutdown)_function in ModuleBuilder
Request specific builder methods were assigning to the wrong fields,
overwriting the MINIT/MSHUTDOWN functions, instead of RINIT/RSHUTDOWN.
2021-12-27 22:03:34 +00:00