Skip to content

Commit

Permalink
fix: android build attach task in release seperately
Browse files Browse the repository at this point in the history
  • Loading branch information
ammarahm-ed committed Sep 20, 2021
1 parent 118095f commit 679146f
Showing 1 changed file with 21 additions and 7 deletions.
28 changes: 21 additions & 7 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ android {
defaultConfig {
minSdkVersion getExtOrDefault('minSdkVersion', 16)
targetSdkVersion getExtOrDefault('targetSdkVersion', 28)
ndkVersion "21.1.6352462"
//ndkVersion "21.1.6352462"

externalNativeBuild {
cmake {
Expand Down Expand Up @@ -102,14 +102,28 @@ task extractJNIFiles {
}
}

def hasExtractedJNIFiles = false;
task extractJNIFilesForRelease {

doLast {
configurations.extractJNI.files.each {
def file = it.absoluteFile

tasks.whenTaskAdded { task ->
if (task.name.contains('generateJsonModel') || task.name.contains('externalNativeBuild')) {
if (!hasExtractedJNIFiles) {
hasExtractedJNIFiles = true;
task.dependsOn(extractJNIFiles)
copy {
from zipTree(file)
into "$buildDir/$file.name"
include "jni/**/*"
}
}
}
}

tasks.whenTaskAdded { task ->
if (task.name.contains('generateJsonModelDebug') || task.name.contains('externalNativeBuild')) {
task.dependsOn(extractJNIFiles);
}

if (task.name.contains('generateJsonModelRelease')) {
task.dependsOn(extractJNIFilesForRelease)
}
}

1 comment on commit 679146f

@vercel
Copy link

@vercel vercel bot commented on 679146f Sep 20, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.