forked from lubuwest/Friendiqa
86 lines
2.4 KiB
Groovy
86 lines
2.4 KiB
Groovy
|
|
// Obtain androidPackageSourceDir
|
|
// androidPackageSourceDir is the absolute path of the folder containing build.gradle and AndroidManifests.xml
|
|
// This code also works with androiddeployqt.
|
|
|
|
import groovy.json.JsonSlurper
|
|
|
|
String getAndroidPackageSourceDir() {
|
|
String res = buildscript.sourceFile.getParent();
|
|
|
|
FileTree tree = fileTree(dir: res + "/..").include("android*deployment-settings.json");
|
|
|
|
if (tree.getFiles().size() > 0) {
|
|
def inputFile = tree.getFiles().toArray()[0];
|
|
def InputJSON = new JsonSlurper().parseText(inputFile.text);
|
|
res = InputJSON["android-package-source-directory"]
|
|
} else {
|
|
println("android*deployment-settings.json not found. Set user.dir be the androidPackageSourceDir");
|
|
}
|
|
|
|
return res;
|
|
}
|
|
|
|
String androidPackageSourceDir = getAndroidPackageSourceDir();
|
|
println("androidPackageSourceDir = " + androidPackageSourceDir);
|
|
|
|
// End of obtain androidPackageSourceDir
|
|
|
|
buildscript {
|
|
repositories {
|
|
jcenter()
|
|
}
|
|
|
|
dependencies {
|
|
classpath 'com.android.tools.build:gradle:1.3.0'
|
|
}
|
|
}
|
|
|
|
allprojects {
|
|
repositories {
|
|
jcenter()
|
|
}
|
|
}
|
|
|
|
apply plugin: 'com.android.application'
|
|
|
|
dependencies {
|
|
compile fileTree(dir: 'libs', include: ['*.jar'])
|
|
}
|
|
|
|
android {
|
|
/*******************************************************
|
|
* The following variables:
|
|
* - androidBuildToolsVersion,
|
|
* - androidCompileSdkVersion
|
|
* - qt5AndroidDir - holds the path to qt android files
|
|
* needed to build any Qt application
|
|
* on Android.
|
|
*
|
|
* are defined in gradle.properties file. This file is
|
|
* updated by QtCreator and androiddeployqt tools.
|
|
* Changing them manually might break the compilation!
|
|
*******************************************************/
|
|
|
|
compileSdkVersion 19
|
|
|
|
buildToolsVersion androidBuildToolsVersion
|
|
|
|
sourceSets {
|
|
main {
|
|
manifest.srcFile 'AndroidManifest.xml'
|
|
java.srcDirs = [qt5AndroidDir + '/src', 'src', 'java',
|
|
androidPackageSourceDir + '/../../../../java/src']
|
|
aidl.srcDirs = [qt5AndroidDir + '/src', 'src', 'aidl']
|
|
res.srcDirs = [qt5AndroidDir + '/res', 'res']
|
|
resources.srcDirs = ['src']
|
|
renderscript.srcDirs = ['src']
|
|
assets.srcDirs = ['assets']
|
|
jniLibs.srcDirs = ['libs']
|
|
}
|
|
}
|
|
|
|
lintOptions {
|
|
abortOnError false
|
|
}
|
|
}
|