2016-05-04 15:33:43 +03:00
|
|
|
// Gradle build file
|
|
|
|
//
|
|
|
|
// This project was started in Eclipse and later moved to Android Studio. In the transition, both IDEs were supported.
|
|
|
|
// Due to this, the files layout is not the usual in new projects created with Android Studio / gradle. This file
|
|
|
|
// merges declarations usually split in two separates build.gradle file, one for global settings of the project in
|
|
|
|
// its root folder, another one for the app module in subfolder of root.
|
|
|
|
|
2014-10-03 14:33:41 +04:00
|
|
|
buildscript {
|
|
|
|
repositories {
|
2016-08-16 16:04:43 +03:00
|
|
|
jcenter()
|
2017-02-22 01:56:13 +03:00
|
|
|
maven {
|
|
|
|
url 'https://oss.sonatype.org/content/repositories/snapshots/'
|
|
|
|
}
|
2017-08-07 12:47:47 +03:00
|
|
|
google()
|
2014-10-03 14:33:41 +04:00
|
|
|
}
|
|
|
|
dependencies {
|
2018-06-09 14:34:54 +03:00
|
|
|
classpath 'com.android.tools.build:gradle:3.1.3'
|
2018-04-03 19:55:07 +03:00
|
|
|
classpath 'com.google.gms:google-services:3.0.0'
|
2018-03-02 14:08:09 +03:00
|
|
|
classpath 'org.codehaus.groovy:groovy-all:2.4.12'
|
|
|
|
classpath('com.dicedmelon.gradle:jacoco-android:0.1.2') {
|
|
|
|
exclude group: 'org.codehaus.groovy', module: 'groovy-all'
|
|
|
|
}
|
2014-10-03 14:33:41 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
apply plugin: 'com.android.application'
|
2016-10-09 02:33:12 +03:00
|
|
|
apply plugin: 'checkstyle'
|
|
|
|
apply plugin: 'pmd'
|
|
|
|
apply plugin: 'findbugs'
|
2018-03-02 14:08:09 +03:00
|
|
|
apply plugin: 'jacoco-android'
|
2014-10-03 14:33:41 +04:00
|
|
|
|
2017-03-06 16:16:31 +03:00
|
|
|
configurations.all {
|
|
|
|
// check for updates every build
|
|
|
|
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
|
|
|
|
}
|
|
|
|
|
2016-04-27 15:48:05 +03:00
|
|
|
ext {
|
2018-04-09 20:50:14 +03:00
|
|
|
supportLibraryVersion = '27.1.1'
|
2018-04-03 19:22:38 +03:00
|
|
|
googleLibraryVersion = '12.0.1'
|
2018-03-22 16:51:39 +03:00
|
|
|
androidLibraryVersion = '1.0.40'
|
2018-03-02 14:08:09 +03:00
|
|
|
jacocoVersion = "0.7.4.201502262128"
|
2016-08-16 18:22:22 +03:00
|
|
|
|
|
|
|
travisBuild = System.getenv("TRAVIS") == "true"
|
|
|
|
|
|
|
|
// allows for -Dpre-dex=false to be set
|
|
|
|
preDexEnabled = "true".equals(System.getProperty("pre-dex", "true"))
|
2016-04-27 15:48:05 +03:00
|
|
|
}
|
2014-10-03 14:33:41 +04:00
|
|
|
|
|
|
|
repositories {
|
2016-08-16 16:04:43 +03:00
|
|
|
jcenter()
|
2016-06-07 15:02:36 +03:00
|
|
|
maven { url "https://jitpack.io" }
|
2017-11-28 17:01:14 +03:00
|
|
|
maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
|
2017-08-07 12:47:47 +03:00
|
|
|
google()
|
2017-08-07 12:53:58 +03:00
|
|
|
|
2014-10-03 14:33:41 +04:00
|
|
|
flatDir {
|
|
|
|
dirs 'libs'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-02-12 14:38:38 +03:00
|
|
|
// semantic versioning for version code
|
|
|
|
def versionMajor = 3
|
2018-06-13 17:48:17 +03:00
|
|
|
def versionMinor = 3
|
2018-02-12 14:38:38 +03:00
|
|
|
def versionPatch = 0
|
2018-06-13 17:48:17 +03:00
|
|
|
def versionBuild = 0 // 0-49=Alpha / 50-98=RC / 99=stable
|
2018-02-12 14:38:38 +03:00
|
|
|
|
2014-10-03 14:33:41 +04:00
|
|
|
android {
|
2016-10-09 02:33:12 +03:00
|
|
|
lintOptions {
|
2017-05-13 09:52:56 +03:00
|
|
|
abortOnError false
|
2016-10-09 02:33:12 +03:00
|
|
|
htmlReport true
|
|
|
|
htmlOutput file("$project.buildDir/reports/lint/lint.html")
|
2017-05-13 09:52:56 +03:00
|
|
|
disable 'MissingTranslation'
|
2016-10-09 02:33:12 +03:00
|
|
|
}
|
2017-02-22 02:46:47 +03:00
|
|
|
|
|
|
|
dexOptions {
|
|
|
|
javaMaxHeapSize "4g"
|
|
|
|
}
|
|
|
|
|
2018-04-03 18:18:24 +03:00
|
|
|
compileSdkVersion 27
|
2015-11-28 13:26:58 +03:00
|
|
|
|
2016-05-05 09:46:47 +03:00
|
|
|
defaultConfig {
|
2017-12-21 11:47:10 +03:00
|
|
|
minSdkVersion 14
|
2018-04-03 18:18:24 +03:00
|
|
|
targetSdkVersion 27
|
2017-12-21 11:47:10 +03:00
|
|
|
|
2016-05-05 09:46:47 +03:00
|
|
|
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
2016-05-06 09:46:50 +03:00
|
|
|
|
2016-05-09 15:06:44 +03:00
|
|
|
// arguments to be passed to functional tests
|
2016-05-09 15:37:08 +03:00
|
|
|
testInstrumentationRunnerArgument "TEST_USER", "\"$System.env.OCTEST_APP_USERNAME\""
|
|
|
|
testInstrumentationRunnerArgument "TEST_PASSWORD", "\"$System.env.OCTEST_APP_PASSWORD\""
|
|
|
|
testInstrumentationRunnerArgument "TEST_SERVER_URL", "\"$System.env.OCTEST_SERVER_BASE_URL\""
|
2016-06-07 22:58:37 +03:00
|
|
|
|
2017-02-22 02:40:03 +03:00
|
|
|
multiDexEnabled true
|
2016-05-05 09:46:47 +03:00
|
|
|
|
2018-03-20 14:53:56 +03:00
|
|
|
versionCode versionMajor * 10000000 + versionMinor * 10000 + versionPatch * 100 + versionBuild
|
2018-02-12 18:10:41 +03:00
|
|
|
|
|
|
|
if (versionBuild > 98) {
|
|
|
|
versionName "${versionMajor}.${versionMinor}.${versionPatch}"
|
2018-02-15 14:30:26 +03:00
|
|
|
} else if (versionBuild > 49) {
|
|
|
|
versionName "${versionMajor}.${versionMinor}.${versionPatch} RC"+(versionBuild-49)
|
2018-02-12 18:10:41 +03:00
|
|
|
} else {
|
2018-02-15 14:30:26 +03:00
|
|
|
versionName "${versionMajor}.${versionMinor}.${versionPatch} Alpha"+(versionBuild+1)
|
2018-02-12 18:10:41 +03:00
|
|
|
}
|
2017-10-06 11:41:15 +03:00
|
|
|
|
2017-03-05 23:09:36 +03:00
|
|
|
// adapt structure from Eclipse to Gradle/Android Studio expectations;
|
|
|
|
// see http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Configuring-the-Structure
|
2014-10-03 14:33:41 +04:00
|
|
|
|
2017-06-07 10:42:41 +03:00
|
|
|
flavorDimensions "default"
|
|
|
|
|
2018-03-02 14:08:09 +03:00
|
|
|
buildTypes {
|
|
|
|
debug {
|
|
|
|
testCoverageEnabled true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-03-05 23:09:36 +03:00
|
|
|
productFlavors {
|
2017-04-26 22:11:27 +03:00
|
|
|
// used for f-droid
|
2017-02-24 17:22:02 +03:00
|
|
|
generic {
|
2017-02-23 17:11:56 +03:00
|
|
|
applicationId 'com.nextcloud.client'
|
2017-06-07 10:42:41 +03:00
|
|
|
dimension "default"
|
2017-02-23 17:11:56 +03:00
|
|
|
}
|
2016-08-15 15:01:00 +03:00
|
|
|
|
2017-04-28 10:26:16 +03:00
|
|
|
gplay {
|
|
|
|
applicationId 'com.nextcloud.client'
|
2017-06-07 10:42:41 +03:00
|
|
|
dimension "default"
|
2017-04-28 10:26:16 +03:00
|
|
|
}
|
|
|
|
|
2017-04-13 10:14:19 +03:00
|
|
|
versionDev {
|
|
|
|
applicationId "com.nextcloud.android.beta"
|
|
|
|
dimension "default"
|
2018-06-13 01:32:58 +03:00
|
|
|
versionCode 20180613
|
|
|
|
versionName "20180613"
|
2017-04-13 10:14:19 +03:00
|
|
|
}
|
2017-02-23 17:11:56 +03:00
|
|
|
}
|
|
|
|
}
|
2014-10-03 14:33:41 +04:00
|
|
|
|
2017-02-23 17:11:56 +03:00
|
|
|
// adapt structure from Eclipse to Gradle/Android Studio expectations;
|
|
|
|
// see http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Configuring-the-Structure
|
2016-08-15 15:01:00 +03:00
|
|
|
|
2016-08-16 18:22:22 +03:00
|
|
|
dexOptions {
|
|
|
|
// Skip pre-dexing when running on Travis CI or when disabled via -Dpre-dex=false.
|
|
|
|
preDexLibraries = preDexEnabled && !travisBuild
|
|
|
|
}
|
2014-10-03 14:33:41 +04:00
|
|
|
|
|
|
|
packagingOptions {
|
|
|
|
exclude 'META-INF/LICENSE.txt'
|
2017-04-12 15:34:43 +03:00
|
|
|
exclude 'META-INF/LICENSE'
|
2014-10-03 14:33:41 +04:00
|
|
|
}
|
2017-02-25 05:00:36 +03:00
|
|
|
|
2016-10-09 02:33:12 +03:00
|
|
|
task checkstyle(type: Checkstyle) {
|
|
|
|
configFile = file("${rootProject.projectDir}/checkstyle.xml")
|
|
|
|
configProperties.checkstyleSuppressionsPath = file("${project.rootDir}/config/quality/checkstyle/suppressions.xml").absolutePath
|
|
|
|
source 'src'
|
|
|
|
include '**/*.java'
|
|
|
|
exclude '**/gen/**'
|
|
|
|
classpath = files()
|
|
|
|
}
|
|
|
|
|
|
|
|
task pmd(type: Pmd) {
|
|
|
|
ruleSetFiles = files("${project.rootDir}/pmd-ruleset.xml")
|
|
|
|
ignoreFailures = false
|
|
|
|
ruleSets = []
|
|
|
|
|
|
|
|
source 'src'
|
|
|
|
include '**/*.java'
|
|
|
|
exclude '**/gen/**'
|
|
|
|
|
|
|
|
reports {
|
|
|
|
xml.enabled = false
|
|
|
|
html.enabled = true
|
|
|
|
xml {
|
2017-08-08 12:36:41 +03:00
|
|
|
destination = file("$project.buildDir/reports/pmd/pmd.xml")
|
2016-10-09 02:33:12 +03:00
|
|
|
}
|
|
|
|
html {
|
2017-08-08 12:36:41 +03:00
|
|
|
destination = file("$project.buildDir/reports/pmd/pmd.html")
|
2016-10-09 02:33:12 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
task findbugs(type: FindBugs) {
|
|
|
|
ignoreFailures = false
|
|
|
|
effort = "max"
|
|
|
|
reportLevel = "high"
|
|
|
|
classes = files("$project.buildDir/intermediates/classes")
|
|
|
|
excludeFilter = new File("${project.rootDir}/findbugs-filter.xml")
|
|
|
|
source 'src'
|
|
|
|
include '**/*.java'
|
|
|
|
exclude '**/gen/**'
|
|
|
|
|
|
|
|
reports {
|
|
|
|
xml.enabled = false
|
|
|
|
html.enabled = true
|
|
|
|
html {
|
2017-08-08 12:36:41 +03:00
|
|
|
destination = file("$project.buildDir/reports/findbugs/findbugs.html")
|
2016-10-09 02:33:12 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
classpath = files()
|
|
|
|
}
|
|
|
|
check.dependsOn 'checkstyle', 'findbugs', 'pmd', 'lint'
|
|
|
|
|
2017-05-05 21:00:52 +03:00
|
|
|
compileOptions {
|
|
|
|
sourceCompatibility JavaVersion.VERSION_1_8
|
|
|
|
targetCompatibility JavaVersion.VERSION_1_8
|
|
|
|
}
|
2016-06-24 01:18:45 +03:00
|
|
|
}
|
2017-02-23 17:11:56 +03:00
|
|
|
|
|
|
|
dependencies {
|
2018-01-10 10:13:18 +03:00
|
|
|
// dependencies for app building
|
2018-04-03 19:22:38 +03:00
|
|
|
implementation 'com.android.support:multidex:1.0.3'
|
2017-12-15 13:36:55 +03:00
|
|
|
// implementation project('nextcloud-android-library')
|
2018-06-01 14:10:33 +03:00
|
|
|
genericImplementation "com.github.nextcloud:android-library:fileVersioning-SNAPSHOT"
|
|
|
|
gplayImplementation "com.github.nextcloud:android-library:fileVersioning-SNAPSHOT"
|
|
|
|
versionDevImplementation 'com.github.nextcloud:android-library:fileVersioning-SNAPSHOT' // use always latest master
|
2017-08-08 12:36:41 +03:00
|
|
|
implementation "com.android.support:support-v4:${supportLibraryVersion}"
|
|
|
|
implementation "com.android.support:design:${supportLibraryVersion}"
|
|
|
|
implementation 'com.jakewharton:disklrucache:2.0.2'
|
|
|
|
implementation "com.android.support:appcompat-v7:${supportLibraryVersion}"
|
|
|
|
implementation "com.android.support:cardview-v7:${supportLibraryVersion}"
|
|
|
|
implementation "com.android.support:exifinterface:${supportLibraryVersion}"
|
2017-08-14 10:16:56 +03:00
|
|
|
implementation 'com.github.albfernandez:juniversalchardet:v2.0.0'
|
2017-08-08 12:36:41 +03:00
|
|
|
implementation 'com.google.code.findbugs:annotations:2.0.1'
|
|
|
|
implementation 'commons-io:commons-io:2.5'
|
2018-03-19 21:04:14 +03:00
|
|
|
implementation 'com.github.evernote:android-job:v1.2.5'
|
2018-01-28 22:45:20 +03:00
|
|
|
implementation 'com.jakewharton:butterknife:8.8.1'
|
|
|
|
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
|
2017-08-08 12:36:41 +03:00
|
|
|
implementation 'org.greenrobot:eventbus:3.0.0'
|
|
|
|
implementation 'com.googlecode.ez-vcard:ez-vcard:0.10.2'
|
|
|
|
implementation 'org.lukhnos:nnio:0.2'
|
2018-01-13 11:43:53 +03:00
|
|
|
implementation 'com.madgag.spongycastle:pkix:1.54.0.0'
|
|
|
|
implementation 'com.google.code.gson:gson:2.8.2'
|
2018-01-24 17:59:51 +03:00
|
|
|
implementation 'com.afollestad:sectioned-recyclerview:0.5.0'
|
2018-05-18 21:01:40 +03:00
|
|
|
implementation 'com.github.chrisbanes:PhotoView:2.1.3'
|
2018-05-20 20:46:13 +03:00
|
|
|
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.12'
|
2017-08-23 16:52:14 +03:00
|
|
|
|
2018-01-15 15:33:34 +03:00
|
|
|
// uncomment for gplay
|
2017-08-08 12:36:41 +03:00
|
|
|
// implementation "com.google.firebase:firebase-messaging:${googleLibraryVersion}"
|
2017-08-18 09:08:50 +03:00
|
|
|
// implementation "com.google.android.gms:play-services-gcm:${googleLibraryVersion}"
|
2018-01-28 22:45:20 +03:00
|
|
|
implementation 'org.parceler:parceler-api:1.1.9'
|
|
|
|
annotationProcessor 'org.parceler:parceler:1.1.9'
|
2018-04-03 18:18:24 +03:00
|
|
|
implementation ('com.github.bumptech.glide:glide:3.7.0') {
|
|
|
|
exclude group: "com.android.support"
|
|
|
|
}
|
2017-08-08 12:36:41 +03:00
|
|
|
implementation 'com.caverock:androidsvg:1.2.1'
|
2017-08-31 09:01:39 +03:00
|
|
|
implementation "com.android.support:support-annotations:${supportLibraryVersion}"
|
2018-01-13 12:20:02 +03:00
|
|
|
implementation 'com.google.code.gson:gson:2.8.2'
|
2018-01-12 19:00:53 +03:00
|
|
|
|
2018-01-10 10:13:18 +03:00
|
|
|
// dependencies for local unit tests
|
2017-08-08 12:36:41 +03:00
|
|
|
testImplementation 'junit:junit:4.12'
|
|
|
|
testImplementation 'org.mockito:mockito-core:1.10.19'
|
2018-01-10 10:13:18 +03:00
|
|
|
// dependencies for instrumented tests
|
2017-02-23 17:11:56 +03:00
|
|
|
// JUnit4 Rules
|
2018-04-26 08:35:14 +03:00
|
|
|
androidTestImplementation 'com.android.support.test:rules:1.0.2'
|
2017-02-23 17:11:56 +03:00
|
|
|
// Android JUnit Runner
|
2018-04-26 08:35:14 +03:00
|
|
|
androidTestImplementation 'com.android.support.test:runner:1.0.2'
|
2017-08-31 09:01:39 +03:00
|
|
|
|
2017-02-23 17:11:56 +03:00
|
|
|
// Espresso core
|
2018-04-26 08:35:14 +03:00
|
|
|
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
|
|
|
|
androidTestImplementation 'com.android.support.test.espresso:espresso-contrib:3.0.2'
|
2017-02-23 17:11:56 +03:00
|
|
|
// UIAutomator - for cross-app UI tests, and to grant screen is turned on in Espresso tests
|
2018-01-18 23:37:55 +03:00
|
|
|
androidTestImplementation 'com.android.support.test.uiautomator:uiautomator-v18:2.1.3'
|
2017-02-23 17:11:56 +03:00
|
|
|
// fix conflict in dependencies; see http://g.co/androidstudio/app-test-app-conflict for details
|
2017-08-08 12:36:41 +03:00
|
|
|
//androidTestImplementation "com.android.support:support-annotations:${supportLibraryVersion}"
|
|
|
|
implementation 'org.jetbrains:annotations:15.0'
|
2017-09-28 14:53:37 +03:00
|
|
|
|
2018-04-03 18:18:24 +03:00
|
|
|
androidTestImplementation 'tools.fastlane:screengrab:1.0.0'
|
2018-03-02 14:08:09 +03:00
|
|
|
|
|
|
|
// jacocoAnt "org.jacoco:org.jacoco.ant:${jacocoVersion}"
|
|
|
|
// jacocoAgent "org.jacoco:org.jacoco.agent:${jacocoVersion}"
|
|
|
|
// androidJacocoAgent "org.jacoco:org.jacoco.agent:${jacocoVersion}"
|
|
|
|
// androidJacocoAnt "org.jacoco:org.jacoco.ant:${jacocoVersion}"
|
|
|
|
// androidJacocoAnt "org.jacoco:org.jacoco.core:${jacocoVersion}"
|
|
|
|
// androidJacocoAnt "org.jacoco:org.jacoco.report:${jacocoVersion}"
|
|
|
|
// androidJacocoAnt "org.jacoco:org.jacoco.agent:${jacocoVersion}"
|
2017-02-23 17:11:56 +03:00
|
|
|
}
|
|
|
|
|
2017-03-28 01:11:56 +03:00
|
|
|
configurations.all {
|
|
|
|
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
|
|
|
|
}
|
|
|
|
|
2017-02-23 17:11:56 +03:00
|
|
|
tasks.withType(Test) {
|
2018-01-10 10:13:18 +03:00
|
|
|
// increased logging for tests
|
2017-02-23 17:11:56 +03:00
|
|
|
testLogging {
|
|
|
|
events "passed", "skipped", "failed"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-03-29 18:43:08 +03:00
|
|
|
android.applicationVariants.all { variant ->
|
|
|
|
variant.outputs.all { output ->
|
|
|
|
outputFileName = "${output.baseName}-${variant.versionCode}.apk"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-03-02 14:08:09 +03:00
|
|
|
task combinedTestReport(type: JacocoReport) {
|
|
|
|
|
|
|
|
reports {
|
|
|
|
xml.enabled = true
|
|
|
|
html.enabled = true
|
|
|
|
}
|
|
|
|
|
|
|
|
def fileFilter = ['**/R.class', '**/R$*.class', '**/BuildConfig.*', '**/Manifest*.*', '**/*Test*.*', 'android/**/*.*']
|
|
|
|
def debugTree = fileTree(dir: "$project.buildDir/intermediates/classes/gplay/debug", excludes: fileFilter)
|
|
|
|
def mainSrc = "$project.projectDir/src/main/java"
|
|
|
|
|
|
|
|
sourceDirectories = files([mainSrc])
|
|
|
|
classDirectories = files([debugTree])
|
|
|
|
executionData = fileTree(dir: project.buildDir, includes: [
|
|
|
|
'jacoco/testGplayDebugUnitTest.exec', 'outputs/code-coverage/connected/flavors/GPLAY/*coverage.ec'
|
|
|
|
])
|
|
|
|
}
|
|
|
|
|
2018-05-24 15:34:08 +03:00
|
|
|
// uncomment for gplay (must be at the bottom)
|
|
|
|
// apply plugin: 'com.google.gms.google-services'
|