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
dependabot[bot] 1d88c0ce62 Bump junit-vintage-engine from 5.3.1 to 5.3.2
Bumps [junit-vintage-engine](https://github.com/junit-team/junit5) from 5.3.1 to 5.3.2.
- [Release notes](https://github.com/junit-team/junit5/releases)
- [Commits](https://github.com/junit-team/junit5/compare/r5.3.1...r5.3.2)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-11-28 10:10:36 -05:00

121 lines
3.5 KiB
Groovy

apply plugin: 'com.android.library'
def groupId = "com.ichi2.anki"
def artifactId = "api"
def version = "1.1.0alpha6"
repositories {
google()
jcenter()
}
android {
compileSdkVersion 28
defaultConfig {
minSdkVersion 8
targetSdkVersion 28
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'
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
}