Skip to content

Commit 53a7b8b

Browse files
committed
see 11/20 log
1 parent acc1923 commit 53a7b8b

File tree

24 files changed

+242
-245
lines changed

24 files changed

+242
-245
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@
66
/build
77
/captures
88
.externalNativeBuild
9-
/apk
9+
/apk
10+
/maven

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
buildscript {
33
apply from: 'config.gradle'
44
repositories {
5-
if (localDebugPlugin) {
5+
if (bus.isDebug) {
66
maven() {
77
url uri(new File(project.rootDir, "maven"))
88
}

bus-gradle-plugin/build.gradle

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ plugins {
66

77
apply {
88
from "../gradle/pluginPublish.gradle"
9-
if (rootProject.localDebugPlugin) {
9+
if (bus.isDebug) {
1010
plugin 'maven'
1111
from "../gradle/localMavenUpload.gradle"
1212
} else {
@@ -30,10 +30,12 @@ dependencies {
3030
implementation dep.javassist
3131
implementation dep.commons_io
3232
implementation dep.junit
33+
implementation gradleApi()
34+
implementation localGroovy()
3335
}
3436

35-
group = rootProject.group
36-
version = rootProject.versionName
37+
group = bus.group
38+
version = bus.version
3739

3840
//./gradlew bus-gradle-plugin:bintrayUpload
3941
//./gradlew publishPlugins

bus-gradle-plugin/src/main/groovy/com/blankj/bus/BusInject.groovy

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,19 @@ import org.apache.commons.io.FileUtils
88
class BusInject {
99

1010
static void start(HashMap<String, String> bus, File busJar) {
11-
String jarPath = busJar.getAbsolutePath()
12-
String decompressedJarPath = jarPath.substring(0, jarPath.length() - 4);
13-
File decompressedJar = new File(decompressedJarPath)
14-
ZipUtils.unzipFile(busJar, decompressedJar)
11+
String jarPath = busJar.getAbsolutePath()
12+
String decompressedJarPath = jarPath.substring(0, jarPath.length() - 4);
13+
File decompressedJar = new File(decompressedJarPath)
14+
ZipUtils.unzipFile(busJar, decompressedJar)
1515

16-
CtClass busUtils = Config.mPool.get(Config.CLASS_BUS_UTILS)
17-
CtMethod callMethod = busUtils.getDeclaredMethod("post");
18-
callMethod.insertAfter(getInsertContent(bus));
19-
busUtils.writeFile(decompressedJarPath)
20-
busUtils.defrost();
21-
FileUtils.forceDelete(busJar)
22-
ZipUtils.zipFile(decompressedJar, busJar)
23-
FileUtils.forceDelete(decompressedJar)
16+
CtClass busUtils = Config.mPool.get(Config.CLASS_BUS_UTILS)
17+
CtMethod callMethod = busUtils.getDeclaredMethod("post");
18+
callMethod.insertAfter(getInsertContent(bus));
19+
busUtils.writeFile(decompressedJarPath)
20+
busUtils.defrost();
21+
FileUtils.forceDelete(busJar)
22+
ZipUtils.zipFile(decompressedJar, busJar)
23+
FileUtils.forceDelete(decompressedJar)
2424
}
2525

2626
private static String getInsertContent(HashMap<String, String> bus) {

bus-gradle-plugin/src/main/groovy/com/blankj/bus/BusTransform.groovy

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ class BusTransform extends Transform {
6060
)
6161
FileUtils.copyDirectory(dir, dest)
6262

63-
LogUtils.l("scan " + dirInput.name)
63+
LogUtils.l("scan dir: " + dirInput.name)
64+
6465
busScan.scanDir(dir)
6566
}
6667

@@ -78,16 +79,17 @@ class BusTransform extends Transform {
7879
FileUtils.copyFile(jar, dest)
7980

8081
if (jumpScan(jarName)) {
81-
LogUtils.l("jump " + jarName)
82+
LogUtils.l("jump jar: " + jarName)
8283
return
8384
}
8485

85-
if (jarName.startsWith("com.blankj:bus:")) {
86+
if (jarName.startsWith("com.blankj:utilcode:")
87+
|| jarName.contains("utilcode-lib")) {
8688
busScan.busJar = dest
8789
return
8890
}
8991

90-
LogUtils.l("scan " + jarName)
92+
LogUtils.l("scan jar: " + jarName)
9193
busScan.scanJar(jar)
9294
}
9395
}
@@ -100,7 +102,7 @@ class BusTransform extends Transform {
100102
BusInject.start(busScan.busMap, busScan.busJar)
101103
} else {
102104
LogUtils.l('u should <implementation "com.blankj:utilcode:1.30.+"> ' +
103-
'or <implementation "com.blankj:bus:1.0+">')
105+
'or <implementation "com.blankj:bus:1.0+">')
104106
}
105107

106108
LogUtils.l(getName() + " finished: " + (System.currentTimeMillis() - stTime) + "ms")

bus-gradle-plugin/src/main/groovy/com/blankj/bus/Config.groovy

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ class Config {
1010
public static final List<String> EXCEPTS = [
1111
'com.android.support:',
1212
'com.android.support.constraint:',
13-
'android.arch.',
14-
'com.blankj:utilcode:'
13+
'android.arch.'
1514
]
1615

1716
public static final String FILE_SEP = System.getProperty("file.separator")

config.gradle

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@ ext {
88
versionCode = 1_022_000
99
versionName = '1.22.0'// E.g. 1.9.72 => 1,009,072
1010

11-
localDebugPlugin = false
11+
bus = [
12+
isDebug: true,
13+
version: '1.4',
14+
group : 'com.blankj'
15+
]
1216

1317
// lib version
1418
kotlin_version = '1.3.0'
@@ -21,7 +25,7 @@ ext {
2125
kotlin_gradle_plugin : "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version",
2226
android_maven_gradle_plugin: "com.github.dcendents:android-maven-gradle-plugin:2.1",
2327
gradle_bintray_plugin : "com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4",
24-
bus_gradle_plugin : "com.blankj:bus-gradle-plugin:1.3",
28+
bus_gradle_plugin : "com.blankj:bus-gradle-plugin:1.4",
2529

2630
// lib
2731
support : [

gradle.properties

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,6 @@
1515
# When configured, Gradle will run in incubating parallel mode.
1616
# This option should only be used with decoupled projects. More details, visit
1717
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18-
# org.gradle.parallel=true
18+
# org.gradle.parallel=true
19+
20+
org.gradle.jvmargs=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005

launcher/app/__bus__.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}

launcher/app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
plugins {
22
id "com.android.application"
3+
// id "com.blankj.bus"
34
id 'kotlin-android'
45
id 'kotlin-android-extensions'
5-
// id "com.blankj.bus"
66
}
77

88
// in config.gradle

0 commit comments

Comments
 (0)