Just for curiosity, how hard is it to make a langu...
# general
a
Just for curiosity, how hard is it to make a language plugin? And is there a recent "guide" or something like that into what is necessary to do so?
Specifically, I'm looking into PHP and Laravel, they represent 50%+ of my codebase, we were getting away with git submodules, but we started running into diamond dependencies frequently enough that this became a problem that I'm trying to solve.
I don't mind building/contributing it myself, I just need something as a guide/north besides the new plugin doc that I can use as a reference
w
the best recommendation would be to look at what's existing in the main repo and base off that. However, I'd likely start with a separate set of questions. How are you using Pants + PHP together? What interactions do you need? What workflows are you looking to make happen? I view aa full language plugin more like an optimization, rather than a requirement
a
Currently I want to manage a central composer and composer-like packages (i.e internal and vendor ones), imports and lockfiles and generate autoloads for such, for PHP itself. For Laravel, I need to run laravel commands like migrate and tests
Added to that, I need to link react frontend dist folders (i.e /public on Laravel), and run laravel wayfinder to generate the typescript routes from controllers.
I'm not currently using Pants for PHP, I'm in the process of migrating our Go and Python packages into it, and figured it would be great for our legacy (not really legacy, they are actively mantained) projects too
✅ 1
w
Ah, gotcha. So, one option is always the language plugin - but another is adhoc_tool if you just need something that has some in/out dependencies and kicks off tasks
gets some percentage of benefit, with minimal effort
a
I will probably start with the adhoc_tool to kickstart stuff
w
👍 There are some examples in the docs and example repos, I also have a sveltekit example here from some years ago https://gist.github.com/sureshjoshi/98fb09f2a340f7c1dad270c4887865a0
a
Thanks!
You mind if I open a discussion of the PHP backend though?
w
sure
gratitude thank you 1
There are also different ways to handle this sorta thing. My personal preference is to delegate to the appropriate tooling as much as possible, and keep Pants for routing, caching, bootstrapping, versioning, etc. So, start by keeping the language shim as thin as possible - and pull in more as necessary. I'm being vague, because I've used PHP like once, 15 years ago - thus, no clue
a
Probably php itself (and its multiple extensions), composer, and estabilished supporting libs like phpunit and pest can probably complete all features to start with?
I will work on a proposal on discussion
Created it: https://github.com/pantsbuild/pants/discussions/23173 Do keep in mind that english is not actually my main language, so I asked AI (Grammarly) to fix mistakes (I did a pass on it too), if anything sounds wrong please let me know and I will fix it.
❤️ 2