Skip to content

Commit

Permalink
Improve incremental build
Browse files Browse the repository at this point in the history
  • Loading branch information
puboe committed Sep 9, 2020
1 parent a95c54f commit a438b2b
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 17 deletions.
6 changes: 3 additions & 3 deletions source/src/main/groovy/com/kezong/fataar/RProcessor.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@ class RProcessor {
if (f.exists()) {
f.delete()
}
mJarDir.getParentFile().deleteDir()
mJarDir.mkdirs()
}

bundleTask.doLast {
Expand Down Expand Up @@ -170,7 +168,9 @@ class RProcessor {
}

private Task createRFileTask(final File destFolder) {
def task = mProject.tasks.create(name: 'createRsFile' + mVariant.name)
def task = mProject.tasks.create(name: 'createRsFile' + mVariant.name) {
outputs.dir(destFolder)
}
task.doLast {
if (destFolder.exists()) {
destFolder.deleteDir()
Expand Down
32 changes: 18 additions & 14 deletions source/src/main/groovy/com/kezong/fataar/VariantProcessor.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,6 @@ class VariantProcessor {
dependencies = context.queue.getFirst().getDependencies()
}
}
archiveLibrary.getRootFolder().deleteDir()
final def zipFolder = archiveLibrary.getRootFolder()
zipFolder.mkdirs()
def group = artifact.getModuleVersion().id.group.capitalize()
Expand Down Expand Up @@ -222,25 +221,30 @@ class VariantProcessor {
}

private Task handleClassesMergeTask(final boolean isMinifyEnabled) {
final Task task = mProject.tasks.create(name: 'mergeClasses'
+ mVariant.name.capitalize())
task.doFirst {
def dustDir = mVersionAdapter.getClassPathDirFiles().first()
if (isMinifyEnabled) {
ExplodedHelper.processClassesJarInfoClasses(mProject, mAndroidArchiveLibraries, dustDir)
ExplodedHelper.processLibsIntoClasses(mProject, mAndroidArchiveLibraries, mJarFiles, dustDir)
} else {
ExplodedHelper.processClassesJarInfoClasses(mProject, mAndroidArchiveLibraries, dustDir)
final Task task = mProject.tasks.create(name: 'mergeClasses' + mVariant.name.capitalize()) {
def outputDir = mVersionAdapter.getClassPathDirFiles().first()
outputs.dir(outputDir)

doFirst {
if (isMinifyEnabled) {
ExplodedHelper.processClassesJarInfoClasses(mProject, mAndroidArchiveLibraries, outputDir)
ExplodedHelper.processLibsIntoClasses(mProject, mAndroidArchiveLibraries, mJarFiles, outputDir)
} else {
ExplodedHelper.processClassesJarInfoClasses(mProject, mAndroidArchiveLibraries, outputDir)
}
}
}
return task
}

private Task handleJarMergeTask() {
final Task task = mProject.tasks.create(name: 'mergeJars'
+ mVariant.name.capitalize())
task.doFirst {
ExplodedHelper.processLibsIntoLibs(mProject, mAndroidArchiveLibraries, mJarFiles, mVersionAdapter.getLibsDirFile())
final Task task = mProject.tasks.create(name: 'mergeJars' + mVariant.name.capitalize()) {
def outputDir = mVersionAdapter.getLibsDirFile()
outputs.dir(outputDir)

doFirst {
ExplodedHelper.processLibsIntoLibs(mProject, mAndroidArchiveLibraries, mJarFiles, outputDir)
}
}
return task
}
Expand Down

0 comments on commit a438b2b

Please sign in to comment.