From d096cde7a930829bb2e8ad1ae6428e4607661e2e Mon Sep 17 00:00:00 2001 From: Jonatan Rhodin Date: Wed, 11 Dec 2024 19:55:43 +0100 Subject: [PATCH] Move relays.json back into build folder --- .github/workflows/android-app.yml | 11 ++++------- android/.gitignore | 2 -- android/app/build.gradle.kts | 12 +++++------- 3 files changed, 9 insertions(+), 16 deletions(-) diff --git a/.github/workflows/android-app.yml b/.github/workflows/android-app.yml index de8c7399a193..7958a7b92634 100644 --- a/.github/workflows/android-app.yml +++ b/.github/workflows/android-app.yml @@ -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 @@ -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: @@ -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/ diff --git a/android/.gitignore b/android/.gitignore index 15fab11b4791..3d946dca367c 100644 --- a/android/.gitignore +++ b/android/.gitignore @@ -2,5 +2,3 @@ build .gradle .kotlin local.properties -# We want to generate relays.json not store it -app/src/main/assets/relays.json \ No newline at end of file diff --git a/android/app/build.gradle.kts b/android/app/build.gradle.kts index cf66a6b933d3..f54041d7b208 100644 --- a/android/app/build.gradle.kts +++ b/android/app/build.gradle.kts @@ -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() @@ -130,7 +131,7 @@ android { gradleLocalProperties(rootProject.projectDir, providers) .getOrDefault("OVERRIDE_CHANGELOG_DIR", defaultChangelogAssetsDirectory) - assets.srcDirs(assetsDirectory, changelogDir) + assets.srcDirs(assetsDirectory, extraAssetsDirectory, changelogDir) } } @@ -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")) @@ -314,8 +312,8 @@ tasks.register("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