Skip to content

Instantly share code, notes, and snippets.

View hsyed's full-sized avatar

Hassan Syed hsyed

View GitHub Profile
@hsyed
hsyed / stubs.kt
Created June 26, 2018 18:46
coroutine binding glue.
package com.axsy.base.grpc.stub
import io.grpc.stub.StreamObserver
import kotlinx.coroutines.experimental.CompletableDeferred
import kotlinx.coroutines.experimental.Deferred
import kotlinx.coroutines.experimental.Job
import kotlinx.coroutines.experimental.channels.LinkedListChannel
import kotlinx.coroutines.experimental.channels.ReceiveChannel
import kotlinx.coroutines.experimental.channels.SendChannel
import kotlinx.coroutines.experimental.launch
@hsyed
hsyed / kt_grpc_library.bzl
Created June 26, 2018 23:52
Adapted version of java_grpc_library
# adapted from grpc-java
load("@io_bazel_rules_kotlin//kotlin:kotlin.bzl", "kt_jvm_library")
load("@io_grpc_grpc_java//:java_grpc_library.bzl", "java_grpc_library")
def _path_ignoring_repository(f):
if (len(f.owner.workspace_root) == 0):
return f.short_path
return f.path[f.path.find(f.owner.workspace_root) + len(f.owner.workspace_root) + 1:]
def _gensource_impl(ctx):
// Idiomatic and efficient stack. Uses a single array.
type Stack interface {
// Push adds an item to a stack.
Push(i int)
// Pop is the item that was popped, max and sz represent the state of the stack after the pop.
Pop() (cur,max, sz int)
// Peek the current state of the stack. An empty stack returns all zeros.
Peek() (cur,max, sz int)
}
package io.bazel.kotlin.compiler.plugins.strictdeps
import com.google.protobuf.TextFormat
import com.intellij.openapi.project.Project
import com.intellij.openapi.vfs.VfsUtilCore
import com.intellij.openapi.vfs.VirtualFile
import com.intellij.psi.PsiElement
import io.bazel.kotlin.compiler.BazelCompiler
import io.bazel.kotlin.model.JvmCompilationTask
import io.bazel.kotlin.model.StrictDeps