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

Formatting.

This commit is contained in:
Cedric Beust 2015-10-13 00:54:27 -07:00
parent fb6f9b51c4
commit e483a210eb

View file

@ -11,7 +11,7 @@ import javax.xml.xpath.XPathConstants
import kotlin.dom.childElements import kotlin.dom.childElements
public class Pom @javax.inject.Inject constructor(@Assisted val id: String, public class Pom @javax.inject.Inject constructor(@Assisted val id: String,
@Assisted documentFile: java.io.File) : KobaltLogger { @Assisted documentFile: java.io.File) : KobaltLogger {
val XPATH_FACTORY = javax.xml.xpath.XPathFactory.newInstance() val XPATH_FACTORY = javax.xml.xpath.XPathFactory.newInstance()
val XPATH = XPATH_FACTORY.newXPath() val XPATH = XPATH_FACTORY.newXPath()
var groupId: String? = null var groupId: String? = null
@ -26,7 +26,7 @@ public class Pom @javax.inject.Inject constructor(@Assisted val id: String,
} }
data public class Dependency(val groupId: String, val artifactId: String, val version: String, data public class Dependency(val groupId: String, val artifactId: String, val version: String,
val optional: Boolean = false, val scope: String? = null) : KobaltLogger { val optional: Boolean = false, val scope: String? = null) : KobaltLogger {
/** When a variable is used in a maven file, e.g. ${version} */ /** When a variable is used in a maven file, e.g. ${version} */
private val VAR = "$" + "{" private val VAR = "$" + "{"
@ -63,10 +63,10 @@ public class Pom @javax.inject.Inject constructor(@Assisted val id: String,
artifactId = XPATH.compile("/project/artifactId").evaluate(document) artifactId = XPATH.compile("/project/artifactId").evaluate(document)
version = XPATH.compile("/project/version").evaluate(document) version = XPATH.compile("/project/version").evaluate(document)
name = XPATH.compile("/project/name").evaluate(document) name = XPATH.compile("/project/name").evaluate(document)
var repositoriesList = XPATH.compile("/project/repositories").evaluate(document, XPathConstants.NODESET) as NodeList var repositoriesList = XPATH.compile("/project/repositories").evaluate(document, XPathConstants.NODESET)
as NodeList
var repoElem = repositoriesList.item(0) as Element? var repoElem = repositoriesList.item(0) as Element?
repositories = repoElem.childElements() repositories = repoElem.childElements().map({ it.getElementsByTagName("url").item(0).textContent })
.map({ it.getElementsByTagName("url").item(0).textContent })
val propertiesList = XPATH.compile("/project/properties").evaluate(document, XPathConstants.NODESET) as NodeList val propertiesList = XPATH.compile("/project/properties").evaluate(document, XPathConstants.NODESET) as NodeList
var propsElem = propertiesList.item(0) as Element? var propsElem = propertiesList.item(0) as Element?