apply plugin: 'com.android.library' apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' apply plugin: 'org.jetbrains.dokka' apply plugin: 'maven' apply plugin: 'signing' android { compileSdkVersion 30 buildToolsVersion "30.0.2" defaultConfig { minSdkVersion 16 targetSdkVersion 30 versionCode 151 versionName "$libVersion" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" consumerProguardFiles "consumer-rules.pro" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } } // sourceSets { // main { // java { // include '**/*.java' // include '**/*.kt' // } // } // } } dependencies { implementation fileTree(dir: "libs", include: ["*.jar"]) implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" implementation 'androidx.core:core-ktx:1.3.2' implementation 'androidx.appcompat:appcompat:1.2.0' api 'org.tensorflow:tensorflow-lite:2.1.0' api 'org.tensorflow:tensorflow-lite-gpu:2.1.0' //协程相关 implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.2" } Properties properties = new Properties() properties.load(project.rootProject.file('local.properties').newDataInputStream()) def lUsername = properties.getProperty("username") def lPassword = properties.getProperty("password") group="io.github.devzwy" version="$libVersion" uploadArchives { repositories { mavenDeployer { beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) } repository(url: "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/") { authentication(userName: lUsername, password: lPassword) } pom.project { name 'nsfw' packaging 'jar' description 'android端离线鉴黄库' url 'https://github.com/devzwy/open_nsfw_android' scm { connection 'scm:git:https://github.com/devzwy/open_nsfw_android.git' developerConnection 'scm:git:https://github.com/devzwy/open_nsfw_android.git' url 'https://github.com/devzwy/open_nsfw_android' } licenses { license { name 'The Apache License, Version 2.0' url 'http://www.apache.org/licenses/LICENSE-2.0.txt' } } developers { developer { id 'nsfw' name 'dev_zwy' email 'dev_zwy@aliyun.com' } } } } } } signing { sign configurations.archives } task generateSourcesJar(type: Jar) { group = 'jar' from android.sourceSets.main.java.srcDirs classifier = 'sources' } task sourcesJar(type: Jar) { from android.sourceSets.main.java.srcDirs classifier = 'sources' } task javadoc(type: Javadoc) { source = android.sourceSets.main.java.srcDirs options.encoding = "UTF-8" classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) } task javadocJar(type: Jar, dependsOn: javadoc) { classifier = 'javadoc' from javadoc.destinationDir } task dokkaJavadoc(type: org.jetbrains.dokka.gradle.DokkaTask) { outputFormat = 'javadoc' outputDirectory = javadoc.destinationDir } task generateJavadoc(type: Jar, dependsOn: dokkaJavadoc) { group = 'jar' classifier = 'javadoc' from javadoc.destinationDir } artifacts { archives generateJavadoc //javadocJar archives generateSourcesJar //sourcesJar }