升级框架1.0.8,提升稳定性,兼容极端场景
This commit is contained in:
@@ -19,6 +19,8 @@ README: [English](https://github.com/YummyLau/ComponentPlugin/blob/master/README
|
||||
* 提供更人性化的调试日志格式
|
||||
* 2019/12/09
|
||||
* 优化插件 gradle 增量编译
|
||||
* 2020/05/28
|
||||
* 调整sdk注入逻辑,优化 sdk 注册,避免极端情况下多模块重复注册导致已绑定的实现丢失
|
||||
|
||||
|
||||
### 为什么要使用
|
||||
@@ -82,7 +84,7 @@ buildscript {
|
||||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath "com.effective.plugins:component:1.0.6
|
||||
classpath "com.effective.plugins:component:1.0.8
|
||||
}
|
||||
}
|
||||
allprojects {
|
||||
|
||||
@@ -19,6 +19,8 @@ From the very beginning, I learned that "WeChat's Modular Architecture Reconstru
|
||||
* Provide a more user-friendly debug log format
|
||||
* 2019/12/09
|
||||
* Optimization plugin gradle incremental compilation
|
||||
* 2020/05/28
|
||||
* Adjust the sdk injection logic, optimize the sdk registration, to avoid the repeated registration of multiple modules in extreme cases, resulting in the loss of the bound implementation
|
||||
|
||||
### Why use it
|
||||
|
||||
@@ -81,7 +83,7 @@ buildscript {
|
||||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath "com.effective.plugins:component:1.0.6
|
||||
classpath "com.effective.plugins:component:1.0.8
|
||||
}
|
||||
}
|
||||
allprojects {
|
||||
|
||||
@@ -22,6 +22,7 @@ import com.plugin.pin.home.PHome;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
|
||||
@@ -2,7 +2,7 @@ apply from: "./gradleScript/config.gradle"
|
||||
|
||||
buildscript {
|
||||
ext.kotlin_version = '1.3.50'
|
||||
ext.component_version = '1.0.6'
|
||||
ext.component_version = '1.0.8'
|
||||
|
||||
repositories {
|
||||
google()
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
apply plugin: 'com.android.library'
|
||||
apply plugin: 'kotlin-android'
|
||||
apply plugin: 'kotlin-kapt'
|
||||
//apply plugin: 'com.novoda.bintray-release'
|
||||
apply plugin: 'com.novoda.bintray-release'
|
||||
|
||||
android {
|
||||
compileSdkVersion 29
|
||||
@@ -29,12 +29,12 @@ dependencies {
|
||||
}
|
||||
|
||||
|
||||
//publish {
|
||||
// userOrg = 'yummylau'
|
||||
// groupId = 'com.effective.android'
|
||||
// artifactId = 'component-core'
|
||||
// publishVersion = '1.0.4'
|
||||
// desc = 'Android component core code'
|
||||
// website = 'https://github.com/YummyLau/ComponentPlugin'
|
||||
//}
|
||||
publish {
|
||||
userOrg = 'yummylau'
|
||||
groupId = 'com.effective.android'
|
||||
artifactId = 'component-core'
|
||||
publishVersion = '1.0.5'
|
||||
desc = 'Android component core code'
|
||||
website = 'https://github.com/YummyLau/ComponentPlugin'
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.plugin.component
|
||||
|
||||
import android.app.Application
|
||||
import android.util.ArrayMap
|
||||
import android.util.Log
|
||||
|
||||
/**
|
||||
* 运行时完成收集
|
||||
@@ -40,8 +41,10 @@ class ComponentInfo {
|
||||
|
||||
|
||||
fun registerSdk(sdkClass: Class<*>, sdkImpl: Any) {
|
||||
if(!isSdkReady(sdkClass) || sdkImpl!is Class<*>){
|
||||
sdkMap[sdkClass] = sdkImpl
|
||||
}
|
||||
}
|
||||
|
||||
fun unregisterSdk(sdkKey: Class<*>): Boolean {
|
||||
if (sdkMap.containsKey(sdkKey)) {
|
||||
|
||||
@@ -31,6 +31,14 @@ object ComponentManager {
|
||||
ComponentManager.application = application
|
||||
sComponentInfoArrayMap = ArrayMap()
|
||||
sInit = true
|
||||
injectComponentWithSdk(application)
|
||||
}
|
||||
|
||||
/**
|
||||
* 仅仅用于 asm 注入
|
||||
*/
|
||||
private fun injectComponentWithSdk(application: Application){
|
||||
|
||||
}
|
||||
|
||||
private fun checkInit() {
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
apply plugin: 'groovy'
|
||||
apply plugin: 'maven'
|
||||
//apply plugin: 'com.novoda.bintray-release'
|
||||
apply plugin: 'com.novoda.bintray-release'
|
||||
|
||||
group = 'com.effective.plugins'
|
||||
archivesBaseName = 'component'
|
||||
version = '1.0.6'
|
||||
version = '1.0.8'
|
||||
|
||||
//设置本地发布路径
|
||||
uploadArchives {
|
||||
@@ -20,7 +20,7 @@ dependencies {
|
||||
implementation gradleApi()
|
||||
implementation localGroovy()
|
||||
implementation 'com.android.tools.build:gradle:3.1.0'
|
||||
implementation 'org.jetbrains.kotlin:kotlin-compiler-embeddable:1.3.50'
|
||||
implementation 'org.jetbrains.kotlin:kotlin-compiler-embeddable:1.3.70'
|
||||
implementation 'org.ow2.asm:asm:7.1'
|
||||
implementation 'org.ow2.asm:asm-commons:7.1'
|
||||
implementation 'org.ow2.asm:asm-util:7.1'
|
||||
@@ -43,13 +43,13 @@ repositories {
|
||||
}
|
||||
|
||||
|
||||
//publish {
|
||||
// userOrg = 'yummylau'
|
||||
// groupId = 'com.effective.plugins'
|
||||
// artifactId = 'component'
|
||||
// publishVersion = '1.0.6'
|
||||
// desc = 'Android component plugin'
|
||||
// website = 'https://github.com/YummyLau/ComponentPlugin'
|
||||
//}
|
||||
publish {
|
||||
userOrg = 'yummylau'
|
||||
groupId = 'com.effective.plugins'
|
||||
artifactId = 'component'
|
||||
publishVersion = '1.0.8'
|
||||
desc = 'Android component plugin'
|
||||
website = 'https://github.com/YummyLau/ComponentPlugin'
|
||||
}
|
||||
|
||||
|
||||
|
||||
0
component-plugin/gradlew
vendored
Normal file → Executable file
0
component-plugin/gradlew
vendored
Normal file → Executable file
@@ -44,7 +44,7 @@ class Constants {
|
||||
public static String IMPL_PRE = 'impl-'
|
||||
public static String COMPONENT_PRE = 'component-'
|
||||
public static String DEBUG_COMPONENT_PRE = 'component(Debug)-'
|
||||
public static String CORE_DEPENDENCY = "com.effective.android:component-core:1.0.4"
|
||||
public static String CORE_DEPENDENCY = "com.effective.android:component-core:1.0.5"
|
||||
|
||||
//sourceSet - default
|
||||
public static String JAVA_PATH = "src/main/java"
|
||||
|
||||
@@ -73,7 +73,7 @@ class InjectCodeAdapter extends ClassVisitor {
|
||||
@Override
|
||||
protected void onMethodEnter() {
|
||||
injectComponentAutoInitCode =
|
||||
className == sComponentManagerPath && name == "init" && descriptor == "(Landroid/app/Application;)V"
|
||||
className == sComponentManagerPath && name == "injectComponentWithSdk" && descriptor == "(Landroid/app/Application;)V"
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -18,9 +18,9 @@ android.useAndroidX=true
|
||||
# Automatically convert third-party libraries to use AndroidX
|
||||
android.enableJetifier=true
|
||||
|
||||
systemProp.http.proxyHost=127.0.0.1
|
||||
systemProp.http.proxyPort=8001
|
||||
systemProp.https.proxyHost=127.0.0.1
|
||||
systemProp.https.proxyPort=8001
|
||||
#systemProp.http.proxyHost=127.0.0.1
|
||||
#systemProp.http.proxyPort=8001
|
||||
#systemProp.https.proxyHost=127.0.0.1
|
||||
#systemProp.https.proxyPort=8001
|
||||
|
||||
|
||||
|
||||
@@ -14,16 +14,16 @@ public class Component implements IComponent {
|
||||
@Override
|
||||
public void attachComponent(Application application) {
|
||||
Log.d("component-plugin", "Component#attachComponent");
|
||||
SdkManager.register(this, ISdk.class, SdkShareImpl.class);
|
||||
SdkManager.register(this, ISdk2.class, SdkShareImpl.class);
|
||||
SdkManager.register(this, IProvideFromLibrary.class, ProvideFromLibraryImpl.class);
|
||||
// SdkManager.register(this, ISdk.class, SdkShareImpl.class);
|
||||
// SdkManager.register(this, ISdk2.class, SdkShareImpl.class);
|
||||
// SdkManager.register(this, IProvideFromLibrary.class, ProvideFromLibraryImpl.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detachComponent() {
|
||||
Log.d("component-plugin", "Component#detachComponent");
|
||||
SdkManager.unregister(ISdk.class);
|
||||
SdkManager.unregister(ISdk2.class);
|
||||
SdkManager.unregister(IProvideFromLibrary.class);
|
||||
// SdkManager.unregister(ISdk.class);
|
||||
// SdkManager.unregister(ISdk2.class);
|
||||
// SdkManager.unregister(IProvideFromLibrary.class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,13 @@ package com.plugin.librarykotlin
|
||||
|
||||
import android.app.Application
|
||||
import android.util.Log
|
||||
import com.plugin.component.ComponentManager
|
||||
import com.plugin.component.IComponent
|
||||
import com.plugin.component.SdkManager
|
||||
import com.plugin.component.SdkManager.getSdk
|
||||
import com.plugin.component.anno.AutoInjectComponent
|
||||
import com.plugin.library.IProvideFromLibrary
|
||||
import com.plugin.library.ISdk
|
||||
|
||||
|
||||
@AutoInjectComponent(impl = [ProvideFromKotlinImpl::class, GetFromLibraryImpl::class])
|
||||
@@ -11,6 +16,7 @@ class KotlinComponent : IComponent {
|
||||
|
||||
override fun attachComponent(application: Application) {
|
||||
Log.d("component-plugin", "KotlinComponent#attachComponent")
|
||||
ComponentManager.init(application)
|
||||
}
|
||||
|
||||
override fun detachComponent() {
|
||||
|
||||
@@ -4,5 +4,5 @@
|
||||
# Location of the SDK. This is only used by Gradle.
|
||||
# For customization when using a Version Control System, please read the
|
||||
# header note.
|
||||
#Sat Aug 31 17:50:10 CST 2019
|
||||
sdk.dir=/Users/yummy/Library/Android/sdk
|
||||
#Thu May 28 17:59:06 CST 2020
|
||||
sdk.dir=/Users/g8931/Library/Android/sdk
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
//发布调试 core
|
||||
//include ':component-core'
|
||||
//
|
||||
|
||||
//发布插件
|
||||
//include ':component-plugin'
|
||||
|
||||
|
||||
Reference in New Issue
Block a user