-
Notifications
You must be signed in to change notification settings - Fork 279
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Add extraction of Kotlin libraries - Add support of home symbol and relative paths for specifying repos path
- Loading branch information
1 parent
5e8bb0a
commit 05d076b
Showing
15 changed files
with
200 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
// Copyright 2017 Sourcerer Inc. All Rights Reserved. | ||
// Author: Liubov Yaronskaya ([email protected]) | ||
|
||
package app.extractors | ||
|
||
import app.model.CommitStats | ||
import app.model.DiffFile | ||
|
||
class KotlinExtractor : ExtractorInterface { | ||
companion object { | ||
val LANGUAGE_NAME = "kotlin" | ||
val FILE_EXTS = listOf("kt") | ||
val LIBRARIES = ExtractorInterface.getLibraries(LANGUAGE_NAME) | ||
val evaluator by lazy { | ||
ExtractorInterface.getLibraryClassifier(LANGUAGE_NAME) | ||
} | ||
} | ||
|
||
override fun extract(files: List<DiffFile>): List<CommitStats> { | ||
files.map { file -> file.language = LANGUAGE_NAME } | ||
return super.extract(files) | ||
} | ||
|
||
override fun extractImports(fileContent: List<String>): List<String> { | ||
val imports = mutableSetOf<String>() | ||
|
||
val regex = Regex("""import\s+(\w+[.\w+]*)""") | ||
fileContent.forEach { | ||
val res = regex.find(it) | ||
if (res != null) { | ||
val importedName = res.groupValues[1] | ||
LIBRARIES.forEach { library -> | ||
if (importedName.startsWith(library)) { | ||
imports.add(library) | ||
} | ||
} | ||
} | ||
} | ||
|
||
return imports.toList() | ||
} | ||
|
||
override fun tokenize(line: String): List<String> { | ||
val importRegex = Regex("""^(.*import)\s[^\n]*""") | ||
val commentRegex = Regex("""^([^\n]*//)[^\n]*""") | ||
val packageRegex = Regex("""^(.*package)\s[^\n]*""") | ||
var newLine = importRegex.replace(line, "") | ||
newLine = commentRegex.replace(newLine, "") | ||
newLine = packageRegex.replace(newLine, "") | ||
return super.tokenize(newLine) | ||
} | ||
|
||
override fun getLineLibraries(line: String, | ||
fileLibraries: List<String>): List<String> { | ||
|
||
return super.getLineLibraries(line, fileLibraries, evaluator, LANGUAGE_NAME) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
com.winterbe.expekt | ||
com.github.vassilibykov.adventkt | ||
me.lazmaid.kraph | ||
com.github.kittinunf.fuel | ||
imgui | ||
org.mapdb | ||
uy.kohesive.kovert | ||
io.reactivex.rxkotlin | ||
com.compass.snail | ||
io.kweb | ||
com.github.andrewoma.kwery | ||
com.github.pgutkowski.kgraphql | ||
io.vertx | ||
org.spekframework.spek2 | ||
com.oneeyedmen.konsent | ||
com.github.salomonbrys.kotson | ||
org.jire.kton | ||
io.kotlintest | ||
ktx | ||
org.kotlinprimavera | ||
org.kottpd | ||
com.almasb.fxgl | ||
org.wasabifx.wasabi | ||
com.fboldog.ext4klaxon | ||
net.yested | ||
ua.com.lavi.komock | ||
kotlinx.nosql | ||
spark | ||
com.github.kittinunf.result | ||
com.nivabit.kuery | ||
io.thelandscape.krawler | ||
io.tekniq | ||
com.beust.klaxon | ||
com.github.shyiko.levelkt | ||
io.javalin | ||
kategory | ||
tornadofx | ||
kotliquery | ||
khttp | ||
ovr | ||
com.hexagonkt | ||
com.nhaarman.mockito_kotlin | ||
io.ktor | ||
com.codepoetics.klenses | ||
io.polymorphicpanda.kspec | ||
com.natpryce.hamkrest | ||
org.http4k | ||
com.vaadin | ||
io.mockk | ||
kara | ||
org.funktionale | ||
com.github.fluidsonic.fluid.json | ||
com.squareup.sqldelight | ||
org.amshove.kluent | ||
com.danneu.kog | ||
org.jetbrains.exposed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.