Skip to content

Commit 438e9f6

Browse files
committed
KShell breaths without highlighter and runtime plugin
1 parent 1990ead commit 438e9f6

File tree

25 files changed

+241
-207
lines changed

25 files changed

+241
-207
lines changed

bin/kshell.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ MAVEN_REPO_BASE=$HOME/.m2/repository/org/jetbrains/kotlin
44
KOTLIN_VERSION=1.3.31
55
KSHELL_REPL_API_VERSION=0.2.7-1.3.31
66
SPARKLIN_VERSION=0.2.7-SNAPSHOT
7-
TROVE4J=$HOME/.m2/repository/org/jetbrains/intellij/deps/trove4j/1.0.20190215/trove4j-1.0.20190215.jar
7+
TROVE4J=$HOME/.m2/repository/org/jetbrains/intellij/deps/trove4j/1.0.20181211/trove4j-1.0.20181211.jar
88
ANNOTATIONS=$HOME/.m2/repository/org/jetbrains/annotations/17.0.0/annotations-17.0.0.jar
99

1010
# Kotlin libraries

hdfs-browser/src/main/kotlin/com/github/khud/sparklin/hdfsbrowser/HdfsBrowserPlugin.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import com.github.khud.sparklin.kshell.BaseCommand
66
import com.github.khud.sparklin.kshell.KShell
77
import com.github.khud.sparklin.kshell.Plugin
88
import com.github.khud.sparklin.kshell.calcHumanReadableSize
9-
import com.github.khud.sparklin.kshell.configuration.Configuration
9+
import com.github.khud.sparklin.kshell.configuration.ReplConfiguration
1010
import com.github.khud.sparklin.kshell.plugins.SparkPlugin
1111
import kotlin.reflect.KClass
1212
import org.apache.hadoop.conf.Configuration as HadoopConfiguration
@@ -17,7 +17,7 @@ class HdfsBrowserPlugin : Plugin {
1717
private lateinit var fs: FileSystem
1818
private var workingDirectory = "."
1919

20-
inner class LsCommand(conf: Configuration) : BaseCommand() {
20+
inner class LsCommand(conf: ReplConfiguration) : BaseCommand() {
2121
override val name: String by conf.get(default = "hdfs.ls")
2222
override val short: String? by conf.getNullable()
2323
override val description: String = "list files in HDFS directory"
@@ -37,14 +37,14 @@ class HdfsBrowserPlugin : Plugin {
3737
}
3838
}
3939

40-
override fun init(repl: KShell, config: Configuration) {
40+
override fun init(repl: KShell, config: ReplConfiguration) {
4141
this.repl = repl
4242
this.fs = FileSystem.get(findHadoopConfiguration(config))
4343

4444
repl.registerCommand(LsCommand(config))
4545
}
4646

47-
private fun findHadoopConfiguration(config: Configuration): HadoopConfiguration {
47+
private fun findHadoopConfiguration(config: ReplConfiguration): HadoopConfiguration {
4848
val spark1 = config.getPluginByClass("com.github.khud.sparklin.spark1x.Spark1xPlugin", SparkPlugin::class)
4949
val spark2 = config.getPluginByClass("com.github.khud.sparklin.spark2x.Spark2xPlugin", SparkPlugin::class)
5050

@@ -56,7 +56,7 @@ class HdfsBrowserPlugin : Plugin {
5656
}
5757

5858

59-
private inline fun <reified T: Plugin> Configuration.getPluginByClass(klassName: String, type: KClass<T>): T? {
59+
private inline fun <reified T: Plugin> ReplConfiguration.getPluginByClass(klassName: String, type: KClass<T>): T? {
6060
return this.getPlugin(klassName) as? T
6161
}
6262

jline3-shaded/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
<relocations>
3838
<relocation>
3939
<pattern>org.jline</pattern>
40-
<shadedPattern>sparklin.kshell.org.jline</shadedPattern>
40+
<shadedPattern>org.jline</shadedPattern>
4141
</relocation>
4242
</relocations>
4343
<transformers>

kshell/pom.xml

Lines changed: 32 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,39 @@
2525
</dependency>
2626
<dependency>
2727
<groupId>org.jetbrains.kotlin</groupId>
28-
<artifactId>kotlin-compiler</artifactId>
28+
<artifactId>kotlin-compiler-embeddable</artifactId>
2929
<version>${kotlin.version}</version>
3030
</dependency>
3131
<dependency>
3232
<groupId>org.jetbrains.kotlin</groupId>
3333
<artifactId>kotlin-script-runtime</artifactId>
3434
<version>${kotlin.version}</version>
3535
</dependency>
36+
<dependency>
37+
<groupId>org.jetbrains.kotlin</groupId>
38+
<artifactId>kotlin-scripting-common</artifactId>
39+
<version>${kotlin.version}</version>
40+
</dependency>
41+
<dependency>
42+
<groupId>org.jetbrains.kotlin</groupId>
43+
<artifactId>kotlin-scripting-jvm</artifactId>
44+
<version>${kotlin.version}</version>
45+
</dependency>
46+
<dependency>
47+
<groupId>org.jetbrains.kotlin</groupId>
48+
<artifactId>kotlin-scripting-jvm-host-embeddable</artifactId>
49+
<version>${kotlin.version}</version>
50+
</dependency>
51+
<dependency>
52+
<groupId>org.jetbrains.kotlin</groupId>
53+
<artifactId>kotlin-scripting-compiler-embeddable</artifactId>
54+
<version>${kotlin.version}</version>
55+
</dependency>
56+
<dependency>
57+
<groupId>org.jetbrains.kotlin</groupId>
58+
<artifactId>kotlin-scripting-ide-services-embeddable</artifactId>
59+
<version>${kotlin.version}</version>
60+
</dependency>
3661
<dependency>
3762
<groupId>junit</groupId>
3863
<artifactId>junit</artifactId>
@@ -43,16 +68,6 @@
4368
<artifactId>hadoop-common</artifactId>
4469
<version>2.7.0</version>
4570
</dependency>
46-
<dependency>
47-
<groupId>com.github.khud</groupId>
48-
<artifactId>kshell-repl-api</artifactId>
49-
<version>0.2.7-1.3.31</version>
50-
</dependency>
51-
<dependency>
52-
<groupId>sparklin</groupId>
53-
<artifactId>jline3-shaded</artifactId>
54-
<version>0.2.7-SNAPSHOT</version>
55-
</dependency>
5671
<dependency>
5772
<groupId>org.jetbrains.intellij.deps</groupId>
5873
<artifactId>trove4j</artifactId>
@@ -64,6 +79,12 @@
6479
<artifactId>annotations</artifactId>
6580
<version>17.0.0</version>
6681
</dependency>
82+
<dependency>
83+
<groupId>org.jline</groupId>
84+
<artifactId>jline</artifactId>
85+
<version>3.9.0</version>
86+
</dependency>
87+
6788

6889
</dependencies>
6990

kshell/src/main/kotlin/com/github/khud/sparklin/kshell/Command.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package com.github.khud.sparklin.kshell
22

3-
import sparklin.kshell.org.jline.reader.Highlighter
3+
import org.jline.reader.Highlighter
44

55
interface Command {
66
fun execute(line: String)

kshell/src/main/kotlin/com/github/khud/sparklin/kshell/ContextHighlighter.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
package com.github.khud.sparklin.kshell
22

3-
import sparklin.kshell.org.jline.reader.Highlighter
4-
import sparklin.kshell.org.jline.reader.LineReader
5-
import sparklin.kshell.org.jline.utils.AttributedString
6-
import sparklin.kshell.org.jline.utils.AttributedStringBuilder
3+
import org.jline.reader.Highlighter
4+
import org.jline.reader.LineReader
5+
import org.jline.utils.AttributedString
6+
import org.jline.utils.AttributedStringBuilder
77
import com.github.khud.sparklin.kshell.plugins.BaseHighlighter
88

99
class ContextHighlighter(private val isSyntaxMode: (String) -> Boolean,

0 commit comments

Comments
 (0)