Skip to content

Commit c228f53

Browse files
committed
Merge branch 'androidx'
2 parents 64555be + e40b6d4 commit c228f53

File tree

210 files changed

+2005
-1627
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

210 files changed

+2005
-1627
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
* `21/05/13` [add] Support publish mavenCentral.
12
* `21/02/22` [add] Fix ToastUtils rtl bug. Publish v1.30.6.
23
* `20/11/16` [add] Add ImageUtils#save2Album support param of dirName.
34
* `20/11/13` [add] Fix MessengerUtils ANR. Add NetworkUtils#getWifiScanResult, [add|remove]OnWifiChangedConsumer. Publish v1.30.5.
@@ -108,6 +109,7 @@
108109
* `19/04/24` [upd] The swipe panel.
109110
* `19/03/17` [fix] The ugly UI.
110111
* `19/03/14` [fix] AdaptScreenUtils didn't work on some HaWei tablet.
112+
* `19/03/09` [fix] UriUtils#uri2File.
111113
* `19/03/08` [add] LogUtils support multi process. Publish v1.23.7.
112114
* `19/03/02` [fix] LogUtils#file.
113115
* `19/02/28` [fix] ImageUtils#calculateInSampleSize. Publish v1.23.6.

build.gradle

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,35 +2,34 @@
22
buildscript {
33
ConfigUtils.init(gradle)
44
repositories {
5-
// use for debug plugin local
6-
if (Config.depConfig.plugin_bus.useLocal || Config.depConfig.plugin_api.useLocal) {
7-
maven() { url uri("${project.rootDir.path}/mavenLocal") }
8-
}
5+
mavenLocal()
96
google()
7+
mavenCentral()
108
jcenter()
119
}
1210

1311
dependencies {
1412
for (def entrySet : ConfigUtils.getApplyPlugins().entrySet()) {
15-
classpath entrySet.value.dep
13+
classpath entrySet.value.path
1614
}
1715
}
1816
}
1917

