0
0
mirror of https://github.com/ankidroid/Anki-Android.git synced 2024-09-20 12:02:16 +02:00
Anki-Android/api/build.gradle

121 lines
3.5 KiB
Groovy
Raw Normal View History

apply plugin: 'com.android.library'
def groupId = "com.ichi2.anki"
def artifactId = "api"
2018-05-29 22:27:52 +02:00
def version = "1.1.0alpha6"
repositories {
google()
jcenter()
}
android {
compileSdkVersion 28
defaultConfig {
minSdkVersion 8
targetSdkVersion 28
2018-05-29 22:45:08 +02:00
versionCode 11016 // 4th digit: 1=alpha, 2=beta, 3=official
versionName version
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
testOptions {
unitTests {
includeAndroidResources = true
}
}
testOptions.unitTests.all {
testLogging {
events "failed", "skipped"
showStackTraces = true
exceptionFormat = "full"
}
maxParallelForks = gradleTestMaxParallelForks
}
}
dependencies {
api fileTree(dir: 'libs', include: ['*.jar'])
testImplementation 'org.junit.vintage:junit-vintage-engine:5.3.2'
Dependency updates (powermock, robolectric, okhttp) (#5121) * Bump robolectric from 4.0.1 to 4.0.2 Bumps [robolectric](https://github.com/robolectric/robolectric) from 4.0.1 to 4.0.2. - [Release notes](https://github.com/robolectric/robolectric/releases) - [Commits](https://github.com/robolectric/robolectric/compare/robolectric-4.0.1...robolectric-4.0.2) Signed-off-by: dependabot[bot] <support@dependabot.com> * Bump okhttp from 3.11.0 to 3.12.0 Bumps [okhttp](https://github.com/square/okhttp) from 3.11.0 to 3.12.0. - [Release notes](https://github.com/square/okhttp/releases) - [Changelog](https://github.com/square/okhttp/blob/master/CHANGELOG.md) - [Commits](https://github.com/square/okhttp/compare/parent-3.11.0...parent-3.12.0) Signed-off-by: dependabot[bot] <support@dependabot.com> * Bump powermock-core from 2.0.0-RC.3 to 2.0.0-RC.4 Bumps [powermock-core](https://github.com/powermock/powermock) from 2.0.0-RC.3 to 2.0.0-RC.4. - [Release notes](https://github.com/powermock/powermock/releases) - [Changelog](https://github.com/powermock/powermock/blob/release/2.x/docs/changelog.txt) - [Commits](https://github.com/powermock/powermock/compare/powermock-2.0.0-RC.3...powermock-2.0.0-RC.4) Signed-off-by: dependabot[bot] <support@dependabot.com> * Bump powermock-api-mockito2 from 2.0.0-RC.3 to 2.0.0-RC.4 Bumps [powermock-api-mockito2](https://github.com/powermock/powermock) from 2.0.0-RC.3 to 2.0.0-RC.4. - [Release notes](https://github.com/powermock/powermock/releases) - [Changelog](https://github.com/powermock/powermock/blob/release/2.x/docs/changelog.txt) - [Commits](https://github.com/powermock/powermock/compare/powermock-2.0.0-RC.3...powermock-2.0.0-RC.4) Signed-off-by: dependabot[bot] <support@dependabot.com> * Bump powermock-module-junit4 from 2.0.0-RC.3 to 2.0.0-RC.4 Bumps [powermock-module-junit4](https://github.com/powermock/powermock) from 2.0.0-RC.3 to 2.0.0-RC.4. - [Release notes](https://github.com/powermock/powermock/releases) - [Changelog](https://github.com/powermock/powermock/blob/release/2.x/docs/changelog.txt) - [Commits](https://github.com/powermock/powermock/compare/powermock-2.0.0-RC.3...powermock-2.0.0-RC.4) Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-11-19 14:51:54 +01:00
testImplementation "org.robolectric:robolectric:4.0.2"
}
// Borrowed from here:
// http://blog.blundell-apps.com/locally-release-an-android-library-for-jcenter-or-maven-central-inclusion/
apply plugin: 'maven'
def localReleaseDest = "${buildDir}/release/${version}"
task androidJavadocs(type: Javadoc) {
source = android.sourceSets.main.java.srcDirs
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
// Java 10 wants you to choose between html4 and html5. We are html5 clean and should use it.
// But in JDK < 10 the option isn't there and it breaks the build. This handles both.
if(JavaVersion.current() >= JavaVersion.VERSION_1_10){
options.addBooleanOption('html5', true)
}
}
// Deprecation is an error. Use @SuppressWarnings("deprecation") and justify in the PR if you must
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:deprecation" << "-Xmaxwarns" << "1000" << "-Werror"
}
task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) {
classifier = 'javadoc'
from androidJavadocs.destinationDir
}
task androidSourcesJar(type: Jar) {
classifier = 'sources'
from android.sourceSets.main.java.srcDirs
}
uploadArchives {
repositories.mavenDeployer {
pom.groupId = groupId
pom.artifactId = artifactId
pom.version = version
// Add other pom properties here if you want (developer details / licenses)
repository(url: "file://${localReleaseDest}")
}
}
task zipRelease(type: Zip) {
from localReleaseDest
destinationDir buildDir
archiveName "release-${version}.zip"
}
task generateRelease {
doLast {
println "Release ${version} can be found at ${localReleaseDest}/"
println "Release ${version} zipped can be found ${buildDir}/release-${version}.zip"
}
}
generateRelease.dependsOn(uploadArchives)
generateRelease.dependsOn(zipRelease)
artifacts {
archives androidSourcesJar
archives androidJavadocsJar
}
// Deprecation is an error. Use @SuppressWarnings("deprecation") and justify in the PR if you must
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:deprecation" << "-Xmaxwarns" << "1000" << "-Werror"
// https://guides.gradle.org/performance/#compiling_java
// 1- fork improves things over time with repeated builds, doesn't harm CI single builds
options.fork = true
// 2- incremental will be the default in the future and can help now
options.incremental = true
}