-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
169 lines (147 loc) · 4.56 KB
/
build.gradle
File metadata and controls
169 lines (147 loc) · 4.56 KB
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
import org.eclipse.jgit.api.errors.RefAlreadyExistsException
plugins {
id 'java'
id 'com.google.protobuf' version '0.9.4'
id 'idea'
id 'org.ajoberstar.grgit' version '5.2.2'
id 'io.github.gradle-nexus.publish-plugin' version "1.3.0"
}
group = "com.transferwise.envoy"
ext.projectName = "envoy-api"
ext.projectDescription = "envoy-api"
ext.projectArtifactName = "envoy-api"
ext.projectGitHubRepoName = "envoy-api-java"
ext.projectScmUrl = "https://github.com/transferwise/${projectGitHubRepoName}"
ext.projectScmConnection = "scm:git:git://github.com/transferwise/${projectGitHubRepoName}.git"
repositories {
mavenCentral()
mavenLocal()
}
idea.project {
vcs = 'Git'
languageLevel = JavaVersion.VERSION_11
targetBytecodeVersion = JavaVersion.VERSION_11
}
java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
withSourcesJar()
withJavadocJar()
}
tasks.withType(Jar).configureEach {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
tasks.withType(Javadoc).configureEach {
options.addStringOption('Xdoclint:none', '-quiet')
}
def grpcVersion = '1.54.1'
def protobufVersion = '3.21.12'
def protocVersion = protobufVersion
dependencies {
implementation "io.grpc:grpc-protobuf:${grpcVersion}"
implementation "io.grpc:grpc-stub:${grpcVersion}"
implementation 'javax.annotation:javax.annotation-api:1.3.2'
runtimeOnly "io.grpc:grpc-netty-shaded:${grpcVersion}"
}
protobuf {
protoc { artifact = "com.google.protobuf:protoc:${protocVersion}" }
plugins {
grpc { artifact = "io.grpc:protoc-gen-grpc-java:${grpcVersion}" }
}
generateProtoTasks {
all()*.plugins { grpc {} }
}
}
sourceSets {
main {
java {
srcDirs 'build/generated/source/proto/main/grpc'
srcDirs 'build/generated/source/proto/main/java'
}
}
}
jar {
manifest {
attributes(
"Implementation-Title": projectName,
"Implementation-Version": archiveVersion
)
}
}
apply plugin: "maven-publish"
apply plugin: "signing"
ext.artifactoryUser = project.hasProperty("artifactoryUser") ? project.artifactoryUser : System.env.ARTIFACTORY_USER as String
ext.artifactoryPassword = project.hasProperty("artifactoryPassword") ? project.artifactoryPassword : System.env.ARTIFACTORY_PASSWORD as String
nexusPublishing {
repositories {
sonatype {
username = System.getenv("SONATYPE_USER")
password = System.getenv("SONATYPE_PASSWORD")
}
}
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
afterEvaluate {
artifactId = projectArtifactName
}
pom {
name = projectName
description = projectDescription
url = projectScmUrl
packaging = "jar"
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id = 'JonathanO'
name = 'Jonathan Oddy'
email = "jonathan.oddy@transferwise.com"
organization = "Transferwise Ltd"
organizationUrl = "https://github.com/transferwise"
}
}
scm {
connection = projectScmConnection
developerConnection = projectScmConnection
url = projectScmUrl
}
}
}
}
if (System.getenv("OSS_SIGNING_KEY")) {
signing {
useInMemoryPgpKeys(System.getenv("OSS_SIGNING_KEY"), System.getenv("OSS_SIGNING_PASSWORD"))
sign publishing.publications.mavenJava
}
}
repositories {
maven {
url System.getenv("MAVEN_URL")
credentials {
username = System.getenv("MAVEN_USER")
password = System.getenv("MAVEN_PASSWORD")
}
}
}
}
task tagRelease {
doLast {
try {
grgit.tag.add {
name = "v$version"
message = "Release of ${version}"
}
grgit.push(refsOrSpecs: ["v$version"])
}
catch (RefAlreadyExistsException ignored) {
logger.warn("Tag v$version already exists.")
}
}
}