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

Clean up a few paths.

This commit is contained in:
Cedric Beust 2016-02-15 11:30:49 -08:00
parent a35e29e3c8
commit ce4bbbe27a

View file

@ -18,13 +18,19 @@ import java.util.jar.JarOutputStream
class WarGenerator @Inject constructor(val dependencyManager: DependencyManager){ class WarGenerator @Inject constructor(val dependencyManager: DependencyManager){
companion object {
val WEB_INF = "WEB-INF"
val CLASSES = "$WEB_INF/classes"
val LIB = "$WEB_INF/lib"
}
fun findIncludedFiles(project: Project, context: KobaltContext, war: War) : List<IncludedFile> { fun findIncludedFiles(project: Project, context: KobaltContext, war: War) : List<IncludedFile> {
// //
// src/main/web app and classes // src/main/web app and classes
// //
val result = arrayListOf( val result = arrayListOf(
IncludedFile(From("src/main/webapp"), To(""), listOf(IFileSpec.GlobSpec("**"))), IncludedFile(From("src/main/webapp"), To(""), listOf(IFileSpec.GlobSpec("**"))),
IncludedFile(From("kobaltBuild/classes"), To("WEB-INF/classes"), listOf(IFileSpec.GlobSpec("**"))) IncludedFile(From("kobaltBuild/classes"), To(CLASSES), listOf(IFileSpec.GlobSpec("**")))
) )
// //
@ -35,9 +41,8 @@ class WarGenerator @Inject constructor(val dependencyManager: DependencyManager)
val allDependencies = dependencyManager.calculateDependencies(project, context, dependentProjects, val allDependencies = dependencyManager.calculateDependencies(project, context, dependentProjects,
project.compileDependencies) project.compileDependencies)
val WEB_INF = "WEB-INF/lib"
val outDir = project.buildDirectory + "/war" val outDir = project.buildDirectory + "/war"
val fullDir = outDir + "/" + WEB_INF val fullDir = outDir + "/" + LIB
File(fullDir).mkdirs() File(fullDir).mkdirs()
// Run through all the classpath contributors and add their contributions to the libs/ directory // Run through all the classpath contributors and add their contributions to the libs/ directory
@ -62,7 +67,7 @@ class WarGenerator @Inject constructor(val dependencyManager: DependencyManager)
result.add(IncludedFile(From(it.path), To(""), listOf(IFileSpec.GlobSpec("**")))) result.add(IncludedFile(From(it.path), To(""), listOf(IFileSpec.GlobSpec("**"))))
} }
result.add(IncludedFile(From(fullDir), To(WEB_INF), listOf(IFileSpec.GlobSpec("**")))) result.add(IncludedFile(From(fullDir), To(LIB), listOf(IFileSpec.GlobSpec("**"))))
// //
// Finally, all the included/excluded files specified in the war{} directive // Finally, all the included/excluded files specified in the war{} directive