netifi-proteus / proteus-java

Proteus Java Client
https://www.netifi.com
Apache License 2.0
42 stars 3 forks source link

Minimal build.gradle #33

Closed misterzirillo closed 5 years ago

misterzirillo commented 5 years ago

I'm trying to use Proteus in a Clojure project, but I'm having trouble triggering the tool that generates 'services' per my proto definitions. I started with the build file found at https://proteus-java.readthedocs.io/en/latest/#getting-started but haven't been able to gradle generateProto.

Here's my build.gradle:

plugins {
    id 'com.google.protobuf' version '0.8.7'
    id 'java'
}

sourceCompatibility = 1.8

dependencies {
    compile "io.rsocket.rpc:rsocket-rpc-core:$rsocketRpcVersion"
    compile "com.google.protobuf:protobuf-java:$protobufVersion"
    compile "com.google.protobuf:protoc:$protobufVersion"
}

sourceSets {
    main {
        proto { srcDir 'resources/proto' }
    }

    test {
        proto { srcDir 'resources/proto' }
    }
}

protobuf {
    protoc {
        artifact = "com.google.protobuf:protoc:$protobufVersion"
    }
    plugins {
        proteus {
            artifact = 'io.netifi.proteus:proteus-java:1.5.4'
        }
    }
    generateProtoTasks {
        all()*.plugins {
            proteus {}
        }
    }
}

repositories {
  jcenter()
  maven {
    url 'https://dl.bintray.com/netifi/netifi-oss'
  }
}

Any tips on how to make this thing work?

mostroverkhov commented 5 years ago

@mrcirillo In, sourceSets block, try prefix paths with src: e.g. src/resources/proto

robertroeser commented 5 years ago

@mrcirillo hey - I need to take that down - those are pretty old. We moved what was proteus-rpc to rsocket-rpc-java Here's a link to the java quickstart that shows how it works with the current version: https://www.netifi.com/getstarted-java

The protobuf block should look more like this:

rsocketRpcVersion = '0.2.12'
protobuf {
    generatedFilesBaseDir = "${projectDir}/src/generated"

    protoc {
        artifact = "com.google.protobuf:protoc:$protobufVersion"
    }

    plugins {
        rsocketRpc {
            artifact = "io.rsocket.rpc:rsocket-rpc-protobuf:$rsocketRpcVersion"
        }
        generateProtoTasks {
            ofSourceSet('main')*.plugins {
                rsocketRpc {}
            }
        }
    }
}
misterzirillo commented 5 years ago

@robertroeser Thanks - that solves it.

Part of my confusion is that build.gradle in the quickstart project doesn't seem have the pieces needed to start using Proteus. Also gradle generateProto is only mentioned in the old docs. AFAIK that is the only way to trigger Proteus-specific code generation.

In short, (if I hadn't submitted this issue) I'm not sure how I would just add Proteus as a dependency to an existing project and start using it.

robertroeser commented 5 years ago

@mrcirillo sorry for the confusions - we actively cleaning up our documentation right now - just hired someone to work on the project - and hopefully we should have some updates soon. Also just started a forum: https://community.netifi.com/ I'm going to close this issue - let us know if you have any other problems.