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

Initialize the Pom lazily.

This commit is contained in:
Cedric Beust 2015-11-19 19:57:14 -08:00
parent 1c6cf1acc4
commit 9f76eeabdc

View file

@ -54,9 +54,9 @@ public class Pom @javax.inject.Inject constructor(@Assisted val id: String,
val id: String = "$groupId:$artifactId:$version" val id: String = "$groupId:$artifactId:$version"
} }
var dependencies = arrayListOf<Dependency>() val dependencies: List<Dependency> by lazy {
val result = arrayListOf<Dependency>()
init {
val DEPENDENCIES = XPATH.compile("/project/dependencies/dependency") val DEPENDENCIES = XPATH.compile("/project/dependencies/dependency")
val document = kotlinx.dom.parseXml(InputSource(FileReader(documentFile))) val document = kotlinx.dom.parseXml(InputSource(FileReader(documentFile)))
@ -99,8 +99,9 @@ public class Pom @javax.inject.Inject constructor(@Assisted val id: String,
} }
log(3, "Done parsing: $groupId $artifactId $version") log(3, "Done parsing: $groupId $artifactId $version")
val tmpDependency = Dependency(groupId!!, artifactId!!, packaging, version, optional!!, scope) val tmpDependency = Dependency(groupId!!, artifactId!!, packaging, version, optional!!, scope)
dependencies.add(tmpDependency) result.add(tmpDependency)
} }
result
} }
override public fun toString() = toString("Pom", id, "id") override public fun toString() = toString("Pom", id, "id")