新增filter模块,core及support上传maven
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
apply plugin: 'com.android.application'
|
||||
android {
|
||||
compileSdkVersion 29
|
||||
buildToolsVersion "29.0.1"
|
||||
@@ -29,8 +28,8 @@ dependencies {
|
||||
|
||||
implementation component(':library')
|
||||
implementation component(':librarykotlin')
|
||||
implementation project(':component-core')
|
||||
implementation project(':component-support-core')
|
||||
implementation 'com.effective.android:component-core:1.0.0'
|
||||
implementation 'com.effective.android:component-support-core:1.0.0'
|
||||
}
|
||||
|
||||
|
||||
|
||||
13
build.gradle
13
build.gradle
@@ -12,6 +12,7 @@ buildscript {
|
||||
classpath 'com.effective.plugins:component-support-plugin'
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
classpath 'com.quinn.hunter:hunter-transform:0.9.0'
|
||||
classpath 'com.novoda:bintray-release:0.9'
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
// in the individual module build.gradle files
|
||||
}
|
||||
@@ -21,7 +22,19 @@ allprojects {
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
maven { url 'https://dl.bintray.com/yummylau/maven' }
|
||||
}
|
||||
|
||||
gradle.projectsEvaluated {
|
||||
tasks.withType(JavaCompile) {
|
||||
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType(Javadoc) {
|
||||
options.addStringOption('Xdoclint:none', '-quiet')
|
||||
options.addStringOption('encoding', 'UTF-8')
|
||||
options.addStringOption('charSet', 'UTF-8')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
apply plugin: 'com.android.library'
|
||||
apply plugin: 'com.novoda.bintray-release'
|
||||
android {
|
||||
compileSdkVersion 29
|
||||
buildToolsVersion "29.0.1"
|
||||
@@ -30,3 +32,14 @@ dependencies {
|
||||
androidTestImplementation 'androidx.test:runner:1.2.0'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
|
||||
}
|
||||
|
||||
|
||||
publish {
|
||||
userOrg = 'yummylau'
|
||||
groupId = 'com.effective.android'
|
||||
artifactId = 'component-core'
|
||||
publishVersion = '1.0.0'
|
||||
desc = 'Android component core code'
|
||||
website = 'https://github.com/YummyLau/ComponentPlugin'
|
||||
}
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -8,6 +8,6 @@ class InjectCodeWeaver extends BaseWeaver{
|
||||
|
||||
@Override
|
||||
protected ClassVisitor wrapClassWriter(ClassWriter classWriter) {
|
||||
return new ScanCodeAdapter(classWriter)
|
||||
return new InjectCodeAdapter(classWriter)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,6 @@ class ScanCodeWeaver extends BaseWeaver {
|
||||
|
||||
@Override
|
||||
protected ClassVisitor wrapClassWriter(ClassWriter classWriter) {
|
||||
return new InjectCodeAdapter(classWriter)
|
||||
return new ScanCodeAdapter(classWriter)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ package com.plugin.component.support;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class CostCache {
|
||||
public class MethodCostHelper {
|
||||
|
||||
public static Map<String, Long> sStartTime = new HashMap<>();
|
||||
public static Map<String, Long> sEndTime = new HashMap<>();
|
||||
Binary file not shown.
Binary file not shown.
@@ -1,7 +1,6 @@
|
||||
package com.plugin.component
|
||||
package com.plugin.component.support
|
||||
|
||||
import com.android.build.gradle.BaseExtension
|
||||
import com.plugin.component.support.transform.MethodCostTransform
|
||||
import com.plugin.component.support.extension.ComponentSupportExtension
|
||||
import org.gradle.api.Plugin
|
||||
import org.gradle.api.Project
|
||||
|
||||
@@ -11,10 +10,28 @@ import org.gradle.api.Project
|
||||
*/
|
||||
class ComponentSupportPlugin implements Plugin<Project> {
|
||||
|
||||
ComponentSupportExtension extension
|
||||
|
||||
@Override
|
||||
void apply(Project project) {
|
||||
if (project != project.rootProject) {
|
||||
project.extensions.findByType(BaseExtension.class).registerTransform(new MethodCostTransform(childProject))
|
||||
boolean isRoot = project == project.rootProject
|
||||
if (!isRoot) {
|
||||
return
|
||||
}
|
||||
|
||||
extension = project.getExtensions().create(Constants.COMPONENT_SUPPORT, ComponentSupportExtension.class)
|
||||
project.afterEvaluate {
|
||||
|
||||
String filterModule = extension.
|
||||
|
||||
project.allprojects.each {
|
||||
if (it == project) return
|
||||
Project childProject = it
|
||||
childProject.apply plugin: 'com.android.component.support'
|
||||
childProject.dependencies {
|
||||
implementation 'com.effective.android:component-support-core:1.0.0'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.plugin.component.support
|
||||
|
||||
class Constants {
|
||||
|
||||
static String TAG = "component-support"
|
||||
public static String COMPONENT_SUPPORT = "componentSupport"
|
||||
}
|
||||
|
||||
@@ -5,13 +5,22 @@ package com.plugin.component.support.extension
|
||||
*/
|
||||
class ComponentSupportExtension {
|
||||
|
||||
public boolean openMethodCost = true
|
||||
public boolean methodCostEnable = true
|
||||
public String filterModule = ""
|
||||
|
||||
/**
|
||||
* 编译sdk
|
||||
* @param version
|
||||
*/
|
||||
void openMethodCost(boolean openMethodCost) {
|
||||
this.openMethodCost = openMethodCost
|
||||
void methodCostEnable(boolean methodCostEnable) {
|
||||
this.methodCostEnable = methodCostEnable
|
||||
}
|
||||
|
||||
/**
|
||||
* 过滤哪些模块,格式为 ':library,:libraryKotlin' 或者 ':library,libraryKotlin' 不带 ":"
|
||||
* @param filterModule
|
||||
*/
|
||||
void filterModule(String filterModule) {
|
||||
this.filterModule = filterModule
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import org.objectweb.asm.commons.AdviceAdapter
|
||||
|
||||
class MethodCostAdapter extends ClassVisitor {
|
||||
|
||||
private static final String sCostCachePath = "com/plugin/component/support/CostCache"
|
||||
private static final String sCostCachePath = "com/plugin/component/support/MethodCostHelper"
|
||||
private String className
|
||||
|
||||
MethodCostAdapter(ClassVisitor classVisitor) {
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
apply plugin: 'com.android.library'
|
||||
|
||||
android {
|
||||
|
||||
compileSdkVersion 29
|
||||
@@ -28,9 +30,11 @@ dependencies {
|
||||
testImplementation 'junit:junit:4.12'
|
||||
androidTestImplementation 'androidx.test:runner:1.2.0'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
|
||||
implementation project(':component-core')
|
||||
implementation 'com.effective.android:component-core:1.0.0'
|
||||
implementation component(':librarykotlin')
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ dependencies {
|
||||
testImplementation 'junit:junit:4.12'
|
||||
androidTestImplementation 'androidx.test:runner:1.2.0'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
|
||||
implementation project(':component-core')
|
||||
implementation 'com.effective.android:component-core:1.0.0'
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
||||
}
|
||||
repositories {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
include ':app', ':library', ':component-core', ':librarykotlin', ':component-support-core'
|
||||
include ':app', ':library', ':librarykotlin'
|
||||
|
||||
|
||||
//调试插件使用
|
||||
|
||||
Reference in New Issue
Block a user