OpenGrok: Searching through the Haiku code online

Sometimes it can be helpful to quickly search specific functions or constants in a large codebase.
Say I see B_DARKEN_1_TINT somewhere and want to see where it’s defined,so I can pick the right inverse tint for dark mode.
I think that was my first time I stumpled upon OpenGrok,which I found really helpful.
Unfortunately the longstanding OpenGrok instance on https://xref.landonf.org that’s mentioned in the developer docs has been offline for quite some weeks now and I’m not sure if it will ever come back.
As alternative, https://grok.dragonflybsd.org was recommended to me in the chat,which seems to work currently but also had multiple days long outages when I tried to work with it,leading me to do a slow local search in my cloned repository.

To fill the gap and offer a way to efficiently search the Haiku source again,I’ve put up my own OpenGrok instance dedicated to Haiku-related projects.
:arrow_right: https://grok.nikisoft.one
It currently has the following repositories:

Maybe it will help you with your Haiku-related development :wink:
Feel free to suggest additional repositories that you need and let me know if anything doesn’t work as it should.

14 Likes

Can it be queried via a REST API? I wonder if it makes sense to create an extension for Genio.

2 Likes

Yes,it has a REST API,see the API documentation here: https://opengrok.docs.apiary.io/
An example to search for B_PANEL_TEXT_COLOR in the haiku repository: https://grok.nikisoft.one/opengrok/api/v1/search?full=B_PANEL_TEXT_COLOR&project=haiku

1 Like

Very good, thank you!

Maybe HaikuArchives? It shows much of the Haiku API and how it’s used in many 3rd party apps.

That’s generally a good idea,but you can’t git clone a whole organization but only single repositories.
HaikuArchives currently has 382 repositories.
I can add the most important ones if you tell me which.

Impossible! :slight_smile:

@nipos, are you committed to keep that service up for the foreseeable future?

@admins , shall we replace the ‘Landonf’ link at the bottom of Development | Haiku Project ?

Yes, I plan to keep that online for the foreseeable future.
Additionally I plan to add daily auto-updating from the latest Git repos, for now that’s still done manually.

I think @pulkomandy also has a service like this running.

But in any case, no objection from my side to replace that link, either with a set of new links or just one.

If you had told me about that instance earlier,I could have saved some headache on setting mine up :rofl:
I searched hours for another OpenGrok instance that has the Haiku repository and found nothing.
Well,now it’s up and running and maybe it not too bad to have a alternative if one server goes down.

I still cannot find @PulkoMandy 's OpenGrok instance… :slight_smile:

Once someone reveals the URL, I’ll update the dev-page of the website with both.

The site seems quite fast. I think I’ll use it, or make my own.

Sadly no dark mode though. : /

(also for haikuwebkit, any way to switch branch to the webkit2 one? am i blind? : /)

I just learnt by reading this topic that I have one…

Unless someone hacked into my server and set it up there, I don’t think that instance exist. I experimented with Woboq, but I don’t regularly keep it up to date. Now that compile_commands.json export is available in jam, it is considerably easier to use local tools like sourcetrail: GitHub - CoatiSoftware/Sourcetrail: Sourcetrail - free and open-source interactive source explorer

but I know the sourcecode well enough that usually I get around with a few git grep operations, and don’t really bother with more complicated tools.

OK. I made the change to nipos’ OpenGrok.
Thanks!

1 Like

Dark mode should be available and somewhat working now.
I merged Opengrok Dark Theme CSS · GitHub into the default CSS file inside of a @media(prefers-color-scheme: dark) block and fixed up the most obvious white areas.
It’s not perfect,but should be good enough until a official dark mode theme from OpenGrok is available.

For switching branches,I don’t think that’s possible on OpenGrok as it heavily relies on the checked-out work directory on the server,which is set to the default branch for each repository.

@nipos can you please host latest versions of following two repositories :
linux kernel (6.6.x preferred)
uboot

I’m only interested in hosting Haiku-related repositories,but the DragonflyBSD OpenGrok instance already has Linux: linux - OpenGrok cross reference for /linux/

1 Like

Yes I noticed linux there, but uboot is not hosted there or anywhere else on the internet. At least I could not find.
If you can consider hosting just uboot, that would be highly appreciated. uboot is a good reference for Haiku community as well.

I don’t really see a connection between Haiku and Uboot,but the Uboot repository isn’t that big and my server has enough free resources,so I decided to add it anyway.
I cloned the Uboot repository to the server.
It should get added to OpenGrok automatically when the next daily refresh task runs.

iirc uboot is used for the riscV port.

1 Like