1
0
Fork 0
mirror of https://github.com/ethauvin/kobalt.git synced 2025-04-27 08:38:13 -07:00

Don't explode the aar if it's already there.

This commit is contained in:
Cedric Beust 2015-12-11 04:48:12 +04:00
parent f6cd3e2259
commit 4b122ac231

View file

@ -122,12 +122,16 @@ public class AndroidPlugin @Inject constructor(val javaCompiler: JavaCompiler,
it.jarFile.get().name.endsWith(".aar") it.jarFile.get().name.endsWith(".aar")
}.forEach { }.forEach {
val mavenId = MavenId.create(it.id) val mavenId = MavenId.create(it.id)
val outputDir = AndroidFiles.intermediates(project) val destDir = File(AndroidFiles.exploded(project, mavenId))
val destDir = Paths.get(outputDir, "exploded-aar", mavenId.groupId, if (!File(AndroidFiles.explodedManifest(project, mavenId)).exists()) {
mavenId.artifactId, mavenId.version)
.toFile()
log(2, "Exploding ${it.jarFile.get()} to $destDir") log(2, "Exploding ${it.jarFile.get()} to $destDir")
JarUtils.extractJarFile(it.jarFile.get(), destDir) JarUtils.extractJarFile(it.jarFile.get(), destDir)
// Copy all the resources from this aar into the same intermediate directory
KFiles.copyRecursively(destDir.resolve("res"), resDir)
} else {
log(2, "$destDir already exists, not extracting again")
}
val classesJar = AndroidFiles.classesJar(project, mavenId) val classesJar = AndroidFiles.classesJar(project, mavenId)
// Add the classses.jar of this .aar to the classpath entries (which are returned via IClasspathContributor) // Add the classses.jar of this .aar to the classpath entries (which are returned via IClasspathContributor)
@ -140,11 +144,7 @@ public class AndroidPlugin @Inject constructor(val javaCompiler: JavaCompiler,
} }
} }
} }
// Copy all the resources from this aar into the same intermediate directory
log(2, "Copying the resources to $resDir")
result.add(destDir) result.add(destDir)
KFiles.copyRecursively(destDir.resolve("res"), resDir)
} }
return result return result
} }