Skip to content

Commit 69a277a

Browse files
committed
Fixes based on feedback
1 parent acbbd99 commit 69a277a

File tree

5 files changed

+14
-23
lines changed

5 files changed

+14
-23
lines changed

.github/workflows/android-app.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -159,16 +159,16 @@ jobs:
159159
include:
160160
- arch: "x86_64"
161161
abi: "x86_64"
162-
taskVariant: "X86_64"
162+
task-variant: "X86_64"
163163
- arch: "i686"
164164
abi: "x86"
165-
taskVariant: "X86"
165+
task-variant: "X86"
166166
- arch: "aarch64"
167167
abi: "arm64-v8a"
168-
taskVariant: "Arm64"
168+
task-variant: "Arm64"
169169
- arch: "armv7"
170170
abi: "armeabi-v7a"
171-
taskVariant: "Arm"
171+
task-variant: "Arm"
172172
steps:
173173
# Fix for HOME path overridden by GH runners when building in containers, see:
174174
# https://github.com/actions/runner/issues/863
@@ -210,7 +210,7 @@ jobs:
210210
uses: burrunan/gradle-cache-action@v1
211211
with:
212212
job-id: jdk17
213-
arguments: cargoBuild${{ matrix.taskVariant }}
213+
arguments: cargoBuild${{ matrix.task-variant }}
214214
gradle-version: wrapper
215215
build-root-directory: android
216216
execution-only-caches: false

android/app/build.gradle.kts

+6-10
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,6 @@ cargo {
295295
add("--locked")
296296
}
297297
}
298-
exec = { spec, _ -> println(spec.commandLine) }
299298
}
300299

301300
tasks.register<Exec>("generateRelayList") {
@@ -313,13 +312,8 @@ tasks.register<Exec>("generateRelayList") {
313312
val output = standardOutput as ByteArrayOutputStream
314313
// Create file if needed
315314
File("$extraAssetsDirectory").mkdirs()
316-
File("$extraAssetsDirectory/relays.json").createNewFile()
317-
FileOutputStream("$extraAssetsDirectory/relays.json").use { it.write(output.toByteArray()) }
318-
319-
// Old ensure exists tasks
320-
if (!relayListPath.exists()) {
321-
throw GradleException("Failed to generate relay list")
322-
}
315+
relayListPath.createNewFile()
316+
FileOutputStream(relayListPath).use { it.write(output.toByteArray()) }
323317
}
324318
}
325319

@@ -333,14 +327,16 @@ if(gradleLocalProperties(rootProject.projectDir, providers)
333327
tasks["clean"].dependsOn("cargoClean")
334328
}
335329

330+
// This is a hack and will not work correctly under all scenarios.
331+
// See DROID-1696 for how we can improve this.
336332
fun isReleaseBuild() =
337333
gradle.startParameter.getTaskNames().any { it.contains("release", ignoreCase = true) }
338334

339335
fun isAlphaOrDevBuild() : Boolean {
340336
val localProperties = gradleLocalProperties(rootProject.projectDir, providers)
341337
val versionName = generateVersionName(localProperties)
342-
return versionName.contains("dev", ignoreCase = true) ||
343-
versionName.contains("alpha", ignoreCase = true)
338+
return versionName.contains("dev") ||
339+
versionName.contains("alpha")
344340
}
345341

346342
androidComponents {

android/build-apk.sh

-6
Original file line numberDiff line numberDiff line change
@@ -52,17 +52,12 @@ if [[ "$BUILD_TYPE" == "release" ]]; then
5252
BUNDLE_TASKS+=(createPlayDevmoleReleaseDistBundle createPlayStagemoleReleaseDistBundle)
5353
elif [[ "$PRODUCT_VERSION" == *"-alpha"* ]]; then
5454
echo "Removing old Rust build artifacts"
55-
cargo clean
5655
GRADLE_TASKS+=(createPlayStagemoleReleaseDistApk)
5756
BUNDLE_TASKS+=(createPlayStagemoleReleaseDistBundle)
5857
PLAY_PUBLISH_TASKS=(publishPlayStagemoleReleaseBundle)
59-
else
60-
cargo clean
6158
fi
6259
fi
6360

64-
pushd "$SCRIPT_DIR"
65-
6661
# Fallback to the system-wide gradle command if the gradlew script is removed.
6762
# It is removed by the F-Droid build process before the build starts.
6863
if [ -f "gradlew" ]; then
@@ -76,7 +71,6 @@ else
7671
fi
7772

7873
$GRADLE_CMD --console plain clean
79-
popd
8074

8175
$GRADLE_CMD --console plain "${GRADLE_TASKS[@]}"
8276

android/build.gradle.kts

-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ plugins {
1818

1919
alias(libs.plugins.detekt) apply true
2020
alias(libs.plugins.dependency.versions) apply true
21-
2221
}
2322

2423
buildscript {

wireguard-go-rs/build.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ fn build_android_dynamic_lib(daita: bool) -> anyhow::Result<()> {
172172
// or if the libwg.so file has been changed. The latter is required since the
173173
// libwg.so file could be deleted. It however means that this build will need
174174
// to run two times before it is properly cached.
175+
// FIXME: Figure out a way to do this better. This is tracked in DROID-1697.
175176
println!(
176177
"cargo::rerun-if-changed={}",
177178
android_output_path(target)?.join("libwg.so").display()
@@ -232,7 +233,8 @@ fn android_move_binary(binary: &Path, output: &Path) -> anyhow::Result<()> {
232233
std::fs::create_dir_all(parent_of_output)?;
233234

234235
let mut copy_command = Command::new("cp");
235-
// P command is required to not rebuild this module everytime
236+
// -p command is required to preserve ownership and timestamp of the file to prevent a
237+
// rebuild of this module everytime.
236238
copy_command
237239
.arg("-p")
238240
.arg(binary.to_str().unwrap())

0 commit comments

Comments
 (0)