bilibili-api/build.gradle
2020-10-04 14:36:35 +08:00

156 lines
4.8 KiB
Groovy

buildscript {
ext {
kotlin_version = '1.4.10'
kotlin_coroutines_version = '1.3.9'
ktor_version = '1.3.1'
jvm_target = JavaVersion.VERSION_1_8
}
repositories {
gradlePluginPortal()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
group = 'com.hiczp'
version = '0.2.1'
description = 'Bilibili Android client API library for Kotlin'
apply plugin: 'kotlin'
apply plugin: 'maven-publish'
apply plugin: 'signing'
repositories {
mavenCentral()
jcenter()
mavenLocal()
}
//kotlin
dependencies {
// https://mvnrepository.com/artifact/org.jetbrains.kotlin/kotlin-stdlib-jdk8
compile group: 'org.jetbrains.kotlin', name: 'kotlin-stdlib-jdk8'
// https://mvnrepository.com/artifact/org.jetbrains.kotlinx/kotlinx-coroutines-core
compile group: 'org.jetbrains.kotlinx', name: 'kotlinx-coroutines-core', version: kotlin_coroutines_version
}
compileKotlin {
kotlinOptions {
jvmTarget = jvm_target
freeCompilerArgs = ["-Xjvm-default=enable", "-Xopt-in=kotlin.RequiresOptIn", "-XXLanguage:+InlineClasses"]
}
}
compileTestKotlin {
kotlinOptions.jvmTarget = jvm_target
}
//logging
dependencies {
// https://mvnrepository.com/artifact/io.github.microutils/kotlin-logging
compile group: 'io.github.microutils', name: 'kotlin-logging', version: '1.7.9'
// https://mvnrepository.com/artifact/org.slf4j/slf4j-simple
testCompile group: 'org.slf4j', name: 'slf4j-simple', version: '1.7.30'
}
//http
dependencies {
// https://mvnrepository.com/artifact/com.squareup.retrofit2/retrofit
compile group: 'com.squareup.retrofit2', name: 'retrofit', version: '2.8.1'
// https://mvnrepository.com/artifact/com.squareup.retrofit2/converter-gson
compile group: 'com.squareup.retrofit2', name: 'converter-gson', version: '2.8.1'
// https://mvnrepository.com/artifact/com.github.salomonbrys.kotson/kotson
compile group: 'com.github.salomonbrys.kotson', name: 'kotson', version: '2.5.0'
// https://mvnrepository.com/artifact/com.jakewharton.retrofit/retrofit2-kotlin-coroutines-adapter
compile group: 'com.jakewharton.retrofit', name: 'retrofit2-kotlin-coroutines-adapter', version: '0.9.2'
// https://mvnrepository.com/artifact/com.squareup.okhttp3/logging-interceptor
compile group: 'com.squareup.okhttp3', name: 'logging-interceptor', version: '4.5.0'
}
//ktor
dependencies {
// https://mvnrepository.com/artifact/io.ktor/ktor-client-websockets
compile group: 'io.ktor', name: 'ktor-client-websockets', version: ktor_version
// https://mvnrepository.com/artifact/io.ktor/ktor-client-cio
compile group: 'io.ktor', name: 'ktor-client-cio', version: ktor_version
}
//checksum
dependencies {
// https://mvnrepository.com/artifact/com.hiczp/crc32-crack
compile group: 'com.hiczp', name: 'crc32-crack', version: '1.0'
}
//unit test
dependencies {
// https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter
testCompile group: 'org.junit.jupiter', name: 'junit-jupiter', version: '5.6.1'
}
task sourcesJar(type: Jar) {
from sourceSets.main.allSource
archiveClassifier = 'sources'
}
task javadocJar(type: Jar) {
from javadoc
archiveClassifier = 'javadoc'
}
publishing {
repositories {
maven {
url = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
credentials {
username = project.properties.ossUsername
password = project.properties.ossPassword
}
}
}
publications {
mavenJava(MavenPublication) {
from components.java
artifact sourcesJar
artifact javadocJar
pom {
name = project.name
description = project.description
url = 'https://github.com/czp3009/bilibili-api'
licenses {
license {
name = 'GNU GENERAL PUBLIC LICENSE Version 3'
url = 'https://www.gnu.org/licenses/gpl-3.0.txt'
}
}
developers {
developer {
id = 'czp3009'
name = 'czp3009'
email = 'czp3009@gmail.com'
url = 'https://www.hiczp.com'
}
}
scm {
connection = 'scm:git:git://github.com/czp3009/bilibili-api.git'
developerConnection = 'scm:git:ssh://github.com/czp3009/bilibili-api.git'
url = 'https://github.com/czp3009/bilibili-api'
}
}
}
}
}
signing {
sign publishing.publications.mavenJava
}
gradle.taskGraph.whenReady { taskGraph ->
tasks.signMavenJavaPublication.onlyIf { taskGraph.hasTask tasks.publish }
}