-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathbuild.gradle
More file actions
157 lines (131 loc) · 4.52 KB
/
build.gradle
File metadata and controls
157 lines (131 loc) · 4.52 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
plugins {
id "java-library"
id "maven-publish"
id "signing"
id "io.github.gradle-nexus.publish-plugin" version "2.0.0"
id "com.google.protobuf" version "0.9.5"
}
repositories {
// The Google mirror is less flaky than mavenCentral()
maven { url "https://maven-central.storage-download.googleapis.com/maven2/" }
mavenCentral()
mavenLocal()
}
group = "com.authzed.api"
version = findProperty("release") ?: "0.0.0-SNAPSHOT"
nexusPublishing {
repositories {
sonatype {
// Docs here:
// https://github.com/gradle-nexus/publish-plugin?tab=readme-ov-file#publishing-to-maven-central-via-sonatype-central
nexusUrl.set(uri("https://ossrh-staging-api.central.sonatype.com/service/local/"))
snapshotRepositoryUrl.set(uri("https://central.sonatype.com/repository/maven-snapshots/"))
}}}
publishing {
publications { authzed(MavenPublication) {
from components.java
pom {
name = "authzed"
description = "Authzed client library for Java"
url = "https://github.com/authzed/authzed-java"
licenses { license {
name = "The Apache License, Version 2.0"
url = "http://www.apache.org/licenses/LICENSE-2.0.txt"
}}
developers { developer {
id = "jzelinskie"
name = "Jimmy Zelinskie"
email = "jimmy@authzed.com"
}}
scm {
connection = "scm:git:git://github.com/authzed/authzed-java.git"
developerConnection = "scm:git:ssh://github.com:authzed/authzed-java.git"
url = "https://github.com/authzed/authzed-java/tree/master"
}
}
}}
repositories { maven {
def releasesRepoUrl = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
def snapshotsRepoUrl = "https://s01.oss.sonatype.org/content/repositories/snapshots/"
def ossrhUsername = findProperty("sonatypeUsername")
def ossrhPassword = findProperty("sonatypePassword")
name = "authzed"
url = project.hasProperty("release") ? releasesRepoUrl : snapshotsRepoUrl
}}
}
signing {
def signingKey = findProperty("signingKey")
def signingPassword = findProperty("signingPassword")
useInMemoryPgpKeys(signingKey, signingPassword)
sign publishing.publications.authzed
}
java {
withJavadocJar()
withSourcesJar()
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
tasks.sourcesJar {
// This is necessary to keep gradle from barking at you
// about an implicit dependency between these two tasks.
dependsOn tasks.compileJava
}
// All it does is complain about generated code.
javadoc { options.addStringOption('Xdoclint:none', '-quiet') }
def grpcVersion = "1.75.0"
def protocVersion = "4.32.0"
def authzedProtoCommit = "v1.45.4"
def bufDir = "${buildDir}/buf"
def protocPlatformTag = project.findProperty('protoc_platform') ? ":${protoc_platform}" : ""
sourceSets { main {
proto { srcDir bufDir }
java { srcDir "$buildDir/generated" }
java { srcDir "$buildDir/src" }
}}
dependencies {
implementation("io.grpc:grpc-protobuf:${grpcVersion}") {
exclude group: 'com.google.protobuf', module: 'protobuf-java'
}
api "com.google.protobuf:protobuf-java:${protocVersion}"
implementation "io.grpc:grpc-stub:${grpcVersion}"
runtimeOnly "io.grpc:grpc-netty-shaded:${grpcVersion}"
compileOnly "org.apache.tomcat:annotations-api:6.0.53"
}
task authzedProtos(type: Exec) {
commandLine("buf", "export", "buf.build/authzed/api:${authzedProtoCommit}", "-o", bufDir)
}
protobuf {
protoc { artifact = "com.google.protobuf:protoc:${protocVersion}${protocPlatformTag}" }
plugins { grpc { artifact = "io.grpc:protoc-gen-grpc-java:${grpcVersion}${protocPlatformTag}" } }
generateProtoTasks {
ofSourceSet("main").each { task -> task.dependsOn authzedProtos }
all()*.plugins { grpc {} }
}
}
tasks.named("jar") { manifest {
attributes("Implementation-Title": project.name,
"Implementation-Version": project.version)
}}
sourceSets {
intTest {
compileClasspath += sourceSets.main.output
runtimeClasspath += sourceSets.main.output
}
}
configurations {
intTestImplementation.extendsFrom implementation
intTestRuntimeOnly.extendsFrom runtimeOnly
}
// Test things
dependencies {
intTestImplementation "junit:junit:4.13.2"
intTestImplementation "org.assertj:assertj-core:3.27.4"
}
tasks.register('integrationTest', Test) {
useJUnit()
description = 'Runs integration tests.'
group = 'verification'
testClassesDirs = sourceSets.intTest.output.classesDirs
classpath = sourceSets.intTest.runtimeClasspath
shouldRunAfter test
}