show proper error if nkd-build is missing

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2020-04-14 17:18:14 +02:00
parent 64580f0ad1
commit 5c8a8e83ac
No known key found for this signature in database
GPG Key ID: 4EF064D0E6D63020
1 changed files with 25 additions and 13 deletions

View File

@ -313,22 +313,34 @@ dependencies {
implementation 'com.facebook.fresco:animated-gif:2.0.0' implementation 'com.facebook.fresco:animated-gif:2.0.0'
} }
// Run this once to be able to run the application with BUCK def getLocalNDKDir = { ->
// puts all compile dependencies into folder libs for BUCK to use
task hemroidBuild(type: Exec) {
def rootDir = project.rootDir def rootDir = project.rootDir
def localProperties = new File(rootDir, "local.properties") def localProperties = new File(rootDir, "local.properties")
if (!localProperties.exists()) {
def ndkDir = System.env.ANDROID_NDK return null
if (localProperties.exists()) { }
Properties properties = new Properties() Properties properties = new Properties()
localProperties.withInputStream { instr -> localProperties.withInputStream { instr ->
properties.load(instr) properties.load(instr)
} }
ndkDir = properties.getProperty('ndk.dir') return properties.getProperty('ndk.dir')
}
// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task hemroidBuild(type: Exec) {
def localNdkDir = getLocalNDKDir()
def ndkDir = System.env.ANDROID_NDK
if (localNdkDir != null) {
ndkDir = localNdkDir
} }
executable "$ndkDir/ndk-build"
def execPath = "$ndkDir/ndk-build"
def exec = new File(execPath)
if (!exec.exists()) {
throw new GradleException("No ndk-build binary found!")
}
executable execPath
} }
preBuild.dependsOn hemroidBuild preBuild.dependsOn hemroidBuild