-
-
Notifications
You must be signed in to change notification settings - Fork 284
Vendor mode in a custom project, with custom extensions #691
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
base: main
Are you sure you want to change the base?
Vendor mode in a custom project, with custom extensions #691
Conversation
I have a hard time understanding how this will lead to less maintenance than a fork. But if you'd like it for modularity reasons, I'll give it a shot locally over the next days. But since you've mentioned snowflake.so, using the glibc build and loading shared extendions is the absolutely easiest approach with zero maintenance on your part. |
I mainly aim these changes to use for extensions like snowflake and a extension we created ourself(compilation is similar to Snowflake). In case other people want to have their extensions available for the project without forking, this would be the easiest solution in stead of having a fork that can conflict on every commit pulling from upstream. So |
@DubbleClick I think the changes are ready, only to make it work in "vendor-mode" in the CI pipeline requires binary paths changes. Instead of |
I'll leave both of your PR's up to @crazywhalecc, he's the owner of the project and I don't see myself in a position to make decisions crucial to the project structure or workflow on my own. He'll be back from vacation soon! I really like the workflow PR though! |
@DubbleClick I don't have the need for the customize builder provider(yet). So I removed it for now. I wait for him to be back :) Hopefully he is refreshed after his holiday! Please feel free to point anything out of the ordinary, if you find any |
Unfortunately I ended my vacation a long time ago, but at the same time I was extremely busy at my day job.🥲 Don't worry though, I should have time to resolve remaining issues this week. |
Ah welcome back, I hope you had a good time. I'm really excited for the shared extensions, once it goes live we'll have full package support for frankenphp + frankenphp-xdebug and frankenphp-ffi in around a week. |
I'm not sure how much customization people will have for private extensions, but I think we should add skeleton commands once vendor mode is officially available. vendor/bin/spc dev:ext-skel myext
# And it will generate config, builder, add composer autoload if not exists, etc...
# BTW I also want it works in project mode, it will also save my time adding new extension. At the same time, for |
If private extensions are supported, perhaps an extension source of type=local is required? |
I will take over this PR after thinking carefully about the implementation of vendor mode. Once everything is ready, I am open to reviews from anyone. In the meantime, I have almost finished the commands to generate skeletons of extensions and libraries: #715, which also helps with vendor mode. |
I think we can start this now. The main work can be divided into several parts:
In addition, I think it may be possible to implement other binary builds in vendor mode. For example, we can reuse spc dependencies to build static python, static vim and other components. Maybe no one will need them, but it should be feasible. As for single-file build support I mentioned before, I feel like now is not the right time and might cause maintenance chaos instead. In the future, we can try to extend based on the current vendor model, and it may be better to use SPC as a base framework to develop. TLDR: For the current PR, I will make a small amount of modifications in the future to support the most basic vendor functions. After that, the vendor mode support of the skeleton command will be improved. |
Yes, this will actually also help quite a bit with spc-packages. I ended up rewriting a lot of sloppy logic to substitute behaviour already implemented in spc. Which is kind of fine for the scope the project has at the moment or that is planned, but I might do a proper rewrite with vendored spc mode once it exists. |
What does this PR do?
Minor changes for allowing to use the library in a custom project instead of forking and adjusting code within the "project base".
Thread of the question can be found in and also fix #687.
Added the following options to adjust:
BuilderProvider
after initializing.➜ poc-vendored-php-static-cli git:(main) tree --gitignore . ├── bin │ └── spc ├── composer.json ├── composer.lock ├── config │ ├── ext.json │ ├── lib.json │ └── source.json └── src ├── ConsoleApplication.php ├── MyCommand.php └── builder ├── extension │ └── snowflake.php ├── linux │ └── library │ └── snowflake.php ├── macos │ └── library │ └── snowflake.php └── unix └── library └── snowflake.php
Project example can be found here. In the example I have added
pdo_snowflake
extension, because I need it, and it gives a good example.Compling works, only the testing part fails at the moment due to PHP not using the
pdo_snowflake.so
file.Checklist before merging
*.php
, runcomposer cs-fix
at local machine.src/global/test-extensions.php
../docs/
.config/xxx.json
content, runbin/spc dev:sort-config xxx
.