I configured a couple of gulp tasks for my own projects, which parse an addons.json file and clone the listed addons to my project dependent local addons. Then checkout the specified commit.
This way I can have different versions of the same addon and working simultanously on multiple projects, whitout having conflicts. This also makes the setup much easier for collaborators.
I am planning to port this to oF, removing the glup dependency and implementing some npm like functions to remove and add addons to the config file, or install addons globally.
Should we have a public register and using just addon ids, instead of just working with absolute urls? Can such a service be integrated in ofxaddons?
Do you guys have similar tools and scripts or how would you approach this? Would this be even useful for others?
Which is the preferred data format? JSON, xml or using the already existing addons.make.
I would like to know your opinions on this.
I think a package manager similar to npm with a project specific list of dependencies is a great idea and I can’t imagine it would be that difficult to implement. As you note this would also remedy the issue of having one global version of an addon shared across multiple projects which has been inconvenient for me as well in the past.
there was a discussion about this in the bug tracker.
it seems you can already place the addon anywhere, specify it in your addons.make and pg takes care of it.
That is how I am planning to use this.
I was talking about how to clone dependencies. The projects include a list of addons and their current commit and the dependency manager clones the addons and checkout the right version. This is common practise in web development and saves so much time and troubles.
@firmread I put it the gulp version on github.
If someone wants to give it a try, I just added a search and install task.
Is there to way to simplify the call? Having to type the path is quite inconvenient. Maybe environment variables?
gulp --cwd /path/to/your/openFrameworks/scripts/gulpOFPackageManager search --query ofxHttp
Before porting this, does anyone have suggestions for other useful tasks?
Hey @thomasgeissl sorry it took me a while to finally get to try it!
here are some feedbacks as a user :
So from what I tried so far, it seems that you focused on managing
local_addons folder. I just wish that this potentially could be something that manage the main OF
addons folder itself. Which I prefer over
local_addons unless I need to make a project specific modification to the addon. I think it make sense to default the tool to the main
addons folder and only do
local_addons when asked specifically.
I prefer having
local_addons folder on one upper level from the app folder. Instead having it along side
bin folder. Since I usually have a few apps in the same project that shares the same addon groups together in the same folder, and I think it would be more efficient to share it throughout local projects.
definitely a long syntax you’re having there! I think there should be a way to set OF folder only once just like how the XCode plugin used to locate the addons.
Ideally I would love to see these functionalities implemented to the projectGenerator. So we could have one centralized tool. Had to admit though that I had no clue what’s going on inside but I imagine this could works as something I can call like:
projectGenerator -a checkout
(it also seems that environment variable of OF folder is mentioned there in PG repo also)
- I truly wish we could combine
addons.make since both seems to do something super similar at this point. And hopefully when it generate or update project, it would also get the right addons ready at the right place. (Although I’m not totally sure yet on how in details.)
Hope this feedback is any helpful. Thank you so much for making this!
Thanks for your feedback. It definitely helps.
For now I am going to keep the default destination and add a destination argument, so you can clone them to your global addons directory or any other directoy. Maybe I could also just store the oF path in the gulpfile or the ofPackage.json file and just pass a flag for global installation.
I will soon finish the save task, which generates the ofPackage.json file based on whats inside your local_addons directory. And I will add an interactive mode as a default task. So you can just call it by typing:
gulp --cwd /path/to/your/openFrameworks/scripts/gulpOFPackageManager
I thought about adding a generate task, which calls the projectGenerator and create your project files.
There will be changes in the ofPackage.json file.
I will add some meta data about the project, oF location, local_addons, addons. Maybe having different local_addons groups with a destination property. I will think about it.
I just see this gulp version as a quick and dirty prototype, the syntax and the call will be clearer once this is ported to c++. Maybe later it can be adapted and merged into the projectGenerator, if people find it useful.
Let me know if you have any further ideas.
I started porting this to an oF based app.
So far I added the following tasks:
- config package manager (globally):
ofPackageManager config [-g]
- init a package (addon, app, …):
- search for a package:
ofPackageManager search midi
- install a package as dependency:
ofPackageManager install ofxMidi && ofPackageManager install --github kylemcdonald/ofxCv && ofPackageManager install --url https://github.com/bakercp/ofxIO.git
- add manually installed package as dependency:
ofPackageManager add local_addons/ofxAddon
- install package (clone dependencies):
git clone packageUrl && cd package && ofPackageManager install
- check for updates:
- update the packages database:
The software uses a git repo as a database. It contains a json file for each package with urls, keywords, package type, …
I am just not sure which package types make sense. It would be nice to filter by type or category.
Any suggestions for this?
I am fighting a little to get the git part working, but the rest works fine so far.
I try to put it on github next week. So people can test it.
Another thing I would like to add is support for makefiles, as they are already there. So even non packagified addons would work. But I don’t see how I would specify the commit/tag of a dependency.
I would like to see something like this.
ADDON_DEPENDENCIES = ofxSSLManager@1.0.0 ofxIO@123456789 ofxMediaType ofxTaskQueue ofxNetworkUtils
Let me know your ideas.
In case someone wants to give it a try, I put it on github: https://github.com/thomasgeissl/ofPackageManager
There are still lot of bugs to fix and features to implement.
Edit: The current version wont work on windows.