Generate default instance list on build
Added a script that will download a list of instances from https://the-federation.info/platform/73 using the GraphQL API, then write it to a file containing a constant.
Currently it'll get the top 10 instances with the most monthly users, but it can easily be changed to e.g. all instances with more than X monthly users instead. The script is called on every build but maybe it'd be better to only call it on release builds, not sure how to detect that though.
The script is written in Bash and thus will only work on Linux systems (it also requires jq and curl), so when building on other platforms a dummy instance list will be emitted.
Also migrated all Gradle build scripts to Kotlin, so fixes #6.
I really like this idea, but I would prefer it be done in a cross-platform manner rather than requiring shell scripts whose dependencies aren't explicitly documented.
Jerboa shouldn't be dependent on running a script to pull a list from a website it doesn't control.
On second thought, this would violate reproducible builds by default. Maybe instead, this could be a Gradle task that is run that updates the file, and then that file is committed to the repo. It would then be done before performing a release.
Sure, it can just make it a separate task instead. I could write it in a Kotlin script, but AFAIK it would mean that the build.gradle file must be converted to Kotlin, and the code would get pretty ugly. Or maybe a python script instead?
A python script has the same problem as bash, unless gradle supports grabbing a python interpreter. There is another issue that suggests migrating the gradle build scripts to kotlin, I'd be in favor of that.
Yeah that's true, I'll write it in Kotlin then.
I've migrated the build.gradle file to Kotlin and also translated the fetch script into Kotlin. The script is in a separate file which makes it neater, but apparently you can't import libraries from other .kts files so I had to use the built-in APIs. This was a bit of a pain to figure out, but the result doesn't look too bad.
To run the task just do ./gradlew fetchInstances
Where should I add the info on how to fetch the instances to the README? Maybe we should add a CONTRIBUTING file.
You're right, this would make more sense in a CONTRIBUTING.md.
Could you create that, and add just that info? I can rework it and add a few things about how to debug and such once that's done.
You're right, this would make more sense in a
CONTRIBUTING.md.Could you create that, and add just that info? I can rework it and add a few things about how to debug and such once that's done.
Don't forget to add this info now that CONTRIBUTING.md has been merged
Obsoleted by #884