Skip to content

bumps and build cleanup #377

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
kotlin("jvm") version "1.6.21" apply false
id("com.google.protobuf") version "0.8.18" apply false

id("org.gradle.test-retry") version "1.5.2"
id("io.github.gradle-nexus.publish-plugin") version "1.1.0"
}

Expand All @@ -22,6 +22,7 @@ subprojects {
plugin("java")
plugin("org.jetbrains.kotlin.jvm")
plugin("com.google.protobuf")
plugin("org.gradle.test-retry")
plugin("maven-publish")
plugin("signing")
}
Expand All @@ -48,8 +49,6 @@ subprojects {

tasks.withType<Test> {
testLogging {
showStandardStreams = true

// set options for log level LIFECYCLE
events = setOf(
TestLogEvent.FAILED,
Expand All @@ -59,6 +58,7 @@ subprojects {
)

exceptionFormat = TestExceptionFormat.FULL
showStandardStreams = true
showExceptions = true
showCauses = true
showStackTraces = true
Expand All @@ -81,6 +81,10 @@ subprojects {
info.exceptionFormat = debug.exceptionFormat
}

retry {
maxRetries.set(10)
}

afterSuite(
KotlinClosure2({ desc: TestDescriptor, result: TestResult ->
if (desc.parent == null) { // will match the outermost suite
Expand Down
29 changes: 9 additions & 20 deletions examples/android/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,39 +3,33 @@ plugins {
kotlin("android")
}

val composeVersion = "1.1.1"
val composeCompilerVersion = "1.2.0"
val composeVersion = "1.4.3"
val composeCompilerVersion = "1.4.7"

dependencies {
implementation(project(":stub-android"))
implementation(kotlin("stdlib"))
implementation("androidx.activity:activity-compose:1.5.0")
implementation("androidx.appcompat:appcompat:1.4.2")

implementation("androidx.activity:activity-compose:1.7.1")
implementation("androidx.compose.foundation:foundation-layout:$composeVersion")
implementation("androidx.compose.material:material:$composeVersion")
implementation("androidx.compose.runtime:runtime:$composeVersion")
implementation("androidx.compose.ui:ui:$composeVersion")

implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:${rootProject.ext["coroutinesVersion"]}")

runtimeOnly("io.grpc:grpc-okhttp:${rootProject.ext["grpcVersion"]}")
}

java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(11))
}
kotlin {
jvmToolchain(8)
}

android {
compileSdk = 31
buildToolsVersion = "31.0.0"
compileSdk = 33
buildToolsVersion = "33.0.0"
namespace = "io.grpc.examples.helloworld"

defaultConfig {
applicationId = "io.grpc.examples.hello"
minSdk = 26
targetSdk = 31
targetSdk = 33
versionCode = 1
versionName = "1.0"

Expand All @@ -47,11 +41,6 @@ android {
}
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}

buildFeatures {
compose = true
}
Expand Down
3 changes: 1 addition & 2 deletions examples/android/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="io.grpc.examples.helloworld">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<uses-permission android:name="android.permission.INTERNET"/>

Expand All @@ -9,7 +9,6 @@
android:icon="@android:drawable/btn_star"
android:label="@string/app_label">
<activity
android:theme="@style/Theme.AppCompat.NoActionBar"
android:name="io.grpc.examples.helloworld.MainActivity"
android:exported="true">
<intent-filter>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package io.grpc.examples.helloworld

import android.net.Uri
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.appcompat.app.AppCompatActivity
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxHeight
Expand All @@ -29,7 +29,7 @@ import kotlinx.coroutines.asExecutor
import kotlinx.coroutines.launch
import java.io.Closeable

class MainActivity : AppCompatActivity() {
class MainActivity : ComponentActivity() {

private val uri by lazy { Uri.parse(resources.getString(R.string.server_url)) }
private val greeterService by lazy { GreeterRCP(uri) }
Expand Down
24 changes: 16 additions & 8 deletions examples/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,24 +1,32 @@
plugins {
id("com.android.application") version "7.0.4" apply false // Older for IntelliJ Support
id("com.google.protobuf") version "0.8.18" apply false
kotlin("jvm") version "1.7.0" apply false
id("org.jlleitschuh.gradle.ktlint") version "10.2.0"
id("com.android.application") version "7.4.2" apply false // Older for IntelliJ Support
id("com.google.protobuf") version "0.9.3" apply false
kotlin("jvm") version "1.8.21" apply false
id("org.jlleitschuh.gradle.ktlint") version "11.3.2"
}

// todo: move to subprojects, but how?
ext["grpcVersion"] = "1.47.0"
ext["grpcVersion"] = "1.54.1"
ext["grpcKotlinVersion"] = "1.3.0" // CURRENT_GRPC_KOTLIN_VERSION
ext["protobufVersion"] = "3.21.2"
ext["coroutinesVersion"] = "1.6.2"
ext["protobufVersion"] = "3.22.3"
ext["coroutinesVersion"] = "1.7.0"

allprojects {
repositories {
mavenLocal()
mavenLocal() // For testing new releases of gRPC Kotlin
mavenCentral()
google()
}

apply(plugin = "org.jlleitschuh.gradle.ktlint")

ktlint {
filter {
exclude {
it.file.path.contains("$buildDir/generated/")
}
}
}
}

tasks.create("assemble").dependsOn(":server:installDist")
6 changes: 2 additions & 4 deletions examples/client/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@ plugins {
kotlin("jvm")
}

java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(11))
}
kotlin {
jvmToolchain(8)
}

dependencies {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ class RouteGuideClient(private val channel: ManagedChannel) : Closeable {
routeNote {
message = "Last message"
location = point(0, 0)
},
}
)
for (note in notes) {
println("Sending message \"${note.message}\" at ${note.location.toStr()}")
Expand Down
Binary file modified examples/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 2 additions & 1 deletion examples/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
19 changes: 12 additions & 7 deletions examples/gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Expand All @@ -80,13 +80,10 @@ do
esac
done

APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

APP_NAME="Gradle"
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down Expand Up @@ -143,12 +140,16 @@ fi
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down Expand Up @@ -193,6 +194,10 @@ if "$cygwin" || "$msys" ; then
done
fi


# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
Expand Down
1 change: 1 addition & 0 deletions examples/gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ if "%OS%"=="Windows_NT" setlocal

set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

Expand Down
8 changes: 3 additions & 5 deletions examples/native-client/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@ plugins {
id("com.palantir.graal") version "0.12.0"
}

java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(11))
}
kotlin {
jvmToolchain(11)
}

dependencies {
Expand All @@ -24,7 +22,7 @@ application {
// JAVA_HOME=~/.gradle/caches/com.palantir.graal/22.1.0/11/graalvm-ce-java11-22.1.0 JAVA_OPTS=-agentlib:native-image-agent=config-output-dir=native-client/src/graal native-client/build/install/native-client/bin/native-client

graal {
graalVersion("22.1.0")
graalVersion("22.3.2")
javaVersion("11")
mainClass(application.mainClass.get())
outputName("hello-world")
Expand Down
6 changes: 2 additions & 4 deletions examples/server/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@ plugins {
kotlin("jvm")
}

java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(11))
}
kotlin {
jvmToolchain(8)
}

dependencies {
Expand Down
38 changes: 15 additions & 23 deletions examples/stub-android/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
import com.google.protobuf.gradle.generateProtoTasks
import com.google.protobuf.gradle.id
import com.google.protobuf.gradle.plugins
import com.google.protobuf.gradle.protobuf
import com.google.protobuf.gradle.protoc

plugins {
id("com.android.library")
kotlin("android")
Expand All @@ -13,28 +7,26 @@ plugins {
dependencies {
protobuf(project(":protos"))

api(kotlin("stdlib-jdk8"))
api("org.jetbrains.kotlinx:kotlinx-coroutines-android:${rootProject.ext["coroutinesVersion"]}")
api("org.jetbrains.kotlinx:kotlinx-coroutines-core:${rootProject.ext["coroutinesVersion"]}")

api("io.grpc:grpc-stub:${rootProject.ext["grpcVersion"]}")
api("io.grpc:grpc-protobuf-lite:${rootProject.ext["grpcVersion"]}")
api("io.grpc:grpc-kotlin-stub:${rootProject.ext["grpcKotlinVersion"]}")
api("com.google.protobuf:protobuf-kotlin-lite:${rootProject.ext["protobufVersion"]}")
}

android {
compileSdk = 31
buildToolsVersion = "31.0.0"
kotlin {
jvmToolchain(8)
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
android {
compileSdk = 33
buildToolsVersion = "33.0.0"
namespace = "io.grpc.examples.stublite"
}

tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().all {
kotlinOptions {
jvmTarget = JavaVersion.VERSION_11.toString()
freeCompilerArgs = listOf("-opt-in=kotlin.RequiresOptIn")
}
}
Expand All @@ -44,31 +36,31 @@ protobuf {
artifact = "com.google.protobuf:protoc:${rootProject.ext["protobufVersion"]}"
}
plugins {
id("java") {
create("java") {
artifact = "io.grpc:protoc-gen-grpc-java:${rootProject.ext["grpcVersion"]}"
}
id("grpc") {
create("grpc") {
artifact = "io.grpc:protoc-gen-grpc-java:${rootProject.ext["grpcVersion"]}"
}
id("grpckt") {
create("grpckt") {
artifact = "io.grpc:protoc-gen-grpc-kotlin:${rootProject.ext["grpcKotlinVersion"]}:jdk8@jar"
}
}
generateProtoTasks {
all().forEach {
it.plugins {
id("java") {
create("java") {
option("lite")
}
id("grpc") {
create("grpc") {
option("lite")
}
id("grpckt") {
create("grpckt") {
option("lite")
}
}
it.builtins {
id("kotlin") {
create("kotlin") {
option("lite")
}
}
Expand Down
2 changes: 1 addition & 1 deletion examples/stub-android/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest package="io.grpc.examples.stublite" />
<manifest />
Loading