Skip to content

Commit

Permalink
🚸 Prepare upgrade to kotlin 1.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
devkanro committed Aug 26, 2020
1 parent 224db19 commit 8a3ed62
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ class CelContext internal constructor(private val engine: CelEngine, global: Map
}

fun visit(start: CelParser.StartContext): Any? {
val t = 1
val expr = start.e ?: return null
return visit(expr)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import kotlin.reflect.full.starProjectedType
import kotlin.reflect.full.valueParameters
import kotlin.reflect.jvm.javaMethod

open class CelRuntime(protected val macro: CelMacro = CelMacro(), protected val std: CelStandardLibrary = CelStandardLibrary()) {
open class CelRuntime(val macro: CelMacro = CelMacro(), val std: CelStandardLibrary = CelStandardLibrary()) {
private val memberFunctions = mutableMapOf<String, MutableList<KFunction<*>>>()

private val macroFunctions = mutableMapOf<String, MutableList<KFunction<*>>>()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import com.bybutter.sisyphus.protobuf.Message
import com.bybutter.sisyphus.protobuf.primitives.Empty
import com.bybutter.sisyphus.rpc.Code
import com.bybutter.sisyphus.rpc.STATUS_META_KEY
import com.bybutter.sisyphus.security.base64
import com.bybutter.sisyphus.security.base64UrlSafe
import com.bybutter.sisyphus.starter.grpc.transcoding.util.toHttpStatus
import com.bybutter.sisyphus.starter.webflux.DetectBodyInserter
Expand Down Expand Up @@ -60,10 +61,10 @@ class TranscodingCallListener(private val body: String) : ClientCall.Listener<Me
}
// No message returned by gRPC, maybe some unknown error happened.
else -> builder.body(DetectBodyInserter(
com.bybutter.sisyphus.rpc.Status {
this.code = status.code.value()
this.message = status.description ?: status.cause?.message ?: "Unknown"
}
com.bybutter.sisyphus.rpc.Status {
this.code = status.code.value()
this.message = status.description ?: status.cause?.message ?: "Unknown"
}
))
}
this.response.onNext(response)
Expand All @@ -84,11 +85,11 @@ class TranscodingCallListener(private val body: String) : ClientCall.Listener<Me
// Skip ignore headers.
if (IGNORE_GRPC_HEADER.contains(key)) continue
// Skip bin headers.
if (key.endsWith(Metadata.BINARY_HEADER_SUFFIX)) continue
// Skip gRPC headers.
if (key.startsWith("grpc-")) continue

header(key, metadata[Metadata.Key.of(key, Metadata.ASCII_STRING_MARSHALLER)])
if (key.endsWith(Metadata.BINARY_HEADER_SUFFIX)) {
header(key, metadata[Metadata.Key.of(key, Metadata.BINARY_BYTE_MARSHALLER)]?.base64())
} else {
header(key, metadata[Metadata.Key.of(key, Metadata.ASCII_STRING_MARSHALLER)])
}
}
return this
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import java.nio.file.Files
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.artifacts.Configuration
import org.gradle.api.attributes.Usage
import org.gradle.api.plugins.JavaPlugin
import org.gradle.api.tasks.SourceSet
import org.gradle.api.tasks.SourceSetContainer
Expand Down Expand Up @@ -69,6 +70,7 @@ class ProtobufPlugin : Plugin<Project> {
isCanBeResolved = true
isTransitive = false
description = "Proto files to compile for source set '${sourceSet.name}'"
attributes.attribute(Usage.USAGE_ATTRIBUTE, target.objects.named(Usage::class.java, Usage.JAVA_API))
}
}

Expand All @@ -78,6 +80,7 @@ class ProtobufPlugin : Plugin<Project> {
isCanBeConsumed = false
isCanBeResolved = true
extendsFrom(target.configurations.getByName(sourceSet.implementationConfigurationName))
attributes.attribute(Usage.USAGE_ATTRIBUTE, target.objects.named(Usage::class.java, Usage.JAVA_API))
}
}

Expand Down

0 comments on commit 8a3ed62

Please sign in to comment.