You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
open_nsfw_android/nsfw/build.gradle

233 lines
7.5 KiB

apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
//apply plugin: 'com.github.dcendents.android-maven'
//apply plugin: 'com.jfrog.bintray'
apply plugin: 'org.jetbrains.dokka'
apply plugin: 'maven-publish'
group 'com.zwy.nsfw'
version "$libVersion"
android {
compileSdkVersion 30
buildToolsVersion "30.0.2"
defaultConfig {
minSdkVersion 21
targetSdkVersion 30
versionCode 139
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"
}
//version = "$libVersion"
//group = "com.zwy.nsfw"
//publish {
// userOrg = 'devzwy'
// repoName = 'maven'
// artifactId = 'nsfw'
// desc = 'android端离线鉴黄库'
// website = 'https://github.com/devzwy'
//}
//
//tasks.withType(Javadoc) {//防止编码问题
// options.addStringOption('Xdoclint:none', '-quiet')
// options.addStringOption('encoding', 'UTF-8')
// options.addStringOption('charSet', 'UTF-8')
//}
def siteUrl = 'https://github.com/devzwy/open_nsfw_android' // 项目的主页(可以写自己的库的GitHub地址)
def gitUrl = 'https://github.com/devzwy/open_nsfw_android.git' // Git仓库的url
group = "io.github.devzwy" // (**慎重填写**)这里是groupId ,必须填写 一般填你唯一的包名,对应com.squareup.okhttp3:okhttp:3.4.1中的com.squareup.okhttp3部分
Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())
def lUsername = properties.getProperty("username")
def lPassword = properties.getProperty("password")
publishing {
publications {
// 推送
publishMyProjectMiniexcel(MavenPublication) {
// 编译jar包
// from components.java
// // 打包源码
// artifact generateSourcesJar
// // javadoc
// artifact generateJavadoc
pom {
name = "nsfw"
description = "android端离线鉴黄库"
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 = "devzwy"
name = "devzwy"
email = "dev_zwy@aliyun.com"
}
}
scm {
connection = gitUrl
developerConnection = gitUrl
url = siteUrl
}
}
}
}
// 到 https://oss.sonatype.org/#nexus-search; 搜索是否上传成功
//Properties properties = new Properties()
//properties.load(project.rootProject.file('local.properties').newDataInputStream())
//bintray {
// user = properties.getProperty("bintray.username") //读取 local.properties 文件里面的 bintray.user
// key = properties.getProperty("bintray.password") //读取 local.properties 文件里面的 bintray.apikey
// configurations = ['archives']
repositories {
//configurations = ['archives']
// 发布Release版本可在版本号后面带上'-RELEASE',也可不带
maven {
name 'Release'
url 'https://oss.sonatype.org/service/local/staging/deploy/maven2'
credentials {
username = lUsername
password = lPassword
}
}
// 发布Snapshot快照版本必须在版本号后面加上'-SNAPSHOT'
// maven {
// name = 'Snapshot'
// url = 'https://oss.sonatype.org/content/repositories/snapshots'
// credentials {
// username = "${NEXUS_USERNAME}"
// password = "${NEXUS_PASSWORD}"
// }
// }
}
}
//install {
// repositories.mavenInstaller {
// pom {
// project {
// packaging 'aar'
// name 'nsfw' //项目名字
// url siteUrl
// licenses {
// license {
// name = 'The Apache Software License, Version 2.0'
// url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
// }
// }
// developers {
// developer {
// id 'z' //填写开发者的一些基本信息
// name 'Jason' //填写开发者的一些基本信息
// email 'dev_zwy@aliyun.com' //填写开发者的一些基本信息
// }
// }
// scm {
// connection gitUrl
// developerConnection gitUrl
// url siteUrl
// }
// }
// }
// }
//}
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
}
//Properties properties = new Properties()
//properties.load(project.rootProject.file('local.properties').newDataInputStream())
//bintray {
// user = properties.getProperty("bintray.user") //读取 local.properties 文件里面的 bintray.user
// key = properties.getProperty("bintray.apikey") //读取 local.properties 文件里面的 bintray.apikey
// configurations = ['archives']
// pkg {
// repo = "maven" //(**慎重填写**)这里填写在bintray中自己新建仓库的名字
// name = "nsfw" //(**慎重填写**)发布到JCenter上的项目名字,必须填写,对应com.squareup.okhttp3:okhttp:3.4.1中的okhttp
// websiteUrl = siteUrl
// vcsUrl = gitUrl
// licenses = ["Apache-2.0"]
// publish = true
// desc = 'android端离线鉴黄库'
// }
//}