Last active
March 10, 2020 14:09
-
-
Save atejandro/86a0b88e8c2e26b2da981076d67562d9 to your computer and use it in GitHub Desktop.
gradle grpc multiproject
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apply plugin: "com.google.protobuf" | |
description = "api" | |
version '1.0.1' | |
sourceCompatibility = 1.6 | |
targetCompatibility = 1.6 | |
def protocVersion = '3.0.2' | |
protobuf { | |
protoc { | |
artifact = "com.google.protobuf:protoc:${protocVersion}" | |
} | |
plugins { | |
grpc { | |
artifact = "io.grpc:protoc-gen-grpc-java:${grpcVersion}" | |
} | |
} | |
generateProtoTasks { | |
all()*.plugins { | |
grpc {} | |
} | |
} | |
} | |
idea { | |
module { | |
// Not using generatedSourceDirs because of | |
// https://discuss.gradle.org/t/support-for-intellij-2016/15294/8 | |
sourceDirs += file("${projectDir}/build/generated/source/proto/main/java"); | |
sourceDirs += file("${projectDir}/build/generated/source/proto/main/grpc"); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
buildscript { repositories { jcenter() } } | |
plugins { | |
id 'idea' | |
id "nebula.project" version "3.3.0" apply false | |
id 'nebula.optional-base' version '3.0.3' apply false | |
id 'nebula.provided-base' version '3.0.3' apply false | |
id 'nebula.maven-publish' version '4.9.1' apply false | |
id "nebula.ospackage-application-daemon" version "4.4.0" apply false | |
id "com.google.protobuf" version "0.8.1" apply false | |
} | |
description 'Project description' | |
subprojects { project -> | |
apply plugin: 'java' | |
apply plugin: 'scala' | |
apply plugin: 'idea' | |
apply plugin: 'nebula.project' | |
apply plugin: 'nebula.optional-base' | |
apply plugin: 'nebula.provided-base' | |
apply plugin: 'nebula.maven-publish' | |
group 'com.payulatam.fraudvault' | |
contacts { | |
'example@email.com' { | |
moniker 'Alejandro Ardila' | |
role 'owner' | |
} | |
} | |
sourceCompatibility = 1.8 | |
targetCompatibility = 1.8 | |
ext { | |
grpcVersion = '1.3.0' // CURRENT_GRPC_VERSION | |
hibernateVersion = '5.2.5.Final' | |
} | |
dependencies { | |
//dependencies for 'main' configurations | |
compile 'org.slf4j:slf4j-api:1.7+' | |
compile 'org.tinylog:slf4j-binding:+' | |
//dependencies for 'test' configurations | |
testCompile 'org.scala-lang:scala-library:2.12+' | |
testCompile 'org.scalatest:scalatest_2.12:3+' | |
compileOnly 'org.projectlombok:lombok:+' | |
if (!(project.name.contains("core"))) { | |
compile "io.grpc:grpc-protobuf:${grpcVersion}" | |
compile "io.grpc:grpc-stub:${grpcVersion}" | |
} | |
} | |
repositories { | |
mavenCentral() | |
mavenLocal() | |
maven { | |
url "http://artifactory.fraudvault.com/artifactory/libs-release" | |
} | |
} | |
//Configurations for managing dependencies in the integration tests. | |
configurations { | |
integrationTestCompile.extendsFrom testCompile | |
integrationTestRuntime.extendsFrom testRuntime | |
} | |
//Defining source folders for integration tests. | |
sourceSets { | |
integrationTest { | |
java { | |
compileClasspath += main.output + test.output | |
runtimeClasspath += main.output + test.output | |
srcDir file('src/integration-test/java') | |
} | |
scala { | |
compileClasspath += main.output + test.output | |
runtimeClasspath += main.output + test.output | |
srcDir file('src/integration-test/scala') | |
} | |
resources.srcDir file('src/integration-test/resources') | |
} | |
} | |
//Task for running integration tests | |
task integrationTest(type: Test){ | |
testClassesDir = sourceSets.integrationTest.output.classesDir | |
classpath = sourceSets.integrationTest.runtimeClasspath | |
//outputs.upToDateWhen {false} | |
} | |
// Run 'integrationTest' task before 'check' task. | |
check.dependsOn integrationTest | |
// Run 'test' task before 'integrationTest' task. | |
integrationTest.mustRunAfter test | |
// Create different HTML reports for unit tests and integration tests. | |
tasks.withType(Test) { | |
reports.html.destination = file("${reporting.baseDir}/${name}") | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rootProject.name = 'my-project-name' | |
include ":my-project-name-api" | |
include ":my-project-name-core" | |
include ":my-project-name-service" | |
project(':my-project-name-api').projectDir = "$rootDir/api" as File | |
project(':my-project-name-core').projectDir = "$rootDir/core" as File | |
project(':my-project-name-service').projectDir = "$rootDir/service" as File |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment