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] 02c444bade Bump annotation from 1.3.0 to 1.4.0
Bumps annotation from 1.3.0 to 1.4.0.

---
updated-dependencies:
- dependency-name: androidx.annotation:annotation
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-07-04 22:34:37 -05:00

136 lines
4.1 KiB
Groovy

plugins {
id 'maven-publish'
id 'com.android.library'
id 'kotlin-android'
}
group = "com.ichi2.anki"
version = "2.0.0"
repositories {
google()
mavenCentral()
}
android {
compileSdkVersion 31
defaultConfig {
minSdkVersion 14
//noinspection OldTargetApi
targetSdkVersion 29
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
apply from: "../lint.gradle"
dependencies {
implementation 'androidx.annotation:annotation:1.4.0'
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
testImplementation "org.junit.jupiter:junit-jupiter:$junit_version"
testImplementation "org.junit.vintage:junit-vintage-engine:$junit_version"
testImplementation 'org.robolectric:robolectric:4.8.1'
lintChecks project(":lint-rules")
}
task androidSourcesJar(type: Jar) {
archiveClassifier.set('sources')
// For Android libraries
from android.sourceSets.main.java.srcDirs
}
task androidJavadocs(type: Javadoc) {
source = android.sourceSets.main.java.srcDirs
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
android.libraryVariants.all { variant ->
if (variant.name == 'release') {
owner.classpath += variant.javaCompileProvider.get().classpath
}
}
exclude '**/R.html', '**/R.*.html', '**/index.html'
if (JavaVersion.current().isJava9Compatible()) {
options.addBooleanOption('html5', true)
}
}
task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) {
archiveClassifier.set('javadoc')
from androidJavadocs.destinationDir
}
publishing {
publications {
mavenJava(MavenPublication) {
artifactId = "api"
artifact("$buildDir/outputs/aar/${project.getName()}-release.aar")
artifact androidSourcesJar
artifact androidJavadocsJar
versionMapping {
usage('java-api') {
fromResolutionOf('runtimeClasspath')
}
usage('java-runtime') {
fromResolutionResult()
}
}
pom {
name = 'AnkiDroid API'
description = 'A programmatic API exported by AnkiDroid'
url = 'https://github.com/ankidroid/Anki-Android/tree/main/api'
licenses {
license {
name = 'GNU LESSER GENERAL PUBLIC LICENSE, v3'
url = 'https://github.com/ankidroid/Anki-Android/blob/main/api/COPYING.LESSER'
}
}
scm {
connection = 'scm:git:git://github.com/ankidroid/Anki-Android.git'
url = 'https://github.com/ankidroid/Anki-Android'
}
}
}
}
repositories {
maven {
// change URLs to point to your repos, e.g. http://my.org/repo
def releasesRepoUrl = layout.buildDirectory.dir('repos/releases')
def snapshotsRepoUrl = layout.buildDirectory.dir('repos/snapshots')
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
}
}
}
task zipRelease(type: Zip) {
from layout.buildDirectory.dir('repos/releases')
destinationDirectory = buildDir
archiveFileName = "${buildDir}/release-${archiveVersion.get()}.zip"
}
// Use this task to make a release you can send to someone
// You may like `./gradlew :api:publishToMavenLocal for development
task generateRelease {
doLast {
println "Release ${version} can be found at ${buildDir}/repos/releases/"
println "Release ${version} zipped can be found ${buildDir}/release-${version}.zip"
}
}
publishMavenJavaPublicationToMavenRepository.dependsOn(assemble)
publish.dependsOn(assemble)
generateRelease.dependsOn(publish)
generateRelease.dependsOn(zipRelease)
apply from: "./kotlinMigration-api.gradle"