kotlin-libraries-playground icon indicating copy to clipboard operation
kotlin-libraries-playground copied to clipboard

Sample wanted for square/wire

Open jmfayard opened this issue 4 years ago • 13 comments

About the library

  • Description: gRPC and protocol buffers for Android, Kotlin, and Java.
  • GitHub: https://github.com/square/wire
  • Official website: https://square.github.io/wire/

What the sample could do

Re-use the Dinosaur sample from the documentation

Wants to contribute the sample?

  • Say so in a comment here
  • Follow instructions in CONTRIBUTING.md
  • Submit your pull request!

jmfayard avatar Sep 30 '20 08:09 jmfayard

I'm currently trying out the library, but I'm unable to import wire's gradle plugin to the project. I tried to add the following in build.gradle.kts file

plugins { id 'application' id 'org.jetbrains.kotlin.jvm' id 'com.squareup.wire' }

wire { kotlin { } }

I get the error: Plugin [id: 'com.squareup.wire'] was not found in any of the following sources:

sijanr avatar Oct 04 '20 18:10 sijanr

@sijanr One get this error when no plugin version is set add manually to versions.properties this: plugin.com.squareup.wire=3.4.0

jmfayard avatar Oct 05 '20 05:10 jmfayard

Should I assign the issue to you?

jmfayard avatar Oct 05 '20 05:10 jmfayard

Yes, that'd be great. Thanks!

sijanr avatar Oct 05 '20 06:10 sijanr

I get the same error even after setting the plugin version, .

I added plugin.com.squareup.wire=3.4.0 to the version.properties file

In build.gradle.kts, I added: plugin { id("com.squareup.wire") }

wire { kotlin{ out "${buildDir}/generate" } }

sijanr avatar Oct 07 '20 18:10 sijanr

It's because the wire plugin is not on the Gradle Plugins portal. You need to add gradlePluginPortal() mavenCentral() in the repos in the pluginManagement in the settings.gradle.kts file.

LouisCAD avatar Oct 11 '20 16:10 LouisCAD

The build is successful, but I'm unable to add the following in the build.gradle.kts

wire { kotlin { } }

I don't think I can generate the kotlin class of the proto file without adding the above code.

Since applying the plugin directly in the build.gradle.pluginManagement { repositories { gradlePluginPortal() mavenCentral() } }kts wasn't working for me, I added plugin.com.squareup.wire=3.4.0 in the version.properties file.

I also added implementation ("com.squareup.wire:wire-runtime:3.4.0") to the dependencies in the build.gradle.kts file

Following your advice, I added

pluginManagement { repositories { gradlePluginPortal() mavenCentral() } }

to the settings.gradle.kts file. Is there anything that I did wrong?

sijanr avatar Oct 24 '20 04:10 sijanr

Can you push your code and open a pull request in its present state? I will try to fix it

jmfayard avatar Oct 24 '20 05:10 jmfayard

@sijanr pluginManagement is meant for the settings.gradle.kts file.

LouisCAD avatar Oct 24 '20 07:10 LouisCAD

Also, please use triple backticks for code snippets.

Like this

LouisCAD avatar Oct 24 '20 07:10 LouisCAD

This is what I've been able to get so far. You'll probably see a bunch of errors in the gradle build file, but it all clears out if you remove

wire {
          kotlin {}
}

sijanr avatar Oct 30 '20 16:10 sijanr

I also deleted the below code from the build.gradle.kts file because I just kept on receiving an error asking me remove it.

tasks.register("run", JavaExec::class.java) {
    this.main = "playground._mainKt"
}

sijanr avatar Oct 30 '20 16:10 sijanr

ok, thanks!

jmfayard avatar Oct 30 '20 16:10 jmfayard