Skip to content

Commit 2542a63

Browse files
authored
Merge pull request #12 from microsoftgraph/bugfix/gradle-upgrade
- replaces gradle upgrade fixes from core
2 parents 4e32a90 + 17869d4 commit 2542a63

File tree

1 file changed

+46
-23
lines changed

1 file changed

+46
-23
lines changed

build.gradle

Lines changed: 46 additions & 23 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
@@ -63,11 +64,6 @@ task javadocJar(type: Jar, dependsOn: javadoc) {
6364
archiveClassifier = 'javadoc'
6465
}
6566

66-
signing {
67-
sign configurations.archives
68-
}
69-
tasks.withType(Sign)*.enabled = mavenCentralPublishingEnabled.toBoolean()
70-
7167
publishing {
7268

7369
publications {
@@ -112,26 +108,9 @@ publishing {
112108
pom.withXml {
113109
def pomFile = file("${project.buildDir}/generated-pom.xml")
114110
writeTo(pomFile)
115-
def pomAscFile = signing.sign(pomFile).signatureFiles[0]
116-
artifact(pomAscFile) {
117-
classifier = null
118-
extension = 'pom.asc'
119-
}
120111
}
121112
artifact sourceJar
122113
artifact javadocJar
123-
project.tasks.signArchives.signatureFiles.each {
124-
artifact(it) {
125-
def matcher = it.file =~ /-(sources|javadoc)\.jar\.asc$/
126-
if(matcher.find()){
127-
classifier = matcher.group(1)
128-
}
129-
else{
130-
classifier = null
131-
}
132-
extension = 'jar.asc'
133-
}
134-
}
135114
}
136115
}
137116
repositories {
@@ -191,7 +170,51 @@ publishing {
191170
}
192171
}
193172
}
173+
}
174+
175+
signing {
176+
sign publishing.publications.mavenCentralRelease
177+
}
178+
tasks.withType(Sign)*.enabled = mavenCentralPublishingEnabled.toBoolean()
194179

180+
def fixAscNames = { name ->
181+
if(name.contains('pom')) {
182+
"${project.property('mavenArtifactId')}-${mavenMajorVersion}.${mavenMinorVersion}.${mavenPatchVersion}.pom.asc"
183+
} else {
184+
name.replace('msgraph-beta-sdk-java', "${project.property('mavenArtifactId')}-${mavenMajorVersion}.${mavenMinorVersion}.${mavenPatchVersion}")
185+
}
186+
}
187+
bintray {
188+
if (project.rootProject.file('local.properties').exists()) {
189+
Properties properties = new Properties()
190+
properties.load(project.rootProject.file('local.properties').newDataInputStream())
191+
user = (properties.containsKey('bintray.user')) ? properties.getProperty('bintray.user').toLowerCase() : "BINTRAY_USERNAME"
192+
key = properties.getProperty('bintray.apikey')
193+
}
194+
publications = ['mavenCentralRelease']
195+
filesSpec {
196+
from ('build/libs') {
197+
include 'msgraph-beta-sdk-java*.jar.asc'
198+
rename fixAscNames
199+
}
200+
from ('build') {
201+
include 'generated-pom.xml.asc'
202+
rename fixAscNames
203+
}
204+
into "com/microsoft/graph/${project.property('mavenArtifactId')}/${mavenMajorVersion}.${mavenMinorVersion}.${mavenPatchVersion}/"
205+
}
206+
pkg {
207+
repo = 'Maven'
208+
name = project.property('mavenArtifactId')
209+
userOrg = 'microsoftgraph'
210+
licenses = ['MIT']
211+
vcsUrl = 'https://github.com/microsoftgraph/msgraph-beta-sdk-java.git'
212+
publicDownloadNumbers = true
213+
version {
214+
name = "${mavenMajorVersion}.${mavenMinorVersion}.${mavenPatchVersion}"
215+
vcsTag = "${mavenMajorVersion}.${mavenMinorVersion}.${mavenPatchVersion}"
216+
}
217+
}
195218
}
196219

197220
compileJava {
@@ -269,7 +292,7 @@ gradle.taskGraph.whenReady { taskGraph ->
269292

270293
model {
271294
tasks.generatePomFileForMavenCentralReleasePublication {
272-
destination = file("$buildDir/generated-pom.xml")
295+
destination = file("${project.buildDir}/generated-pom.xml")
273296
}
274297
tasks.publishMavenCentralReleasePublicationToMavenLocal {
275298
dependsOn project.tasks.signArchives

0 commit comments

Comments
 (0)