mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-27 08:38:13 -07:00
Fix inclusion bug.
This commit is contained in:
parent
a574bc1adf
commit
2f386a622d
6 changed files with 44 additions and 17 deletions
|
@ -38,7 +38,7 @@ class JarGenerator @Inject constructor(val dependencyManager: DependencyManager)
|
|||
filesNotExcluded.forEach {
|
||||
fileSpecs.add(IFileSpec.FileSpec(it.path.toString().substring(prefixPath.toString().length + 1)))
|
||||
}
|
||||
result.add(IncludedFile(From(project.directory + "/" + prefixPath.toString() + "/"), To(""), fileSpecs))
|
||||
result.add(IncludedFile(From(prefixPath.toString()), To(""), fileSpecs))
|
||||
|
||||
// Resources, if applicable
|
||||
context.variant.resourceDirectories(project).forEach {
|
||||
|
@ -48,7 +48,8 @@ class JarGenerator @Inject constructor(val dependencyManager: DependencyManager)
|
|||
//
|
||||
// The user specified an include, just use it verbatim
|
||||
//
|
||||
result.addAll(PackagingPlugin.findIncludedFiles(project.directory, jar.includedFiles, jar.excludes))
|
||||
val includedFiles = PackagingPlugin.findIncludedFiles(project.directory, jar.includedFiles, jar.excludes)
|
||||
result.addAll(includedFiles)
|
||||
}
|
||||
|
||||
//
|
||||
|
|
|
@ -14,6 +14,7 @@ import com.beust.kobalt.misc.*
|
|||
import java.io.File
|
||||
import java.io.FileOutputStream
|
||||
import java.io.OutputStream
|
||||
import java.nio.file.Paths
|
||||
import java.util.*
|
||||
import java.util.zip.ZipOutputStream
|
||||
import javax.inject.Inject
|
||||
|
@ -51,13 +52,14 @@ class PackagingPlugin @Inject constructor(val dependencyManager : DependencyMana
|
|||
val fromPath = includedFile.from
|
||||
if (File(fromPath).exists()) {
|
||||
spec.toFiles(directory, fromPath).forEach { file ->
|
||||
val fullFile = File(fromPath, file.path)
|
||||
val fullFile = File(KFiles.joinDir(directory, fromPath, file.path))
|
||||
if (! fullFile.exists()) {
|
||||
throw AssertionError("File should exist: $fullFile")
|
||||
}
|
||||
|
||||
if (!KFiles.isExcluded(fullFile, excludes)) {
|
||||
includedSpecs.add(FileSpec(file.path))
|
||||
val normalized = Paths.get(file.path).normalize().toFile().path
|
||||
includedSpecs.add(FileSpec(normalized))
|
||||
} else {
|
||||
log(2, "Not adding ${file.path} to jar file because it's excluded")
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue