2016-03-03 17:46:31 +01:00
|
|
|
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
|
|
|
|
|
|
|
buildscript {
|
2017-11-18 20:04:59 +01:00
|
|
|
ext.version_setup_compileSdk = 27
|
|
|
|
ext.version_setup_minSdk = 17
|
|
|
|
ext.version_setup_targetSdk = ext.version_setup_compileSdk
|
2018-02-06 23:11:18 +01:00
|
|
|
ext.version_setup_buildTools = "27.0.3" // Specifying optional
|
2017-11-18 20:04:59 +01:00
|
|
|
|
2018-02-06 23:11:18 +01:00
|
|
|
// https://developer.android.com/studio/releases/gradle-plugin.html
|
|
|
|
ext.version_gradle_tools = "3.0.1"
|
2017-11-18 20:04:59 +01:00
|
|
|
// https://developer.android.com/topic/libraries/support-library/revisions.html
|
2018-03-02 15:56:14 +01:00
|
|
|
ext.version_library_appcompat = "27.1.0"
|
2017-11-18 20:04:59 +01:00
|
|
|
// https://github.com/JakeWharton/butterknife/releases
|
|
|
|
ext.version_library_butterknife = "8.8.1"
|
|
|
|
// https://github.com/atlassian/commonmark-java/releases
|
|
|
|
ext.version_library_commonmark = "0.10.0"
|
|
|
|
// https://github.com/guardianproject/NetCipher/releases
|
|
|
|
ext.version_library_netcipher = "2.0.0-alpha1"
|
2018-02-06 23:11:18 +01:00
|
|
|
// https://mvnrepository.com/artifact/org.jetbrains.kotlin/kotlin-gradle-plugin#LookAtCentral
|
2018-03-02 15:56:14 +01:00
|
|
|
ext.version_plugin_kotlin = "1.2.21"
|
2017-11-18 20:04:59 +01:00
|
|
|
ext.enable_plugin_kotlin = false
|
|
|
|
|
2016-03-03 17:46:31 +01:00
|
|
|
repositories {
|
|
|
|
jcenter()
|
2017-10-29 11:01:27 +01:00
|
|
|
google()
|
2016-03-03 17:46:31 +01:00
|
|
|
}
|
|
|
|
dependencies {
|
2018-02-06 23:11:18 +01:00
|
|
|
classpath "com.android.tools.build:gradle:$version_gradle_tools"
|
2017-10-29 11:01:27 +01:00
|
|
|
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
|
2017-11-18 20:04:59 +01:00
|
|
|
if (project.enable_plugin_kotlin) {
|
|
|
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$version_plugin_kotlin"
|
|
|
|
}
|
2016-03-03 17:46:31 +01:00
|
|
|
|
|
|
|
// NOTE: Do not place your application dependencies here; they belong
|
|
|
|
// in the individual module build.gradle files
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
allprojects {
|
|
|
|
repositories {
|
|
|
|
jcenter()
|
2017-08-05 12:26:04 +02:00
|
|
|
google()
|
2016-06-02 13:58:09 +02:00
|
|
|
mavenCentral()
|
2017-08-05 12:26:04 +02:00
|
|
|
maven { url "https://jitpack.io" }
|
2016-03-03 17:46:31 +01:00
|
|
|
}
|
2018-02-06 23:11:18 +01:00
|
|
|
|
|
|
|
tasks.matching { task -> task.name.matches('.*generate.*Resources') }.all {
|
|
|
|
task -> task.dependsOn copyRepoFiles
|
|
|
|
}
|
2016-03-03 17:46:31 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
task clean(type: Delete) {
|
|
|
|
delete rootProject.buildDir
|
|
|
|
}
|
2017-10-29 11:01:27 +01:00
|
|
|
|
2018-02-06 23:11:18 +01:00
|
|
|
final String[] ROOT_TO_RAW_COPYFILES = ["README.md", "CHANGELOG.md", "CONTRIBUTORS.md", "LICENSE.txt", "LICENSE.md", "LICENSE"]
|
2017-10-29 11:01:27 +01:00
|
|
|
task copyRepoFiles(type: Copy) {
|
|
|
|
from rootProject.files(ROOT_TO_RAW_COPYFILES)
|
|
|
|
into "app/src/main/res/raw"
|
2017-11-18 20:04:59 +01:00
|
|
|
rename { String fileName -> fileName.replace(fileName, fileName.toLowerCase()) }
|
2018-02-06 23:11:18 +01:00
|
|
|
}
|
2017-11-18 20:04:59 +01:00
|
|
|
|
2017-10-29 11:01:27 +01:00
|
|
|
|
|
|
|
@SuppressWarnings(["UnnecessaryQualifiedReference", "SpellCheckingInspection", "GroovyUnusedDeclaration"])
|
2017-11-18 20:04:59 +01:00
|
|
|
// Returns used android languages as a buildConfig array: {'de', 'it', ..}"
|
|
|
|
static String getUsedAndroidLanguages() {
|
2017-10-29 11:01:27 +01:00
|
|
|
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-", ""))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2017-11-18 20:04:59 +01:00
|
|
|
return '{' + langs.collect { "\"${it}\"" }.join(",") + '}'
|
2017-10-29 11:01:27 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
ext.getGitHash = { ->
|
2018-02-06 23:11:18 +01:00
|
|
|
try {
|
|
|
|
def stdout = new ByteArrayOutputStream() exec {
|
|
|
|
commandLine 'git', 'rev-parse', 'HEAD'
|
|
|
|
standardOutput = stdout
|
|
|
|
}
|
|
|
|
return stdout.toString().trim()
|
|
|
|
} catch (Exception e) {
|
|
|
|
return '???'
|
2017-10-29 11:01:27 +01:00
|
|
|
}
|
|
|
|
}
|