Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xiaoxuan_i809
AndroidUtilCode
提交
480447dd
A
AndroidUtilCode
项目概览
xiaoxuan_i809
/
AndroidUtilCode
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
A
AndroidUtilCode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
480447dd
编写于
3月 27, 2020
作者:
B
Blankj
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
see 03/27 log
上级
d21758b0
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
208 addition
and
125 deletion
+208
-125
CHANGELOG.md
CHANGELOG.md
+1
-0
buildSrc/build.gradle
buildSrc/build.gradle
+2
-2
buildSrc/src/main/groovy/Config.groovy
buildSrc/src/main/groovy/Config.groovy
+8
-9
buildSrc/src/main/java/com/blankj/plugin/readme/FormatUtils.groovy
...src/main/java/com/blankj/plugin/readme/FormatUtils.groovy
+1
-1
buildSrc/src/main/java/com/blankj/plugin/readme/ReadmeCorePlugin.groovy
...ain/java/com/blankj/plugin/readme/ReadmeCorePlugin.groovy
+1
-1
buildSrc/src/main/java/com/blankj/plugin/readme/ReadmeExtension.groovy
...main/java/com/blankj/plugin/readme/ReadmeExtension.groovy
+1
-1
buildSrc/src/main/java/com/blankj/plugin/readme/ReadmeSubPlugin.groovy
...main/java/com/blankj/plugin/readme/ReadmeSubPlugin.groovy
+5
-8
gradle/publish.gradle
gradle/publish.gradle
+177
-89
lib/utilcode/build.gradle
lib/utilcode/build.gradle
+4
-6
plugin/api-gradle-plugin/build.gradle
plugin/api-gradle-plugin/build.gradle
+4
-4
plugin/bus-gradle-plugin/build.gradle
plugin/bus-gradle-plugin/build.gradle
+4
-4
未找到文件。
CHANGELOG.md
浏览文件 @
480447dd
*
`20/03/27`
[opt] publish.gradle
*
`20/01/17`
[upd] Leak Canary to v2.1.
*
`19/11/30`
[add] Publish bus plugin v2.4. Publish api plugin v1.2.
*
`19/11/28`
[add] Publish v1.26.0.
...
...
buildSrc/build.gradle
浏览文件 @
480447dd
...
...
@@ -12,12 +12,12 @@ gradlePlugin {
plugins
{
readmeCore
{
id
=
'readme-core'
implementationClass
=
'com.blankj.plugin.ReadmeCorePlugin'
implementationClass
=
'com.blankj.plugin.
readme.
ReadmeCorePlugin'
}
readmeSub
{
id
=
'readme-sub'
implementationClass
=
'com.blankj.plugin.ReadmeSubPlugin'
implementationClass
=
'com.blankj.plugin.
readme.
ReadmeSubPlugin'
}
}
}
...
...
buildSrc/src/main/groovy/Config.groovy
浏览文件 @
480447dd
...
...
@@ -15,7 +15,7 @@ class Config {
static
minSdkVersion
=
14
static
targetSdkVersion
=
29
static
versionCode
=
1
_026_001
static
versionName
=
'1.26.1-
alpha8
'
// E.g. 1.9.72 => 1,009,072
static
versionName
=
'1.26.1-
r5
'
// E.g. 1.9.72 => 1,009,072
// lib version
static
gradlePluginVersion
=
'3.5.0'
...
...
@@ -50,15 +50,14 @@ class Config {
plugin_bintray
:
new
DepConfig
(
pluginPath:
"com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4"
,
pluginId:
"com.jfrog.bintray"
),
// 上传到 bintray
plugin_traute
:
new
DepConfig
(
pluginPath:
"tech.harmonysoft:traute-gradle:1.1.10"
,
pluginId:
"tech.harmonysoft.oss.traute"
),
// 注解转非空判断
// 本地第一次上传插件新的版本需设置 isApply = false, useLocal = true
// 本地上传成功之后 isApply = true 即可应用插件来调试,后续版本更新无需设置 isApply = false
// 发布版本的话把 isApply = false, useLocal = false,更新版本号,发布成功后 isApply = true 即可使用远程库版本
plugin_api
:
new
DepConfig
(
isApply:
true
,
useLocal:
false
,
pluginPath:
"com.blankj:api-gradle-plugin:1.2"
,
pluginId:
"com.blankj.api"
),
//./gradlew plugin:api-gradle-plugin:uploadArchives // 上传到本地 maven
//./gradlew plugin:api-gradle-plugin:bintrayUpload // 上传到 jcenter
// 上传新版本插件更新 pluginPath 中的版本号,并设置 isApply = false
// 通过 mavenLocal 上传本地版本,设置 isApply = true 即可应用插件来调试,最后通过 bintrayUpload 来发布插件
plugin_api
:
new
DepConfig
(
isApply:
true
,
useLocal:
false
,
pluginPath:
"com.blankj:api-gradle-plugin:1.2-r0"
,
pluginId:
"com.blankj.api"
),
//./gradlew plugin:plugin_api-gradle-plugin:mavenLocal // 上传到本地 mavenLocal
//./gradlew plugin:plugin_api-gradle-plugin:bintrayUpload // 上传到 jcenter
plugin_bus
:
new
DepConfig
(
isApply:
true
,
useLocal:
false
,
pluginPath:
"com.blankj:bus-gradle-plugin:2.4"
,
pluginId:
"com.blankj.bus"
),
//./gradlew plugin:
bus-gradle-plugin:uploadArchives // 上传到本地 maven
//./gradlew plugin:bus-gradle-plugin:bintrayUpload // 上传到 jcenter
//./gradlew plugin:
plugin_bus-gradle-plugin:mavenLocal // 上传到本地 mavenLocal
//./gradlew plugin:
plugin_
bus-gradle-plugin:bintrayUpload // 上传到 jcenter
support_appcompat_v7
:
new
DepConfig
(
"com.android.support:appcompat-v7:$supportVersion"
),
support_design
:
new
DepConfig
(
"com.android.support:design:$supportVersion"
),
...
...
buildSrc/src/main/java/com/blankj/plugin/FormatUtils.groovy
→
buildSrc/src/main/java/com/blankj/plugin/
readme/
FormatUtils.groovy
浏览文件 @
480447dd
package
com.blankj.plugin
package
com.blankj.plugin
.readme
class
FormatUtils
{
...
...
buildSrc/src/main/java/com/blankj/plugin/ReadmeCorePlugin.groovy
→
buildSrc/src/main/java/com/blankj/plugin/
readme/
ReadmeCorePlugin.groovy
浏览文件 @
480447dd
package
com.blankj.plugin
package
com.blankj.plugin
.readme
import
org.gradle.api.Plugin
import
org.gradle.api.Project
...
...
buildSrc/src/main/java/com/blankj/plugin/ReadmeExtension.groovy
→
buildSrc/src/main/java/com/blankj/plugin/
readme/
ReadmeExtension.groovy
浏览文件 @
480447dd
package
com.blankj.plugin
package
com.blankj.plugin
.readme
class
ReadmeExtension
{
...
...
buildSrc/src/main/java/com/blankj/plugin/ReadmeSubPlugin.groovy
→
buildSrc/src/main/java/com/blankj/plugin/
readme/
ReadmeSubPlugin.groovy
浏览文件 @
480447dd
package
com.blankj.plugin
package
com.blankj.plugin
.readme
import
org.gradle.api.Plugin
import
org.gradle.api.Project
import
static
FormatUtils
.
LINE_SEP
class
ReadmeSubPlugin
implements
Plugin
<
Project
>
{
@Override
...
...
@@ -30,9 +27,9 @@ class ReadmeSubPlugin implements Plugin<Project> {
static
def
readmeOfSubUtil2Eng
(
File
readmeCN
,
File
readmeEng
)
{
FormatUtils
.
format
(
readmeCN
)
def
lines
=
readmeCN
.
readLines
(
"UTF-8"
),
sb
=
new
StringBuilder
(
"## How to use"
+
LINE_SEP
+
LINE_SEP
+
"You should copy the following classes which you want to use in your project."
+
LINE_SEP
),
sb
=
new
StringBuilder
(
"## How to use"
+
FormatUtils
.
LINE_SEP
+
FormatUtils
.
LINE_SEP
+
"You should copy the following classes which you want to use in your project."
+
FormatUtils
.
LINE_SEP
),
i
=
3
,
size
=
lines
.
size
()
for
(;
i
<
size
;
++
i
)
{
...
...
@@ -45,7 +42,7 @@ class ReadmeSubPlugin implements Plugin<Project> {
}
else
{
sb
.
append
(
line
)
}
sb
.
append
(
LINE_SEP
)
sb
.
append
(
FormatUtils
.
LINE_SEP
)
}
readmeEng
.
write
(
sb
.
toString
(),
"UTF-8"
)
}
...
...
gradle/publish.gradle
浏览文件 @
480447dd
apply
plugin:
Config
.
depConfig
.
plugin_maven
.
pluginId
apply
plugin:
Config
.
depConfig
.
plugin_bintray
.
pluginId
/*
1. must add the following classpath in root build.gradle
classpath "com.github.dcendents:android-maven-gradle-plugin:2.1"
classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4"
2. add bintrayUser, bintrayKey in root local.properties
3. apply this file in the publish module
apply from: "${rootDir.path}/gradle/publish.gradle"
publish {
name = "UtilCode"
groupId = "com.blankj"
artifactId = "utilcode"
version = "xx.xx"
website = "https://github.com/Blankj/AndroidUtilCode"
}
4. execute following command to publish
./gradlew bintrayUpload -> upload to bintray
./gradlew mavenLocal -> upload to local maven
*/
apply
plugin:
"com.github.dcendents.android-maven"
apply
plugin:
"com.jfrog.bintray"
extensions
.
create
(
'publish'
,
PublishExtension
)
afterEvaluate
{
def
ext
=
project
[
'publish'
]
as
PublishExtension
loadBintray
(
ext
)
configMaven
(
project
,
ext
)
configBintray
(
project
,
ext
)
configJavadoc
(
project
,
ext
)
}
def
isAndroid
()
{
return
project
.
getPlugins
().
hasPlugin
(
'com.android.application'
)
||
project
.
getPlugins
().
hasPlugin
(
'com.android.library'
)
private
void
loadBintray
(
PublishExtension
ext
)
{
Properties
properties
=
new
Properties
()
File
localPropertiesFile
=
project
.
rootProject
.
file
(
"local.properties"
);
if
(
localPropertiesFile
.
exists
())
{
properties
.
load
(
localPropertiesFile
.
newDataInputStream
())
ext
.
bintrayUser
=
properties
.
getProperty
(
"bintrayUser"
)
ext
.
bintrayKey
=
properties
.
getProperty
(
"bintrayKey"
)
}
}
def
configurePom
(
pom
)
{
def
configMaven
(
Project
project
,
PublishExtension
ext
)
{
project
.
group
=
ext
.
groupId
project
.
version
=
ext
.
version
project
.
install
{
repositories
.
mavenInstaller
{
configPom
(
pom
,
ext
)
}
}
project
.
tasks
.
create
(
"mavenLocal"
,
Upload
)
{
configuration
=
project
.
configurations
.
archives
repositories
.
mavenDeployer
{
repository
(
url:
uri
(
new
File
(
project
.
rootDir
.
getPath
()
+
"/mavenLocal"
)))
configPom
(
pom
,
ext
)
}
doFirst
{
checkExt
(
project
,
ext
)
}
}
project
.
tasks
.
findByName
(
"bintrayUpload"
).
doFirst
{
checkExt
(
project
,
ext
)
}
}
def
configPom
(
pom
,
PublishExtension
ext
)
{
pom
.
project
{
name
project
.
ext
.
name
groupId
=
project
.
ext
.
groupId
artifactId
=
project
.
ext
.
artifactId
version
=
project
.
ext
.
versionName
name
ext
.
name
groupId
ext
.
groupId
artifactId
ext
.
artifactId
version
ext
.
version
packaging
isAndroid
()
?
"aar"
:
"jar"
description
project
.
ext
.
name
url
project
.
ext
.
siteUrl
description
ext
.
name
url
ext
.
website
scm
{
url
project
.
ext
.
siteUrl
connection
project
.
ext
.
siteUrl
developerConnection
project
.
ext
.
siteUrl
+
".git"
url
ext
.
website
connection
ext
.
website
developerConnection
ext
.
website
+
".git"
}
licenses
{
...
...
@@ -31,105 +96,128 @@ def configurePom(pom) {
developers
{
developer
{
id
"Blankj"
name
"Blankj"
id
ext
.
bintrayUser
name
ext
.
bintrayUser
}
}
}
}
tasks
.
create
(
"mavenLocal"
,
Upload
)
{
configuration
=
configurations
.
archives
repositories
{
mavenDeployer
{
repository
(
url:
uri
(
new
File
(
project
.
rootDir
.
getPath
()
+
"/mavenLocal"
)))
configurePom
(
pom
)
}
static
def
checkExt
(
Project
project
,
PublishExtension
ext
)
{
if
(
ext
.
isBintrayEmpty
())
{
throw
new
NullPointerException
(
"U should set bintrayUser and bintrayKey in local.properties"
)
}
ext
.
check
()
}
install
{
repositories
.
mavenInstaller
{
configurePom
(
pom
)
def
configBintray
(
Project
project
,
PublishExtension
ext
)
{
project
.
bintray
{
user
=
ext
.
bintrayUser
key
=
ext
.
bintrayKey
configurations
=
[
'archives'
]
override
=
false
publish
=
true
pkg
{
repo
=
"maven"
name
=
ext
.
name
websiteUrl
=
ext
.
website
vcsUrl
=
ext
.
website
+
'.git'
licenses
=
[
"Apache-2.0"
]
}
}
}
if
(
isAndroid
())
{
// This generates sources.jar
task
sourcesJar
(
type:
Jar
)
{
classifier
=
'sources'
from
android
.
sourceSets
.
main
.
java
.
source
}
private
void
configJavadoc
(
Project
project
,
PublishExtension
ext
)
{
if
(
isAndroid
())
{
// This generates sources.jar
task
sourcesJar
(
type:
Jar
)
{
classifier
=
'sources'
from
android
.
sourceSets
.
main
.
java
.
source
}
task
javadoc
(
type:
Javadoc
)
{
source
=
android
.
sourceSets
.
main
.
java
.
source
classpath
+=
configurations
.
compile
classpath
+=
project
.
files
(
android
.
getBootClasspath
().
join
(
File
.
pathSeparator
))
}
task
javadoc
(
type:
Javadoc
)
{
source
=
android
.
sourceSets
.
main
.
java
.
source
classpath
+=
configurations
.
compile
classpath
+=
project
.
files
(
android
.
getBootClasspath
().
join
(
File
.
pathSeparator
))
}
task
javadocJar
(
type:
Jar
,
dependsOn:
javadoc
)
{
classifier
=
'javadoc'
from
javadoc
.
destinationDir
}
}
else
{
task
sourcesJar
(
type:
Jar
,
dependsOn:
classes
)
{
classifier
=
'sources'
from
sourceSets
.
main
.
allSource
task
javadocJar
(
type:
Jar
,
dependsOn:
javadoc
)
{
classifier
=
'javadoc'
from
javadoc
.
destinationDir
}
}
else
{
task
sourcesJar
(
type:
Jar
,
dependsOn:
classes
)
{
classifier
=
'sources'
from
sourceSets
.
main
.
allSource
}
task
javadocJar
(
type:
Jar
,
dependsOn:
javadoc
)
{
classifier
=
'javadoc'
from
javadoc
.
destinationDir
}
}
task
javadocJar
(
type:
Jar
,
dependsOn:
javadoc
)
{
classifier
=
'javadoc'
from
javadoc
.
destinationDir
if
(
project
.
hasProperty
(
"kotlin"
))
{
// Disable creating javadocs
project
.
tasks
.
withType
(
Javadoc
)
{
enabled
=
false
}
}
}
if
(
project
.
hasProperty
(
"kotlin"
))
{
// Disable creating javadocs
tasks
.
withType
(
Javadoc
)
{
enabled
=
false
javadoc
{
options
{
encoding
"UTF-8"
charSet
'UTF-8'
author
true
version
ext
.
version
links
"http://docs.oracle.com/javase/7/docs/api"
title
"${ext.name} ${ext.version}"
}
}
}
// javadoc configuration
javadoc
{
options
{
encoding
"UTF-8"
charSet
'UTF-8'
author
true
version
project
.
ext
.
versionName
links
"http://docs.oracle.com/javase/7/docs/api"
title
"${project.ext.name} ${project.ext.versionName}"
artifacts
{
archives
javadocJar
archives
sourcesJar
}
}
artifacts
{
archives
javadocJar
archives
sourcesJar
def
isAndroid
()
{
return
project
.
getPlugins
().
hasPlugin
(
'com.android.application'
)
||
project
.
getPlugins
().
hasPlugin
(
'com.android.library'
)
}
class
PublishExtension
{
String
name
String
groupId
String
artifactId
String
version
String
website
String
bintrayUser
String
bintrayKey
void
check
()
{
checkField
(
name
,
"name"
)
checkField
(
groupId
,
"groupId"
)
checkField
(
artifactId
,
"artifactId"
)
checkField
(
version
,
"version"
)
checkField
(
website
,
"website"
)
checkField
(
bintrayUser
,
"bintrayUser"
)
checkField
(
bintrayKey
,
"bintrayKey"
)
}
Properties
properties
=
new
Properties
()
File
localPropertiesFile
=
project
.
rootProject
.
file
(
"local.properties"
);
if
(
localPropertiesFile
.
exists
())
{
properties
.
load
(
localPropertiesFile
.
newDataInputStream
())
}
void
checkField
(
String
field
,
String
fieldName
)
{
if
(
isEmpty
(
field
))
{
throw
new
NullPointerException
(
"$fieldName is empty!!"
)
}
}
boolean
isBintrayEmpty
()
{
return
isEmpty
(
bintrayUser
)
||
isEmpty
(
bintrayKey
)
}
def
bintrayUser
=
properties
.
getProperty
(
"bintrayUser"
)
def
bintrayKey
=
properties
.
getProperty
(
"bintrayKey"
)
// bintray configuration
bintray
{
user
=
bintrayUser
key
=
bintrayKey
configurations
=
[
'archives'
]
override
=
false
pkg
{
repo
=
"maven"
name
=
project
.
ext
.
name
websiteUrl
=
project
.
ext
.
siteUrl
vcsUrl
=
project
.
ext
.
siteUrl
+
'.git'
licenses
=
[
"Apache-2.0"
]
boolean
isEmpty
(
String
str
)
{
return
str
==
null
||
str
.
length
()
==
0
}
}
\ No newline at end of file
lib/utilcode/build.gradle
浏览文件 @
480447dd
...
...
@@ -39,13 +39,11 @@ dependencies {
testImplementation
Config
.
depConfig
.
eventbus_lib
.
dep
}
ext
{
apply
from:
"${rootDir.path}/gradle/publish.gradle"
publish
{
name
=
"UtilCode"
groupId
=
Config
.
depConfig
.
lib_utilcode
.
groupId
artifactId
=
Config
.
depConfig
.
lib_utilcode
.
artifactId
version
Name
=
Config
.
depConfig
.
lib_utilcode
.
version
siteUrl
=
"https://github.com/Blankj/AndroidUtilCode"
version
=
Config
.
depConfig
.
lib_utilcode
.
version
website
=
"https://github.com/Blankj/AndroidUtilCode"
}
apply
from:
"${rootDir.path}/gradle/publish.gradle"
plugin/api-gradle-plugin/build.gradle
浏览文件 @
480447dd
...
...
@@ -47,14 +47,14 @@ pluginBundle {
}
}
ext
{
apply
from:
"${rootDir.path}/gradle/publish.gradle"
publish
{
name
=
"ApiPlugin"
groupId
=
Config
.
depConfig
.
plugin_api
.
groupId
artifactId
=
Config
.
depConfig
.
plugin_api
.
artifactId
version
Name
=
Config
.
depConfig
.
plugin_api
.
version
siteUrl
=
"https://github.com/Blankj/AndroidUtilCode"
version
=
Config
.
depConfig
.
plugin_api
.
version
website
=
"https://github.com/Blankj/AndroidUtilCode"
}
apply
from:
"${rootDir.path}/gradle/publish.gradle"
//./gradlew plugin:plugin_api-gradle-plugin:mavenLocal // 上传到本地 mavenLocal
//./gradlew plugin:plugin_api-gradle-plugin:bintrayUpload // 上传到 jcenter
...
...
plugin/bus-gradle-plugin/build.gradle
浏览文件 @
480447dd
...
...
@@ -47,14 +47,14 @@ pluginBundle {
}
}
ext
{
apply
from:
"${rootDir.path}/gradle/publish.gradle"
publish
{
name
=
"BusPlugin"
groupId
=
Config
.
depConfig
.
plugin_bus
.
groupId
artifactId
=
Config
.
depConfig
.
plugin_bus
.
artifactId
version
Name
=
Config
.
depConfig
.
plugin_bus
.
version
siteUrl
=
"https://github.com/Blankj/AndroidUtilCode"
version
=
Config
.
depConfig
.
plugin_bus
.
version
website
=
"https://github.com/Blankj/AndroidUtilCode"
}
apply
from:
"${rootDir.path}/gradle/publish.gradle"
//./gradlew plugin:lib_bus-gradle-plugin:mavenLocal // 上传到本地 mavenLocal
//./gradlew plugin:lib_bus-gradle-plugin:bintrayUpload // 上传到 jcenter
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录