Skip to content
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

Remove support for the Kotlin JS plugin #271

Merged
Merged
Show file tree
Hide file tree
Changes from 20 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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
strategy:
matrix:
os: [ ubuntu-latest, windows-latest, macos-latest ]
kotlin: [ 1.8.22, 1.9.24 ]
kotlin: [ 1.8.22, 1.9.25, 2.0.21, 2.1.0 ]
jdk: [ 11, 17, 21 ]

runs-on: ${{ matrix.os }}
Expand Down
4 changes: 1 addition & 3 deletions buildSrc/src/main/kotlin/LocalProtoktBuild.kt
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ import protokt.v1.gradle.configureProtokt
import java.io.File

fun Project.localProtokt(disableJava: Boolean = true) {
configureProtokt(this, null, disableJava) {
"$rootDir/protokt-codegen/build/install/$CODEGEN_NAME/bin/$CODEGEN_NAME"
}
configureProtokt(this, null, disableJava, "$rootDir/protokt-codegen/build/install/$CODEGEN_NAME/bin/$CODEGEN_NAME")
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for deferred evaluation anymore and this was causing a problem in the plugin integration test as it tried to create the new _codegen_ configuration once per target.


afterEvaluate {
tasks.withType<GenerateProtoTask> {
Expand Down
9 changes: 3 additions & 6 deletions buildSrc/src/main/kotlin/RemotePublishing.kt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

import com.google.protobuf.gradle.GenerateProtoTask
import com.vanniktech.maven.publish.JavadocJar
import com.vanniktech.maven.publish.KotlinJs
import com.vanniktech.maven.publish.KotlinJvm
import com.vanniktech.maven.publish.KotlinMultiplatform
import com.vanniktech.maven.publish.MavenPublishBaseExtension
Expand All @@ -31,6 +30,7 @@ import org.gradle.kotlin.dsl.the
import org.gradle.kotlin.dsl.withType
import org.gradle.plugins.signing.Sign
import org.gradle.plugins.signing.SigningExtension
import protokt.v1.gradle.KotlinPlugins

private object Pgp {
val key by lazy {
Expand Down Expand Up @@ -85,15 +85,12 @@ fun Project.enablePublishing(defaultJars: Boolean = true) {
}

if (defaultJars) {
pluginManager.withPlugin("org.jetbrains.kotlin.multiplatform") {
pluginManager.withPlugin(KotlinPlugins.MULTIPLATFORM) {
configure(KotlinMultiplatform(JavadocJar.Empty()))
}
pluginManager.withPlugin("org.jetbrains.kotlin.jvm") {
pluginManager.withPlugin(KotlinPlugins.JVM) {
configure(KotlinJvm(JavadocJar.Empty(), true))
}
pluginManager.withPlugin("org.jetbrains.kotlin.js") {
configure(KotlinJs(JavadocJar.Empty()))
}
}

afterEvaluate {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
plugins {
id("protokt.common-conventions")
id("com.android.library")
kotlin("android")
`kotlin-android`
}

javaBasedProjectConventions()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

plugins {
id("protokt.jvm-conventions")
kotlin("kapt")
`kotlin-kapt`
}

dependencies {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import org.jetbrains.kotlin.gradle.dsl.KotlinVersion

plugins {
id("protokt.common-conventions")
kotlin("jvm")
kotlin
}

javaBasedProjectConventions()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*/

plugins {
kotlin("multiplatform")
`kotlin-multiplatform`
id("protokt.common-conventions")
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
* Copyright (c) 2024 Toast, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

plugins {
id("protokt.multiplatform-conventions")
}

enablePublishing()
trackKotlinApiCompatibility()
36 changes: 18 additions & 18 deletions examples/grpc-node/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,11 @@
* limitations under the License.
*/

import com.google.protobuf.gradle.proto
import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsExec
import protokt.v1.gradle.protokt

plugins {
id("org.jetbrains.kotlin.js")
`kotlin-multiplatform`
}

kotlin {
Expand All @@ -31,6 +30,23 @@ kotlin {
binaries.executable()
useCommonJs()
}

sourceSets {
val jsMain by getting {
dependencies {
api(project(":protokt-runtime-grpc-lite"))
api(project(":examples:protos"))
api(libs.kotlinx.coroutines.core)
}
}

val jsTest by getting {
dependencies {
api(kotlin("test"))
api(libs.kotlinx.coroutines.test)
}
}
}
}

localProtokt()
Expand All @@ -44,22 +60,6 @@ protokt {
}
}

dependencies {
implementation(project(":examples:protos"))
implementation(libs.kotlinx.coroutines.core)

testImplementation(kotlin("test"))
testImplementation(libs.kotlinx.coroutines.test)
}

sourceSets {
named("jsMain") {
proto {
srcDir("../protos/src/main/proto")
}
}
}

tasks.withType<NodeJsExec> {
args(listOfNotNull(properties["service"], properties["mode"], properties["args"]))
}
Expand Down
4 changes: 1 addition & 3 deletions extensions/protokt-extensions-api/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@
*/

plugins {
id("protokt.multiplatform-conventions")
id("protokt.multiplatform-published-conventions")
}

enablePublishing()
compatibleWithAndroid()
trackKotlinApiCompatibility()
11 changes: 7 additions & 4 deletions extensions/protokt-extensions-lite/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,10 @@ import protokt.v1.gradle.protokt
import protokt.v1.gradle.protoktExtensions

plugins {
id("protokt.multiplatform-conventions")
id("protokt.multiplatform-published-conventions")
}

localProtokt()
enablePublishing()
trackKotlinApiCompatibility()

spotless {
kotlin {
Expand All @@ -42,7 +40,12 @@ protokt {

kotlin {
sourceSets {
val commonMain by getting {}
// todo: not sure why this is needed
andrewparmet marked this conversation as resolved.
Show resolved Hide resolved
val commonMain by getting {
dependencies {
api(project(":protokt-core-lite"))
}
}

val jvmMain by getting {
dependencies {
Expand Down
5 changes: 1 addition & 4 deletions extensions/protokt-extensions-simple/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,9 @@
*/

plugins {
id("protokt.multiplatform-conventions")
id("protokt.multiplatform-published-conventions")
}

enablePublishing()
trackKotlinApiCompatibility()

kotlin {
sourceSets {
val jvmMain by getting {
Expand Down
7 changes: 4 additions & 3 deletions extensions/protokt-extensions/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,11 @@ import com.google.protobuf.gradle.proto
import protokt.v1.gradle.protokt

plugins {
id("protokt.multiplatform-conventions")
id("protokt.multiplatform-published-conventions")
}

localProtokt()
enablePublishing()
compatibleWithAndroid()
trackKotlinApiCompatibility()

spotless {
kotlin {
Expand All @@ -45,6 +43,9 @@ kotlin {
val commonMain by getting {
dependencies {
api(project(":extensions:protokt-extensions-lite"))

// todo: not sure why this is needed
andrewparmet marked this conversation as resolved.
Show resolved Hide resolved
api(project(":protokt-core"))
}
}
}
Expand Down
Loading
Loading