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
org.jetbrains.kotlin.script.jsr223.KotlinJsr223JvmLocalScriptEngineFactory |
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
fun Any?.toIndentString(): String { | |
val notFancy = toString() | |
return buildString(notFancy.length) { | |
var indent = 0 | |
fun StringBuilder.line() { | |
appendln() | |
repeat(2 * indent) { append(' ') } | |
} |
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
import java.io.IOException; | |
import java.nio.ByteBuffer; | |
import okio.Buffer; | |
import okio.BufferedSink; | |
import okio.BufferedSource; | |
import okio.Okio; | |
import okio.Sink; | |
import okio.Source; | |
import okio.Timeout; |
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
import java.io.IOException; | |
import java.net.ProtocolException; | |
import java.security.GeneralSecurityException; | |
import java.util.Random; | |
import javax.crypto.Cipher; | |
import javax.crypto.ShortBufferException; | |
import javax.crypto.spec.IvParameterSpec; | |
import javax.crypto.spec.SecretKeySpec; | |
import okio.Buffer; | |
import okio.BufferedSink; |
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
import kotlinx.coroutines.experimental.nio.aRead | |
import kotlinx.coroutines.experimental.nio.aWrite | |
import okio.Buffer | |
import java.nio.ByteBuffer | |
import java.nio.channels.AsynchronousFileChannel | |
import java.nio.channels.AsynchronousSocketChannel | |
import java.util.concurrent.TimeUnit | |
suspend fun AsynchronousSocketChannel.aRead( | |
buffer: Buffer, |
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
interface WebSocketSession { | |
val incoming: ReceiveChannel<String> | |
val outgoing: SendChannel<String> | |
} | |
suspend fun <R> OkHttpClient.newWebSocket( | |
request: Request, | |
block: suspend WebSocketSession.() -> R | |
): R = coroutineScope { | |
val incoming = Channel<String>() |
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
buildConfig { | |
val project = project(":kotlin-ir-plugin") | |
packageName(project.group.toString()) | |
buildConfigField("String", "KOTLIN_PLUGIN_ID", "\"${rootProject.extra["kotlin_plugin_id"]}\"") | |
buildConfigField("String", "KOTLIN_PLUGIN_GROUP", "\"${project.group}\"") | |
buildConfigField("String", "KOTLIN_PLUGIN_NAME", "\"${project.name}\"") | |
buildConfigField("String", "KOTLIN_PLUGIN_VERSION", "\"${project.version}\"") | |
} |
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
class TemplateGradlePlugin : KotlinCompilerPluginSupportPlugin { | |
override fun apply(target: Project): Unit = with(target) { | |
extensions.create("template", TemplateGradleExtension::class.java) | |
} | |
override fun isApplicable(kotlinCompilation: KotlinCompilation<*>): Boolean = true | |
override fun getCompilerPluginId(): String = BuildConfig.KOTLIN_PLUGIN_ID | |
override fun getPluginArtifact(): SubpluginArtifact = SubpluginArtifact( |
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
@AutoService(CommandLineProcessor::class) | |
class TemplateCommandLineProcessor : CommandLineProcessor { | |
companion object { | |
private const val OPTION_STRING = "string" | |
private const val OPTION_FILE = "file" | |
val ARG_STRING = CompilerConfigurationKey<String>(OPTION_STRING) | |
val ARG_FILE = CompilerConfigurationKey<String>(OPTION_FILE) | |
} |
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
@AutoService(ComponentRegistrar::class) | |
class TemplateComponentRegistrar( | |
private val defaultString: String, | |
private val defaultFile: String, | |
) : ComponentRegistrar { | |
@Suppress("unused") // Used by service loader | |
constructor() : this( | |
defaultString = "Hello, World!", | |
defaultFile = "file.txt" |