Skip to content

Commit

Permalink
add 'shadowjar' config for conformance binaries; fix bug in readInt
Browse files Browse the repository at this point in the history
  • Loading branch information
jhump committed Dec 20, 2023
1 parent 83d1de0 commit 6201610
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 4 deletions.
9 changes: 9 additions & 0 deletions conformance/client/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,15 @@ sourceSets {
}
}

tasks {
compileKotlin {
kotlinOptions {
// Generated Kotlin code for protobufs uses RequiresOptIn annotation
freeCompilerArgs += "-opt-in=kotlin.RequiresOptIn"
}
}
}

dependencies {
implementation(project(":okhttp"))
implementation(libs.kotlin.coroutines.core)
Expand Down
9 changes: 9 additions & 0 deletions conformance/client/google-java/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,15 @@ tasks {
freeCompilerArgs += "-opt-in=kotlin.RequiresOptIn"
}
}
shadowJar {
archiveBaseName.set("shadow")
manifest {
attributes(mapOf("Main-Class" to "com.connectrpc.conformance.client.java.MainKt"))
}
}
build {
dependsOn(shadowJar)
}
}

// This project contains an alternate copy of the generated
Expand Down
23 changes: 23 additions & 0 deletions conformance/client/google-javalite/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,28 @@
buildscript {
repositories {
mavenCentral()
gradlePluginPortal()
}
dependencies {
classpath("gradle.plugin.com.github.johnrengelman:shadow:7.1.2")
}
}

plugins {
kotlin("jvm")
id("com.github.johnrengelman.shadow").version("7.1.2")
}

tasks {
shadowJar {
archiveBaseName.set("shadow")
manifest {
attributes(mapOf("Main-Class" to "com.connectrpc.conformance.client.javalite.MainKt"))
}
}
build {
dependsOn(shadowJar)
}
}

dependencies {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,10 @@ class ConformanceClientLoop {

private fun InputStream.readInt(): Int? {
val bytes = this.readN(4) ?: return null
return bytes[0].toInt().shl(24) or
bytes[1].toInt().shl(16) or
bytes[2].toInt().shl(8) or
bytes[3].toInt()
return bytes[0].toInt().and(0xff).shl(24) or
bytes[1].toInt().and(0xff).shl(16) or
bytes[2].toInt().and(0xff).shl(8) or
bytes[3].toInt().and(0xff)
}

fun parseArgs(args: Array<String>): InvokeStyle {
Expand Down

0 comments on commit 6201610

Please sign in to comment.