Skip to content

Commit

Permalink
修复远端仓库无法正常依赖的问题,升级到1.3.9
Browse files Browse the repository at this point in the history
  • Loading branch information
赵文文 committed Oct 16, 2020
1 parent 011a1c5 commit 76c9f8f
Show file tree
Hide file tree
Showing 6 changed files with 252 additions and 45 deletions.
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
![图片](https://github.com/devzwy/open_nsfw_android/blob/dev/img/demopic.png)


### 开始使用(从1.3.7版本开始,依赖从JetPack移动到Maven仓库,可直接在项目中依赖,无需添加jetpack支持)
### 开始使用(从1.3.9版本开始,依赖从JetPack移动到Maven仓库,可直接在项目中依赖,无需添加jetpack支持)

- 开启tflite文件支持

Expand All @@ -29,13 +29,16 @@
}
}
```
- 引入依赖
- 引入依赖(lastVersion更换为最新版本,最新版本为右边图片中的数字👉[ ![Download](https://api.bintray.com/packages/devzwy/maven/nsfw/images/download.svg) ](https://bintray.com/devzwy/maven/nsfw/_latestVersion))

```
//可选 快速初始化扫描器,可免去初始化代码
implementation 'com.zwy.nsfw:nsfw_initializer:1.3.7'
implementation 'com.zwy.nsfw:nsfw_initializer:lastVersion'
//必须 扫描器核心文件
implementation 'com.zwy.nsfw:nsfw:1.3.7'
implementation 'com.zwy.nsfw:nsfw:lastVersion'
//必须 tensorflow 支持库
implementation 'org.tensorflow:tensorflow-lite:2.1.0'
implementation 'org.tensorflow:tensorflow-lite-gpu:2.1.0'
```

- 初始化
Expand Down
11 changes: 7 additions & 4 deletions README_EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@



### start use(As of version 1.3.7, dependencies are moved from jetpack to Maven repository, which can be directly dependent in the project without adding jetpack support)
### start use(As of version 1.3.9, dependencies are moved from jetpack to Maven repository, which can be directly dependent in the project without adding jetpack support)

- Open tflite support

Expand All @@ -29,13 +29,16 @@
}
}
```
- Dependencies
- Dependencies [ ![Download](https://api.bintray.com/packages/devzwy/maven/nsfw/images/download.svg) ](https://bintray.com/devzwy/maven/nsfw/_latestVersion)

```
//Optional Quick initialization of scanner, can avoid initialization code
implementation 'com.zwy.nsfw:nsfw_initializer:1.3.7'
implementation 'com.zwy.nsfw:nsfw_initializer:lastVersion'
//must Scanner core file
implementation 'com.zwy.nsfw:nsfw:1.3.7'
implementation 'com.zwy.nsfw:nsfw:lastVersion'
//must tensorflow
implementation 'org.tensorflow:tensorflow-lite:2.1.0'
implementation 'org.tensorflow:tensorflow-lite-gpu:2.1.0'
```

- Initialization
Expand Down
15 changes: 9 additions & 6 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ android {
applicationId "com.zww.sample"
minSdkVersion 21
targetSdkVersion 30
versionCode 137
versionName "1.3.7"
versionCode 139
versionName "$libVersion"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
Expand Down Expand Up @@ -53,9 +53,12 @@ dependencies {
implementation 'com.github.bumptech.glide:glide:4.11.0'
kapt 'com.github.bumptech.glide:compiler:4.11.0'

// implementation 'com.zwy.nsfw:nsfw_initializer:1.3.7'
// implementation 'com.zwy.nsfw:nsfw:1.3.7'

implementation project(path: ':nsfw_initializer')
implementation project(path: ':nsfw')
implementation 'com.zwy.nsfw:nsfw_initializer:1.3.9'
implementation 'com.zwy.nsfw:nsfw:1.3.9'
implementation 'org.tensorflow:tensorflow-lite:2.1.0'
implementation 'org.tensorflow:tensorflow-lite-gpu:2.1.0'

// implementation project(path: ':nsfw_initializer')
// implementation project(path: ':nsfw')
}
11 changes: 10 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
buildscript {
ext.kotlin_version = '1.3.72'
ext.libVersion = '1.3.9'
repositories {
google()
jcenter()
Expand All @@ -8,7 +9,9 @@ buildscript {
dependencies {
classpath 'com.android.tools.build:gradle:4.0.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "guru.stefma.bintrayrelease:bintrayrelease:1.0.0"
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
classpath "org.jetbrains.dokka:dokka-gradle-plugin:0.9.18"
}
}

Expand All @@ -18,6 +21,12 @@ allprojects {
jcenter()
mavenCentral()
}

tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
options.addStringOption('encoding', 'UTF-8')
options.encoding = "GBK"
}
}

task clean(type: Delete) {
Expand Down
124 changes: 109 additions & 15 deletions nsfw/build.gradle
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: "guru.stefma.bintrayrelease"
apply plugin: 'com.github.dcendents.android-maven'
apply plugin: 'com.jfrog.bintray'
apply plugin: 'org.jetbrains.dokka'
android {
compileSdkVersion 30
buildToolsVersion "30.0.2"

defaultConfig {
minSdkVersion 21
targetSdkVersion 30
versionCode 137
versionName "1.3.7"
versionCode 139
versionName "$libVersion"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
Expand All @@ -22,6 +24,15 @@ android {
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}

sourceSets {
main {
java {
include '**/*.java'
include '**/*.kt'
}
}
}
}

dependencies {
Expand All @@ -37,18 +48,101 @@ dependencies {
implementation 'org.tensorflow:tensorflow-lite-gpu:2.1.0'
}

version = "1.3.7"
group = "com.zwy.nsfw"
publish {
userOrg = 'devzwy'
repoName = 'maven'
artifactId = 'nsfw'
desc = 'android端离线鉴黄库'
website = 'https://github.com/devzwy'
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 = "com.zwy.nsfw" // (**慎重填写**)这里是groupId ,必须填写 一般填你唯一的包名,对应com.squareup.okhttp3:okhttp:3.4.1中的com.squareup.okhttp3部分

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
}

tasks.withType(Javadoc) {//防止编码问题
options.addStringOption('Xdoclint:none', '-quiet')
options.addStringOption('encoding', 'UTF-8')
options.addStringOption('charSet', 'UTF-8')
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端离线鉴黄库'
}
}
Loading

0 comments on commit 76c9f8f

Please sign in to comment.