Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DiDi
DoraemonKit
提交
0a9f42af
D
DoraemonKit
项目概览
DiDi
/
DoraemonKit
12 个月 前同步成功
通知
166
Star
19623
Fork
3062
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
DoraemonKit
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
0a9f42af
编写于
5月 25, 2021
作者:
J
jackjintai
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
modify:
[Android] 1)升级kotlin v1.4.20 1)去掉kotlin扩展插件
上级
59cd402b
变更
14
隐藏空白更改
内联
并排
Showing
14 changed file
with
223 addition
and
66 deletion
+223
-66
Android/java/buildSrc/src/main/kotlin/com/didichuxing/doraemonkit/plugin/DoKitExt.kt
...ain/kotlin/com/didichuxing/doraemonkit/plugin/DoKitExt.kt
+25
-1
Android/java/buildSrc/src/main/kotlin/com/didichuxing/doraemonkit/plugin/DoKitPlugin.kt
.../kotlin/com/didichuxing/doraemonkit/plugin/DoKitPlugin.kt
+17
-8
Android/java/buildSrc/src/main/kotlin/com/didichuxing/doraemonkit/plugin/DoKitTransformInvocation.kt
...idichuxing/doraemonkit/plugin/DoKitTransformInvocation.kt
+5
-23
Android/java/buildSrc/src/main/kotlin/com/didichuxing/doraemonkit/plugin/transform/DoKitBaseTransform.kt
...huxing/doraemonkit/plugin/transform/DoKitBaseTransform.kt
+4
-1
Android/java/buildSrc/src/main/kotlin/com/didichuxing/doraemonkit/plugin/transform/DoKitCommTransform.kt
...huxing/doraemonkit/plugin/transform/DoKitCommTransform.kt
+2
-0
Android/java/buildSrc/src/main/kotlin/com/didichuxing/doraemonkit/plugin/transform/DoKitCommTransformV34.kt
...ing/doraemonkit/plugin/transform/DoKitCommTransformV34.kt
+22
-0
Android/java/buildSrc/src/main/kotlin/com/didichuxing/doraemonkit/plugin/transform/DoKitDependTransformV34.kt
...g/doraemonkit/plugin/transform/DoKitDependTransformV34.kt
+36
-0
Android/java/doraemonkit-plugin/src/main/kotlin/com/didichuxing/doraemonkit/plugin/DoKitExt.kt
...ain/kotlin/com/didichuxing/doraemonkit/plugin/DoKitExt.kt
+25
-1
Android/java/doraemonkit-plugin/src/main/kotlin/com/didichuxing/doraemonkit/plugin/DoKitPlugin.kt
.../kotlin/com/didichuxing/doraemonkit/plugin/DoKitPlugin.kt
+17
-8
Android/java/doraemonkit-plugin/src/main/kotlin/com/didichuxing/doraemonkit/plugin/DoKitTransformInvocation.kt
...idichuxing/doraemonkit/plugin/DoKitTransformInvocation.kt
+6
-23
Android/java/doraemonkit-plugin/src/main/kotlin/com/didichuxing/doraemonkit/plugin/transform/DoKitBaseTransform.kt
...huxing/doraemonkit/plugin/transform/DoKitBaseTransform.kt
+4
-1
Android/java/doraemonkit-plugin/src/main/kotlin/com/didichuxing/doraemonkit/plugin/transform/DoKitCommTransform.kt
...huxing/doraemonkit/plugin/transform/DoKitCommTransform.kt
+2
-0
Android/java/doraemonkit-plugin/src/main/kotlin/com/didichuxing/doraemonkit/plugin/transform/DoKitCommTransformV34.kt
...ing/doraemonkit/plugin/transform/DoKitCommTransformV34.kt
+22
-0
Android/java/doraemonkit-plugin/src/main/kotlin/com/didichuxing/doraemonkit/plugin/transform/DoKitDependTransformV34.kt
...g/doraemonkit/plugin/transform/DoKitDependTransformV34.kt
+36
-0
未找到文件。
Android/java/buildSrc/src/main/kotlin/com/didichuxing/doraemonkit/plugin/DoKitExt.kt
浏览文件 @
0a9f42af
package
com.didichuxing.doraemonkit.plugin
import
com.android.build.gradle.api.BaseVariant
import
com.android.dex.DexFormat
import
com.android.dx.command.dexer.Main
import
com.didiglobal.booster.kotlinx.NCPU
import
com.didiglobal.booster.transform.TransformContext
import
org.objectweb.asm.Opcodes.*
import
org.objectweb.asm.tree.*
...
...
@@ -111,4 +114,25 @@ val MethodInsnNode.ownerClassName: String
val
ClassNode
.
formatSuperName
:
String
get
()
=
superName
.
replace
(
'/'
,
'.'
)
\ No newline at end of file
get
()
=
superName
.
replace
(
'/'
,
'.'
)
internal
fun
File
.
dex
(
output
:
File
,
api
:
Int
=
DexFormat
.
API_NO_EXTENDED_OPCODES
):
Int
{
val
args
=
Main
.
Arguments
().
apply
{
numThreads
=
NCPU
debug
=
true
warnings
=
true
emptyOk
=
true
multiDex
=
true
jarOutput
=
true
optimize
=
false
minSdkVersion
=
api
fileNames
=
arrayOf
(
output
.
canonicalPath
)
outName
=
canonicalPath
}
return
try
{
Main
.
run
(
args
)
}
catch
(
t
:
Throwable
)
{
t
.
printStackTrace
()
-
1
}
}
Android/java/buildSrc/src/main/kotlin/com/didichuxing/doraemonkit/plugin/DoKitPlugin.kt
浏览文件 @
0a9f42af
...
...
@@ -6,8 +6,9 @@ import com.didichuxing.doraemonkit.plugin.extension.DoKitExt
import
com.didichuxing.doraemonkit.plugin.extension.SlowMethodExt
import
com.didichuxing.doraemonkit.plugin.processor.DoKitPluginConfigProcessor
import
com.didichuxing.doraemonkit.plugin.stack_method.MethodStackNodeUtil
import
com.didichuxing.doraemonkit.plugin.transform.DoKitCommTransform
import
com.didichuxing.doraemonkit.plugin.transform.DoKitDependTransform
import
com.didichuxing.doraemonkit.plugin.transform.*
import
com.didichuxing.doraemonkit.plugin.transform.DoKitCommTransformV34
import
com.didiglobal.booster.gradle.GTE_V3_4
import
com.didiglobal.booster.gradle.dependencies
import
com.didiglobal.booster.gradle.getAndroid
import
com.didiglobal.booster.gradle.getProperty
...
...
@@ -94,7 +95,7 @@ class DoKitPlugin : Plugin<Project> {
MethodStackNodeUtil
.
METHOD_STACK_KEYS
.
clear
()
if
(
DoKitExtUtil
.
DOKIT_PLUGIN_SWITCH
)
{
//注册transform
androidExt
.
registerTransform
(
DoKitCommTransform
(
project
))
androidExt
.
registerTransform
(
commNewInstance
(
project
))
if
(
slowMethodSwitch
&&
slowMethodStrategy
==
SlowMethodExt
.
STRATEGY_STACK
)
{
MethodStackNodeUtil
.
METHOD_STACK_KEYS
.
add
(
0
,
mutableSetOf
<
String
>())
val
methodStackRange
=
1
until
methodStackLevel
...
...
@@ -105,10 +106,7 @@ class DoKitPlugin : Plugin<Project> {
mutableSetOf
<
String
>()
)
androidExt
.
registerTransform
(
DoKitDependTransform
(
project
,
index
)
dependNewInstance
(
project
,
index
)
)
}
}
...
...
@@ -176,7 +174,7 @@ class DoKitPlugin : Plugin<Project> {
project
.
getAndroid
<
LibraryExtension
>().
let
{
libraryExt
->
"library module ${project.name} is executing..."
.
println
()
if
(
DoKitExtUtil
.
DOKIT_PLUGIN_SWITCH
)
{
libraryExt
.
registerTransform
(
DoKitCommTransform
(
project
))
libraryExt
.
registerTransform
(
commNewInstance
(
project
))
}
project
.
afterEvaluate
{
libraryExt
.
libraryVariants
.
forEach
{
variant
->
...
...
@@ -195,4 +193,15 @@ class DoKitPlugin : Plugin<Project> {
}
}
private
fun
commNewInstance
(
project
:
Project
):
DoKitBaseTransform
=
when
{
GTE_V3_4
->
DoKitCommTransformV34
(
project
)
else
->
DoKitCommTransform
(
project
)
}
private
fun
dependNewInstance
(
project
:
Project
,
index
:
Int
):
DoKitBaseTransform
=
when
{
GTE_V3_4
->
DoKitDependTransformV34
(
project
,
index
)
else
->
DoKitDependTransform
(
project
,
index
)
}
}
\ No newline at end of file
Android/java/buildSrc/src/main/kotlin/com/didichuxing/doraemonkit/plugin/DoKitTransformInvocation.kt
浏览文件 @
0a9f42af
...
...
@@ -206,29 +206,11 @@ internal class DoKitTransformInvocation(
private
fun
doVerify
()
{
outputs
.
sortedBy
(
File
::
nameWithoutExtension
).
forEach
{
output
->
val
out
=
temporaryDir
.
file
(
output
.
name
)
val
args
=
Main
.
Arguments
().
apply
{
numThreads
=
NCPU
debug
=
true
warnings
=
true
emptyOk
=
true
multiDex
=
true
jarOutput
=
true
optimize
=
false
minSdkVersion
=
variant
.
extension
.
defaultConfig
.
targetSdkVersion
?.
apiLevel
!!
fileNames
=
arrayOf
(
output
.
absolutePath
)
outName
=
out
.
absolutePath
}
val
rc
=
try
{
Main
.
run
(
args
)
}
catch
(
t
:
Throwable
)
{
t
.
printStackTrace
()
-
1
}
// val rc = out.dex(
// output,
// variant.extension.defaultConfig.targetSdkVersion?.apiLevel
// ?: DexFormat.API_NO_EXTENDED_OPCODES
// )
val
rc
=
out
.
dex
(
output
,
variant
.
extension
.
defaultConfig
.
targetSdkVersion
?.
apiLevel
?:
DexFormat
.
API_NO_EXTENDED_OPCODES
)
println
(
"${if (rc != 0) red("
✗
") else green("
✓
")} $output"
)
out
.
deleteRecursively
()
}
...
...
Android/java/buildSrc/src/main/kotlin/com/didichuxing/doraemonkit/plugin/transform/DoKitBaseTransform.kt
浏览文件 @
0a9f42af
...
...
@@ -47,7 +47,8 @@ open class DoKitBaseTransform(val project: Project) : Transform() {
override
fun
isCacheable
()
=
!
verifyEnabled
override
fun
getInputTypes
():
MutableSet
<
QualifiedContent
.
ContentType
>
=
TransformManager
.
CONTENT_CLASS
override
fun
getInputTypes
():
MutableSet
<
QualifiedContent
.
ContentType
>
=
TransformManager
.
CONTENT_CLASS
override
fun
getScopes
():
MutableSet
<
in
QualifiedContent
.
Scope
>
=
when
{
transformers
.
isEmpty
()
->
mutableSetOf
()
...
...
@@ -78,6 +79,8 @@ open class DoKitBaseTransform(val project: Project) : Transform() {
}
}
}
/**
...
...
Android/java/buildSrc/src/main/kotlin/com/didichuxing/doraemonkit/plugin/transform/DoKitCommTransform.kt
浏览文件 @
0a9f42af
package
com.didichuxing.doraemonkit.plugin.transform
import
com.didiglobal.booster.gradle.GTE_V3_4
import
org.gradle.api.Project
/**
...
...
@@ -9,4 +10,5 @@ import org.gradle.api.Project
*/
class
DoKitCommTransform
(
androidProject
:
Project
)
:
DoKitBaseTransform
(
androidProject
)
{
}
Android/java/buildSrc/src/main/kotlin/com/didichuxing/doraemonkit/plugin/transform/DoKitCommTransformV34.kt
0 → 100644
浏览文件 @
0a9f42af
package
com.didichuxing.doraemonkit.plugin.transform
import
com.android.build.api.variant.VariantInfo
import
org.gradle.api.Project
internal
class
DoKitCommTransformV34
(
project
:
Project
)
:
DoKitBaseTransform
(
project
)
{
@Suppress
(
"UnstableApiUsage"
)
override
fun
applyToVariant
(
variant
:
VariantInfo
):
Boolean
{
return
variant
.
buildTypeEnabled
||
(
variant
.
flavorNames
.
isNotEmpty
()
&&
variant
.
fullVariantEnabled
)
}
@Suppress
(
"UnstableApiUsage"
)
private
val
VariantInfo
.
fullVariantEnabled
:
Boolean
get
()
=
project
.
findProperty
(
"booster.transform.${fullVariantName}.enabled"
)
?.
toString
()
?.
toBoolean
()
?:
true
@Suppress
(
"UnstableApiUsage"
)
private
val
VariantInfo
.
buildTypeEnabled
:
Boolean
get
()
=
project
.
findProperty
(
"booster.transform.${buildTypeName}.enabled"
)
?.
toString
()
?.
toBoolean
()
?:
true
}
Android/java/buildSrc/src/main/kotlin/com/didichuxing/doraemonkit/plugin/transform/DoKitDependTransformV34.kt
0 → 100644
浏览文件 @
0a9f42af
package
com.didichuxing.doraemonkit.plugin.transform
import
com.android.build.api.variant.VariantInfo
import
com.didichuxing.doraemonkit.plugin.asmtransformer.DoKitAsmTransformer
import
com.didiglobal.booster.transform.Transformer
import
org.gradle.api.Project
/**
* Represents the transform base
* DoKitCommTransform 作用于 CommTransformer、BigImgTransformer、UrlConnectionTransformer、GlobalSlowMethodTransformer
* @author johnsonlee
*/
open
class
DoKitDependTransformV34
(
androidProject
:
Project
,
private
val
level
:
Int
)
:
DoKitBaseTransform
(
androidProject
)
{
@Suppress
(
"UnstableApiUsage"
)
override
fun
applyToVariant
(
variant
:
VariantInfo
):
Boolean
{
return
variant
.
buildTypeEnabled
||
(
variant
.
flavorNames
.
isNotEmpty
()
&&
variant
.
fullVariantEnabled
)
}
@Suppress
(
"UnstableApiUsage"
)
private
val
VariantInfo
.
fullVariantEnabled
:
Boolean
get
()
=
project
.
findProperty
(
"booster.transform.${fullVariantName}.enabled"
)
?.
toString
()
?.
toBoolean
()
?:
true
@Suppress
(
"UnstableApiUsage"
)
private
val
VariantInfo
.
buildTypeEnabled
:
Boolean
get
()
=
project
.
findProperty
(
"booster.transform.${buildTypeName}.enabled"
)
?.
toString
()
?.
toBoolean
()
?:
true
internal
override
val
transformers
=
mutableListOf
<
Transformer
>(
DoKitAsmTransformer
(
level
))
override
fun
getName
():
String
{
return
"${this.javaClass.simpleName}_$level"
}
}
Android/java/doraemonkit-plugin/src/main/kotlin/com/didichuxing/doraemonkit/plugin/DoKitExt.kt
浏览文件 @
0a9f42af
package
com.didichuxing.doraemonkit.plugin
import
com.android.build.gradle.api.BaseVariant
import
com.android.dex.DexFormat
import
com.android.dx.command.dexer.Main
import
com.didiglobal.booster.kotlinx.NCPU
import
com.didiglobal.booster.transform.TransformContext
import
org.objectweb.asm.Opcodes.*
import
org.objectweb.asm.tree.*
...
...
@@ -111,4 +114,25 @@ val MethodInsnNode.ownerClassName: String
val
ClassNode
.
formatSuperName
:
String
get
()
=
superName
.
replace
(
'/'
,
'.'
)
\ No newline at end of file
get
()
=
superName
.
replace
(
'/'
,
'.'
)
internal
fun
File
.
dex
(
output
:
File
,
api
:
Int
=
DexFormat
.
API_NO_EXTENDED_OPCODES
):
Int
{
val
args
=
Main
.
Arguments
().
apply
{
numThreads
=
NCPU
debug
=
true
warnings
=
true
emptyOk
=
true
multiDex
=
true
jarOutput
=
true
optimize
=
false
minSdkVersion
=
api
fileNames
=
arrayOf
(
output
.
canonicalPath
)
outName
=
canonicalPath
}
return
try
{
Main
.
run
(
args
)
}
catch
(
t
:
Throwable
)
{
t
.
printStackTrace
()
-
1
}
}
Android/java/doraemonkit-plugin/src/main/kotlin/com/didichuxing/doraemonkit/plugin/DoKitPlugin.kt
浏览文件 @
0a9f42af
...
...
@@ -6,8 +6,9 @@ import com.didichuxing.doraemonkit.plugin.extension.DoKitExt
import
com.didichuxing.doraemonkit.plugin.extension.SlowMethodExt
import
com.didichuxing.doraemonkit.plugin.processor.DoKitPluginConfigProcessor
import
com.didichuxing.doraemonkit.plugin.stack_method.MethodStackNodeUtil
import
com.didichuxing.doraemonkit.plugin.transform.DoKitCommTransform
import
com.didichuxing.doraemonkit.plugin.transform.DoKitDependTransform
import
com.didichuxing.doraemonkit.plugin.transform.*
import
com.didichuxing.doraemonkit.plugin.transform.DoKitCommTransformV34
import
com.didiglobal.booster.gradle.GTE_V3_4
import
com.didiglobal.booster.gradle.dependencies
import
com.didiglobal.booster.gradle.getAndroid
import
com.didiglobal.booster.gradle.getProperty
...
...
@@ -94,7 +95,7 @@ class DoKitPlugin : Plugin<Project> {
MethodStackNodeUtil
.
METHOD_STACK_KEYS
.
clear
()
if
(
DoKitExtUtil
.
DOKIT_PLUGIN_SWITCH
)
{
//注册transform
androidExt
.
registerTransform
(
DoKitCommTransform
(
project
))
androidExt
.
registerTransform
(
commNewInstance
(
project
))
if
(
slowMethodSwitch
&&
slowMethodStrategy
==
SlowMethodExt
.
STRATEGY_STACK
)
{
MethodStackNodeUtil
.
METHOD_STACK_KEYS
.
add
(
0
,
mutableSetOf
<
String
>())
val
methodStackRange
=
1
until
methodStackLevel
...
...
@@ -105,10 +106,7 @@ class DoKitPlugin : Plugin<Project> {
mutableSetOf
<
String
>()
)
androidExt
.
registerTransform
(
DoKitDependTransform
(
project
,
index
)
dependNewInstance
(
project
,
index
)
)
}
}
...
...
@@ -176,7 +174,7 @@ class DoKitPlugin : Plugin<Project> {
project
.
getAndroid
<
LibraryExtension
>().
let
{
libraryExt
->
"library module ${project.name} is executing..."
.
println
()
if
(
DoKitExtUtil
.
DOKIT_PLUGIN_SWITCH
)
{
libraryExt
.
registerTransform
(
DoKitCommTransform
(
project
))
libraryExt
.
registerTransform
(
commNewInstance
(
project
))
}
project
.
afterEvaluate
{
libraryExt
.
libraryVariants
.
forEach
{
variant
->
...
...
@@ -195,4 +193,15 @@ class DoKitPlugin : Plugin<Project> {
}
}
private
fun
commNewInstance
(
project
:
Project
):
DoKitBaseTransform
=
when
{
GTE_V3_4
->
DoKitCommTransformV34
(
project
)
else
->
DoKitCommTransform
(
project
)
}
private
fun
dependNewInstance
(
project
:
Project
,
index
:
Int
):
DoKitBaseTransform
=
when
{
GTE_V3_4
->
DoKitDependTransformV34
(
project
,
index
)
else
->
DoKitDependTransform
(
project
,
index
)
}
}
\ No newline at end of file
Android/java/doraemonkit-plugin/src/main/kotlin/com/didichuxing/doraemonkit/plugin/DoKitTransformInvocation.kt
浏览文件 @
0a9f42af
...
...
@@ -2,6 +2,7 @@ package com.didichuxing.doraemonkit.plugin
import
com.android.build.api.transform.*
import
com.android.build.api.transform.Status.*
import
com.android.dex.DexFormat
import
com.android.dx.command.dexer.Main
import
com.didichuxing.doraemonkit.plugin.transform.DoKitBaseTransform
import
com.didiglobal.booster.gradle.*
...
...
@@ -205,29 +206,11 @@ internal class DoKitTransformInvocation(
private
fun
doVerify
()
{
outputs
.
sortedBy
(
File
::
nameWithoutExtension
).
forEach
{
output
->
val
out
=
temporaryDir
.
file
(
output
.
name
)
val
args
=
Main
.
Arguments
().
apply
{
numThreads
=
NCPU
debug
=
true
warnings
=
true
emptyOk
=
true
multiDex
=
true
jarOutput
=
true
optimize
=
false
minSdkVersion
=
variant
.
extension
.
defaultConfig
.
targetSdkVersion
?.
apiLevel
!!
fileNames
=
arrayOf
(
output
.
absolutePath
)
outName
=
out
.
absolutePath
}
val
rc
=
try
{
Main
.
run
(
args
)
}
catch
(
t
:
Throwable
)
{
t
.
printStackTrace
()
-
1
}
// val rc = out.dex(
// output,
// variant.extension.defaultConfig.targetSdkVersion?.apiLevel
// ?: DexFormat.API_NO_EXTENDED_OPCODES
// )
val
rc
=
out
.
dex
(
output
,
variant
.
extension
.
defaultConfig
.
targetSdkVersion
?.
apiLevel
?:
DexFormat
.
API_NO_EXTENDED_OPCODES
)
println
(
"${if (rc != 0) red("
✗
") else green("
✓
")} $output"
)
out
.
deleteRecursively
()
}
...
...
Android/java/doraemonkit-plugin/src/main/kotlin/com/didichuxing/doraemonkit/plugin/transform/DoKitBaseTransform.kt
浏览文件 @
0a9f42af
...
...
@@ -47,7 +47,8 @@ open class DoKitBaseTransform(val project: Project) : Transform() {
override
fun
isCacheable
()
=
!
verifyEnabled
override
fun
getInputTypes
():
MutableSet
<
QualifiedContent
.
ContentType
>
=
TransformManager
.
CONTENT_CLASS
override
fun
getInputTypes
():
MutableSet
<
QualifiedContent
.
ContentType
>
=
TransformManager
.
CONTENT_CLASS
override
fun
getScopes
():
MutableSet
<
in
QualifiedContent
.
Scope
>
=
when
{
transformers
.
isEmpty
()
->
mutableSetOf
()
...
...
@@ -78,6 +79,8 @@ open class DoKitBaseTransform(val project: Project) : Transform() {
}
}
}
/**
...
...
Android/java/doraemonkit-plugin/src/main/kotlin/com/didichuxing/doraemonkit/plugin/transform/DoKitCommTransform.kt
浏览文件 @
0a9f42af
package
com.didichuxing.doraemonkit.plugin.transform
import
com.didiglobal.booster.gradle.GTE_V3_4
import
org.gradle.api.Project
/**
...
...
@@ -9,4 +10,5 @@ import org.gradle.api.Project
*/
class
DoKitCommTransform
(
androidProject
:
Project
)
:
DoKitBaseTransform
(
androidProject
)
{
}
Android/java/doraemonkit-plugin/src/main/kotlin/com/didichuxing/doraemonkit/plugin/transform/DoKitCommTransformV34.kt
0 → 100644
浏览文件 @
0a9f42af
package
com.didichuxing.doraemonkit.plugin.transform
import
com.android.build.api.variant.VariantInfo
import
org.gradle.api.Project
internal
class
DoKitCommTransformV34
(
project
:
Project
)
:
DoKitBaseTransform
(
project
)
{
@Suppress
(
"UnstableApiUsage"
)
override
fun
applyToVariant
(
variant
:
VariantInfo
):
Boolean
{
return
variant
.
buildTypeEnabled
||
(
variant
.
flavorNames
.
isNotEmpty
()
&&
variant
.
fullVariantEnabled
)
}
@Suppress
(
"UnstableApiUsage"
)
private
val
VariantInfo
.
fullVariantEnabled
:
Boolean
get
()
=
project
.
findProperty
(
"booster.transform.${fullVariantName}.enabled"
)
?.
toString
()
?.
toBoolean
()
?:
true
@Suppress
(
"UnstableApiUsage"
)
private
val
VariantInfo
.
buildTypeEnabled
:
Boolean
get
()
=
project
.
findProperty
(
"booster.transform.${buildTypeName}.enabled"
)
?.
toString
()
?.
toBoolean
()
?:
true
}
Android/java/doraemonkit-plugin/src/main/kotlin/com/didichuxing/doraemonkit/plugin/transform/DoKitDependTransformV34.kt
0 → 100644
浏览文件 @
0a9f42af
package
com.didichuxing.doraemonkit.plugin.transform
import
com.android.build.api.variant.VariantInfo
import
com.didichuxing.doraemonkit.plugin.asmtransformer.DoKitAsmTransformer
import
com.didiglobal.booster.transform.Transformer
import
org.gradle.api.Project
/**
* Represents the transform base
* DoKitCommTransform 作用于 CommTransformer、BigImgTransformer、UrlConnectionTransformer、GlobalSlowMethodTransformer
* @author johnsonlee
*/
open
class
DoKitDependTransformV34
(
androidProject
:
Project
,
private
val
level
:
Int
)
:
DoKitBaseTransform
(
androidProject
)
{
@Suppress
(
"UnstableApiUsage"
)
override
fun
applyToVariant
(
variant
:
VariantInfo
):
Boolean
{
return
variant
.
buildTypeEnabled
||
(
variant
.
flavorNames
.
isNotEmpty
()
&&
variant
.
fullVariantEnabled
)
}
@Suppress
(
"UnstableApiUsage"
)
private
val
VariantInfo
.
fullVariantEnabled
:
Boolean
get
()
=
project
.
findProperty
(
"booster.transform.${fullVariantName}.enabled"
)
?.
toString
()
?.
toBoolean
()
?:
true
@Suppress
(
"UnstableApiUsage"
)
private
val
VariantInfo
.
buildTypeEnabled
:
Boolean
get
()
=
project
.
findProperty
(
"booster.transform.${buildTypeName}.enabled"
)
?.
toString
()
?.
toBoolean
()
?:
true
internal
override
val
transformers
=
mutableListOf
<
Transformer
>(
DoKitAsmTransformer
(
level
))
override
fun
getName
():
String
{
return
"${this.javaClass.simpleName}_$level"
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录