open-toast / protokt

Protobuf compiler and runtime for Kotlin
Apache License 2.0
154 stars 14 forks source link

Plugin fails with Kotlin/JS project #200

Closed pusolito closed 1 year ago

pusolito commented 1 year ago

I have a pure Kotlin/JS project with the following config. However, the build fails with the error below. Am I missing something? Does the plugin only work with Kotlin JVM? Or is it designed to work w/ sub-projects? This seemed to be referenced in issue #138.

plugins {
    kotlin("js") version "1.9.10"
    id("com.toasttab.protokt") version "0.12.1"
}

repositories {
    mavenCentral()
}

kotlin {
    js {}

    dependencies {
        implementation("com.google.protobuf:protobuf-java:3.24.4")
    }
}
The com.google.protobuf plugin could not be applied during project evaluation. The Java plugin or one of the Android plugins must be applied to the project first.
andrewparmet commented 1 year ago

You'll want to use version 1.0.0-alpha.6.

One thing to look out for - since the Kotlin JS plugin is now deprecated, protokt will soon stop supporting it. All the same codegen will happen for a multiplatform project with a JS target but we haven't quite worked out the mechanics yet. It's another "alpha" factor that snuck up in Kotlin 1.9.

pusolito commented 1 year ago

I tried using 1.0.0-alpha.6, but hit an issue where that version of the plugin doesn't seem to be in staging (maven, url: https://oss.sonatype.org/content/repositories/snapshots).

image

I see that version for other parts of the library, but the .gradle/tools/protoc-gen-protokt-1.0.0-alpha.6 directory is empty and therefore the build fails:

protoc: stdout: . stderr: /Users/neddy/Development/Projects/FurryFloofs/.gradle/tools/protoc-gen-protokt-1.0.0-alpha.6/bin/protoc-gen-protokt: program not found or is not executable

andrewparmet commented 1 year ago

Part of going multiplatform involved refactoring publishing logic and while it passes in CI, the integration with Maven Central broke. Working on a fix now.

andrewparmet commented 1 year ago

Still working on this. May be a few days.

andrewparmet commented 1 year ago

Fixed in 1.0.0-alpha.9