Skip to content

Commit

Permalink
Move relays.json back into build folder
Browse files Browse the repository at this point in the history
  • Loading branch information
Pururun committed Dec 11, 2024
1 parent da5d7b9 commit d096cde
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 16 deletions.
11 changes: 4 additions & 7 deletions .github/workflows/android-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -132,14 +132,14 @@ jobs:
env:
RUSTFLAGS: --deny warnings
run: |
mkdir -p android/app/src/main/assets
cargo run --bin relay_list > android/app/src/main/assets/relays.json
mkdir -p android/app/build/extraAssets/
cargo run --bin relay_list > android/app/build/extraAssets/relays.json
- name: Upload
uses: actions/upload-artifact@v4
with:
name: relay-list
path: android/app/src/main/assets/relays.json
path: android/app/build/extraAssets/relays.json
if-no-files-found: error
retention-days: 7

Expand Down Expand Up @@ -276,9 +276,6 @@ jobs:
- name: Fix HOME path
run: echo "HOME=/root" >> $GITHUB_ENV

- name: Set ANDROID_NDK_ROOT
run: echo "ANDROID_NDK_ROOT=$ANDROID_NDK_HOME" >> $GITHUB_ENV

- name: Checkout repository
uses: actions/checkout@v4
with:
Expand Down Expand Up @@ -325,7 +322,7 @@ jobs:
- uses: actions/download-artifact@v4
with:
name: relay-list
path: android/app/src/main/assets
path: android/app/build/extraAssets

- name: Copy maybenot machines to asset directory
run: cp dist-assets/maybenot_machines android/app/src/main/assets/
Expand Down
2 changes: 0 additions & 2 deletions android/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,3 @@ build
.gradle
.kotlin
local.properties
# We want to generate relays.json not store it
app/src/main/assets/relays.json
12 changes: 5 additions & 7 deletions android/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ plugins {

val repoRootPath = rootProject.projectDir.absoluteFile.parentFile.absolutePath
val assetsDirectory = layout.projectDirectory.dir("src/main/assets")
val relayListPath = assetsDirectory.file("relays.json").asFile
val extraAssetsDirectory = layout.buildDirectory.dir("extraAssets").get()
val relayListPath = extraAssetsDirectory.file("relays.json").asFile
val defaultChangelogAssetsDirectory = "$repoRootPath/android/src/main/play/release-notes/"
val rustJniLibs = layout.buildDirectory.dir("rustJniLibs/android").get()

Expand Down Expand Up @@ -130,7 +131,7 @@ android {
gradleLocalProperties(rootProject.projectDir, providers)
.getOrDefault("OVERRIDE_CHANGELOG_DIR", defaultChangelogAssetsDirectory)

assets.srcDirs(assetsDirectory, changelogDir)
assets.srcDirs(assetsDirectory, extraAssetsDirectory, changelogDir)
}
}

Expand Down Expand Up @@ -282,9 +283,6 @@ cargo {
}
prebuiltToolchains = true
targetDirectory = "$repoRootPath/target"
// Set this if you get a cargo not found error
// rustcCommand = ""
// cargoCommand = ""
features {
if (enableApiOverride) {
defaultAnd(arrayOf("api-override"))
Expand Down Expand Up @@ -314,8 +312,8 @@ tasks.register<Exec>("generateRelayList") {
doLast {
val output = standardOutput as ByteArrayOutputStream
// Create file if needed
File("$assetsDirectory").mkdirs()
File("$assetsDirectory/relays.json").createNewFile()
File("$extraAssetsDirectory").mkdirs()
File("$extraAssetsDirectory/relays.json").createNewFile()
FileOutputStream("$assetsDirectory/relays.json").use { it.write(output.toByteArray()) }

// Old ensure exists tasks
Expand Down

0 comments on commit d096cde

Please sign in to comment.