aboutsummaryrefslogtreecommitdiff
path: root/examples/thrift/build.gradle
blob: 6cd2d76d5a144ca49f2a3fb4fbc3d149c2dccb0b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
apply plugin: 'java'

description = "Thrift Examples"

repositories {
  mavenCentral()
  mavenLocal()
}

// IMPORTANT: You probably want the non-SNAPSHOT version of gRPC. Make sure you
// are looking at a tagged version of the example and not "master"!

// Feel free to delete the comment at the next line. It is just for safely
// updating the version in our release process.
def grpcVersion = '1.3.0-SNAPSHOT' // CURRENT_GRPC_VERSION

dependencies {
  compile "io.grpc:grpc-stub:${grpcVersion}"
  compile "io.grpc:grpc-thrift:${grpcVersion}"
  compile "io.grpc:grpc-netty:${grpcVersion}"
}

// Add pre-generated code to build path
String generatedSourcePath = "${projectDir}/src/generated"
project.sourceSets {
  main {
    java {
      srcDir "${generatedSourcePath}/main/java"
      srcDir "${generatedSourcePath}/main/grpc"
    }
  }
}

// Inform IntelliJ projects about the generated code.
apply plugin: 'idea'

idea {
    module {
        sourceDirs += file("${projectDir}/src/generated/main/java");
        sourceDirs += file("${projectDir}/src/generated/main/grpc");
    }
}

// Provide convenience executables for trying out the examples.
apply plugin: 'application'

startScripts.enabled = false

task thriftHelloWorldServer(type: CreateStartScripts) {
    mainClassName = "io.grpc.examples.thrift.helloworld.HelloWorldServer"
    applicationName = "thrift-hello-world-server"
    outputDir = new File(project.buildDir, 'tmp')
    classpath = jar.outputs.files + project.configurations.runtime
}

task thriftHelloWorldClient(type: CreateStartScripts) {
   mainClassName = "io.grpc.examples.thrift.helloworld.HelloWorldClient"
   applicationName = "thrift-hello-world-client"
   outputDir = new File(project.buildDir, 'tmp')
   classpath = jar.outputs.files + project.configurations.runtime
}

applicationDistribution.into("bin") {
    from(thriftHelloWorldServer)
    from(thriftHelloWorldClient)
    fileMode = 0755
}