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

.war: run the classpath contributors.

Need to make sure the Kotlin runtime is included in libs/.
This commit is contained in:
Cedric Beust 2015-11-27 05:10:03 -08:00
parent f6d5c8a1f1
commit 947c620e56

View file

@ -105,8 +105,8 @@ class PackagingPlugin @Inject constructor(val dependencyManager : DependencyMana
} }
// //
// Transitive closure of libraries into WEB-INF/libs // The transitive closure of libraries goes into WEB-INF/libs.
// Copy them all in kobaltBuild/war/WEB-INF/libs and created one IncludedFile out of that directory // Copy them all in kobaltBuild/war/WEB-INF/libs and create one IncludedFile out of that directory
// //
val allDependencies = dependencyManager.transitiveClosure(project.compileDependencies) val allDependencies = dependencyManager.transitiveClosure(project.compileDependencies)
@ -114,9 +114,22 @@ class PackagingPlugin @Inject constructor(val dependencyManager : DependencyMana
val outDir = project.buildDirectory + "/war" val outDir = project.buildDirectory + "/war"
val fullDir = outDir + "/" + WEB_INF val fullDir = outDir + "/" + WEB_INF
File(fullDir).mkdirs() File(fullDir).mkdirs()
// Run through all the classpath contributors and add their contributions to the libs/ directory
context.pluginInfo.classpathContributors.map {
it.entriesFor(project)
}.map { deps : Collection<IClasspathDependency> ->
deps.forEach { dep ->
val jar = dep.jarFile.get()
KFiles.copy(Paths.get(jar.path), Paths.get(fullDir, jar.name))
}
}
// Add the regular dependencies to the libs/ directory
allDependencies.map { it.jarFile.get() }.forEach { allDependencies.map { it.jarFile.get() }.forEach {
KFiles.copy(Paths.get(it.absolutePath), Paths.get(fullDir, it.name)) KFiles.copy(Paths.get(it.absolutePath), Paths.get(fullDir, it.name))
} }
allFiles.add(IncludedFile(From(fullDir), To(WEB_INF), listOf(Glob("**")))) allFiles.add(IncludedFile(From(fullDir), To(WEB_INF), listOf(Glob("**"))))
val jarFactory = { os:OutputStream -> JarOutputStream(os, manifest) } val jarFactory = { os:OutputStream -> JarOutputStream(os, manifest) }