Automatic cumulative usage script#82
Conversation
- Rename old usage generators to meta/old_* - Simplify meta/android-usage-generator.ps1, update for A16 - Add Unlicense and documentation to meta/android-usage-generator.ps1 - Update cumulative usage to January 2026
|
If we rewrite the script, it feels like for an Android based project, the most appropriate would be a Kotlin script... but I'll let @ebelinski decide. Few examples with networking and serialisation: https://github.com/search?q=repo%3ATWiStErRob%2FTWiStErRob-env+path%3Akts&type=code |
I'd be happy to rewrite it in whatever language is deemed appropriate, but Kotlin is not a scripting language, so we'd either need to keep the compiled binary (be that JVM bytecode or a native app via LLVM) in the repo for others to run, transpile to JS, or have contributors compile it with It just seems like that would be overcomplicating things versus an interpreted scripting language like Python, PowerShell, Lua etc. |
|
Kotlin is a scripting language..., can run it directly with: It can pull in Maven dependencies, so it's all totally familiar to Android devs. Anyway, let's see what the owner says. (Just as an extra thing that blew my mind, you can write GitHub Actions steps in Kotlin too: https://github.com/TWiStErRob/github-actions-test/blob/main/.github/workflows/scripting.yml#L8-L23) |
I've never seen Kotlin used that way - pretty neat. I was aware of the Actions support for arbitrary shells (and I use PowerShell more than I should) but again had no idea Kotlin has a command line interpreter built in! |
One very prominent use of Kotlin scripting is Gradle's syntax modernization for |
Adds a PowerShell script for automatically fetching usage data, calculating cumulative usage, and updating the homepage markdown.
The script will work with PowerShell 7 on any platform and Windows PowerShell. It defaults to using the previous month as the range end date, but can accept any month.
The script also updates the footnote with the data source month and update date.
Usage:
-JustPrintwill output cumulative usage to the console without modifying index.md-Month YYYY-MMallows a custom range end to be chosenThe hardcoded relative path to index.md and default month are intended to make it easier for others to run the script and for any future automation.