2015-09-10 22:08:18 +02:00
|
|
|
apply plugin: 'com.android.library'
|
|
|
|
|
2015-09-11 09:27:17 +02:00
|
|
|
def groupId = "com.ichi2.anki"
|
|
|
|
def artifactId = "api"
|
2018-05-29 22:27:52 +02:00
|
|
|
def version = "1.1.0alpha6"
|
2015-09-11 09:27:17 +02:00
|
|
|
|
2015-09-10 22:08:18 +02:00
|
|
|
android {
|
2018-09-19 03:59:12 +02:00
|
|
|
compileSdkVersion 27
|
2015-09-10 22:08:18 +02:00
|
|
|
|
|
|
|
defaultConfig {
|
|
|
|
minSdkVersion 8
|
2018-09-19 03:59:12 +02:00
|
|
|
targetSdkVersion 27
|
2018-05-29 22:45:08 +02:00
|
|
|
versionCode 11016 // 4th digit: 1=alpha, 2=beta, 3=official
|
2015-09-11 09:27:17 +02:00
|
|
|
versionName version
|
2015-09-10 22:08:18 +02:00
|
|
|
}
|
|
|
|
buildTypes {
|
|
|
|
release {
|
|
|
|
minifyEnabled false
|
|
|
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
|
|
|
}
|
|
|
|
}
|
2018-10-16 19:10:01 +02:00
|
|
|
testOptions {
|
|
|
|
unitTests {
|
|
|
|
includeAndroidResources = true
|
|
|
|
}
|
|
|
|
}
|
2015-09-10 22:08:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
dependencies {
|
2018-05-19 04:55:10 +02:00
|
|
|
api fileTree(dir: 'libs', include: ['*.jar'])
|
2018-10-26 19:05:51 +02:00
|
|
|
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"
|
2015-09-10 22:08:18 +02:00
|
|
|
}
|
2015-09-11 09:27:17 +02:00
|
|
|
|
|
|
|
// 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))
|
2018-06-08 05:42:25 +02:00
|
|
|
|
|
|
|
// 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)
|
|
|
|
}
|
2015-09-11 09:27:17 +02:00
|
|
|
}
|
|
|
|
|
2018-10-07 08:12:44 +02:00
|
|
|
// 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"
|
|
|
|
}
|
|
|
|
|
2015-09-11 09:27:17 +02:00
|
|
|
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"
|
|
|
|
}
|
|
|
|
|
2018-05-19 04:55:10 +02:00
|
|
|
task generateRelease {
|
|
|
|
doLast {
|
|
|
|
println "Release ${version} can be found at ${localReleaseDest}/"
|
|
|
|
println "Release ${version} zipped can be found ${buildDir}/release-${version}.zip"
|
|
|
|
}
|
2015-09-11 09:27:17 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
generateRelease.dependsOn(uploadArchives)
|
|
|
|
generateRelease.dependsOn(zipRelease)
|
|
|
|
|
|
|
|
artifacts {
|
|
|
|
archives androidSourcesJar
|
|
|
|
archives androidJavadocsJar
|
|
|
|
}
|