Skip to content

Commit 341f017

Browse files
authored
Merge branch 'dev' into feature/readme-cleanup
2 parents b0795e1 + ca583b5 commit 341f017

File tree

2 files changed

+49
-44
lines changed

2 files changed

+49
-44
lines changed

.azure-pipelines/buildAndPackage.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ steps:
7777
SourceFolder: '$(System.DefaultWorkingDirectory)'
7878
Contents: |
7979
**/libs/*
80+
build/generated-pom.xml
81+
build/generated-pom.xml.asc
8082
build.gradle
8183
gradlew
8284
gradlew.bat

build.gradle

Lines changed: 47 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ plugins {
1313
id 'eclipse'
1414
id 'maven-publish'
1515
id 'signing'
16+
id 'com.jfrog.bintray' version '1.8.5'
1617
}
1718

1819
// In this section you declare where to find the dependencies of your project
@@ -58,11 +59,6 @@ task javadocJar(type: Jar, dependsOn: javadoc) {
5859
archiveClassifier = 'javadoc'
5960
}
6061

61-
signing {
62-
sign configurations.archives
63-
}
64-
tasks.withType(Sign)*.enabled = mavenCentralPublishingEnabled.toBoolean()
65-
6662
publishing {
6763

6864
publications {
@@ -107,26 +103,9 @@ publishing {
107103
pom.withXml {
108104
def pomFile = file("${project.buildDir}/generated-pom.xml")
109105
writeTo(pomFile)
110-
def pomAscFile = signing.sign(pomFile).signatureFiles[0]
111-
artifact(pomAscFile) {
112-
classifier = null
113-
extension = 'pom.asc'
114-
}
115106
}
116107
artifact sourceJar
117108
artifact javadocJar
118-
project.tasks.signArchives.signatureFiles.each {
119-
artifact(it) {
120-
def matcher = it.file =~ /-(sources|javadoc)\.jar\.asc$/
121-
if(matcher.find()){
122-
classifier = matcher.group(1)
123-
}
124-
else{
125-
classifier = null
126-
}
127-
extension = 'jar.asc'
128-
}
129-
}
130109
}
131110
}
132111
repositories {
@@ -147,7 +126,7 @@ publishing {
147126
maven {
148127
url = 'https://oss.sonatype.org/service/local/staging/deploy/maven2'
149128
name = 'sonatype'
150-
129+
151130
credentials {
152131
if (project.rootProject.file('local.properties').exists()) {
153132
Properties properties = new Properties()
@@ -176,20 +155,6 @@ publishing {
176155
url = 'https://oss.jfrog.org/artifactory/libs-release'
177156
name = 'jfrog'
178157

179-
credentials {
180-
if (project.rootProject.file('local.properties').exists()) {
181-
Properties properties = new Properties()
182-
properties.load(project.rootProject.file('local.properties').newDataInputStream())
183-
username = (properties.containsKey('bintray.user')) ? properties.getProperty('bintray.user').toLowerCase() : "BINTRAY_USERNAME"
184-
password = properties.getProperty('bintray.apikey')
185-
}
186-
}
187-
}
188-
189-
maven {
190-
url = 'https://api.bintray.com/content/microsoftgraph/Maven/microsoft-graph-core'
191-
name = 'bintray'
192-
193158
credentials {
194159
if (project.rootProject.file('local.properties').exists()) {
195160
Properties properties = new Properties()
@@ -200,7 +165,51 @@ publishing {
200165
}
201166
}
202167
}
168+
}
203169

170+
signing {
171+
sign publishing.publications.mavenCentralRelease
172+
}
173+
tasks.withType(Sign)*.enabled = mavenCentralPublishingEnabled.toBoolean()
174+
175+
def fixAscNames = { name ->
176+
if(name.contains('pom')) {
177+
"${project.property('mavenArtifactId')}-${mavenMajorVersion}.${mavenMinorVersion}.${mavenPatchVersion}.pom.asc"
178+
} else {
179+
name.replace('msgraph-sdk-java-core', "${project.property('mavenArtifactId')}-${mavenMajorVersion}.${mavenMinorVersion}.${mavenPatchVersion}")
180+
}
181+
}
182+
bintray {
183+
if (project.rootProject.file('local.properties').exists()) {
184+
Properties properties = new Properties()
185+
properties.load(project.rootProject.file('local.properties').newDataInputStream())
186+
user = (properties.containsKey('bintray.user')) ? properties.getProperty('bintray.user').toLowerCase() : "BINTRAY_USERNAME"
187+
key = properties.getProperty('bintray.apikey')
188+
}
189+
publications = ['mavenCentralRelease']
190+
filesSpec {
191+
from ('build/libs') {
192+
include 'msgraph-sdk-java-core*.jar.asc'
193+
rename fixAscNames
194+
}
195+
from ('build') {
196+
include 'generated-pom.xml.asc'
197+
rename fixAscNames
198+
}
199+
into "com/microsoft/graph/${project.property('mavenArtifactId')}/${mavenMajorVersion}.${mavenMinorVersion}.${mavenPatchVersion}/"
200+
}
201+
pkg {
202+
repo = 'Maven'
203+
name = project.property('mavenArtifactId')
204+
userOrg = 'microsoftgraph'
205+
licenses = ['MIT']
206+
vcsUrl = 'https://github.com/microsoftgraph/msgraph-sdk-java-core.git'
207+
publicDownloadNumbers = true
208+
version {
209+
name = "${mavenMajorVersion}.${mavenMinorVersion}.${mavenPatchVersion}"
210+
vcsTag = "${mavenMajorVersion}.${mavenMinorVersion}.${mavenPatchVersion}"
211+
}
212+
}
204213
}
205214

206215
compileJava {
@@ -278,12 +287,6 @@ gradle.taskGraph.whenReady { taskGraph ->
278287

279288
model {
280289
tasks.generatePomFileForMavenCentralReleasePublication {
281-
destination = file("$buildDir/generated-pom.xml")
282-
}
283-
tasks.publishMavenCentralReleasePublicationToMavenLocal {
284-
dependsOn project.tasks.signArchives
285-
}
286-
tasks.publishMavenCentralReleasePublicationToSonatypeRepository {
287-
dependsOn project.tasks.signArchives
290+
destination = file("${project.buildDir}/generated-pom.xml")
288291
}
289292
}

0 commit comments

Comments
 (0)