2019-09-07 23:18:57 +08:00
|
|
|
plugins {
|
2023-05-07 01:07:39 +08:00
|
|
|
id 'java' // changes the behavior of TARGET_JVM_VERSION_ATTRIBUTE
|
|
|
|
|
2019-09-07 23:18:57 +08:00
|
|
|
id "com.google.osdetector" apply false
|
|
|
|
id "me.champeau.gradle.japicmp" apply false
|
|
|
|
id "net.ltgt.errorprone" apply false
|
2022-06-30 05:52:19 +08:00
|
|
|
id 'com.google.cloud.tools.jib' apply false
|
2015-04-18 01:49:11 +08:00
|
|
|
}
|
2015-03-01 01:59:25 +08:00
|
|
|
|
2023-08-12 10:46:44 +08:00
|
|
|
import io.grpc.gradle.CheckForUpdatesTask
|
|
|
|
import io.grpc.gradle.RequireUpperBoundDepsMatchTask
|
2018-12-14 02:17:06 +08:00
|
|
|
import net.ltgt.gradle.errorprone.CheckSeverity
|
|
|
|
|
2015-09-05 04:26:24 +08:00
|
|
|
subprojects {
|
2015-01-31 06:58:07 +08:00
|
|
|
apply plugin: "checkstyle"
|
2015-01-22 06:30:14 +08:00
|
|
|
apply plugin: "idea"
|
2015-03-03 05:31:14 +08:00
|
|
|
apply plugin: "signing"
|
2015-05-06 03:29:26 +08:00
|
|
|
apply plugin: "jacoco"
|
2014-12-16 01:58:05 +08:00
|
|
|
|
2015-09-17 06:15:10 +08:00
|
|
|
apply plugin: "com.google.osdetector"
|
2018-12-14 02:17:06 +08:00
|
|
|
apply plugin: "net.ltgt.errorprone"
|
2015-09-17 06:15:10 +08:00
|
|
|
|
2015-01-28 02:25:39 +08:00
|
|
|
group = "io.grpc"
|
2024-09-26 17:20:23 +08:00
|
|
|
version = "1.67.2-SNAPSHOT" // CURRENT_GRPC_VERSION
|
2014-12-16 01:58:05 +08:00
|
|
|
|
|
|
|
repositories {
|
2018-06-12 09:35:18 +08:00
|
|
|
maven { // The google mirror is less flaky than mavenCentral()
|
2020-07-10 00:38:24 +08:00
|
|
|
url "https://maven-central.storage-download.googleapis.com/maven2/" }
|
2019-09-28 02:05:56 +08:00
|
|
|
mavenCentral()
|
2018-03-02 11:11:24 +08:00
|
|
|
mavenLocal()
|
2014-12-16 01:58:05 +08:00
|
|
|
}
|
|
|
|
|
2022-07-02 06:48:38 +08:00
|
|
|
tasks.withType(JavaCompile).configureEach {
|
2018-06-12 09:35:18 +08:00
|
|
|
it.options.compilerArgs += [
|
|
|
|
"-Xlint:all",
|
|
|
|
"-Xlint:-options",
|
2018-08-17 00:35:25 +08:00
|
|
|
"-Xlint:-path",
|
|
|
|
"-Xlint:-try"
|
2018-06-12 09:35:18 +08:00
|
|
|
]
|
2015-03-13 06:25:11 +08:00
|
|
|
it.options.encoding = "UTF-8"
|
2023-06-29 07:24:21 +08:00
|
|
|
// Avoid Gradle OOM.
|
|
|
|
// https://docs.gradle.org/current/userguide/performance.html#run_the_compiler_as_a_separate_process
|
|
|
|
it.options.fork = true
|
2016-07-11 02:40:12 +08:00
|
|
|
if (rootProject.hasProperty('failOnWarnings') && rootProject.failOnWarnings.toBoolean()) {
|
|
|
|
it.options.compilerArgs += ["-Werror"]
|
|
|
|
}
|
2015-01-27 06:03:11 +08:00
|
|
|
}
|
|
|
|
|
2022-07-02 06:48:38 +08:00
|
|
|
tasks.withType(GenerateModuleMetadata).configureEach {
|
2020-07-07 06:40:45 +08:00
|
|
|
// Module metadata, introduced in Gradle 6.0, conflicts with our publishing task for
|
|
|
|
// grpc-alts and grpc-compiler.
|
|
|
|
enabled = false
|
|
|
|
}
|
|
|
|
|
2020-05-02 13:59:06 +08:00
|
|
|
def isAndroid = project.name in [
|
|
|
|
'grpc-android', 'grpc-android-interop-testing', 'grpc-cronet']
|
|
|
|
|
2015-02-14 08:21:53 +08:00
|
|
|
ext {
|
2015-05-08 06:20:44 +08:00
|
|
|
def exeSuffix = osdetector.os == 'windows' ? ".exe" : ""
|
|
|
|
protocPluginBaseName = 'protoc-gen-grpc-java'
|
2016-01-27 04:13:06 +08:00
|
|
|
javaPluginPath = "$rootDir/compiler/build/exe/java_plugin/$protocPluginBaseName$exeSuffix"
|
2015-05-08 06:20:44 +08:00
|
|
|
|
2015-05-06 07:11:27 +08:00
|
|
|
configureProtoCompilation = {
|
2018-06-12 09:35:18 +08:00
|
|
|
String generatedSourcePath = "${projectDir}/src/generated"
|
2018-10-25 05:25:22 +08:00
|
|
|
project.protobuf {
|
|
|
|
protoc {
|
|
|
|
if (project.hasProperty('protoc')) {
|
|
|
|
path = project.protoc
|
|
|
|
} else {
|
2022-06-14 03:09:30 +08:00
|
|
|
artifact = libs.protobuf.protoc.get()
|
2018-10-25 05:25:22 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
generateProtoTasks {
|
|
|
|
all().each { task ->
|
2020-03-20 03:37:48 +08:00
|
|
|
if (isAndroid) {
|
|
|
|
task.builtins {
|
|
|
|
java { option 'lite' }
|
|
|
|
}
|
|
|
|
}
|
2018-10-25 05:25:22 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2018-06-12 09:35:18 +08:00
|
|
|
if (rootProject.childProjects.containsKey('grpc-compiler')) {
|
2018-10-25 05:25:22 +08:00
|
|
|
// Only when the codegen is built along with the project, will we be able to run
|
|
|
|
// the grpc code generator.
|
2022-07-02 06:48:38 +08:00
|
|
|
def syncGeneratedSources = tasks.register("syncGeneratedSources") { }
|
2018-06-12 09:35:18 +08:00
|
|
|
project.protobuf {
|
|
|
|
plugins { grpc { path = javaPluginPath } }
|
|
|
|
generateProtoTasks {
|
|
|
|
all().each { task ->
|
2020-03-20 03:37:48 +08:00
|
|
|
String variantOrSourceSet = isAndroid ? task.variant.name : task.sourceSet.name
|
|
|
|
def syncTask = project.tasks.register("syncGeneratedSources${variantOrSourceSet}", Sync) {
|
2023-05-06 01:09:22 +08:00
|
|
|
from task
|
|
|
|
into "$generatedSourcePath/$variantOrSourceSet"
|
|
|
|
include "grpc/"
|
2020-03-20 03:37:48 +08:00
|
|
|
}
|
2022-07-02 06:48:38 +08:00
|
|
|
syncGeneratedSources.configure {
|
|
|
|
dependsOn syncTask
|
|
|
|
}
|
|
|
|
|
|
|
|
task.configure {
|
|
|
|
dependsOn ':grpc-compiler:java_pluginExecutable'
|
|
|
|
// Recompile protos when the codegen has been changed
|
|
|
|
inputs.file javaPluginPath
|
|
|
|
plugins { grpc { option 'noversion' } }
|
|
|
|
if (isAndroid) {
|
|
|
|
plugins {
|
|
|
|
grpc {
|
|
|
|
option 'lite'
|
|
|
|
}
|
2020-03-20 03:37:48 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2018-06-12 09:35:18 +08:00
|
|
|
}
|
|
|
|
}
|
2015-06-23 07:29:30 +08:00
|
|
|
}
|
2018-10-25 05:25:22 +08:00
|
|
|
// Re-sync as part of a normal build, to avoid forgetting to run the sync
|
2022-07-02 06:48:38 +08:00
|
|
|
tasks.named("assemble").configure {
|
|
|
|
dependsOn syncGeneratedSources
|
|
|
|
}
|
2018-06-12 09:35:18 +08:00
|
|
|
} else {
|
|
|
|
// Otherwise, we just use the checked-in generated code.
|
2020-03-20 03:37:48 +08:00
|
|
|
if (isAndroid) {
|
|
|
|
project.android.sourceSets {
|
|
|
|
debug { java { srcDir "${generatedSourcePath}/debug/grpc" } }
|
|
|
|
release { java { srcDir "${generatedSourcePath}/release/grpc" } }
|
|
|
|
}
|
|
|
|
} else {
|
2022-07-07 22:26:38 +08:00
|
|
|
project.sourceSets.each() { sourceSet ->
|
|
|
|
sourceSet.java { srcDir "${generatedSourcePath}/${sourceSet.name}/grpc" }
|
2020-03-20 03:37:48 +08:00
|
|
|
}
|
2015-05-08 08:32:31 +08:00
|
|
|
}
|
2015-06-23 07:29:30 +08:00
|
|
|
}
|
|
|
|
|
2022-07-02 06:48:38 +08:00
|
|
|
tasks.withType(JavaCompile).configureEach {
|
2020-12-17 08:47:51 +08:00
|
|
|
appendToProperty(
|
|
|
|
it.options.errorprone.excludedPaths,
|
|
|
|
".*/src/generated/[^/]+/java/.*" +
|
|
|
|
"|.*/build/generated/source/proto/[^/]+/java/.*",
|
|
|
|
"|")
|
2015-05-12 07:58:28 +08:00
|
|
|
}
|
2015-05-06 07:11:27 +08:00
|
|
|
}
|
|
|
|
|
2022-06-14 03:09:30 +08:00
|
|
|
libraries = libs
|
2020-05-02 13:59:28 +08:00
|
|
|
|
2020-12-17 08:47:51 +08:00
|
|
|
appendToProperty = { Property<String> property, String value, String separator ->
|
|
|
|
if (property.present) {
|
|
|
|
property.set(property.get() + separator + value)
|
|
|
|
} else {
|
|
|
|
property.set(value)
|
|
|
|
}
|
|
|
|
}
|
2015-02-14 08:21:53 +08:00
|
|
|
}
|
2014-12-16 01:58:05 +08:00
|
|
|
|
2015-03-03 23:59:13 +08:00
|
|
|
// Disable JavaDoc doclint on Java 8. It's annoying.
|
|
|
|
if (JavaVersion.current().isJava8Compatible()) {
|
2018-06-12 09:35:18 +08:00
|
|
|
allprojects {
|
2022-07-02 06:48:38 +08:00
|
|
|
tasks.withType(Javadoc).configureEach {
|
2018-06-12 09:35:18 +08:00
|
|
|
options.addStringOption('Xdoclint:none', '-quiet')
|
|
|
|
}
|
2015-03-03 23:59:13 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-01-31 06:58:07 +08:00
|
|
|
checkstyle {
|
2020-07-31 21:55:52 +08:00
|
|
|
configDirectory = file("$rootDir/buildscripts")
|
2023-07-22 01:15:05 +08:00
|
|
|
toolVersion = JavaVersion.current().isJava11Compatible() ? libs.checkstyle.get().version : libs.checkstylejava8.get().version
|
|
|
|
|
2015-05-05 23:54:51 +08:00
|
|
|
ignoreFailures = false
|
2015-03-22 01:59:17 +08:00
|
|
|
if (rootProject.hasProperty("checkstyle.ignoreFailures")) {
|
|
|
|
ignoreFailures = rootProject.properties["checkstyle.ignoreFailures"].toBoolean()
|
|
|
|
}
|
2015-01-31 06:58:07 +08:00
|
|
|
}
|
|
|
|
|
2022-01-13 04:06:27 +08:00
|
|
|
if (!project.hasProperty('errorProne') || errorProne.toBoolean()) {
|
2020-01-10 07:20:41 +08:00
|
|
|
dependencies {
|
2023-03-02 13:21:33 +08:00
|
|
|
errorprone JavaVersion.current().isJava11Compatible() ? libs.errorprone.core : libs.errorprone.corejava8
|
2020-01-10 07:20:41 +08:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// Disable Error Prone
|
2022-07-02 06:48:38 +08:00
|
|
|
tasks.withType(JavaCompile).configureEach {
|
2022-01-13 04:06:27 +08:00
|
|
|
options.errorprone.enabled = false
|
2020-01-10 07:20:41 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-09-08 01:24:29 +08:00
|
|
|
plugins.withId("java") {
|
|
|
|
dependencies {
|
2020-07-31 21:55:52 +08:00
|
|
|
testImplementation libraries.junit,
|
2022-06-14 03:09:30 +08:00
|
|
|
libraries.mockito.core,
|
2019-09-08 01:24:29 +08:00
|
|
|
libraries.truth
|
|
|
|
}
|
|
|
|
|
2022-07-02 06:48:38 +08:00
|
|
|
tasks.named("compileTestJava").configure {
|
2019-09-08 01:24:29 +08:00
|
|
|
// serialVersionUID is basically guaranteed to be useless in our tests
|
|
|
|
options.compilerArgs += [
|
|
|
|
"-Xlint:-serial"
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
2022-07-02 06:48:38 +08:00
|
|
|
tasks.named("jar").configure {
|
|
|
|
manifest {
|
|
|
|
attributes('Implementation-Title': name,
|
|
|
|
'Implementation-Version': project.version)
|
|
|
|
}
|
2019-09-08 01:24:29 +08:00
|
|
|
}
|
|
|
|
|
2022-07-02 06:48:38 +08:00
|
|
|
tasks.named("javadoc").configure {
|
|
|
|
options {
|
|
|
|
encoding = 'UTF-8'
|
|
|
|
use = true
|
2024-02-24 08:27:18 +08:00
|
|
|
linksOffline 'https://docs.oracle.com/javase/8/docs/api/',
|
|
|
|
"${rootProject.projectDir}/gradle/javadoc/docs.oracle.com-javase-8-docs-api/"
|
2022-07-02 06:48:38 +08:00
|
|
|
source = "8"
|
|
|
|
}
|
2019-09-08 01:24:29 +08:00
|
|
|
}
|
|
|
|
|
2022-07-02 06:48:38 +08:00
|
|
|
tasks.named("checkstyleMain").configure {
|
2019-09-24 02:48:00 +08:00
|
|
|
source = fileTree(dir: "$projectDir/src/main", include: "**/*.java")
|
2019-09-08 01:24:29 +08:00
|
|
|
}
|
2015-01-31 06:58:07 +08:00
|
|
|
|
2022-07-02 06:48:38 +08:00
|
|
|
tasks.named("checkstyleTest").configure {
|
2019-09-24 02:48:00 +08:00
|
|
|
source = fileTree(dir: "$projectDir/src/test", include: "**/*.java")
|
2019-09-08 01:24:29 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// At a test failure, log the stack trace to the console so that we don't
|
|
|
|
// have to open the HTML in a browser.
|
2022-07-02 06:48:38 +08:00
|
|
|
tasks.named("test").configure {
|
2019-09-08 01:24:29 +08:00
|
|
|
testLogging {
|
|
|
|
exceptionFormat = 'full'
|
|
|
|
showExceptions true
|
|
|
|
showCauses true
|
|
|
|
showStackTraces true
|
|
|
|
}
|
|
|
|
maxHeapSize = '1500m'
|
|
|
|
}
|
|
|
|
|
2022-01-13 04:06:27 +08:00
|
|
|
if (!project.hasProperty('errorProne') || errorProne.toBoolean()) {
|
2019-09-08 01:24:29 +08:00
|
|
|
dependencies {
|
2022-06-14 03:09:30 +08:00
|
|
|
annotationProcessor libs.guava.betaChecker
|
2019-09-08 01:24:29 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-08-01 08:04:44 +08:00
|
|
|
tasks.withType(JavaCompile).configureEach {
|
|
|
|
if (JavaVersion.current().isJava9Compatible()) {
|
|
|
|
options.release = 8
|
|
|
|
} else {
|
2023-07-21 00:48:39 +08:00
|
|
|
sourceCompatibility = JavaVersion.VERSION_1_8
|
|
|
|
targetCompatibility = JavaVersion.VERSION_1_8
|
2023-08-01 08:04:44 +08:00
|
|
|
}
|
|
|
|
}
|
2022-07-02 06:48:38 +08:00
|
|
|
tasks.named("compileJava").configure {
|
2020-01-04 06:50:34 +08:00
|
|
|
// This project targets Java 7 (no time.Duration class)
|
|
|
|
options.errorprone.check("PreferJavaTimeOverload", CheckSeverity.OFF)
|
2022-01-13 04:06:27 +08:00
|
|
|
options.errorprone.check("JavaUtilDate", CheckSeverity.OFF)
|
2020-08-04 03:51:05 +08:00
|
|
|
// The warning fails to provide a source location
|
|
|
|
options.errorprone.check("MissingSummary", CheckSeverity.OFF)
|
2024-06-13 04:42:20 +08:00
|
|
|
|
|
|
|
// This check is in libs.errorprone.corejava8 but has been removed
|
|
|
|
// in later versions. It isn't smart enough to realize the field is
|
|
|
|
// actually immutable. And it also doesn't complain about arrays
|
|
|
|
// that are actually mutable.
|
|
|
|
options.errorprone.check("MutableConstantField", CheckSeverity.OFF)
|
2020-01-04 06:50:34 +08:00
|
|
|
}
|
2022-07-02 06:48:38 +08:00
|
|
|
tasks.named("compileTestJava").configure {
|
2019-09-08 01:24:29 +08:00
|
|
|
// LinkedList doesn't hurt much in tests and has lots of usages
|
|
|
|
options.errorprone.check("JdkObsolete", CheckSeverity.OFF)
|
2020-01-04 06:50:34 +08:00
|
|
|
options.errorprone.check("PreferJavaTimeOverload", CheckSeverity.OFF)
|
2022-01-13 04:06:27 +08:00
|
|
|
options.errorprone.check("JavaUtilDate", CheckSeverity.OFF)
|
2024-06-13 04:42:20 +08:00
|
|
|
|
|
|
|
// This check is in libs.errorprone.corejava8 but has been removed
|
|
|
|
// in later versions. It isn't smart enough to realize the field is
|
|
|
|
// actually immutable. And it also doesn't complain about arrays
|
|
|
|
// that are actually mutable.
|
|
|
|
options.errorprone.check("MutableConstantField", CheckSeverity.OFF)
|
2019-09-08 01:24:29 +08:00
|
|
|
}
|
2022-01-08 01:54:50 +08:00
|
|
|
|
|
|
|
plugins.withId("ru.vyarus.animalsniffer") {
|
|
|
|
// Only available after java plugin has loaded
|
|
|
|
animalsniffer {
|
2023-05-06 23:14:33 +08:00
|
|
|
toolVersion = libs.animalsniffer.asProvider().get().version
|
2022-01-08 01:54:50 +08:00
|
|
|
}
|
|
|
|
}
|
2015-01-31 06:58:07 +08:00
|
|
|
}
|
|
|
|
|
2021-06-12 05:01:18 +08:00
|
|
|
plugins.withId("java-library") {
|
|
|
|
// Detect Maven Enforcer's dependencyConvergence failures. We only care
|
|
|
|
// for artifacts used as libraries by others with Maven.
|
2023-08-12 10:46:44 +08:00
|
|
|
tasks.register('checkUpperBoundDeps', RequireUpperBoundDepsMatchTask) {
|
|
|
|
configuration = configurations.getByName('runtimeClasspath')
|
2021-06-12 05:01:18 +08:00
|
|
|
}
|
2023-07-18 02:45:31 +08:00
|
|
|
tasks.named('assemble').configure {
|
2023-08-12 10:46:44 +08:00
|
|
|
dependsOn tasks.named('checkUpperBoundDeps')
|
2021-06-12 05:01:18 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-01-08 01:54:50 +08:00
|
|
|
plugins.withId("me.champeau.jmh") {
|
2019-09-08 00:03:53 +08:00
|
|
|
// invoke jmh on a single benchmark class like so:
|
|
|
|
// ./gradlew -PjmhIncludeSingleClass=StatsTraceContextBenchmark clean :grpc-core:jmh
|
2022-07-02 06:48:38 +08:00
|
|
|
tasks.named("jmh").configure {
|
2019-09-08 00:03:53 +08:00
|
|
|
warmupIterations = 10
|
|
|
|
iterations = 10
|
|
|
|
fork = 1
|
|
|
|
// None of our benchmarks need the tests, and we have pseudo-circular
|
|
|
|
// dependencies that break when including them. (context's testCompile
|
|
|
|
// depends on core; core's testCompile depends on testing)
|
|
|
|
includeTests = false
|
|
|
|
if (project.hasProperty('jmhIncludeSingleClass')) {
|
2022-11-04 07:55:33 +08:00
|
|
|
includes = [
|
2019-09-08 00:03:53 +08:00
|
|
|
project.property('jmhIncludeSingleClass')
|
|
|
|
]
|
|
|
|
}
|
2018-03-14 08:46:03 +08:00
|
|
|
}
|
2017-08-27 08:10:18 +08:00
|
|
|
}
|
|
|
|
|
2022-06-14 03:05:27 +08:00
|
|
|
plugins.withId("com.github.johnrengelman.shadow") {
|
2022-07-02 06:48:38 +08:00
|
|
|
tasks.named("shadowJar").configure {
|
2022-06-14 03:05:27 +08:00
|
|
|
// Do a dance to remove Class-Path. This needs to run after the doFirst() from the
|
|
|
|
// shadow plugin that adds Class-Path and before the core jar action. Using doFirst will
|
|
|
|
// have this run before the shadow plugin, and doLast will run after the core jar
|
|
|
|
// action. See #8606.
|
|
|
|
// The shadow plugin adds another doFirst when application is used for setting
|
|
|
|
// Main-Class. Ordering with it doesn't matter.
|
|
|
|
actions.add(plugins.hasPlugin("application") ? 2 : 1, new Action<Task>() {
|
|
|
|
@Override public void execute(Task task) {
|
|
|
|
if (!task.manifest.attributes.remove("Class-Path")) {
|
|
|
|
throw new AssertionError("Did not find Class-Path to remove from manifest")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-09-08 00:27:32 +08:00
|
|
|
plugins.withId("maven-publish") {
|
|
|
|
publishing {
|
|
|
|
publications {
|
|
|
|
// do not use mavenJava, as java plugin will modify it via "magic"
|
|
|
|
maven(MavenPublication) {
|
|
|
|
pom {
|
|
|
|
name = project.group + ":" + project.name
|
2019-02-01 09:38:43 +08:00
|
|
|
url = 'https://github.com/grpc/grpc-java'
|
2019-09-08 00:27:32 +08:00
|
|
|
afterEvaluate {
|
|
|
|
// description is not available until evaluated.
|
|
|
|
description = project.description
|
|
|
|
}
|
2015-03-13 08:03:01 +08:00
|
|
|
|
2019-09-08 00:27:32 +08:00
|
|
|
scm {
|
|
|
|
connection = 'scm:git:https://github.com/grpc/grpc-java.git'
|
|
|
|
developerConnection = 'scm:git:git@github.com:grpc/grpc-java.git'
|
|
|
|
url = 'https://github.com/grpc/grpc-java'
|
2019-02-01 09:38:43 +08:00
|
|
|
}
|
|
|
|
|
2019-09-08 00:27:32 +08:00
|
|
|
licenses {
|
|
|
|
license {
|
|
|
|
name = 'Apache 2.0'
|
|
|
|
url = 'https://opensource.org/licenses/Apache-2.0'
|
|
|
|
}
|
2019-02-01 09:38:43 +08:00
|
|
|
}
|
|
|
|
|
2019-09-08 00:27:32 +08:00
|
|
|
developers {
|
|
|
|
developer {
|
|
|
|
id = "grpc.io"
|
|
|
|
name = "gRPC Contributors"
|
|
|
|
email = "grpc-io@googlegroups.com"
|
|
|
|
url = "https://grpc.io/"
|
|
|
|
organization = "gRPC Authors"
|
|
|
|
organizationUrl = "https://www.google.com"
|
|
|
|
}
|
|
|
|
}
|
2019-02-01 09:38:43 +08:00
|
|
|
}
|
2015-03-13 08:03:01 +08:00
|
|
|
}
|
|
|
|
}
|
2019-09-08 00:27:32 +08:00
|
|
|
repositories {
|
|
|
|
maven {
|
|
|
|
if (rootProject.hasProperty('repositoryDir')) {
|
|
|
|
url = new File(rootProject.repositoryDir).toURI()
|
2019-02-28 01:39:02 +08:00
|
|
|
} else {
|
2019-09-08 00:27:32 +08:00
|
|
|
String stagingUrl
|
|
|
|
if (rootProject.hasProperty('repositoryId')) {
|
|
|
|
stagingUrl = 'https://oss.sonatype.org/service/local/staging/deployByRepositoryId/' +
|
|
|
|
rootProject.repositoryId
|
|
|
|
} else {
|
|
|
|
stagingUrl = 'https://oss.sonatype.org/service/local/staging/deploy/maven2/'
|
|
|
|
}
|
|
|
|
credentials {
|
|
|
|
if (rootProject.hasProperty('ossrhUsername') && rootProject.hasProperty('ossrhPassword')) {
|
|
|
|
username = rootProject.ossrhUsername
|
|
|
|
password = rootProject.ossrhPassword
|
|
|
|
}
|
2019-02-28 01:39:02 +08:00
|
|
|
}
|
2019-09-08 00:27:32 +08:00
|
|
|
def releaseUrl = stagingUrl
|
|
|
|
def snapshotUrl = 'https://oss.sonatype.org/content/repositories/snapshots/'
|
|
|
|
url = version.endsWith('SNAPSHOT') ? snapshotUrl : releaseUrl
|
2019-02-28 01:39:02 +08:00
|
|
|
}
|
2019-09-08 00:27:32 +08:00
|
|
|
}
|
2018-06-12 09:35:18 +08:00
|
|
|
}
|
2016-04-09 04:47:30 +08:00
|
|
|
}
|
2019-02-01 09:38:43 +08:00
|
|
|
|
2019-09-08 00:27:32 +08:00
|
|
|
signing {
|
|
|
|
required false
|
|
|
|
sign publishing.publications.maven
|
|
|
|
}
|
2019-02-01 09:38:43 +08:00
|
|
|
|
2019-09-08 01:24:29 +08:00
|
|
|
plugins.withId("java") {
|
2020-07-31 04:59:34 +08:00
|
|
|
java {
|
|
|
|
withJavadocJar()
|
|
|
|
withSourcesJar()
|
2019-09-08 01:24:29 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
publishing {
|
|
|
|
publications {
|
|
|
|
maven {
|
|
|
|
if (project.name != 'grpc-netty-shaded') {
|
|
|
|
from components.java
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2015-04-23 01:02:19 +08:00
|
|
|
}
|
|
|
|
}
|
2017-09-27 23:31:43 +08:00
|
|
|
|
2019-09-08 01:23:23 +08:00
|
|
|
// Run with: ./gradlew japicmp --continue
|
|
|
|
plugins.withId("me.champeau.gradle.japicmp") {
|
|
|
|
def baselineGrpcVersion = '1.6.1'
|
2017-09-27 23:31:43 +08:00
|
|
|
|
|
|
|
// Get the baseline version's jar for this subproject
|
2023-08-12 11:46:04 +08:00
|
|
|
configurations {
|
|
|
|
baselineArtifact
|
|
|
|
}
|
2017-09-27 23:31:43 +08:00
|
|
|
// A necessary hack, the intuitive thing does NOT work:
|
|
|
|
// https://discuss.gradle.org/t/is-the-default-configuration-leaking-into-independent-configurations/2088/6
|
|
|
|
def oldGroup = project.group
|
|
|
|
try {
|
|
|
|
project.group = 'virtual_group_for_japicmp'
|
2023-08-12 11:46:04 +08:00
|
|
|
dependencies {
|
|
|
|
baselineArtifact "io.grpc:${project.name}:${baselineGrpcVersion}@jar"
|
|
|
|
}
|
2017-09-27 23:31:43 +08:00
|
|
|
} finally {
|
|
|
|
project.group = oldGroup
|
|
|
|
}
|
|
|
|
|
|
|
|
// Add a japicmp task that compares the current .jar with baseline .jar
|
2022-07-02 06:48:38 +08:00
|
|
|
tasks.register("japicmp", me.champeau.gradle.japicmp.JapicmpTask) {
|
2023-08-12 11:46:04 +08:00
|
|
|
oldClasspath.from configurations.baselineArtifact
|
|
|
|
newClasspath.from tasks.named("jar")
|
2017-09-27 23:31:43 +08:00
|
|
|
onlyBinaryIncompatibleModified = false
|
|
|
|
// Be quiet about things that did not change
|
|
|
|
onlyModified = true
|
|
|
|
// This task should fail if there are incompatible changes
|
|
|
|
failOnModification = true
|
|
|
|
ignoreMissingClasses = true
|
|
|
|
htmlOutputFile = file("$buildDir/reports/japi.html")
|
|
|
|
|
|
|
|
packageExcludes = ['io.grpc.internal']
|
|
|
|
|
|
|
|
// Also break on source incompatible changes, not just binary.
|
|
|
|
// Eg adding abstract method to public class.
|
2023-08-12 11:46:04 +08:00
|
|
|
failOnSourceIncompatibility = true
|
2017-09-27 23:31:43 +08:00
|
|
|
|
|
|
|
// Ignore any classes or methods marked @ExperimentalApi
|
2023-08-12 11:46:04 +08:00
|
|
|
annotationExcludes = ['@io.grpc.ExperimentalApi']
|
2017-09-27 23:31:43 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-06-12 05:01:18 +08:00
|
|
|
|
2023-05-07 01:07:39 +08:00
|
|
|
repositories {
|
|
|
|
mavenCentral()
|
|
|
|
google()
|
|
|
|
}
|
|
|
|
|
|
|
|
def isAcceptableVersion(ModuleComponentIdentifier candidate) {
|
|
|
|
String group = candidate.group
|
|
|
|
String module = candidate.module
|
|
|
|
String version = candidate.version
|
|
|
|
if (group == 'com.google.guava')
|
|
|
|
return true
|
|
|
|
if (group == 'io.netty' && version.contains('Final'))
|
|
|
|
return true
|
2024-07-12 06:09:00 +08:00
|
|
|
if (group == 'io.undertow' && version.contains('Final'))
|
|
|
|
return true
|
2023-05-07 01:07:39 +08:00
|
|
|
if (module == 'android-api-level-19')
|
|
|
|
return true
|
2024-07-12 06:09:00 +08:00
|
|
|
if (module == 'opentelemetry-exporter-prometheus')
|
|
|
|
return true
|
|
|
|
if (module == 'opentelemetry-gcp-resources')
|
|
|
|
return true
|
2023-05-07 01:07:39 +08:00
|
|
|
return version ==~ /^[0-9]+(\.[0-9]+)+$/
|
|
|
|
}
|
|
|
|
|
|
|
|
configurations {
|
|
|
|
checkForUpdates {
|
|
|
|
attributes.attribute(TargetJvmVersion.TARGET_JVM_VERSION_ATTRIBUTE, 8)
|
|
|
|
resolutionStrategy {
|
|
|
|
componentSelection {
|
|
|
|
all {
|
|
|
|
if (!isAcceptableVersion(it.candidate))
|
|
|
|
it.reject("Not stable version")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-08-12 10:46:44 +08:00
|
|
|
tasks.register('checkForUpdates', CheckForUpdatesTask, project.configurations.checkForUpdates, "libs")
|