feat: add support for GH codespaces (#25)

* feat: support for codespaces

Signed-off-by: Alex Yong <alexjyong@gmail.com>

* feat: allowing this to be ran in automated contexts

Signed-off-by: Alex Yong <alexjyong@gmail.com>

* chore: update devcontainer.json

Signed-off-by: Alex Yong <alexjyong@gmail.com>

* feat: Adding in dummy google services json file, and updating documentation

* fix: typo

* fix: adjust storage bucket

---------

Signed-off-by: Alex Yong <alexjyong@gmail.com>
This commit is contained in:
Alex Yong 2025-08-11 13:10:30 -04:00 committed by Infi
parent edefffabcd
commit adfaa04a71
4 changed files with 131 additions and 9 deletions

View File

@ -0,0 +1,23 @@
{
"image": "mcr.microsoft.com/devcontainers/universal:2",
"features": {
"ghcr.io/devcontainers-community/features/deno:1": {},
"ghcr.io/nordcominc/devcontainer-features/android-sdk:1": {
"extra_packages": "ndk;28.1.13356709"
},
"ghcr.io/devcontainers/features/java:1": {
"version": "21",
"jdkDistro": "oracle"
}
},
"postCreateCommand": "chmod +x gradlew && deno run -A scripts/download_deps.ts --yes && cp revoltbuild.properties.example revoltbuild.properties && cp sentry.properties.example sentry.properties && cp app/google-services.json.example app/google-services.json && git submodule update --init --recursive",
"customizations": {
"vscode": {
"extensions": [
"redhat.java",
"vscjava.vscode-java-pack",
"kotlin.kotlin"
]
}
}
}

View File

@ -0,0 +1,68 @@
{
"project_info": {
"project_number": "123456789012",
"project_id": "revolt-android-dev",
"storage_bucket": "revolt-chat.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:123456789012:android:abcdef1234567890",
"android_client_info": {
"package_name": "chat.revolt"
}
},
"oauth_client": [
{
"client_id": "123456789012-abcdefghijklmnopqrstuvwxyz123456.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyDummyKeyForDevelopmentOnly1234567890"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "123456789012-abcdefghijklmnopqrstuvwxyz123456.apps.googleusercontent.com",
"client_type": 3
}
]
}
}
},
{
"client_info": {
"mobilesdk_app_id": "1:123456789012:android:abcdef1234567891",
"android_client_info": {
"package_name": "chat.revolt.debug"
}
},
"oauth_client": [
{
"client_id": "123456789012-abcdefghijklmnopqrstuvwxyz123456.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyDummyKeyForDevelopmentOnly1234567890"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "123456789012-abcdefghijklmnopqrstuvwxyz123456.apps.googleusercontent.com",
"client_type": 3
}
]
}
}
}
],
"configuration_version": "1"
}

View File

@ -6,10 +6,12 @@ template: doc
This page contains the guidelines for setting up your development environment for Revolt on Android. These guidelines are important to ensure that your development environment is set up correctly and you can start contributing to the project.
If you want to compile the app for yourself, you can also follow these guidelines, however you may not need Android Studio and it may be possible to build the app using the command line, out of the scope of this guide.
If you want to compile the app yourself, you can follow these guidelines. You may not need Android Studio, as its possible to build the app from the command line. GitHub Codespaces automates most of the process for you if you want to go that route and this guide covers those steps, but wont go into detail on other command-line methods.
:::danger
It may be tempting to skip some of these steps, but make sure you follow them to ensure that your development environment is set up correctly.
Note: If you are doing this in Github Codespaces, steps 1-10 will be done for you. Also note that while small codespace instances can build this app, it's recommend to use 8-core or above for best results.
:::
import { Tabs, TabItem, Steps } from "@astrojs/starlight/components"
@ -137,11 +139,26 @@ import { Tabs, TabItem, Steps } from "@astrojs/starlight/components"
You can get these values from the Sentry dashboard.
10. Build the project.
10. Copy the `google-services.json.example` file within the `app` directory to `google-services.json`.
Firebase services are integrated into the project, so we need a `google-services.json` file for the build to succeed. For development purposes, use the provided example file:
```sh
cp app/google-services.json.example app/google-services.json
```
:::note
This is a mock configuration file for development purposes only. In a production environment, you would use a real Firebase project configuration.
:::
11. Build the project.
You can build the project by clicking on the 'Run' button in Android Studio.
If asked, build the `:app` module.
11. **You're all set!** You can now start contributing to Revolt on Android.
If building within Github Codespaces, you can build a fresh debug apk by running `./gradlew assembledebug --no-daemon` from the root of the project.
Upon completion, the apk will be within `app/build/outputs/apk/debug/`
</Steps>
12. **You're all set!** You can now start contributing to Revolt on Android.
</Steps>

View File

@ -1,4 +1,14 @@
import { resolve } from "jsr:@std/path"
import { parseArgs } from "jsr:@std/cli/parse-args"
const args = parseArgs(Deno.args, {
boolean: ["yes", "y", "auto-accept"],
alias: {
"y": "yes"
}
})
const autoAccept = args.yes || args["auto-accept"]
const outputFolderParent = resolve(Deno.cwd(), "app", "src", "main", "assets")
@ -13,7 +23,7 @@ try {
console.error(
"Usage: " +
"\x1b[35m" + // magenta
"deno run -A scripts/download_deps.ts" +
"deno run -A scripts/download_deps.ts [--yes|-y|--auto-accept]" +
"\x1b[0m" +
" from the " +
"\x1b[1;31;4m" + // bold red underline
@ -299,10 +309,14 @@ for (const dep of deps) {
console.log(`- ${dep.file} from ${dep.url}`)
}
console.log("Will download the above files.")
if (!confirm("Continue?")) {
console.log("Aborted.")
Deno.exit(0)
if (!autoAccept) {
console.log("Will download the above files.")
if (!confirm("Continue?")) {
console.log("Aborted.")
Deno.exit(0)
}
} else {
console.log("Will download the above files. (auto-accepted)")
}
const fontsFolder = resolve(outputFolder, "fonts")