Skip to content

Commit 192144e

Browse files
committed
Add Sonatype OSSRH upload support, with nice POMs
Mockito was upgraded to latest to solve JavaDoc issue with ArgumentsAreDifferent. We don't yet publish any artifacts for grpc-compiler.
1 parent b938ba5 commit 192144e

2 files changed

Lines changed: 66 additions & 2 deletions

File tree

build.gradle

Lines changed: 62 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ subprojects {
44
apply plugin: "java"
55
apply plugin: "maven"
66
apply plugin: "idea"
7+
apply plugin: "signing"
78

89
group = "io.grpc"
910
version = "0.1.0-SNAPSHOT"
@@ -42,7 +43,7 @@ subprojects {
4243

4344
// Test dependencies.
4445
junit: 'junit:junit:4.11',
45-
mockito: 'org.mockito:mockito-core:1.10.8'
46+
mockito: 'org.mockito:mockito-core:1.10.19'
4647
]
4748

4849
// Determine the correct version of Jetty ALPN boot to use based
@@ -69,4 +70,64 @@ subprojects {
6970
testCompile libraries.junit,
7071
libraries.mockito
7172
}
73+
74+
signing {
75+
required false
76+
sign configurations.archives
77+
}
78+
79+
task javadocJar(type: Jar) {
80+
classifier = 'javadoc'
81+
from javadoc
82+
}
83+
84+
task sourcesJar(type: Jar) {
85+
classifier = 'sources'
86+
from sourceSets.main.allSource
87+
}
88+
89+
artifacts {
90+
archives javadocJar, sourcesJar
91+
}
92+
93+
uploadArchives.repositories.mavenDeployer {
94+
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
95+
96+
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
97+
if (rootProject.hasProperty("ossrhUsername")
98+
&& rootProject.hasProperty("ossrhPassword")) {
99+
authentication(userName: ossrhUsername, password: ossrhPassword)
100+
}
101+
}
102+
103+
snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
104+
if (rootProject.hasProperty("ossrhUsername")
105+
&& rootProject.hasProperty("ossrhPassword")) {
106+
authentication(userName: ossrhUsername, password: ossrhPassword)
107+
}
108+
}
109+
}
110+
111+
[
112+
install.repositories.mavenInstaller,
113+
uploadArchives.repositories.mavenDeployer,
114+
]*.pom*.whenConfigured { pom ->
115+
pom.project {
116+
description project.description
117+
url 'https://github.com/grpc/grpc-java'
118+
119+
scm {
120+
connection 'scm:svn:https://github.com/grpc/grpc-java.git'
121+
developerConnection 'scm:svn:[email protected]:grpc/grpc-java.git'
122+
url 'https://github.com/grpc/grpc-java'
123+
}
124+
125+
licenses {
126+
license {
127+
name 'BSD 3-Clause'
128+
url 'http://opensource.org/licenses/BSD-3-Clause'
129+
}
130+
}
131+
}
132+
}
72133
}

compiler/build.gradle

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,4 +78,7 @@ task testNanoGolden(type: Exec, dependsOn: 'java_pluginExecutable') {
7878
commandLine './src/test/run_nano_test.sh'
7979
}
8080

81-
81+
[
82+
install.repositories.mavenInstaller,
83+
uploadArchives.repositories.mavenDeployer,
84+
]*.addFilter('none') { artifact, file -> false }

0 commit comments

Comments
 (0)