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

98 lines
2.7 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"
android {
compileSdkVersion 27
defaultConfig {
minSdkVersion 8
targetSdkVersion 27
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
}
}
}
dependencies {
api fileTree(dir: 'libs', include: ['*.jar'])
testImplementation 'org.junit.vintage:junit-vintage-engine:5.3.1'
2018-11-01 22:16:18 +01:00
testImplementation "org.robolectric:robolectric:4.0.1"
}
// 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
}