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

fixed fatJar for projects in subdirectories that depend on other projects

E.g. building p2 (see below) failed with
  `java.lang.AssertionError: File should exist: p2\p1\kobaltBuild\classes`
because `p2.directory is != "."`

```
val p1 = project {
	name = "p1"
	directory = name
}

val p2 = project(p1) {
	name = "p2"
	directory = name
	assemble {
		jar {
			fatJar = true
		}
	}
}
```
This commit is contained in:
DevCharly 2016-06-07 16:58:18 +02:00
parent a005a14db5
commit cbbe9cbeb7
2 changed files with 4 additions and 4 deletions

View file

@ -107,7 +107,7 @@ class JarGenerator @Inject constructor(val dependencyManager: DependencyManager)
if (! seen.contains(file.path)) {
seen.add(file.path)
if (! KFiles.Companion.isExcluded(file, jar.excludes)) {
result.add(IncludedFile(specs = arrayListOf(IFileSpec.FileSpec(file.path)),
result.add(IncludedFile(specs = arrayListOf(IFileSpec.FileSpec(file.absolutePath)),
expandJarFiles = true))
}
}

View file

@ -47,12 +47,12 @@ public class JarUtils {
throw AssertionError("File should exist: $localFile")
}
if (foundFile.isDirectory) {
if (localFile.isDirectory) {
log(2, "Writing contents of directory $foundFile")
// Directory
val includedFile = IncludedFile(From(foundFile.path), To(""), listOf(IFileSpec.GlobSpec("**")))
addSingleFile(".", includedFile, outputStream, expandJarFiles)
val includedFile = IncludedFile(From(""), To(""), listOf(IFileSpec.GlobSpec("**")))
addSingleFile(localFile.path, includedFile, outputStream, expandJarFiles)
} else {
if (file.expandJarFiles && foundFile.name.endsWith(".jar") && ! file.from.contains("resources")) {
log(2, "Writing contents of jar file $foundFile")