Skip to content

Commit

Permalink
Fixes based on feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
Pururun committed Dec 19, 2024
1 parent acbbd99 commit 69a277a
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 23 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/android-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -159,16 +159,16 @@ jobs:
include:
- arch: "x86_64"
abi: "x86_64"
taskVariant: "X86_64"
task-variant: "X86_64"
- arch: "i686"
abi: "x86"
taskVariant: "X86"
task-variant: "X86"
- arch: "aarch64"
abi: "arm64-v8a"
taskVariant: "Arm64"
task-variant: "Arm64"
- arch: "armv7"
abi: "armeabi-v7a"
taskVariant: "Arm"
task-variant: "Arm"
steps:
# Fix for HOME path overridden by GH runners when building in containers, see:
# https://github.com/actions/runner/issues/863
Expand Down Expand Up @@ -210,7 +210,7 @@ jobs:
uses: burrunan/gradle-cache-action@v1
with:
job-id: jdk17
arguments: cargoBuild${{ matrix.taskVariant }}
arguments: cargoBuild${{ matrix.task-variant }}
gradle-version: wrapper
build-root-directory: android
execution-only-caches: false
Expand Down
16 changes: 6 additions & 10 deletions android/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,6 @@ cargo {
add("--locked")
}
}
exec = { spec, _ -> println(spec.commandLine) }
}

tasks.register<Exec>("generateRelayList") {
Expand All @@ -313,13 +312,8 @@ tasks.register<Exec>("generateRelayList") {
val output = standardOutput as ByteArrayOutputStream
// Create file if needed
File("$extraAssetsDirectory").mkdirs()
File("$extraAssetsDirectory/relays.json").createNewFile()
FileOutputStream("$extraAssetsDirectory/relays.json").use { it.write(output.toByteArray()) }

// Old ensure exists tasks
if (!relayListPath.exists()) {
throw GradleException("Failed to generate relay list")
}
relayListPath.createNewFile()
FileOutputStream(relayListPath).use { it.write(output.toByteArray()) }
}
}

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

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

fun isAlphaOrDevBuild() : Boolean {
val localProperties = gradleLocalProperties(rootProject.projectDir, providers)
val versionName = generateVersionName(localProperties)
return versionName.contains("dev", ignoreCase = true) ||
versionName.contains("alpha", ignoreCase = true)
return versionName.contains("dev") ||
versionName.contains("alpha")
}

androidComponents {
Expand Down
6 changes: 0 additions & 6 deletions android/build-apk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,12 @@ if [[ "$BUILD_TYPE" == "release" ]]; then
BUNDLE_TASKS+=(createPlayDevmoleReleaseDistBundle createPlayStagemoleReleaseDistBundle)
elif [[ "$PRODUCT_VERSION" == *"-alpha"* ]]; then
echo "Removing old Rust build artifacts"
cargo clean
GRADLE_TASKS+=(createPlayStagemoleReleaseDistApk)
BUNDLE_TASKS+=(createPlayStagemoleReleaseDistBundle)
PLAY_PUBLISH_TASKS=(publishPlayStagemoleReleaseBundle)
else
cargo clean
fi
fi

pushd "$SCRIPT_DIR"

# Fallback to the system-wide gradle command if the gradlew script is removed.
# It is removed by the F-Droid build process before the build starts.
if [ -f "gradlew" ]; then
Expand All @@ -76,7 +71,6 @@ else
fi

$GRADLE_CMD --console plain clean
popd

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

Expand Down
1 change: 0 additions & 1 deletion android/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ plugins {

alias(libs.plugins.detekt) apply true
alias(libs.plugins.dependency.versions) apply true

}

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

let mut copy_command = Command::new("cp");
// P command is required to not rebuild this module everytime
// -p command is required to preserve ownership and timestamp of the file to prevent a
// rebuild of this module everytime.
copy_command
.arg("-p")
.arg(binary.to_str().unwrap())
Expand Down

0 comments on commit 69a277a

Please sign in to comment.