1
0
Fork 0
mirror of https://github.com/ethauvin/kobalt.git synced 2025-04-26 08:27:12 -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")
}.forEach {
val mavenId = MavenId.create(it.id)
val outputDir = AndroidFiles.intermediates(project)
val destDir = Paths.get(outputDir, "exploded-aar", mavenId.groupId,
mavenId.artifactId, mavenId.version)
.toFile()
log(2, "Exploding ${it.jarFile.get()} to $destDir")
JarUtils.extractJarFile(it.jarFile.get(), destDir)
val destDir = File(AndroidFiles.exploded(project, mavenId))
if (!File(AndroidFiles.explodedManifest(project, mavenId)).exists()) {
log(2, "Exploding ${it.jarFile.get()} to $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)
// Add the classses.jar of this .aar to the classpath entries (which are returned via IClasspathContributor)
@ -135,16 +139,12 @@ public class AndroidPlugin @Inject constructor(val javaCompiler: JavaCompiler,
// Also add all the jar files found in the libs/ directory
File(destDir, "libs").let { libsDir ->
if (libsDir.exists()) {
libsDir.listFiles().filter { it.name.endsWith(".jar")}.forEach {
libsDir.listFiles().filter { it.name.endsWith(".jar") }.forEach {
classpathEntries.put(project.name, FileDependency(it.absolutePath))
}
}
}
// Copy all the resources from this aar into the same intermediate directory
log(2, "Copying the resources to $resDir")
result.add(destDir)
KFiles.copyRecursively(destDir.resolve("res"), resDir)
}
return result
}