From 7fc886cf3e5acef2562b1edf5c2872b3fbbf2302 Mon Sep 17 00:00:00 2001 From: kezong <379977@qq.com> Date: Fri, 23 Oct 2020 19:42:19 +0800 Subject: [PATCH] fix bug that R.class not embed when publish to maven #200 --- .../groovy/com/kezong/fataar/RProcessor.groovy | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/source/src/main/groovy/com/kezong/fataar/RProcessor.groovy b/source/src/main/groovy/com/kezong/fataar/RProcessor.groovy index 3cdaa7e3..47930d32 100644 --- a/source/src/main/groovy/com/kezong/fataar/RProcessor.groovy +++ b/source/src/main/groovy/com/kezong/fataar/RProcessor.groovy @@ -22,7 +22,6 @@ class RProcessor { private final File mClassDir private final File mJarDir private final File mAarUnZipDir - private final File mIntermediateAarFile private final File mAarOutputFile private final String mGradlePluginVersion private VersionAdapter mVersionAdapter @@ -40,8 +39,6 @@ class RProcessor { mJavaDir = mProject.file("${mProject.getBuildDir()}/intermediates/${Constants.INTERMEDIATES_TEMP_FOLDER}/r/${mVariant.name}") // R.class compile dir mClassDir = mProject.file("${mProject.getBuildDir()}/intermediates/${Constants.INTERMEDIATES_TEMP_FOLDER}/r-class/${mVariant.name}") - // Intermediate aar dir - mIntermediateAarFile = mProject.file("${mProject.getBuildDir()}/intermediates/${Constants.INTERMEDIATES_TEMP_FOLDER}/aar/${mVariant.name}/${mAarOutputFile.name}") // R.jar dir mJarDir = mProject.file("${mProject.getBuildDir()}/outputs/${Constants.RE_BUNDLE_FOLDER}/${mVariant.name}/libs") // Aar unzip dir @@ -63,18 +60,13 @@ class RProcessor { bundleTask.configure { it -> finalizedBy(RFileTask) - // Redirect bundle output to intermediate directory to avoid breaking incremental builds - // because of bundle and reBundle tasks having the same output if (Utils.compareVersion(mProject.gradle.gradleVersion, "6.0.1") >= 0) { - it.getDestinationDirectory().set(mIntermediateAarFile.parentFile) + it.getArchiveFileName().set(mAarOutputFile.name) } else { - it.destinationDir = mIntermediateAarFile.parentFile + it.archiveName = mAarOutputFile } doFirst { - if (mIntermediateAarFile.exists()) { - mIntermediateAarFile.delete() - } // Delete previously unzipped data. mAarUnZipDir.deleteDir() mJarDir.mkdirs() @@ -82,7 +74,7 @@ class RProcessor { doLast { mProject.copy { - from mProject.zipTree(mIntermediateAarFile) + from mProject.zipTree(mAarOutputFile) into mAarUnZipDir } deleteEmptyDir(mAarUnZipDir)