From 3d4f8ef863183d7a32844dfa4e39de526e3e1684 Mon Sep 17 00:00:00 2001 From: puboe <> Date: Tue, 8 Sep 2020 17:57:54 +0200 Subject: [PATCH 01/13] Fix some warnings --- .../main/groovy/com/kezong/fataar/RProcessor.groovy | 10 +++++----- .../groovy/com/kezong/fataar/VariantProcessor.groovy | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/source/src/main/groovy/com/kezong/fataar/RProcessor.groovy b/source/src/main/groovy/com/kezong/fataar/RProcessor.groovy index 2da936cd..993f0271 100644 --- a/source/src/main/groovy/com/kezong/fataar/RProcessor.groovy +++ b/source/src/main/groovy/com/kezong/fataar/RProcessor.groovy @@ -197,7 +197,7 @@ class RProcessor { it.sourceCompatibility = mProject.android.compileOptions.sourceCompatibility it.targetCompatibility = mProject.android.compileOptions.targetCompatibility it.classpath = classpath - it.destinationDir destinationDir + it.destinationDir = destinationDir }) task.doFirst { @@ -214,7 +214,7 @@ class RProcessor { return task } - private Task createRJarTask(final def fromDir, final def desFile) { + private Task createRJarTask(final File fromDir, final File desFile) { String taskName = "createRsJar${mVariant.name.capitalize()}" Task task = mProject.getTasks().create(taskName, Jar.class, { it.from fromDir.path @@ -225,7 +225,7 @@ class RProcessor { it.getDestinationDirectory().set(desFile) } else { it.archiveName = "r-classes.jar" - it.destinationDir desFile + it.destinationDir = desFile } }) task.doFirst { @@ -244,14 +244,14 @@ class RProcessor { it.getDestinationDirectory().set(destDir) } else { it.archiveName = new File(filePath).name - it.destinationDir(destDir) + it.destinationDir = destDir } }) return task } - def deleteEmptyDir = { file -> + private void deleteEmptyDir(final File file) { file.listFiles().each { x -> if (x.isDirectory()) { if (x.listFiles().size() == 0) { diff --git a/source/src/main/groovy/com/kezong/fataar/VariantProcessor.groovy b/source/src/main/groovy/com/kezong/fataar/VariantProcessor.groovy index 0a21d09f..445decbf 100644 --- a/source/src/main/groovy/com/kezong/fataar/VariantProcessor.groovy +++ b/source/src/main/groovy/com/kezong/fataar/VariantProcessor.groovy @@ -23,7 +23,7 @@ class VariantProcessor { private final LibraryVariant mVariant - private Set mResolvedArtifacts = new ArrayList<>() + private Set mResolvedArtifacts = new HashSet<>() private Collection mAndroidArchiveLibraries = new ArrayList<>() From 8efcaaf4ef72207e43c0d37de80b1f07749afb52 Mon Sep 17 00:00:00 2001 From: puboe <8038503+puboe@users.noreply.github.com> Date: Tue, 8 Sep 2020 18:07:21 +0200 Subject: [PATCH 02/13] Migrate mergeClasses tasks to config avoidance API --- .../com/kezong/fataar/VariantProcessor.groovy | 32 +++++++++---------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/source/src/main/groovy/com/kezong/fataar/VariantProcessor.groovy b/source/src/main/groovy/com/kezong/fataar/VariantProcessor.groovy index 445decbf..5f7d6e84 100644 --- a/source/src/main/groovy/com/kezong/fataar/VariantProcessor.groovy +++ b/source/src/main/groovy/com/kezong/fataar/VariantProcessor.groovy @@ -11,6 +11,7 @@ import org.gradle.api.internal.artifacts.DefaultResolvedArtifact import org.gradle.api.internal.tasks.CachingTaskDependencyResolveContext import org.gradle.api.tasks.Copy import org.gradle.api.tasks.TaskDependency +import org.gradle.api.tasks.TaskProvider /** * Processor for variant @@ -221,24 +222,25 @@ class VariantProcessor { processManifestTask.finalizedBy manifestsMergeTask } - 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) + private TaskProvider handleClassesMergeTask(final boolean isMinifyEnabled) { + final TaskProvider task = mProject.tasks.register('mergeClasses' + mVariant.name.capitalize()) { + dependsOn(mExplodeTasks) + dependsOn(mVersionAdapter.getJavaCompileTask()) + 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) + } } } return task } private Task handleJarMergeTask() { - final Task task = mProject.tasks.create(name: 'mergeJars' - + mVariant.name.capitalize()) + final Task task = mProject.tasks.create('mergeJars' + mVariant.name.capitalize()) task.doFirst { ExplodedHelper.processLibsIntoLibs(mProject, mAndroidArchiveLibraries, mJarFiles, mVersionAdapter.getLibsDirFile()) } @@ -270,12 +272,8 @@ class VariantProcessor { } Task javacTask = mVersionAdapter.getJavaCompileTask() - Task mergeClasses = handleClassesMergeTask(isMinifyEnabled) + TaskProvider mergeClasses = handleClassesMergeTask(isMinifyEnabled) syncLibTask.dependsOn(mergeClasses) - mExplodeTasks.each { it -> - mergeClasses.dependsOn it - } - mergeClasses.dependsOn(javacTask) if (!isMinifyEnabled) { Task mergeJars = handleJarMergeTask() From 1e8792e7a9d23ce004b3a095991c5f57cc25725d Mon Sep 17 00:00:00 2001 From: puboe <8038503+puboe@users.noreply.github.com> Date: Tue, 8 Sep 2020 18:16:10 +0200 Subject: [PATCH 03/13] Migrate mergeJar tasks --- .../com/kezong/fataar/VariantProcessor.groovy | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/source/src/main/groovy/com/kezong/fataar/VariantProcessor.groovy b/source/src/main/groovy/com/kezong/fataar/VariantProcessor.groovy index 5f7d6e84..6b2545ba 100644 --- a/source/src/main/groovy/com/kezong/fataar/VariantProcessor.groovy +++ b/source/src/main/groovy/com/kezong/fataar/VariantProcessor.groovy @@ -239,10 +239,14 @@ class VariantProcessor { return task } - private Task handleJarMergeTask() { - final Task task = mProject.tasks.create('mergeJars' + mVariant.name.capitalize()) - task.doFirst { - ExplodedHelper.processLibsIntoLibs(mProject, mAndroidArchiveLibraries, mJarFiles, mVersionAdapter.getLibsDirFile()) + private TaskProvider handleJarMergeTask(final Task syncLibTask) { + final TaskProvider task = mProject.tasks.register('mergeJars' + mVariant.name.capitalize()) { + dependsOn(mExplodeTasks) + dependsOn(mVersionAdapter.getJavaCompileTask()) + mustRunAfter(syncLibTask) + doFirst { + ExplodedHelper.processLibsIntoLibs(mProject, mAndroidArchiveLibraries, mJarFiles, mVersionAdapter.getLibsDirFile()) + } } return task } @@ -271,18 +275,12 @@ class VariantProcessor { throw new RuntimeException("Can not find task ${taskPath}!") } - Task javacTask = mVersionAdapter.getJavaCompileTask() TaskProvider mergeClasses = handleClassesMergeTask(isMinifyEnabled) syncLibTask.dependsOn(mergeClasses) if (!isMinifyEnabled) { - Task mergeJars = handleJarMergeTask() - mergeJars.mustRunAfter(syncLibTask) + TaskProvider mergeJars = handleJarMergeTask(syncLibTask) bundleTask.dependsOn(mergeJars) - mExplodeTasks.each { it -> - mergeJars.dependsOn it - } - mergeJars.dependsOn(javacTask) } } From 4b345e1e1e0540b37273ad8787806c9d45845a74 Mon Sep 17 00:00:00 2001 From: puboe <8038503+puboe@users.noreply.github.com> Date: Tue, 8 Sep 2020 18:38:57 +0200 Subject: [PATCH 04/13] migrate mergeManifest tasks --- .../com/kezong/fataar/VariantProcessor.groovy | 59 ++++++++++--------- 1 file changed, 30 insertions(+), 29 deletions(-) diff --git a/source/src/main/groovy/com/kezong/fataar/VariantProcessor.groovy b/source/src/main/groovy/com/kezong/fataar/VariantProcessor.groovy index 6b2545ba..68cf3d34 100644 --- a/source/src/main/groovy/com/kezong/fataar/VariantProcessor.groovy +++ b/source/src/main/groovy/com/kezong/fataar/VariantProcessor.groovy @@ -1,7 +1,6 @@ package com.kezong.fataar import com.android.build.gradle.api.LibraryVariant -import com.android.build.gradle.tasks.InvokeManifestMerger import org.gradle.api.Project import org.gradle.api.Task import org.gradle.api.artifacts.Dependency @@ -184,42 +183,44 @@ class VariantProcessor { } else { manifestOutput = mProject.file(processManifestTask.getManifestOutputDirectory().absolutePath + '/AndroidManifest.xml') } - InvokeManifestMerger manifestsMergeTask = mProject.tasks.create("merge${mVariant.name.capitalize()}Manifest", LibraryManifestMerger.class) - manifestsMergeTask.setGradleVersion(mProject.getGradle().getGradleVersion()) - manifestsMergeTask.setGradlePluginVersion(mGradlePluginVersion) - manifestsMergeTask.setVariantName(mVariant.name) - manifestsMergeTask.setMainManifestFile(mProject.file("${manifestInputDir}/AndroidManifest.xml")) - List list = new ArrayList<>() - for (archiveLibrary in mAndroidArchiveLibraries) { - list.add(archiveLibrary.getManifest()) - } - manifestsMergeTask.setSecondaryManifestFiles(list) - manifestsMergeTask.setOutputFile(manifestOutput) - manifestsMergeTask.doFirst { - List existFiles = new ArrayList<>() - manifestsMergeTask.getSecondaryManifestFiles().each { - if (it.exists()) { - existFiles.add(it) - } - } - manifestsMergeTask.setSecondaryManifestFiles(existFiles) - } - - mExplodeTasks.each { it -> - manifestsMergeTask.dependsOn it - } // AGP 4.0.0 brings in a change which wipes out the output files whenever a task gets rerun // See https://android.googlesource.com/platform/tools/base/+/studio-master-dev/build-system/gradle-core/src/main/java/com/android/build/gradle/internal/tasks/NonIncrementalTask.kt // The manifest merging task tries to update the manifest in place, by setting input == output, resulting in the input file being explicitly deleted just before the task gets run // The sleight-of-hand below gets things working again - Task copyTask = mProject.tasks.create(name: "copy${mVariant.name.capitalize()}Manifest", type: Copy) { + TaskProvider copyTask = mProject.tasks.register("copy${mVariant.name.capitalize()}Manifest", Copy) { + dependsOn(processManifestTask) + from manifestOutput into mProject.file(manifestInputDir) } - copyTask.dependsOn processManifestTask - manifestsMergeTask.dependsOn copyTask - processManifestTask.finalizedBy manifestsMergeTask + + List list = new ArrayList<>() + for (archiveLibrary in mAndroidArchiveLibraries) { + list.add(archiveLibrary.getManifest()) + } + TaskProvider manifestsMergeTask = mProject.tasks.register("merge${mVariant.name.capitalize()}Manifest", LibraryManifestMerger) { + dependsOn(copyTask) + dependsOn(mExplodeTasks) + + setGradleVersion(mProject.getGradle().getGradleVersion()) + setGradlePluginVersion(mGradlePluginVersion) + setVariantName(mVariant.name) + setMainManifestFile(mProject.file("${manifestInputDir}/AndroidManifest.xml")) + setSecondaryManifestFiles(list) + setOutputFile(manifestOutput) + doFirst { + List existFiles = new ArrayList<>() + getSecondaryManifestFiles().each { + if (it.exists()) { + existFiles.add(it) + } + } + setSecondaryManifestFiles(existFiles) + } + } + + processManifestTask.finalizedBy(manifestsMergeTask) } private TaskProvider handleClassesMergeTask(final boolean isMinifyEnabled) { From 99b6114fcfbe7f59d625c3992826ebf409840337 Mon Sep 17 00:00:00 2001 From: puboe <8038503+puboe@users.noreply.github.com> Date: Tue, 8 Sep 2020 18:47:32 +0200 Subject: [PATCH 05/13] Migrate R file task --- .../com/kezong/fataar/RProcessor.groovy | 30 ++++++++++--------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/source/src/main/groovy/com/kezong/fataar/RProcessor.groovy b/source/src/main/groovy/com/kezong/fataar/RProcessor.groovy index 993f0271..f2f8333b 100644 --- a/source/src/main/groovy/com/kezong/fataar/RProcessor.groovy +++ b/source/src/main/groovy/com/kezong/fataar/RProcessor.groovy @@ -4,6 +4,7 @@ import com.android.build.gradle.api.LibraryVariant import org.gradle.api.Project import org.gradle.api.Task +import org.gradle.api.tasks.TaskProvider import org.gradle.api.tasks.bundling.Zip import org.gradle.api.tasks.compile.JavaCompile import org.gradle.jvm.tasks.Jar @@ -49,8 +50,8 @@ class RProcessor { } void inject(Task bundleTask) { - def RFileTask = createRFileTask(mJavaDir) def RClassTask = createRClassTask(mJavaDir, mClassDir) + def RFileTask = createRFileTask(mJavaDir, RClassTask) def RJarTask = createRJarTask(mClassDir, mJarDir) def reBundleAar = createBundleAarTask(mAarUnZipDir, mAarOutputDir, mAarOutputPath) @@ -89,7 +90,6 @@ class RProcessor { } bundleTask.finalizedBy(RFileTask) - RFileTask.finalizedBy(RClassTask) RClassTask.finalizedBy(RJarTask) RJarTask.finalizedBy(reBundleAar) } @@ -169,21 +169,23 @@ class RProcessor { return map } - private Task createRFileTask(final File destFolder) { - def task = mProject.tasks.create(name: 'createRsFile' + mVariant.name) - task.doLast { - if (destFolder.exists()) { - destFolder.deleteDir() - } - if (mLibraries != null && mLibraries.size() > 0) { - def symbolsMap = getSymbolsMap() - mLibraries.each { - Utils.logInfo("Generate R File, Library:${it.name}") - createRFile(it, destFolder, symbolsMap) + private TaskProvider createRFileTask(final File destFolder, final Task RClassTask) { + def task = mProject.tasks.register('createRsFile' + mVariant.name) { + finalizedBy(RClassTask) + + doLast { + if (destFolder.exists()) { + destFolder.deleteDir() + } + if (mLibraries != null && mLibraries.size() > 0) { + def symbolsMap = getSymbolsMap() + mLibraries.each { + Utils.logInfo("Generate R File, Library:${it.name}") + createRFile(it, destFolder, symbolsMap) + } } } } - return task } From fdab5038da966f2163a1afee371362246396e199 Mon Sep 17 00:00:00 2001 From: puboe <8038503+puboe@users.noreply.github.com> Date: Tue, 8 Sep 2020 18:55:56 +0200 Subject: [PATCH 06/13] migrate more R related tasks --- .../com/kezong/fataar/RProcessor.groovy | 29 ++++++++++--------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/source/src/main/groovy/com/kezong/fataar/RProcessor.groovy b/source/src/main/groovy/com/kezong/fataar/RProcessor.groovy index f2f8333b..43e785a1 100644 --- a/source/src/main/groovy/com/kezong/fataar/RProcessor.groovy +++ b/source/src/main/groovy/com/kezong/fataar/RProcessor.groovy @@ -50,9 +50,9 @@ class RProcessor { } void inject(Task bundleTask) { - def RClassTask = createRClassTask(mJavaDir, mClassDir) - def RFileTask = createRFileTask(mJavaDir, RClassTask) def RJarTask = createRJarTask(mClassDir, mJarDir) + def RClassTask = createRClassTask(mJavaDir, mClassDir, RJarTask) + def RFileTask = createRFileTask(mJavaDir, RClassTask) def reBundleAar = createBundleAarTask(mAarUnZipDir, mAarOutputDir, mAarOutputPath) reBundleAar.doFirst { @@ -90,7 +90,6 @@ class RProcessor { } bundleTask.finalizedBy(RFileTask) - RClassTask.finalizedBy(RJarTask) RJarTask.finalizedBy(reBundleAar) } @@ -169,7 +168,7 @@ class RProcessor { return map } - private TaskProvider createRFileTask(final File destFolder, final Task RClassTask) { + private TaskProvider createRFileTask(final File destFolder, final TaskProvider RClassTask) { def task = mProject.tasks.register('createRsFile' + mVariant.name) { finalizedBy(RClassTask) @@ -189,27 +188,29 @@ class RProcessor { return task } - private Task createRClassTask(final def sourceDir, final def destinationDir) { + private TaskProvider createRClassTask(final File sourceDir, final File destinationDir, final Task RJarTask) { mProject.mkdir(destinationDir) def classpath = mVersionAdapter.getRClassPath() String taskName = "compileRs${mVariant.name.capitalize()}" - Task task = mProject.getTasks().create(taskName, JavaCompile.class, { + TaskProvider task = mProject.getTasks().register(taskName, JavaCompile.class) { + finalizedBy(RJarTask) + it.source = sourceDir.path it.sourceCompatibility = mProject.android.compileOptions.sourceCompatibility it.targetCompatibility = mProject.android.compileOptions.targetCompatibility it.classpath = classpath it.destinationDir = destinationDir - }) - task.doFirst { - Utils.logInfo("Compile R.class, Dir:${sourceDir.path}") - Utils.logInfo("Compile R.class, classpath:${classpath.first().absolutePath}") + doFirst { + Utils.logInfo("Compile R.class, Dir:${sourceDir.path}") + Utils.logInfo("Compile R.class, classpath:${classpath.first().absolutePath}") - if (mGradlePluginVersion != null && Utils.compareVersion(mGradlePluginVersion, "3.3.0") >= 0) { - mProject.copy { - from mProject.zipTree(mVersionAdapter.getRClassPath().first().absolutePath + "/R.jar") - into mVersionAdapter.getRClassPath().first().absolutePath + if (mGradlePluginVersion != null && Utils.compareVersion(mGradlePluginVersion, "3.3.0") >= 0) { + mProject.copy { + from mProject.zipTree(mVersionAdapter.getRClassPath().first().absolutePath + "/R.jar") + into mVersionAdapter.getRClassPath().first().absolutePath + } } } } From ce3b0522bdda1ab15fe0155f6598881269da34fb Mon Sep 17 00:00:00 2001 From: puboe <8038503+puboe@users.noreply.github.com> Date: Tue, 8 Sep 2020 19:12:20 +0200 Subject: [PATCH 07/13] Migrate more tasks --- .../com/kezong/fataar/RProcessor.groovy | 46 +++++++++---------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/source/src/main/groovy/com/kezong/fataar/RProcessor.groovy b/source/src/main/groovy/com/kezong/fataar/RProcessor.groovy index 43e785a1..a91132a4 100644 --- a/source/src/main/groovy/com/kezong/fataar/RProcessor.groovy +++ b/source/src/main/groovy/com/kezong/fataar/RProcessor.groovy @@ -1,7 +1,6 @@ package com.kezong.fataar import com.android.build.gradle.api.LibraryVariant - import org.gradle.api.Project import org.gradle.api.Task import org.gradle.api.tasks.TaskProvider @@ -9,7 +8,6 @@ import org.gradle.api.tasks.bundling.Zip import org.gradle.api.tasks.compile.JavaCompile import org.gradle.jvm.tasks.Jar - /** * R file processor * @author kezong on 2019/7/16. @@ -50,21 +48,22 @@ class RProcessor { } void inject(Task bundleTask) { - def RJarTask = createRJarTask(mClassDir, mJarDir) + def reBundleAar = createBundleAarTask(mAarUnZipDir, mAarOutputDir, mAarOutputPath) + def RJarTask = createRJarTask(mClassDir, mJarDir, reBundleAar) def RClassTask = createRClassTask(mJavaDir, mClassDir, RJarTask) def RFileTask = createRFileTask(mJavaDir, RClassTask) - def reBundleAar = createBundleAarTask(mAarUnZipDir, mAarOutputDir, mAarOutputPath) - reBundleAar.doFirst { - mProject.copy { - from mProject.zipTree(mAarOutputPath) - into mAarUnZipDir + reBundleAar.configure { + doFirst { + mProject.copy { + from mProject.zipTree(mAarOutputPath) + into mAarUnZipDir + } + deleteEmptyDir(mAarUnZipDir) + } + doLast { + Utils.logAnytime("target: $mAarOutputPath") } - deleteEmptyDir(mAarUnZipDir) - } - - reBundleAar.doLast { - Utils.logAnytime("target: $mAarOutputPath") } bundleTask.doFirst { @@ -90,7 +89,6 @@ class RProcessor { } bundleTask.finalizedBy(RFileTask) - RJarTask.finalizedBy(reBundleAar) } private def createRFile(AndroidArchiveLibrary library, def rFolder, ConfigObject symbolsMap) { @@ -188,7 +186,7 @@ class RProcessor { return task } - private TaskProvider createRClassTask(final File sourceDir, final File destinationDir, final Task RJarTask) { + private TaskProvider createRClassTask(final File sourceDir, final File destinationDir, final TaskProvider RJarTask) { mProject.mkdir(destinationDir) def classpath = mVersionAdapter.getRClassPath() @@ -217,9 +215,11 @@ class RProcessor { return task } - private Task createRJarTask(final File fromDir, final File desFile) { + private TaskProvider createRJarTask(final File fromDir, final File desFile, final TaskProvider reBundleAarTask) { String taskName = "createRsJar${mVariant.name.capitalize()}" - Task task = mProject.getTasks().create(taskName, Jar.class, { + TaskProvider task = mProject.getTasks().register(taskName, Jar) { + finalizedBy(reBundleAarTask) + it.from fromDir.path // The destinationDir property has been deprecated. // This is scheduled to be removed in Gradle 7.0. Please use the destinationDirectory property instead. @@ -230,16 +230,16 @@ class RProcessor { it.archiveName = "r-classes.jar" it.destinationDir = desFile } - }) - task.doFirst { - Utils.logInfo("Generate R.jar, Dir:$fromDir") + doFirst { + Utils.logInfo("Generate R.jar, Dir:$fromDir") + } } return task } - private Task createBundleAarTask(final File from, final File destDir, final String filePath) { + private TaskProvider createBundleAarTask(final File from, final File destDir, final String filePath) { String taskName = "reBundleAar${mVariant.name.capitalize()}" - Task task = mProject.getTasks().create(taskName, Zip.class, { + TaskProvider task = mProject.getTasks().register(taskName, Zip.class) { it.from from it.include "**" if (Utils.compareVersion(mProject.gradle.gradleVersion, "6.0.1") >= 0) { @@ -249,7 +249,7 @@ class RProcessor { it.archiveName = new File(filePath).name it.destinationDir = destDir } - }) + } return task } From 2f5353f1c750c73b910e42bb84bfdeb02a3b6149 Mon Sep 17 00:00:00 2001 From: puboe <8038503+puboe@users.noreply.github.com> Date: Tue, 8 Sep 2020 20:02:09 +0200 Subject: [PATCH 08/13] Migrate more tasks --- .../com/kezong/fataar/VariantProcessor.groovy | 49 ++++++++----------- 1 file changed, 21 insertions(+), 28 deletions(-) diff --git a/source/src/main/groovy/com/kezong/fataar/VariantProcessor.groovy b/source/src/main/groovy/com/kezong/fataar/VariantProcessor.groovy index 68cf3d34..0dc57743 100644 --- a/source/src/main/groovy/com/kezong/fataar/VariantProcessor.groovy +++ b/source/src/main/groovy/com/kezong/fataar/VariantProcessor.groovy @@ -6,7 +6,6 @@ import org.gradle.api.Task import org.gradle.api.artifacts.Dependency import org.gradle.api.artifacts.ResolvedArtifact import org.gradle.api.artifacts.ResolvedDependency -import org.gradle.api.internal.artifacts.DefaultResolvedArtifact import org.gradle.api.internal.tasks.CachingTaskDependencyResolveContext import org.gradle.api.tasks.Copy import org.gradle.api.tasks.TaskDependency @@ -129,7 +128,7 @@ class VariantProcessor { * exploded artifact files */ private void processArtifacts(Task prepareTask, Task bundleTask) { - for (final DefaultResolvedArtifact artifact in mResolvedArtifacts) { + for (final ResolvedArtifact artifact in mResolvedArtifacts) { if (FatLibraryPlugin.ARTIFACT_TYPE_JAR == artifact.type) { addJarFile(artifact.file) } else if (FatLibraryPlugin.ARTIFACT_TYPE_AAR == artifact.type) { @@ -153,7 +152,7 @@ class VariantProcessor { def group = artifact.getModuleVersion().id.group.capitalize() def name = artifact.name.capitalize() String taskName = "explode${group}${name}${mVariant.name.capitalize()}" - Task explodeTask = mProject.tasks.create(name: taskName, type: Copy) { + Task explodeTask = mProject.tasks.create(taskName, Copy) { from mProject.zipTree(artifact.file.absolutePath) into zipFolder } @@ -350,26 +349,26 @@ class VariantProcessor { */ private void processJniLibs() { String taskPath = 'merge' + mVariant.name.capitalize() + 'JniLibFolders' - Task mergeJniLibsTask = mProject.tasks.findByPath(taskPath) + TaskProvider mergeJniLibsTask = mProject.tasks.named(taskPath) if (mergeJniLibsTask == null) { throw new RuntimeException("Can not find task ${taskPath}!") } - mergeJniLibsTask.doFirst { - for (archiveLibrary in mAndroidArchiveLibraries) { - if (archiveLibrary.jniFolder != null && archiveLibrary.jniFolder.exists()) { - mProject.android.sourceSets.each { - if (it.name == mVariant.name) { - it.jniLibs.srcDir(archiveLibrary.jniFolder) + mergeJniLibsTask.configure { + dependsOn(mExplodeTasks) + + doFirst { + for (archiveLibrary in mAndroidArchiveLibraries) { + if (archiveLibrary.jniFolder != null && archiveLibrary.jniFolder.exists()) { + mProject.android.sourceSets.each { + if (it.name == mVariant.name) { + it.jniLibs.srcDir(archiveLibrary.jniFolder) + } } } } } } - - mExplodeTasks.each { it -> - mergeJniLibsTask.dependsOn it - } } /** @@ -378,31 +377,25 @@ class VariantProcessor { */ private void processProguardTxt(Task prepareTask) { String taskPath = 'merge' + mVariant.name.capitalize() + 'ConsumerProguardFiles' - Task mergeFileTask = mProject.tasks.findByPath(taskPath) + TaskProvider mergeFileTask = mProject.tasks.named(taskPath) if (mergeFileTask == null) { throw new RuntimeException("Can not find task ${taskPath}!") } + + def proguardFiles = new ArrayList() for (archiveLibrary in mAndroidArchiveLibraries) { List thirdProguardFiles = archiveLibrary.proguardRules for (File file : thirdProguardFiles) { if (file.exists()) { Utils.logInfo('add proguard file: ' + file.absolutePath) - mergeFileTask.getInputs().file(file) + proguardFiles.add(file) } } } - mergeFileTask.doFirst { - def proguardFiles = mergeFileTask.getInputFiles() - for (archiveLibrary in mAndroidArchiveLibraries) { - List thirdProguardFiles = archiveLibrary.proguardRules - for (File file : thirdProguardFiles) { - if (file.exists()) { - Utils.logInfo('add proguard file: ' + file.absolutePath) - proguardFiles.add(file) - } - } - } + + mergeFileTask.configure { + dependsOn(prepareTask) + inputs.files(proguardFiles) } - mergeFileTask.dependsOn prepareTask } } From a298ce258f44c7a7f6edd60e9d06d4e4f1ee5731 Mon Sep 17 00:00:00 2001 From: puboe <8038503+puboe@users.noreply.github.com> Date: Tue, 8 Sep 2020 20:09:46 +0200 Subject: [PATCH 09/13] Migrate sync task --- .../main/groovy/com/kezong/fataar/VariantProcessor.groovy | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/source/src/main/groovy/com/kezong/fataar/VariantProcessor.groovy b/source/src/main/groovy/com/kezong/fataar/VariantProcessor.groovy index 0dc57743..5e381db4 100644 --- a/source/src/main/groovy/com/kezong/fataar/VariantProcessor.groovy +++ b/source/src/main/groovy/com/kezong/fataar/VariantProcessor.groovy @@ -239,7 +239,7 @@ class VariantProcessor { return task } - private TaskProvider handleJarMergeTask(final Task syncLibTask) { + private TaskProvider handleJarMergeTask(final TaskProvider syncLibTask) { final TaskProvider task = mProject.tasks.register('mergeJars' + mVariant.name.capitalize()) { dependsOn(mExplodeTasks) dependsOn(mVersionAdapter.getJavaCompileTask()) @@ -270,13 +270,15 @@ class VariantProcessor { } String taskPath = mVersionAdapter.getSyncLibJarsTaskPath() - Task syncLibTask = mProject.tasks.findByPath(taskPath) + TaskProvider syncLibTask = mProject.tasks.named(taskPath) if (syncLibTask == null) { throw new RuntimeException("Can not find task ${taskPath}!") } TaskProvider mergeClasses = handleClassesMergeTask(isMinifyEnabled) - syncLibTask.dependsOn(mergeClasses) + syncLibTask.configure { + dependsOn(mergeClasses) + } if (!isMinifyEnabled) { TaskProvider mergeJars = handleJarMergeTask(syncLibTask) From fe06d99995d679e9a9acf62ed282b82076d06b83 Mon Sep 17 00:00:00 2001 From: puboe <8038503+puboe@users.noreply.github.com> Date: Tue, 8 Sep 2020 20:12:41 +0200 Subject: [PATCH 10/13] Avoid generateResources tasks creation --- .../com/kezong/fataar/VariantProcessor.groovy | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/source/src/main/groovy/com/kezong/fataar/VariantProcessor.groovy b/source/src/main/groovy/com/kezong/fataar/VariantProcessor.groovy index 5e381db4..72b47fa8 100644 --- a/source/src/main/groovy/com/kezong/fataar/VariantProcessor.groovy +++ b/source/src/main/groovy/com/kezong/fataar/VariantProcessor.groovy @@ -297,25 +297,25 @@ class VariantProcessor { */ private void processResourcesAndR() { String taskPath = 'generate' + mVariant.name.capitalize() + 'Resources' - Task resourceGenTask = mProject.tasks.findByPath(taskPath) + TaskProvider resourceGenTask = mProject.tasks.named(taskPath) if (resourceGenTask == null) { throw new RuntimeException("Can not find task ${taskPath}!") } - resourceGenTask.doFirst { - for (archiveLibrary in mAndroidArchiveLibraries) { - mProject.android.sourceSets.each { - if (it.name == mVariant.name) { - Utils.logInfo("Merge resource,Library res:${archiveLibrary.resFolder}") - it.res.srcDir(archiveLibrary.resFolder) + resourceGenTask.configure { + dependsOn(mExplodeTasks) + + doFirst { + for (archiveLibrary in mAndroidArchiveLibraries) { + mProject.android.sourceSets.each { + if (it.name == mVariant.name) { + Utils.logInfo("Merge resource,Library res:${archiveLibrary.resFolder}") + it.res.srcDir(archiveLibrary.resFolder) + } } } } } - - mExplodeTasks.each { it -> - resourceGenTask.dependsOn(it) - } } /** From 8bb08e55a026d52191e9099bfede1adc899181be Mon Sep 17 00:00:00 2001 From: puboe <8038503+puboe@users.noreply.github.com> Date: Tue, 8 Sep 2020 20:27:47 +0200 Subject: [PATCH 11/13] Avoid creation of preBuild tasks --- .../main/groovy/com/kezong/fataar/VariantProcessor.groovy | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/src/main/groovy/com/kezong/fataar/VariantProcessor.groovy b/source/src/main/groovy/com/kezong/fataar/VariantProcessor.groovy index 72b47fa8..0348551a 100644 --- a/source/src/main/groovy/com/kezong/fataar/VariantProcessor.groovy +++ b/source/src/main/groovy/com/kezong/fataar/VariantProcessor.groovy @@ -89,7 +89,7 @@ class VariantProcessor { void processVariant() { String taskPath = 'pre' + mVariant.name.capitalize() + 'Build' - Task prepareTask = mProject.tasks.findByPath(taskPath) + TaskProvider prepareTask = mProject.tasks.named(taskPath) if (prepareTask == null) { throw new RuntimeException("Can not find task ${taskPath}!") } @@ -127,7 +127,7 @@ class VariantProcessor { /** * exploded artifact files */ - private void processArtifacts(Task prepareTask, Task bundleTask) { + private void processArtifacts(TaskProvider prepareTask, Task bundleTask) { for (final ResolvedArtifact artifact in mResolvedArtifacts) { if (FatLibraryPlugin.ARTIFACT_TYPE_JAR == artifact.type) { addJarFile(artifact.file) @@ -377,7 +377,7 @@ class VariantProcessor { * fixme * merge proguard.txt */ - private void processProguardTxt(Task prepareTask) { + private void processProguardTxt(TaskProvider prepareTask) { String taskPath = 'merge' + mVariant.name.capitalize() + 'ConsumerProguardFiles' TaskProvider mergeFileTask = mProject.tasks.named(taskPath) if (mergeFileTask == null) { From 790742684a620a1b1616a8aa8c706bddfb71d11c Mon Sep 17 00:00:00 2001 From: puboe <8038503+puboe@users.noreply.github.com> Date: Tue, 8 Sep 2020 21:09:50 +0200 Subject: [PATCH 12/13] Refactor duplicated code --- .../com/kezong/fataar/FlavorArtifact.groovy | 26 +++++++----- .../com/kezong/fataar/RProcessor.groovy | 40 ++++++++++--------- .../com/kezong/fataar/VariantProcessor.groovy | 23 +++++------ 3 files changed, 47 insertions(+), 42 deletions(-) diff --git a/source/src/main/groovy/com/kezong/fataar/FlavorArtifact.groovy b/source/src/main/groovy/com/kezong/fataar/FlavorArtifact.groovy index f894acab..2a2976f2 100644 --- a/source/src/main/groovy/com/kezong/fataar/FlavorArtifact.groovy +++ b/source/src/main/groovy/com/kezong/fataar/FlavorArtifact.groovy @@ -3,6 +3,7 @@ package com.kezong.fataar import com.android.build.gradle.api.LibraryVariant import org.gradle.api.Project import org.gradle.api.Task +import org.gradle.api.UnknownTaskException import org.gradle.api.artifacts.ModuleVersionIdentifier import org.gradle.api.artifacts.ResolvedDependency import org.gradle.api.artifacts.component.ComponentArtifactIdentifier @@ -12,6 +13,7 @@ import org.gradle.api.internal.artifacts.DefaultResolvedArtifact import org.gradle.api.internal.tasks.TaskDependencyContainer import org.gradle.api.internal.tasks.TaskDependencyResolveContext import org.gradle.api.tasks.TaskDependency +import org.gradle.api.tasks.TaskProvider import org.gradle.internal.Factory import org.gradle.internal.component.model.DefaultIvyArtifactName @@ -95,22 +97,26 @@ class FlavorArtifact { return new File(outputName) } - private static TaskDependency createTaskDependency(Project project, LibraryVariant variant) { - def taskPath = 'bundle' + variant.name.capitalize() - Task bundleTask = project.tasks.findByPath(taskPath) - if (bundleTask == null) { - taskPath = 'bundle' + variant.name.capitalize() + "Aar" - bundleTask = project.tasks.findByPath(taskPath) - } - if (bundleTask == null) { - throw new RuntimeException("Can not find task ${taskPath}!") + static TaskProvider getBundleTaskProvider(final Project project, final LibraryVariant variant) throws UnknownTaskException { + def taskPath = "bundle" + variant.name.capitalize() + TaskProvider bundleTask + try { + bundleTask = project.tasks.named(taskPath) + } catch (UnknownTaskException ignored) { + taskPath += "Aar" + bundleTask = project.tasks.named(taskPath) } + return bundleTask + } + + private static TaskDependency createTaskDependency(Project project, LibraryVariant variant) { + def bundleTaskProvider = getBundleTaskProvider(project, variant) return new TaskDependency() { @Override Set getDependencies(@Nullable Task task) { def set = new HashSet() - set.add(bundleTask) + set.add(bundleTaskProvider.get()) return set } } diff --git a/source/src/main/groovy/com/kezong/fataar/RProcessor.groovy b/source/src/main/groovy/com/kezong/fataar/RProcessor.groovy index a91132a4..7ba6b554 100644 --- a/source/src/main/groovy/com/kezong/fataar/RProcessor.groovy +++ b/source/src/main/groovy/com/kezong/fataar/RProcessor.groovy @@ -47,7 +47,7 @@ class RProcessor { mAarOutputPath = mVersionAdapter.getOutputPath() } - void inject(Task bundleTask) { + void inject(TaskProvider bundleTask) { def reBundleAar = createBundleAarTask(mAarUnZipDir, mAarOutputDir, mAarOutputPath) def RJarTask = createRJarTask(mClassDir, mJarDir, reBundleAar) def RClassTask = createRClassTask(mJavaDir, mClassDir, RJarTask) @@ -66,29 +66,31 @@ class RProcessor { } } - bundleTask.doFirst { - File f = new File(mAarOutputPath) - if (f.exists()) { - f.delete() + bundleTask.configure { + finalizedBy(RFileTask) + + doFirst { + File f = new File(mAarOutputPath) + if (f.exists()) { + f.delete() + } + mJarDir.getParentFile().deleteDir() + mJarDir.mkdirs() } - mJarDir.getParentFile().deleteDir() - mJarDir.mkdirs() - } - bundleTask.doLast { - // support gradle 5.1 && gradle plugin 3.4 before, the outputName is changed - File file = new File(mAarOutputPath) - if (!file.exists()) { - mAarOutputPath = mAarOutputDir.absolutePath + "/" + mProject.name + ".aar" - if (Utils.compareVersion(mProject.gradle.gradleVersion, "6.0.1") >= 0) { - reBundleAar.getArchiveFileName().set(new File(mAarOutputPath).name) - } else { - reBundleAar.archiveName = new File(mAarOutputPath).name + doLast { + // support gradle 5.1 && gradle plugin 3.4 before, the outputName is changed + File file = new File(mAarOutputPath) + if (!file.exists()) { + mAarOutputPath = mAarOutputDir.absolutePath + "/" + mProject.name + ".aar" + if (Utils.compareVersion(mProject.gradle.gradleVersion, "6.0.1") >= 0) { + reBundleAar.getArchiveFileName().set(new File(mAarOutputPath).name) + } else { + reBundleAar.archiveName = new File(mAarOutputPath).name + } } } } - - bundleTask.finalizedBy(RFileTask) } private def createRFile(AndroidArchiveLibrary library, def rFolder, ConfigObject symbolsMap) { diff --git a/source/src/main/groovy/com/kezong/fataar/VariantProcessor.groovy b/source/src/main/groovy/com/kezong/fataar/VariantProcessor.groovy index 0348551a..b177f191 100644 --- a/source/src/main/groovy/com/kezong/fataar/VariantProcessor.groovy +++ b/source/src/main/groovy/com/kezong/fataar/VariantProcessor.groovy @@ -93,15 +93,8 @@ class VariantProcessor { if (prepareTask == null) { throw new RuntimeException("Can not find task ${taskPath}!") } - taskPath = 'bundle' + mVariant.name.capitalize() - Task bundleTask = mProject.tasks.findByPath(taskPath) - if (bundleTask == null) { - taskPath = 'bundle' + mVariant.name.capitalize() + "Aar" - bundleTask = mProject.tasks.findByPath(taskPath) - } - if (bundleTask == null) { - throw new RuntimeException("Can not find task ${taskPath}!") - } + TaskProvider bundleTask = FlavorArtifact.getBundleTaskProvider(mProject, mVariant) + processCache() processArtifacts(prepareTask, bundleTask) processClassesAndJars(bundleTask) @@ -127,7 +120,7 @@ class VariantProcessor { /** * exploded artifact files */ - private void processArtifacts(TaskProvider prepareTask, Task bundleTask) { + private void processArtifacts(TaskProvider prepareTask, TaskProvider bundleTask) { for (final ResolvedArtifact artifact in mResolvedArtifacts) { if (FatLibraryPlugin.ARTIFACT_TYPE_JAR == artifact.type) { addJarFile(artifact.file) @@ -164,7 +157,9 @@ class VariantProcessor { } Task javacTask = mVersionAdapter.getJavaCompileTask() javacTask.dependsOn(explodeTask) - bundleTask.dependsOn(explodeTask) + bundleTask.configure { + dependsOn(explodeTask) + } mExplodeTasks.add(explodeTask) } } @@ -254,7 +249,7 @@ class VariantProcessor { /** * merge classes and jars */ - private void processClassesAndJars(Task bundleTask) { + private void processClassesAndJars(TaskProvider bundleTask) { boolean isMinifyEnabled = mVariant.getBuildType().isMinifyEnabled() if (isMinifyEnabled) { //merge proguard file @@ -282,7 +277,9 @@ class VariantProcessor { if (!isMinifyEnabled) { TaskProvider mergeJars = handleJarMergeTask(syncLibTask) - bundleTask.dependsOn(mergeJars) + bundleTask.configure { + dependsOn(mergeJars) + } } } From 964e47ed75da8738ddff58ee577a310b884a02db Mon Sep 17 00:00:00 2001 From: kezong <379977@qq.com> Date: Thu, 10 Sep 2020 17:57:26 +0800 Subject: [PATCH 13/13] support merge data-binding files #25 #67 --- source/build.gradle | 2 +- .../gradle/wrapper/gradle-wrapper.properties | 2 +- .../groovy/com/kezong/fataar/Constants.groovy | 8 ++++ .../com/kezong/fataar/RProcessor.groovy | 7 ++-- .../com/kezong/fataar/VariantProcessor.groovy | 42 ++++++++++++++++++- .../kezong/fataar/AndroidArchiveLibrary.java | 8 ++++ 6 files changed, 61 insertions(+), 8 deletions(-) create mode 100644 source/src/main/groovy/com/kezong/fataar/Constants.groovy diff --git a/source/build.gradle b/source/build.gradle index 0e3eeb74..31334f10 100644 --- a/source/build.gradle +++ b/source/build.gradle @@ -21,7 +21,7 @@ dependencies { implementation gradleApi() implementation localGroovy() - implementation 'com.android.tools.build:gradle:4.0.0' + implementation 'com.android.tools.build:gradle:3.6.1' } //afterEvaluate { diff --git a/source/gradle/wrapper/gradle-wrapper.properties b/source/gradle/wrapper/gradle-wrapper.properties index be297714..eb891f28 100644 --- a/source/gradle/wrapper/gradle-wrapper.properties +++ b/source/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-all.zip diff --git a/source/src/main/groovy/com/kezong/fataar/Constants.groovy b/source/src/main/groovy/com/kezong/fataar/Constants.groovy new file mode 100644 index 00000000..76ae3318 --- /dev/null +++ b/source/src/main/groovy/com/kezong/fataar/Constants.groovy @@ -0,0 +1,8 @@ +package com.kezong.fataar + +class Constants { + + public static final String RE_BUNDLE_FOLDER = "aar_rebundle" + + public static final String INTERMEDIATES_TEMP_FOLDER = "fat-r" +} \ No newline at end of file diff --git a/source/src/main/groovy/com/kezong/fataar/RProcessor.groovy b/source/src/main/groovy/com/kezong/fataar/RProcessor.groovy index 7ba6b554..bd8361b6 100644 --- a/source/src/main/groovy/com/kezong/fataar/RProcessor.groovy +++ b/source/src/main/groovy/com/kezong/fataar/RProcessor.groovy @@ -34,11 +34,11 @@ class RProcessor { mGradlePluginVersion = version mVersionAdapter = new VersionAdapter(project, variant, version) // R.java dir - mJavaDir = mProject.file("${mProject.getBuildDir()}/intermediates/fat-R/r/${mVariant.dirName}") + mJavaDir = mProject.file("${mProject.getBuildDir()}/intermediates/${Constants.INTERMEDIATES_TEMP_FOLDER}/r/${mVariant.dirName}") // R.class compile dir - mClassDir = mProject.file("${mProject.getBuildDir()}/intermediates/fat-R/r-class/${mVariant.dirName}") + mClassDir = mProject.file("${mProject.getBuildDir()}/intermediates/${Constants.INTERMEDIATES_TEMP_FOLDER}/r-class/${mVariant.dirName}") // R.jar dir - mJarDir = mProject.file("${mProject.getBuildDir()}/outputs/aar-R/${mVariant.dirName}/libs") + mJarDir = mProject.file("${mProject.getBuildDir()}/outputs/${Constants.RE_BUNDLE_FOLDER}/${mVariant.dirName}/libs") // aar zip file mAarUnZipDir = mJarDir.getParentFile() // aar output dir @@ -74,7 +74,6 @@ class RProcessor { if (f.exists()) { f.delete() } - mJarDir.getParentFile().deleteDir() mJarDir.mkdirs() } diff --git a/source/src/main/groovy/com/kezong/fataar/VariantProcessor.groovy b/source/src/main/groovy/com/kezong/fataar/VariantProcessor.groovy index b177f191..fb495b8a 100644 --- a/source/src/main/groovy/com/kezong/fataar/VariantProcessor.groovy +++ b/source/src/main/groovy/com/kezong/fataar/VariantProcessor.groovy @@ -106,15 +106,53 @@ class VariantProcessor { processAssets() processJniLibs() processProguardTxt(prepareTask) + processR(bundleTask) + processDataBinding(bundleTask) + } + + private void processR(TaskProvider bundleTask) { RProcessor rProcessor = new RProcessor(mProject, mVariant, mAndroidArchiveLibraries, mGradlePluginVersion) rProcessor.inject(bundleTask) } + private void processDataBinding(TaskProvider bundleTask) { + bundleTask.configure { + doFirst { + for (archiveLibrary in mAndroidArchiveLibraries) { + if (archiveLibrary.dataBindingFolder != null && archiveLibrary.dataBindingFolder.exists()) { + String filePath = "${mProject.getBuildDir()}/outputs/${Constants.RE_BUNDLE_FOLDER}" + + "/${mVariant.dirName}/${archiveLibrary.dataBindingFolder.name}" + new File(filePath).mkdirs() + mProject.copy { + from archiveLibrary.dataBindingFolder + into filePath + } + } + + if (archiveLibrary.dataBindingLogFolder != null && archiveLibrary.dataBindingLogFolder.exists()) { + String filePath = "${mProject.getBuildDir()}/outputs/${Constants.RE_BUNDLE_FOLDER}/${mVariant.dirName}" + + "/${archiveLibrary.dataBindingLogFolder.name}" + new File(filePath).mkdirs() + mProject.copy { + from archiveLibrary.dataBindingLogFolder + into filePath + } + } + } + } + } + } + private void processCache() { if (Utils.compareVersion(mGradlePluginVersion, "3.5.0") >= 0) { mVersionAdapter.getLibsDirFile().deleteDir() mVersionAdapter.getClassPathDirFiles().first().deleteDir() } + + File reBundleFile = mProject.file("${mProject.getBuildDir()}/outputs/${Constants.RE_BUNDLE_FOLDER}/${mVariant.dirName}") + if (reBundleFile != null && reBundleFile.exists()) { + reBundleFile.delete() + } } /** @@ -170,7 +208,7 @@ class VariantProcessor { */ private void processManifest() { Task processManifestTask = mVersionAdapter.getProcessManifest() - String manifestInputDir = "${mProject.getBuildDir()}/intermediates/fat-R/manifest" + String manifestInputDir = "${mProject.getBuildDir()}/intermediates/${Constants.INTERMEDIATES_TEMP_FOLDER}/manifest" File manifestOutput if (mGradlePluginVersion != null && Utils.compareVersion(mGradlePluginVersion, "3.3.0") >= 0) { manifestOutput = mProject.file("${mProject.buildDir.path}/intermediates/library_manifest/${mVariant.name}/AndroidManifest.xml") @@ -184,7 +222,7 @@ class VariantProcessor { // The sleight-of-hand below gets things working again TaskProvider copyTask = mProject.tasks.register("copy${mVariant.name.capitalize()}Manifest", Copy) { dependsOn(processManifestTask) - + outputs.upToDateWhen { false } from manifestOutput into mProject.file(manifestInputDir) } diff --git a/source/src/main/java/com/kezong/fataar/AndroidArchiveLibrary.java b/source/src/main/java/com/kezong/fataar/AndroidArchiveLibrary.java index f0006912..dcdc286b 100644 --- a/source/src/main/java/com/kezong/fataar/AndroidArchiveLibrary.java +++ b/source/src/main/java/com/kezong/fataar/AndroidArchiveLibrary.java @@ -127,4 +127,12 @@ public String getPackageName() { } return packageName; } + + public File getDataBindingFolder() { + return new File(getRootFolder(), "data-binding"); + } + + public File getDataBindingLogFolder() { + return new File(getRootFolder(), "data-binding-base-class-log"); + } }