2018
allprojects {
2119
repositories {
22-
maven() { url uri("${project.rootDir.path}/mavenLocal") }
20+
mavenLocal()
2321
maven { url "https://jitpack.io" }
2422
google()
23+
mavenCentral()
2524
jcenter()
2625
}
2726

2827
configurations.all {
2928
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
3029

3130
resolutionStrategy.eachDependency {
32-
if (it.requested.group == 'com.android.support'
33-
&& !it.requested.name.contains('multidex')) {
31+
if (it.requested.group == 'com.android.support' && !it.requested.name.contains(
32+
'multidex')) {
3433
it.useVersion Config.supportVersion
3534
}
3635
}

buildApp.gradle

Lines changed: 48 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,30 @@
1+
apply plugin: "com.android.application"
2+
13
apply {
2-
plugin "com.android.application"
3-
from "${rootDir.path}/buildCommon.gradle"
4-
if (Config.depConfig.plugin_api.isApply) {
5-
plugin Config.depConfig.plugin_api.pluginId
4+
from "${rootDir.path}/buildCommon.gradle"
5+
from "${rootDir.path}/config/flavor.gradle"
6+
if (Config.plugins.plugin_api.isApply) {
7+
plugin Config.plugins.plugin_api.id
68
}
7-
if (Config.depConfig.plugin_bus.isApply) {
8-
plugin Config.depConfig.plugin_bus.pluginId
9+
if (Config.plugins.plugin_bus.isApply) {
10+
plugin Config.plugins.plugin_bus.id
911
}
1012
}
1113

1214
configSigning()
1315
configApkName()
1416

15-
if (Config.depConfig.plugin_bus.isApply) {
16-
bus {
17-
onlyScanLibRegex = '^([:]|(com\\.blankj)).+$'
18-
}
19-
}
20-
21-
if (Config.depConfig.plugin_api.isApply) {
22-
api {
23-
onlyScanLibRegex = '^([:]|(com\\.blankj)).+$'
24-
}
25-
}
17+
//if (PluginConfig.plugin_bus.isApply) {
18+
// bus {
19+
// onlyScanLibRegex = '^([:]|(com\\.blankj)).+$'
20+
// }
21+
//}
22+
//
23+
//if (PluginConfig.plugin_api.isApply) {
24+
// api {
25+
// onlyScanLibRegex = '^([:]|(com\\.blankj)).+$'
26+
// }
27+
//}
2628

2729
android {
2830
defaultConfig {
@@ -32,17 +34,11 @@ android {
3234
}
3335

3436
buildTypes {
35-
debug {
36-
minifyEnabled false
37-
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
38-
applicationIdSuffix ".debug"
39-
resValue "string", "app_name", Config.appName + suffix + ".debug"
40-
}
37+
debug {}
4138

4239
release {
4340
minifyEnabled true
4441
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
45-
resValue "string", "app_name", Config.appName + suffix
4642
}
4743
}
4844

@@ -56,29 +52,42 @@ android {
5652
maxProcessCount 8
5753
dexInProcess = true
5854
}
59-
}
6055

56+
productFlavors {
57+
dev {
58+
applicationIdSuffix ".dev"
59+
versionNameSuffix "-dev"
60+
resValue "string", "app_name", Config.appName + suffix + "-dev"
61+
}
62+
63+
production {
64+
resValue "string", "app_name", Config.appName + suffix
65+
}
66+
}
67+
}
6168

6269
dependencies {
6370
// LeakCanary
64-
debugImplementation Config.depConfig.leakcanary.dep
71+
debugImplementation Config.libs.leakcanary.path
6572

66-
debugImplementation Config.depConfig.lib_utildebug.dep
67-
releaseImplementation Config.depConfig.lib_utildebug_no_op.dep
73+
debugImplementation Config.modules.lib_utildebug.dep
74+
releaseImplementation Config.modules.lib_utildebug_no_op.dep
6875

6976
// 根据 Config.pkgConfig 来依赖所有 pkg
7077
for (def entrySet : ConfigUtils.getApplyPkgs().entrySet()) {
7178
api entrySet.value.dep
7279
}
7380

74-
if (Config.depConfig.feature_mock.isApply) {
75-
api Config.depConfig.feature_mock.dep
81+
if (Config.modules.feature_mock.isApply) {
82+
api ModuleConfig.modules.feature_mock.dep
7683
}
7784
}
7885

7986
def getSuffix() {
8087
if (project.name == "feature_launcher_app") return ""
81-
return "." + project.name.substring("feature_".length(), project.name.length() - "_app".length())
88+
return "." + project.
89+
name.
90+
substring("feature_".length(), project.name.length() - "_app".length())
8291
}
8392

8493
def configSigning() {
@@ -108,12 +117,14 @@ def configApkName() {
108117
if (variant.buildType.name != "debug") {
109118
def artifact = variant.getPackageApplicationProvider().get()
110119
artifact.outputDirectory = new File("${rootDir.path}/apk")
111-
artifact.outputScope.apkDatas.forEach { apkData ->
112-
apkData.outputFileName = "util" + suffix +
113-
(variant.flavorName == "" ? "" : ("_" + variant.flavorName)) +
114-
"_" + variant.versionName.replace(".", "_") +
115-
"_" + variant.buildType.name +
116-
".apk"
120+
variant.outputs.each {
121+
it.outputFileName = "util" + suffix +
122+
(variant.flavorName == "" ? "" : ("_" + variant.flavorName)) +
123+
"_" +
124+
variant.versionName.replace(".", "_") +
125+
"_" +
126+
variant.buildType.name +
127+
".apk"
117128
}
118129
}
119130
}

buildCommon.gradle

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,23 +19,12 @@ android {
1919
}
2020
}
2121

22+
compileOptions {
23+
sourceCompatibility JavaVersion.VERSION_1_8
24+
targetCompatibility JavaVersion.VERSION_1_8
25+
}
26+
2227
lintOptions {
2328
abortOnError false
2429
}
25-
26-
// viewBinding {
27-
// enabled = true
28-
// }
29-
30-
// flavorDimensions "region"
31-
//
32-
// productFlavors {
33-
// china {
34-
// dimension "region"
35-
// }
36-
//
37-
// oversea {
38-
// dimension "region"
39-
// }
40-
// }
4130
}

buildLib.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ dependencies {
88
api entrySet.value.dep
99
}
1010
} else if (project.name.endsWith("_export")) {
11-
api Config.depConfig.lib_common.dep
11+
api Config.modules.lib_common.dep
1212
}
1313
}

buildSrc/settings.gradle

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
//dependencyResolutionManagement {
2+
// repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
3+
// repositories {
4+
// google()
5+
// mavenCentral()
6+
// jcenter() // Warning: this repository is going to shut down soon
7+
// }
8+
//}
Lines changed: 60 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
1-
/**
2-
* <pre>
3-
* author: blankj
4-
* blog : http://blankj.com
5-
* time : 2019/07/13
6-
* desc :
7-
* </pre>
8-
*/
91
class Config {
102

113
static applicationId = 'com.blankj.androidutilcode'
@@ -14,76 +6,84 @@ class Config {
146
static compileSdkVersion = 29
157
static minSdkVersion = 14
168
static targetSdkVersion = 29
17-
static versionCode = 1_030_006
18-
static versionName = '1.30.6'// E.g. 1.9.72 => 1,009,072
9+
static versionCode = 1_030_007
10+
static versionName = '1.31.0'// E.g. 1.9.72 => 1,009,072
1911

2012
// lib version
21-
static gradlePluginVersion = '3.5.0'
13+
static gradlePluginVersion = '4.1.0'
2214
static kotlinVersion = '1.3.72'
23-
static supportVersion = '28.0.0'
15+
static androidxVersion = '1.0.0'
2416

25-
static depConfig = [
26-
/*Never delete this line*/
27-
/*Generated by "config.json"*/
28-
plugin_api_gradle_plugin : new DepConfig(true , true , ":plugin:api-gradle-plugin"),
29-
plugin_bus_gradle_plugin : new DepConfig(true , true , ":plugin:bus-gradle-plugin"),
30-
plugin_lib_base_transform : new DepConfig(true , false, ":plugin:lib:base-transform", "com.blankj:base-transform:1.0"),
31-
feature_mock : new DepConfig(false, true , ":feature:mock"),
32-
feature_launcher_app : new DepConfig(true , true , ":feature:launcher:app"),
33-
feature_main_app : new DepConfig(false, true , ":feature:main:app"),
34-
feature_main_pkg : new DepConfig(true , true , ":feature:main:pkg"),
35-
feature_subutil_app : new DepConfig(false, true , ":feature:subutil:app"),
36-
feature_subutil_pkg : new DepConfig(true , true , ":feature:subutil:pkg"),
37-
feature_subutil_export : new DepConfig(true , true , ":feature:subutil:export"),
38-
feature_utilcode_app : new DepConfig(false, true , ":feature:utilcode:app"),
39-
feature_utilcode_pkg : new DepConfig(true , true , ":feature:utilcode:pkg"),
40-
feature_utilcode_export : new DepConfig(true , true , ":feature:utilcode:export", "com.blankj:utilcode-export:1.1"),
41-
lib_base : new DepConfig(true , true , ":lib:base"),
42-
lib_common : new DepConfig(true , true , ":lib:common"),
43-
lib_subutil : new DepConfig(true , true , ":lib:subutil"),
44-
lib_utilcode : new DepConfig(true , true , ":lib:utilcode", "com.blankj:utilcode:$versionName"),
45-
lib_utildebug : new DepConfig(true , true , ":lib:utildebug"),
46-
lib_utildebug_no_op : new DepConfig(true , true , ":lib:utildebug-no-op"),
47-
/*Never delete this line*/
48-
plugin_gradle : new DepConfig(pluginPath: "com.android.tools.build:gradle:$gradlePluginVersion"),
49-
plugin_kotlin : new DepConfig(pluginPath: "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"),
50-
plugin_maven : new DepConfig(pluginPath: "com.github.dcendents:android-maven-gradle-plugin:2.1", pluginId: "com.github.dcendents.android-maven"),// 上传到 maven
51-
plugin_bintray : new DepConfig(pluginPath: "com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4", pluginId: "com.jfrog.bintray"),// 上传到 bintray
52-
plugin_traute : new DepConfig(pluginPath: "tech.harmonysoft:traute-gradle:1.1.10", pluginId: "tech.harmonysoft.oss.traute"),// 注解转非空判断
17+
static modules = [
18+
/*Don't delete this line*/
19+
/*Generated by "module_config.json"*/
20+
plugin_api_gradle_plugin : new ModuleConfig(isApply: true , useLocal: true , localPath: "./plugin/api-gradle-plugin"),
21+
plugin_bus_gradle_plugin : new ModuleConfig(isApply: true , useLocal: true , localPath: "./plugin/bus-gradle-plugin"),
22+
plugin_lib_base_transform : new ModuleConfig(isApply: true , useLocal: true , localPath: "./plugin/lib/base-transform", remotePath: "com.blankj:base-transform:1.0"),
23+
plugin_buildSrc_plugin : new ModuleConfig(isApply: true , useLocal: true , localPath: "./plugin/buildSrc-plugin"),
24+
feature_mock : new ModuleConfig(isApply: false, useLocal: true , localPath: "./feature/mock"),
25+
feature_launcher_app : new ModuleConfig(isApply: true , useLocal: true , localPath: "./feature/launcher/app"),
26+
feature_main_app : new ModuleConfig(isApply: false, useLocal: true , localPath: "./feature/main/app"),
27+
feature_main_pkg : new ModuleConfig(isApply: true , useLocal: true , localPath: "./feature/main/pkg"),
28+
feature_subutil_app : new ModuleConfig(isApply: false, useLocal: true , localPath: "./feature/subutil/app"),
29+
feature_subutil_pkg : new ModuleConfig(isApply: true , useLocal: true , localPath: "./feature/subutil/pkg"),
30+
feature_subutil_export : new ModuleConfig(isApply: true , useLocal: true , localPath: "./feature/subutil/export"),
31+
feature_utilcode_app : new ModuleConfig(isApply: false, useLocal: true , localPath: "./feature/utilcode/app"),
32+
feature_utilcode_pkg : new ModuleConfig(isApply: true , useLocal: true , localPath: "./feature/utilcode/pkg"),
33+
feature_utilcode_export : new ModuleConfig(isApply: true , useLocal: true , localPath: "./feature/utilcode/export", remotePath: "com.blankj:utilcode-export:1.1"),
34+
lib_base : new ModuleConfig(isApply: true , useLocal: true , localPath: "./lib/base"),
35+
lib_common : new ModuleConfig(isApply: true , useLocal: true , localPath: "./lib/common"),
36+
lib_subutil : new ModuleConfig(isApply: true , useLocal: true , localPath: "./lib/subutil"),
37+
lib_utilcode : new ModuleConfig(isApply: true , useLocal: false, localPath: "./lib/utilcode", remotePath: "com.blankj:utilcode:$Config.versionName"),
38+
lib_utildebug : new ModuleConfig(isApply: true , useLocal: true , localPath: "./lib/utildebug"),
39+
lib_utildebug_no_op : new ModuleConfig(isApply: true , useLocal: true , localPath: "./lib/utildebug-no-op"),
40+
/*Don't delete this line*/
41+
]
42+
43+
static plugins = [
44+
plugin_gradle : new PluginConfig(path: "com.android.tools.build:gradle:$gradlePluginVersion"),
45+
plugin_kotlin : new PluginConfig(path: "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"),
46+
// 上传到 maven
47+
plugin_maven : new PluginConfig(path: "com.github.dcendents:android-maven-gradle-plugin:2.1", id: "com.github.dcendents.android-maven"),
5348

54-
// 上传新版本插件更新 pluginPath 中的版本号,并设置 isApply = false
49+
// 上传新版本插件更新 path 中的版本号,并设置 isApply = false
5550
// 通过 mavenLocal 上传本地版本,设置 isApply = true 即可应用插件来调试,最后通过 bintrayUpload 来发布插件
56-
plugin_api : new DepConfig(isApply: true, useLocal: false, pluginPath: "com.blankj:api-gradle-plugin:1.5", pluginId: "com.blankj.api"),
51+
plugin_api : new PluginConfig(isApply: true, useLocal: false, path: "com.blankj:api-gradle-plugin:1.5", id: "com.blankj.api"),
5752
//./gradlew clean :plugin_api-gradle-plugin:mavenLocal // 上传到本地 mavenLocal
5853
//./gradlew clean :plugin_api-gradle-plugin:bintrayUpload // 上传到 jcenter
59-
plugin_bus : new DepConfig(isApply: true, useLocal: false, pluginPath: "com.blankj:bus-gradle-plugin:2.6", pluginId: "com.blankj.bus"),
54+
plugin_bus : new PluginConfig(isApply: true, useLocal: false, path: "com.blankj:bus-gradle-plugin:2.6", id: "com.blankj.bus"),
6055
//./gradlew clean :plugin_bus-gradle-plugin:mavenLocal // 上传到本地 mavenLocal
6156
//./gradlew clean :plugin_bus-gradle-plugin:bintrayUpload // 上传到 jcenter
57+
plugin_buildSrc: new PluginConfig(isApply: true, useLocal: false, path: "com.blankj:buildSrc-plugin:1.0", id: "com.blankj.buildSrc"),
58+
//./gradlew clean :plugin_bus-gradle-plugin:mavenLocal // 上传到本地 mavenLocal
59+
//./gradlew clean :plugin_bus-gradle-plugin:bintrayUpload // 上传到 jcenter
60+
]
6261

63-
support_appcompat_v7 : new DepConfig("com.android.support:appcompat-v7:$supportVersion"),
64-
support_design : new DepConfig("com.android.support:design:$supportVersion"),
65-
support_multidex : new DepConfig("com.android.support:multidex:1.0.2"),
66-
support_constraint : new DepConfig("com.android.support.constraint:constraint-layout:1.1.3"),
62+
static libs = [
63+
androidx_appcompat : new LibConfig(path: "androidx.appcompat:appcompat:$androidxVersion"),
64+
androidx_material : new LibConfig(path: "com.google.android.material:material:$androidxVersion"),
65+
androidx_multidex : new LibConfig(path: "androidx.multidex:multidex:2.0.0"),
66+
androidx_constraint: new LibConfig(path: "androidx.constraintlayout:constraintlayout:1.1.3"),
6767

68-
kotlin : new DepConfig("org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion"),
68+
kotlin : new LibConfig(path: "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion"),
6969

70-
leakcanary : new DepConfig("com.squareup.leakcanary:leakcanary-android:2.1"),
70+
leakcanary : new LibConfig(path: "com.squareup.leakcanary:leakcanary-android:2.1"),
7171

72-
free_proguard : new DepConfig("com.blankj:free-proguard:1.0.2"),
73-
swipe_panel : new DepConfig("com.blankj:swipe-panel:1.2"),
72+
free_proguard : new LibConfig(path: "com.blankj:free-proguard:1.0.2"),
73+
swipe_panel : new LibConfig(path: "com.blankj:swipe-panel:1.2"),
7474

75-
gson : new DepConfig("com.google.code.gson:gson:2.8.5"),
76-
glide : new DepConfig("com.github.bumptech.glide:glide:4.7.1"),
77-
retrofit : new DepConfig("com.squareup.retrofit2:retrofit:2.4.0"),
78-
commons_io : new DepConfig("commons-io:commons-io:2.6"),
75+
gson : new LibConfig(path: "com.google.code.gson:gson:2.8.5"),
76+
glide : new LibConfig(path: "com.github.bumptech.glide:glide:4.7.1"),
77+
retrofit : new LibConfig(path: "com.squareup.retrofit2:retrofit:2.4.0"),
78+
commons_io : new LibConfig(path: "commons-io:commons-io:2.6"),
7979

80-
eventbus_lib : new DepConfig("org.greenrobot:eventbus:3.1.1"),
81-
eventbus_processor : new DepConfig("org.greenrobot:eventbus-annotation-processor:3.0.1"),
80+
eventbus_lib : new LibConfig(path: "org.greenrobot:eventbus:3.1.1"),
81+
eventbus_processor : new LibConfig(path: "org.greenrobot:eventbus-annotation-processor:3.0.1"),
8282

83-
photo_view : new DepConfig("com.github.chrisbanes:PhotoView:2.0.0"),
83+
photo_view : new LibConfig(path: "com.github.chrisbanes:PhotoView:2.0.0"),
8484

85-
test_junit : new DepConfig("junit:junit:4.12"),
86-
test_robolectric : new DepConfig("org.robolectric:robolectric:4.3.1"),
85+
test_junit : new LibConfig(path: "junit:junit:4.12"),
86+
test_robolectric : new LibConfig(path: "org.robolectric:robolectric:4.3.1"),
8787
]
8888
}
8989
//./gradlew clean :lib_utilcode:bintrayUpload

0 commit comments

Comments
 (0)