Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: fwcd/kotlin-language-server
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: main
Choose a base ref
...
head repository: HybrIT-share/KotlinLanguageServer
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Can’t automatically merge. Don’t worry, you can still create the pull request.
  • 1 commit
  • 1 file changed
  • 1 contributor

Commits on Jun 25, 2019

  1. Fix bug #88

    changed long condition for parts.size, to be 5 or 6.
    made minor improvements to make better use of kotlin language functionality.
    Marthijs-Berfelo committed Jun 25, 2019
    Copy the full SHA
    7e716e3 View commit details
Showing with 8 additions and 9 deletions.
  1. +8 −9 shared/src/main/kotlin/org/javacs/kt/classpath/MavenClassPathResolver.kt
Original file line number Diff line number Diff line change
@@ -46,11 +46,11 @@ private fun findMavenArtifact(a: Artifact, source: Boolean): Path? {
.resolve(a.version)
.resolve(mavenJarName(a, source))

if (Files.exists(result))
return result
return if (Files.exists(result))
result
else {
LOG.warn("Couldn't find {} in {}", a, result)
return null
null
}
}

@@ -61,15 +61,14 @@ private fun mavenJarName(a: Artifact, source: Boolean) =
private fun generateMavenDependencyList(pom: Path): Path? {
val mavenOutput = Files.createTempFile("deps", ".txt")
val workingDirectory = pom.toAbsolutePath().parent.toFile()
val cmd = "${mvnCommand} dependency:list -DincludeScope=test -DoutputFile=$mavenOutput"
val cmd = "$mvnCommand dependency:list -DincludeScope=test -DoutputFile=$mavenOutput"
LOG.info("Run {} in {}", cmd, workingDirectory)
val process = Runtime.getRuntime().exec(cmd, null, workingDirectory)

process.inputStream.bufferedReader().use { reader ->
while (process.isAlive()) {
val line = reader.readLine()?.trim()
if (line == null) break
if ((line.length > 0) && !line.startsWith("Progress")) {
while (process.isAlive) {
val line = reader.readLine()?.trim() ?: break
if ((line.isNotEmpty()) && !line.startsWith("Progress")) {
LOG.info("Maven: {}", line)
}
}
@@ -87,7 +86,7 @@ fun parseArtifact(rawArtifact: String, version: String? = null): Artifact {

return when (parts.size) {
3 -> Artifact(parts[0], parts[1], version ?: parts[2])
5 -> Artifact(parts[0], parts[1], version ?: parts[3])
5, 6 -> Artifact(parts[0], parts[1], version ?: parts[3])
else -> throw IllegalArgumentException("$rawArtifact is not a properly formed Maven/Gradle artifact")
}
}