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:
parent
f6cd3e2259
commit
4b122ac231
1 changed files with 11 additions and 11 deletions
|
@ -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)
|
||||||
|
@ -135,16 +139,12 @@ public class AndroidPlugin @Inject constructor(val javaCompiler: JavaCompiler,
|
||||||
// Also add all the jar files found in the libs/ directory
|
// Also add all the jar files found in the libs/ directory
|
||||||
File(destDir, "libs").let { libsDir ->
|
File(destDir, "libs").let { libsDir ->
|
||||||
if (libsDir.exists()) {
|
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))
|
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)
|
result.add(destDir)
|
||||||
KFiles.copyRecursively(destDir.resolve("res"), resDir)
|
|
||||||
}
|
}
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue