mirror of
https://github.com/nextcloud/android.git
synced 2024-11-24 14:15:44 +03:00
205 lines
6.5 KiB
Groovy
205 lines
6.5 KiB
Groovy
// 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.
|
|
|
|
buildscript {
|
|
repositories {
|
|
jcenter()
|
|
}
|
|
dependencies {
|
|
classpath 'com.android.tools.build:gradle:2.2.1'
|
|
}
|
|
}
|
|
|
|
apply plugin: 'com.android.application'
|
|
apply plugin: 'checkstyle'
|
|
apply plugin: 'pmd'
|
|
apply plugin: 'findbugs'
|
|
|
|
ext {
|
|
supportLibraryVersion = '24.2.1'
|
|
|
|
travisBuild = System.getenv("TRAVIS") == "true"
|
|
|
|
// allows for -Dpre-dex=false to be set
|
|
preDexEnabled = "true".equals(System.getProperty("pre-dex", "true"))
|
|
}
|
|
|
|
repositories {
|
|
jcenter()
|
|
maven { url "https://jitpack.io" }
|
|
|
|
flatDir {
|
|
dirs 'libs'
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
/// dependencies for app building
|
|
compile name: 'touch-image-view'
|
|
|
|
compile 'com.github.nextcloud:android-library:1.0.8'
|
|
compile "com.android.support:support-v4:${supportLibraryVersion}"
|
|
compile "com.android.support:design:${supportLibraryVersion}"
|
|
compile 'com.jakewharton:disklrucache:2.0.2'
|
|
compile "com.android.support:appcompat-v7:${supportLibraryVersion}"
|
|
compile 'com.getbase:floatingactionbutton:1.10.1'
|
|
compile 'com.google.code.findbugs:annotations:2.0.1'
|
|
|
|
|
|
/// dependencies for local unit tests
|
|
testCompile 'junit:junit:4.12'
|
|
testCompile 'org.mockito:mockito-core:1.10.19'
|
|
|
|
/// dependencies for instrumented tests
|
|
// JUnit4 Rules
|
|
androidTestCompile 'com.android.support.test:rules:0.5'
|
|
|
|
// Android JUnit Runner
|
|
androidTestCompile 'com.android.support.test:runner:0.5'
|
|
|
|
// Android Annotation Support
|
|
androidTestCompile "com.android.support:support-annotations:${supportLibraryVersion}"
|
|
|
|
// Espresso core
|
|
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2'
|
|
|
|
// UIAutomator - for cross-app UI tests, and to grant screen is turned on in Espresso tests
|
|
androidTestCompile 'com.android.support.test.uiautomator:uiautomator-v18:2.1.2'
|
|
// fix conflict in dependencies; see http://g.co/androidstudio/app-test-app-conflict for details
|
|
androidTestCompile "com.android.support:support-annotations:${supportLibraryVersion}"
|
|
|
|
|
|
}
|
|
|
|
tasks.withType(Test) {
|
|
/// increased logging for tests
|
|
testLogging {
|
|
events "passed", "skipped", "failed"
|
|
}
|
|
}
|
|
|
|
android {
|
|
lintOptions {
|
|
abortOnError true
|
|
lintConfig file("${project.rootDir}/lint.xml")
|
|
htmlReport true
|
|
htmlOutput file("$project.buildDir/reports/lint/lint.html")
|
|
}
|
|
compileSdkVersion 24
|
|
buildToolsVersion "24.0.2"
|
|
|
|
defaultConfig {
|
|
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
|
|
|
// arguments to be passed to functional tests
|
|
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\""
|
|
|
|
applicationId "com.nextcloud.client"
|
|
}
|
|
|
|
// 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
|
|
sourceSets {
|
|
main {
|
|
manifest.srcFile 'AndroidManifest.xml'
|
|
java.srcDirs = ['src']
|
|
resources.srcDirs = ['src']
|
|
aidl.srcDirs = ['src']
|
|
renderscript.srcDirs = ['src']
|
|
res.srcDirs = ['res']
|
|
assets.srcDirs = ['assets']
|
|
}
|
|
|
|
|
|
// move whole local unit tests structure as a whole from src/test/* to test/*
|
|
test.setRoot('test')
|
|
|
|
// move whole instrumented tests structure as a whole from src/androidTest/* to androidTest/*
|
|
androidTest.setRoot('androidTest')
|
|
|
|
|
|
// Move the build types to build-types/<type>
|
|
// For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
|
|
// This moves them out of them default location under src/<type>/... which would
|
|
// conflict with src/ being used by the main source set.
|
|
// Adding new build types or product flavors should be accompanied
|
|
// by a similar customization.
|
|
debug.setRoot('build-types/debug')
|
|
release.setRoot('build-types/release')
|
|
}
|
|
|
|
dexOptions {
|
|
// Skip pre-dexing when running on Travis CI or when disabled via -Dpre-dex=false.
|
|
preDexLibraries = preDexEnabled && !travisBuild
|
|
}
|
|
|
|
compileOptions {
|
|
sourceCompatibility JavaVersion.VERSION_1_7
|
|
targetCompatibility JavaVersion.VERSION_1_7
|
|
}
|
|
|
|
lintOptions {
|
|
abortOnError false
|
|
}
|
|
|
|
packagingOptions {
|
|
exclude 'META-INF/LICENSE.txt'
|
|
}
|
|
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 {
|
|
destination "$project.buildDir/reports/pmd/pmd.xml"
|
|
}
|
|
html {
|
|
destination "$project.buildDir/reports/pmd/pmd.html"
|
|
}
|
|
}
|
|
}
|
|
|
|
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 {
|
|
destination "$project.buildDir/reports/findbugs/findbugs.html"
|
|
}
|
|
}
|
|
classpath = files()
|
|
}
|
|
check.dependsOn 'checkstyle', 'findbugs', 'pmd', 'lint'
|
|
|
|
}
|