mirror of
https://github.com/gsantner/dandelion
synced 2024-11-24 21:32:07 +01:00
129 lines
4.3 KiB
Groovy
129 lines
4.3 KiB
Groovy
apply plugin: 'com.android.application'
|
|
|
|
ext {
|
|
version_sdk = [
|
|
compileSdk : 24,
|
|
buildTools : "26.0.1",
|
|
minSdk : 17,
|
|
//targetSdk: compileSdk,
|
|
]
|
|
version_sdk.targetSdk = version_sdk.compileSdk
|
|
version_lib = [
|
|
appcompat : "24.1.0", // Broken after 24.1.0, Fix announced at 26.0.0, but still not fixed... See https://issuetracker.google.com/issues/37118105
|
|
butterknife : "8.4.0",
|
|
netcipher : "2.0.0-alpha1",
|
|
]
|
|
}
|
|
|
|
android {
|
|
compileSdkVersion version_sdk.compileSdk
|
|
buildToolsVersion version_sdk.buildTools
|
|
|
|
defaultConfig {
|
|
minSdkVersion version_sdk.minSdk
|
|
targetSdkVersion version_sdk.targetSdk
|
|
|
|
versionCode 24
|
|
versionName "1.0.4"
|
|
|
|
applicationId "com.github.dfa.diaspora_android"
|
|
resValue 'string', 'app_name', "dandelion*"
|
|
manifestPlaceholders = [appIcon: "@drawable/ic_launcher"]
|
|
|
|
buildConfigField "boolean", "IS_TEST_BUILD", "false"
|
|
buildConfigField "boolean", "IS_GPLAY_BUILD", "false"
|
|
buildConfigField("String[]", "APPLICATION_LANGUAGES", '{' + getUsedAndroidLanguages().collect {"\"${it}\""}.join(",") + '}')
|
|
|
|
vectorDrawables.useSupportLibrary = true
|
|
}
|
|
buildTypes {
|
|
release {
|
|
minifyEnabled false
|
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
|
}
|
|
}
|
|
|
|
productFlavors {
|
|
flavorDefault {
|
|
}
|
|
|
|
/*
|
|
flavorGplay {
|
|
buildConfigField "boolean", "IS_GPLAY_BUILD", "true"
|
|
}
|
|
*/
|
|
|
|
flavorTest {
|
|
applicationId "com.github.dfa.secondlion"
|
|
resValue 'string', 'app_name', "secondlion*"
|
|
manifestPlaceholders = [appIcon: "@drawable/ic_launcher_test"]
|
|
versionCode = Integer.parseInt(new Date().format('yyMMdd'))
|
|
versionName = new Date().format('yyMMdd')
|
|
buildConfigField "boolean", "IS_TEST_BUILD", "true"
|
|
}
|
|
}
|
|
lintOptions {
|
|
disable 'MissingTranslation'
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
// Sub-Projects
|
|
//compile project(':subprojectFromRoot')
|
|
|
|
// Jars
|
|
compile fileTree(dir: 'libs', include: ['*.jar'])
|
|
testCompile 'junit:junit:4.12'
|
|
|
|
// Android standard libs
|
|
compile "com.android.support:appcompat-v7:${version_lib.appcompat}"
|
|
compile "com.android.support:design:${version_lib.appcompat}"
|
|
compile "com.android.support:support-v4:${version_lib.appcompat}"
|
|
compile "com.android.support:customtabs:${version_lib.appcompat}"
|
|
compile "com.android.support:cardview-v7:${version_lib.appcompat}"
|
|
|
|
// UI libraries
|
|
compile "com.github.DASAR:ShiftColorPicker:v0.5"
|
|
|
|
// Tool libraries
|
|
compile "com.jakewharton:butterknife:${version_lib.butterknife}"
|
|
compile "info.guardianproject.netcipher:netcipher:${version_lib.netcipher}"
|
|
compile "info.guardianproject.netcipher:netcipher-webkit:${version_lib.netcipher}"
|
|
|
|
annotationProcessor "com.jakewharton:butterknife-compiler:${version_lib.butterknife}"
|
|
}
|
|
|
|
@SuppressWarnings(["UnnecessaryQualifiedReference", "SpellCheckingInspection"])
|
|
static String[] getUsedAndroidLanguages() {
|
|
Set<String> langs = new HashSet<>()
|
|
new File('.').eachFileRecurse(groovy.io.FileType.DIRECTORIES) {
|
|
final foldername = it.name
|
|
if (foldername.startsWith('values-') && !it.canonicalPath.contains("build" + File.separator + "intermediates")) {
|
|
new File(it.toString()).eachFileRecurse(groovy.io.FileType.FILES) {
|
|
if (it.name.toLowerCase().endsWith(".xml") && it.getCanonicalFile().getText('UTF-8').contains("<string")) {
|
|
langs.add(foldername.replace("values-", ""))
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return langs.toArray(new String[langs.size()])
|
|
}
|
|
|
|
// #####################
|
|
// Groovy Coding Area
|
|
// #####################
|
|
final String RAW_DIR = "app/src/main/res/raw"
|
|
final String[] ROOT_TO_RAW_COPYFILES = ["README.md", "LICENSE.md", "CHANGELOG.md", "CONTRIBUTORS.md"]
|
|
|
|
// Called before building
|
|
task copyRepoFiles(type: Copy) {
|
|
|
|
// Copy files over to raw dir
|
|
from rootProject.files(ROOT_TO_RAW_COPYFILES)
|
|
into RAW_DIR.replaceFirst("app/", "")
|
|
rename { String fileName ->
|
|
fileName.replace(fileName, fileName.toLowerCase())
|
|
}
|
|
}
|
|
tasks.copyRepoFiles.execute()
|