2015-04-30 16:15:10 -06:00
|
|
|
apply plugin: 'com.android.application'
|
|
|
|
|
|
|
|
android {
|
|
|
|
compileSdkVersion 21
|
2015-05-22 15:14:28 -06:00
|
|
|
buildToolsVersion "22.0.1"
|
2015-04-30 16:15:10 -06:00
|
|
|
|
|
|
|
lintOptions {
|
|
|
|
// This is important as it will run lint but not abort on error
|
|
|
|
// Lint has some overly obnoxious "errors" that should really be warnings
|
|
|
|
abortOnError false
|
|
|
|
}
|
|
|
|
|
|
|
|
defaultConfig {
|
2015-06-16 13:42:11 -06:00
|
|
|
// TODO If this is ever modified, change application_id in strings.xml
|
2015-04-30 16:15:10 -06:00
|
|
|
applicationId "org.dolphinemu.dolphinemu"
|
2015-06-02 08:30:21 -06:00
|
|
|
minSdkVersion 21
|
2015-04-30 16:15:10 -06:00
|
|
|
targetSdkVersion 21
|
2015-06-08 16:07:26 -06:00
|
|
|
|
|
|
|
// TODO This should be set to the Buildbot build number for release builds, and be "1" for debug builds.
|
2015-04-30 16:15:10 -06:00
|
|
|
versionCode 13
|
2015-06-08 16:07:26 -06:00
|
|
|
|
|
|
|
// TODO This should be set to the string currently provided by NativeLibrary.GetVersionString().
|
2015-04-30 16:15:10 -06:00
|
|
|
versionName "0.13"
|
|
|
|
}
|
|
|
|
|
|
|
|
signingConfigs {
|
|
|
|
release {
|
|
|
|
if (project.hasProperty('keystore')) {
|
|
|
|
storeFile file(project.property('keystore'))
|
|
|
|
storePassword project.property('storepass')
|
|
|
|
keyAlias project.property('keyalias')
|
|
|
|
keyPassword project.property('keypass')
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-05-13 20:45:12 -06:00
|
|
|
// Define build types, which are orthogonal to product flavors.
|
2015-04-30 16:15:10 -06:00
|
|
|
buildTypes {
|
|
|
|
// Signed by release key, allowing for upload to Play Store.
|
|
|
|
release {
|
|
|
|
signingConfig signingConfigs.release
|
|
|
|
}
|
|
|
|
|
|
|
|
// Signed by debug key disallowing distribution on Play Store.
|
|
|
|
// Attaches 'debug' suffix to version and package name, allowing installation alongside the release build.
|
|
|
|
debug {
|
2015-06-16 13:42:11 -06:00
|
|
|
// TODO If this is ever modified, change application_id in debug/strings.xml
|
2015-04-30 16:15:10 -06:00
|
|
|
applicationIdSuffix ".debug"
|
|
|
|
versionNameSuffix '-debug'
|
|
|
|
jniDebuggable true
|
2015-05-18 18:22:01 -06:00
|
|
|
|
|
|
|
tasks.withType(JavaCompile) {
|
|
|
|
compileTask -> compileTask.dependsOn(compileNative)
|
|
|
|
}
|
2015-04-30 16:15:10 -06:00
|
|
|
}
|
|
|
|
}
|
2015-05-13 20:45:12 -06:00
|
|
|
|
|
|
|
// Define product flavors, which can be split into categories. Common examples
|
|
|
|
// of product flavors are paid vs. free, ARM vs. x86, etc.
|
|
|
|
productFlavors {
|
|
|
|
arm_64 {
|
|
|
|
flavorDimension "abi"
|
|
|
|
ndk {
|
|
|
|
abiFilter "arm64-v8a"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-05-22 15:13:25 -06:00
|
|
|
x86_64 {
|
2015-05-13 20:45:12 -06:00
|
|
|
flavorDimension "abi"
|
|
|
|
ndk {
|
|
|
|
abiFilter "x86_64"
|
|
|
|
}
|
2015-05-22 15:13:25 -06:00
|
|
|
}
|
2015-05-13 20:45:12 -06:00
|
|
|
}
|
2015-04-30 16:15:10 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
dependencies {
|
2015-06-20 17:37:36 -06:00
|
|
|
compile 'com.android.support:support-v13:22.2.0'
|
|
|
|
compile 'com.android.support:cardview-v7:22.2.0'
|
|
|
|
compile 'com.android.support:recyclerview-v7:22.2.0'
|
|
|
|
compile 'com.android.support:design:22.2.0'
|
2015-05-06 18:12:58 -06:00
|
|
|
|
|
|
|
// For showing the banner as a circle a-la Material Design Guidelines
|
|
|
|
compile 'de.hdodenhof:circleimageview:1.2.2'
|
|
|
|
|
|
|
|
// For loading huge screenshots from the disk.
|
2015-05-08 17:54:56 -06:00
|
|
|
compile 'com.squareup.picasso:picasso:2.5.2'
|
2015-04-30 16:15:10 -06:00
|
|
|
}
|
2015-05-18 18:22:01 -06:00
|
|
|
|
|
|
|
task setupCMake(type: Exec) {
|
|
|
|
// Check if a build properties file exists.
|
|
|
|
def propsFile = rootProject.file("build.properties")
|
|
|
|
|
|
|
|
// If it does, call CMake.
|
|
|
|
if (propsFile.canRead()) {
|
|
|
|
// Read the properties file's contents.
|
|
|
|
def buildProperties = new Properties()
|
|
|
|
buildProperties.load(new FileInputStream(propsFile))
|
|
|
|
|
2015-05-22 15:13:25 -06:00
|
|
|
String abi = getAbi()
|
|
|
|
|
|
|
|
mkdir('build/' + abi)
|
|
|
|
workingDir 'build/' + abi
|
2015-05-18 18:22:01 -06:00
|
|
|
|
2015-06-13 04:54:37 -06:00
|
|
|
executable getExecutablePath("cmake")
|
2015-05-18 18:22:01 -06:00
|
|
|
|
|
|
|
args "-DANDROID=true",
|
|
|
|
"-DANDROID_NATIVE_API_LEVEL=android-18",
|
|
|
|
"-DCMAKE_TOOLCHAIN_FILE=../../../android.toolchain.cmake",
|
|
|
|
"../../../../..",
|
2015-06-13 04:54:37 -06:00
|
|
|
"-DGIT_EXECUTABLE=" + getExecutablePath("git"),
|
2015-05-19 07:05:35 -06:00
|
|
|
"-DANDROID_NDK=" + getNdkPath(),
|
2015-05-22 15:13:25 -06:00
|
|
|
"-DANDROID_TOOLCHAIN_NAME=" + getToolchainName(),
|
|
|
|
"-DANDROID_ABI=" + abi
|
2015-05-18 18:22:01 -06:00
|
|
|
} else {
|
|
|
|
executable 'echo'
|
|
|
|
args 'No build.properties found; skipping CMake.'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
task compileNative(type: Exec, dependsOn: 'setupCMake') {
|
|
|
|
// Check if a build properties file exists.
|
|
|
|
def propsFile = rootProject.file("build.properties")
|
|
|
|
|
|
|
|
// If it does, call make.
|
|
|
|
if (propsFile.canRead()) {
|
|
|
|
// Read the properties file's contents.
|
|
|
|
def buildProperties = new Properties()
|
|
|
|
buildProperties.load(new FileInputStream(propsFile))
|
|
|
|
|
2015-05-22 15:13:25 -06:00
|
|
|
String abi = getAbi()
|
|
|
|
|
|
|
|
workingDir 'build/' + abi
|
2015-05-18 18:22:01 -06:00
|
|
|
|
|
|
|
executable 'make'
|
|
|
|
|
|
|
|
args buildProperties.makeArgs
|
|
|
|
} else {
|
|
|
|
executable 'echo'
|
|
|
|
args 'No build.properties found; skipping native build.'
|
|
|
|
}
|
2015-05-19 07:05:35 -06:00
|
|
|
}
|
|
|
|
|
2015-06-13 04:54:37 -06:00
|
|
|
String getExecutablePath(String command) {
|
|
|
|
def propsFile = rootProject.file("build.properties")
|
|
|
|
def path = null
|
|
|
|
if (propsFile.canRead()) {
|
|
|
|
def buildProperties = new Properties()
|
|
|
|
buildProperties.load(new FileInputStream(propsFile))
|
|
|
|
println buildProperties
|
|
|
|
path = buildProperties[command + "Path"]
|
|
|
|
}
|
|
|
|
if (path == null) {
|
|
|
|
try {
|
|
|
|
def stdout = new ByteArrayOutputStream()
|
2015-05-19 07:05:35 -06:00
|
|
|
|
2015-06-13 04:54:37 -06:00
|
|
|
exec {
|
|
|
|
commandLine 'which', command
|
|
|
|
standardOutput = stdout
|
|
|
|
}
|
2015-05-19 07:05:35 -06:00
|
|
|
|
2015-06-13 04:54:37 -06:00
|
|
|
path = stdout.toString().trim()
|
|
|
|
} catch (ignored) {
|
|
|
|
project.logger.error("Gradle error: Couldn't find " + command + " executable.")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (path != null) {
|
|
|
|
project.logger.quiet("Gradle: Found " + command + " executuable:" + path)
|
2015-05-19 07:05:35 -06:00
|
|
|
}
|
2015-06-13 04:54:37 -06:00
|
|
|
return path
|
2015-05-19 07:05:35 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
String getNdkPath() {
|
2015-06-12 20:59:25 -06:00
|
|
|
def propsFile = rootProject.file("build.properties")
|
|
|
|
def ndkPath = null
|
|
|
|
if (propsFile.canRead()) {
|
|
|
|
def buildProperties = new Properties()
|
|
|
|
buildProperties.load(new FileInputStream(propsFile))
|
|
|
|
ndkPath = buildProperties.ndkPath
|
|
|
|
}
|
|
|
|
if (ndkPath == null) {
|
|
|
|
try {
|
|
|
|
def stdout = new ByteArrayOutputStream()
|
|
|
|
|
|
|
|
exec {
|
|
|
|
// ndk-build.cmd is a file unique to the root directory of android-ndk-r10e.
|
|
|
|
commandLine 'locate', 'ndk-build.cmd'
|
|
|
|
standardOutput = stdout
|
|
|
|
}
|
2015-05-19 07:05:35 -06:00
|
|
|
|
2015-06-12 20:59:25 -06:00
|
|
|
def ndkCmdPath = stdout.toString()
|
|
|
|
ndkPath = ndkCmdPath.substring(0, ndkCmdPath.lastIndexOf('/'))
|
|
|
|
} catch (ignored) {
|
|
|
|
project.logger.error("Gradle error: Couldn't find NDK.")
|
2015-05-19 07:05:35 -06:00
|
|
|
}
|
|
|
|
}
|
2015-06-12 20:59:25 -06:00
|
|
|
if (ndkPath != null) {
|
|
|
|
project.logger.quiet("Gradle: Found Android NDK: " + ndkPath)
|
|
|
|
}
|
|
|
|
return ndkPath
|
2015-05-22 15:13:25 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
String getAbi() {
|
|
|
|
String taskName = getGradle().startParameter.taskNames[0]
|
|
|
|
String abi;
|
|
|
|
|
|
|
|
if (taskName == null) {
|
|
|
|
return ""
|
|
|
|
}
|
|
|
|
|
|
|
|
project.logger.quiet("Gradle: Build = " + taskName)
|
|
|
|
|
|
|
|
if (taskName.contains("Arm_64")) {
|
|
|
|
abi = "arm64-v8a"
|
|
|
|
} else if (taskName.contains("Arm")) {
|
|
|
|
abi = "armeabi-v7a"
|
|
|
|
} else if (taskName.contains("X86_64")) {
|
|
|
|
abi = "x86_64"
|
|
|
|
}
|
|
|
|
|
|
|
|
project.logger.quiet("Gradle: ABI name: " + abi)
|
|
|
|
return abi;
|
|
|
|
}
|
|
|
|
|
|
|
|
String getToolchainName() {
|
|
|
|
String taskName = getGradle().startParameter.taskNames[0]
|
|
|
|
String toolchain;
|
|
|
|
|
|
|
|
if (taskName == null) {
|
|
|
|
return ""
|
|
|
|
}
|
|
|
|
|
|
|
|
if (taskName.contains("Arm_64")) {
|
|
|
|
toolchain = "aarch64-linux-android-4.9"
|
|
|
|
} else if (taskName.contains("Arm")) {
|
|
|
|
toolchain = "arm-linux-androideabi-4.9"
|
|
|
|
} else if (taskName.contains("X86_64")) {
|
|
|
|
toolchain = "x86_64-4.9"
|
|
|
|
}
|
|
|
|
|
|
|
|
project.logger.quiet("Gradle: ABI name: " + toolchain)
|
|
|
|
return toolchain;
|
2015-05-18 18:22:01 -06:00
|
|
|
}
|