1
0
Fork 0
mirror of https://github.com/ethauvin/kobalt.git synced 2025-04-26 16:28:12 -07:00

Handle resources in the packaging task.

This commit is contained in:
Cedric Beust 2016-02-14 13:38:02 -08:00
parent d45054b123
commit ea9f3dfdc4
2 changed files with 6 additions and 1 deletions

View file

@ -59,7 +59,7 @@ public class JarUtils {
val includedFile = IncludedFile(From(source.path), To(""), listOf(IFileSpec.GlobSpec("**"))) val includedFile = IncludedFile(From(source.path), To(""), listOf(IFileSpec.GlobSpec("**")))
addSingleFile(".", includedFile, outputStream, expandJarFiles) addSingleFile(".", includedFile, outputStream, expandJarFiles)
} else { } else {
if (expandJarFiles and source.name.endsWith(".jar")) { if (expandJarFiles && source.name.endsWith(".jar") && ! source.path.contains("resources")) {
log(2, "Writing contents of jar file $source") log(2, "Writing contents of jar file $source")
val stream = JarInputStream(FileInputStream(source)) val stream = JarInputStream(FileInputStream(source))
var entry = stream.nextEntry var entry = stream.nextEntry

View file

@ -39,6 +39,11 @@ class JarGenerator @Inject constructor(val dependencyManager: DependencyManager)
fileSpecs.add(IFileSpec.FileSpec(it.path.toString().substring(prefixPath.toString().length + 1))) fileSpecs.add(IFileSpec.FileSpec(it.path.toString().substring(prefixPath.toString().length + 1)))
} }
result.add(IncludedFile(From(prefixPath.toString() + "/"), To(""), fileSpecs)) result.add(IncludedFile(From(prefixPath.toString() + "/"), To(""), fileSpecs))
// Resources, if applicable
project.sourceDirectories.filter { it.contains("resources") }.forEach {
result.add(IncludedFile(From(it), To(""), listOf(IFileSpec.GlobSpec("**"))))
}
} else { } else {
// //
// The user specified an include, just use it verbatim // The user specified an include, just use it verbatim