Skip to content

Commit bf3c72d

Browse files
authored
feature: Adding support for Github codespaces (#25)
* Adding 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> * Update devcontainer.json Signed-off-by: Alex Yong <alexjyong@gmail.com> * feat: Adding in dummy google services json file, and updating documentation * fix: typo :) * Adjusting storage bucket per feedback in Revolt Dev server. --------- Signed-off-by: Alex Yong <alexjyong@gmail.com>
1 parent edefffa commit bf3c72d

File tree

4 files changed

+131
-9
lines changed

4 files changed

+131
-9
lines changed

.devcontainer/devcontainer.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"image": "mcr.microsoft.com/devcontainers/universal:2",
3+
"features": {
4+
"ghcr.io/devcontainers-community/features/deno:1": {},
5+
"ghcr.io/nordcominc/devcontainer-features/android-sdk:1": {
6+
"extra_packages": "ndk;28.1.13356709"
7+
},
8+
"ghcr.io/devcontainers/features/java:1": {
9+
"version": "21",
10+
"jdkDistro": "oracle"
11+
}
12+
},
13+
"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",
14+
"customizations": {
15+
"vscode": {
16+
"extensions": [
17+
"redhat.java",
18+
"vscjava.vscode-java-pack",
19+
"kotlin.kotlin"
20+
]
21+
}
22+
}
23+
}

app/google-services.json.example

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
{
2+
"project_info": {
3+
"project_number": "123456789012",
4+
"project_id": "revolt-android-dev",
5+
"storage_bucket": "revolt-chat.appspot.com"
6+
},
7+
"client": [
8+
{
9+
"client_info": {
10+
"mobilesdk_app_id": "1:123456789012:android:abcdef1234567890",
11+
"android_client_info": {
12+
"package_name": "chat.revolt"
13+
}
14+
},
15+
"oauth_client": [
16+
{
17+
"client_id": "123456789012-abcdefghijklmnopqrstuvwxyz123456.apps.googleusercontent.com",
18+
"client_type": 3
19+
}
20+
],
21+
"api_key": [
22+
{
23+
"current_key": "AIzaSyDummyKeyForDevelopmentOnly1234567890"
24+
}
25+
],
26+
"services": {
27+
"appinvite_service": {
28+
"other_platform_oauth_client": [
29+
{
30+
"client_id": "123456789012-abcdefghijklmnopqrstuvwxyz123456.apps.googleusercontent.com",
31+
"client_type": 3
32+
}
33+
]
34+
}
35+
}
36+
},
37+
{
38+
"client_info": {
39+
"mobilesdk_app_id": "1:123456789012:android:abcdef1234567891",
40+
"android_client_info": {
41+
"package_name": "chat.revolt.debug"
42+
}
43+
},
44+
"oauth_client": [
45+
{
46+
"client_id": "123456789012-abcdefghijklmnopqrstuvwxyz123456.apps.googleusercontent.com",
47+
"client_type": 3
48+
}
49+
],
50+
"api_key": [
51+
{
52+
"current_key": "AIzaSyDummyKeyForDevelopmentOnly1234567890"
53+
}
54+
],
55+
"services": {
56+
"appinvite_service": {
57+
"other_platform_oauth_client": [
58+
{
59+
"client_id": "123456789012-abcdefghijklmnopqrstuvwxyz123456.apps.googleusercontent.com",
60+
"client_type": 3
61+
}
62+
]
63+
}
64+
}
65+
}
66+
],
67+
"configuration_version": "1"
68+
}

docs/src/content/docs/contributing/setup.mdx

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@ template: doc
66

77
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.
88

9-
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.
9+
If you want to compile the app yourself, you can follow these guidelines. You may not need Android Studio, as it’s 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 won’t go into detail on other command-line methods.
1010

1111
:::danger
1212
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.
13+
14+
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.
1315
:::
1416

1517
import { Tabs, TabItem, Steps } from "@astrojs/starlight/components"
@@ -137,11 +139,26 @@ import { Tabs, TabItem, Steps } from "@astrojs/starlight/components"
137139

138140
You can get these values from the Sentry dashboard.
139141

140-
10. Build the project.
142+
10. Copy the `google-services.json.example` file within the `app` directory to `google-services.json`.
143+
144+
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:
145+
146+
```sh
147+
cp app/google-services.json.example app/google-services.json
148+
```
149+
150+
:::note
151+
This is a mock configuration file for development purposes only. In a production environment, you would use a real Firebase project configuration.
152+
:::
153+
154+
11. Build the project.
141155

142156
You can build the project by clicking on the 'Run' button in Android Studio.
143157
If asked, build the `:app` module.
144158

145-
11. **You're all set!** You can now start contributing to Revolt on Android.
159+
If building within Github Codespaces, you can build a fresh debug apk by running `./gradlew assembledebug --no-daemon` from the root of the project.
160+
Upon completion, the apk will be within `app/build/outputs/apk/debug/`
161+
162+
12. **You're all set!** You can now start contributing to Revolt on Android.
146163

147-
</Steps>
164+
</Steps>

scripts/download_deps.ts

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
11
import { resolve } from "jsr:@std/path"
2+
import { parseArgs } from "jsr:@std/cli/parse-args"
3+
4+
const args = parseArgs(Deno.args, {
5+
boolean: ["yes", "y", "auto-accept"],
6+
alias: {
7+
"y": "yes"
8+
}
9+
})
10+
11+
const autoAccept = args.yes || args["auto-accept"]
212

313
const outputFolderParent = resolve(Deno.cwd(), "app", "src", "main", "assets")
414

@@ -13,7 +23,7 @@ try {
1323
console.error(
1424
"Usage: " +
1525
"\x1b[35m" + // magenta
16-
"deno run -A scripts/download_deps.ts" +
26+
"deno run -A scripts/download_deps.ts [--yes|-y|--auto-accept]" +
1727
"\x1b[0m" +
1828
" from the " +
1929
"\x1b[1;31;4m" + // bold red underline
@@ -299,10 +309,14 @@ for (const dep of deps) {
299309
console.log(`- ${dep.file} from ${dep.url}`)
300310
}
301311

302-
console.log("Will download the above files.")
303-
if (!confirm("Continue?")) {
304-
console.log("Aborted.")
305-
Deno.exit(0)
312+
if (!autoAccept) {
313+
console.log("Will download the above files.")
314+
if (!confirm("Continue?")) {
315+
console.log("Aborted.")
316+
Deno.exit(0)
317+
}
318+
} else {
319+
console.log("Will download the above files. (auto-accepted)")
306320
}
307321

308322
const fontsFolder = resolve(outputFolder, "fonts")

0 commit comments

Comments
 (0)