Skip to content

Commit

Permalink
feat: add dexMergeIncremental 开关
Browse files Browse the repository at this point in the history
  • Loading branch information
chaojiong1zhang20230913 committed Aug 1, 2022
1 parent 9979fc3 commit 3279e2d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion buildSrc/src/main/kotlin/plugin/RocketXPlugin.kt
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ open class RocketXPlugin : Plugin<Project> {
// }
}

mProject.gradle.addBuildListener(RocketXBuildListener(this, mProject, mAllChangedProject))
mProject.gradle.addBuildListener(RocketXBuildListener(this, mProject, mAllChangedProject,mRocketXBean?.dexMergeIncremental?:true))

//开启一些加速的编译项
speedBuildByOption(mProject, mAppExtension)
Expand Down
3 changes: 2 additions & 1 deletion buildSrc/src/main/kotlin/plugin/bean/RocketXBean.kt
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package plugin.bean


/**
* description:
* author chaojiong.zhang
* data: 2021/11/10
* copyright TCL+
*/
open class RocketXBean(var localMaven:Boolean = false, var openLog:Boolean = false, var excludeModule:Set<String> = HashSet())
open class RocketXBean(var localMaven:Boolean = false, var openLog:Boolean = false, var excludeModule:Set<String> = HashSet(),var dexMergeIncremental: Boolean = true)
10 changes: 7 additions & 3 deletions buildSrc/src/main/kotlin/plugin/listener/RocketXBuildListener.kt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ import java.util.*
class RocketXBuildListener(
private val rocketXPlugin: RocketXPlugin,
private val appProject: Project,
private val mAllChangedProject: MutableMap<String, Project>?
private val mAllChangedProject: MutableMap<String, Project>?,
private val dexMergeIncremental: Boolean
) : BuildListener, TaskExecutionListener {

private var taskStartTime: Long = 0
Expand Down Expand Up @@ -50,7 +51,9 @@ class RocketXBuildListener(
}

override fun projectsEvaluated(gradle: Gradle) {
// BeforePreBuildJob(appProject).runCleanAction()
if (!dexMergeIncremental) {
BeforePreBuildJob(appProject).runCleanAction()
}
appProject.rootProject.allprojects.forEach {
//剔除 app 和 rootProject
if (hasAppPlugin(it) || it == appProject.rootProject || it.childProjects.isNotEmpty()) {
Expand All @@ -68,7 +71,8 @@ class RocketXBuildListener(
}
//android 子 module
if (childAndroid != null) {
mLocalMaven = AarFlatLocalMaven(childProject, rocketXPlugin, appProject, mAllChangedProject)
mLocalMaven =
AarFlatLocalMaven(childProject, rocketXPlugin, appProject, mAllChangedProject)
} else if (hasJavaPlugin(childProject)) {
//java 子 module
mLocalMaven = JarFlatLocalMaven(childProject, rocketXPlugin, mAllChangedProject)
Expand Down

0 comments on commit 3279e2d

Please sign in to comment.