Skip to content

Commit 8c480ee

Browse files
authored
Merge pull request #56 from microsoftgraph/feature/gradle-upgrade
- upgrades gradle from 4.5 to 6.6
2 parents 883c420 + c8298b5 commit 8c480ee

File tree

8 files changed

+142
-180
lines changed

8 files changed

+142
-180
lines changed

build.gradle

Lines changed: 70 additions & 119 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
/*
2-
* This build file was generated by the Gradle 'init' task.
2+
* This file was generated by the Gradle 'init' task.
33
*
44
* This generated file contains a sample Java Library project to get you started.
55
* For more details take a look at the Java Libraries chapter in the Gradle
6-
* user guide available at https://docs.gradle.org/4.5/userguide/java_library_plugin.html
6+
* User Manual available at https://docs.gradle.org/6.6/userguide/java_library_plugin.html
77
*/
88

9-
// Apply the java-library plugin to add support for Java Library
10-
apply plugin: 'java-library'
11-
apply plugin: 'java'
12-
apply plugin: 'eclipse'
13-
apply plugin: 'maven'
14-
apply plugin: 'maven-publish'
15-
apply plugin: 'signing'
16-
apply plugin: 'jacoco'
9+
plugins {
10+
// Apply the java-library plugin to add support for Java Library
11+
id 'java-library'
12+
id 'java'
13+
id 'eclipse'
14+
id 'maven-publish'
15+
id 'signing'
16+
}
1717

1818
// In this section you declare where to find the dependencies of your project
1919
repositories {
@@ -30,7 +30,7 @@ dependencies {
3030
api 'com.squareup.okhttp3:okhttp:3.12.1'
3131

3232
// https://mvnrepository.com/artifact/com.googlecode.json-simple/json-simple
33-
compile group: 'com.googlecode.json-simple', name: 'json-simple', version: '1.1.1'
33+
implementation group: 'com.googlecode.json-simple', name: 'json-simple', version: '1.1.1'
3434
}
3535

3636
def pomConfig = {
@@ -47,23 +47,33 @@ def pomConfig = {
4747
//Maven Central Snapshot: publishSnapshotPublicationToMavenRepository
4848
//Maven Central Release: publishMavenCentralReleasePublicationToMaven2Repository
4949
//Bintray Snapshot: publishSnapshotPublicationToMaven3Repository
50-
//Bintray Release: uploadArchives
5150

52-
publishing {
51+
task sourceJar(type: Jar) {
52+
from sourceSets.main.allJava
53+
archiveClassifier = 'sources'
54+
}
5355

54-
publications {
56+
task javadocJar(type: Jar, dependsOn: javadoc) {
57+
from javadoc.destinationDir
58+
archiveClassifier = 'javadoc'
59+
}
5560

56-
maven(MavenPublication) {
61+
signing {
62+
sign configurations.archives
63+
}
64+
tasks.withType(Sign)*.enabled = mavenCentralPublishingEnabled.toBoolean()
5765

58-
groupId 'com.microsoft.graph'
66+
publishing {
5967

60-
artifactId 'microsoft-graph-core'
68+
publications {
6169

70+
maven(MavenPublication) {
71+
groupId project.property('mavenGroupId')
72+
artifactId project.property('mavenArtifactId')
6273
version "${mavenMajorVersion}.${mavenMinorVersion}.${mavenPatchVersion}${mavenArtifactSuffix}"
63-
6474
from components.java
65-
6675
artifact sourceJar
76+
artifact javadocJar
6777
pom.withXml {
6878
def root = asNode()
6979
root.appendNode('name', 'Microsoft Graph Core SDK for Java')
@@ -76,26 +86,22 @@ publishing {
7686
}
7787
Snapshot(MavenPublication) {
7888
customizePom(pom)
79-
groupId 'com.microsoft.graph'
80-
artifactId 'microsoft-graph-core'
89+
groupId project.property('mavenGroupId')
90+
artifactId project.property('mavenArtifactId')
8191
version "${mavenMajorVersion}.${mavenMinorVersion}.${mavenPatchVersion}${mavenCentralSnapshotArtifactSuffix}"
8292
from components.java
8393
pom.withXml {
8494
def pomFile = file("${project.buildDir}/generated-pom.xml")
8595
writeTo(pomFile)
8696
}
87-
artifact(sourceJar) {
88-
classifier = 'sources'
89-
}
90-
artifact(javadocJar) {
91-
classifier = 'javadoc'
92-
}
97+
artifact sourceJar
98+
artifact javadocJar
9399
}
94100

95101
mavenCentralRelease(MavenPublication) {
96102
customizePom(pom)
97-
groupId 'com.microsoft.graph'
98-
artifactId 'microsoft-graph-core'
103+
groupId project.property('mavenGroupId')
104+
artifactId project.property('mavenArtifactId')
99105
version "${mavenMajorVersion}.${mavenMinorVersion}.${mavenPatchVersion}"
100106
from components.java
101107
pom.withXml {
@@ -107,12 +113,8 @@ publishing {
107113
extension = 'pom.asc'
108114
}
109115
}
110-
artifact(sourceJar) {
111-
classifier = 'sources'
112-
}
113-
artifact(javadocJar) {
114-
classifier = 'javadoc'
115-
}
116+
artifact sourceJar
117+
artifact javadocJar
116118
project.tasks.signArchives.signatureFiles.each {
117119
artifact(it) {
118120
def matcher = it.file =~ /-(sources|javadoc)\.jar\.asc$/
@@ -129,67 +131,78 @@ publishing {
129131
}
130132
repositories {
131133
maven {
132-
url = project.property('mavenCentralSnapshotUrl')
134+
url = 'https://oss.sonatype.org/content/repositories/snapshots'
135+
name = 'sonatypeSnapshot'
133136

134137
credentials {
135138
if (project.rootProject.file('local.properties').exists()) {
136-
137139
Properties properties = new Properties()
138-
139140
properties.load(project.rootProject.file('local.properties').newDataInputStream())
140-
141141
username = properties.getProperty('sonatypeUsername')
142-
143142
password = properties.getProperty('sonatypePassword')
144-
145143
}
146144
}
147145
}
148146

149147
maven {
150-
url = project.property('mavenCentralReleaseUrl')
148+
url = 'https://oss.sonatype.org/service/local/staging/deploy/maven2'
149+
name = 'sonatype'
151150

152151
credentials {
153152
if (project.rootProject.file('local.properties').exists()) {
154-
155153
Properties properties = new Properties()
156-
157154
properties.load(project.rootProject.file('local.properties').newDataInputStream())
158-
159155
username = properties.getProperty('sonatypeUsername')
160-
161156
password = properties.getProperty('sonatypePassword')
162-
163157
}
164158
}
165159
}
166160

167161
maven {
168-
url = project.property('mavenBintraySnapshotUrl')
162+
url = 'http://oss.jfrog.org/artifactory/oss-snapshot-local'
163+
name = 'jfrogSnapshot'
169164

170165
credentials {
171166
if (project.rootProject.file('local.properties').exists()) {
172-
173167
Properties properties = new Properties()
174-
175168
properties.load(project.rootProject.file('local.properties').newDataInputStream())
176-
177169
username = (properties.containsKey('bintray.user')) ? properties.getProperty('bintray.user').toLowerCase() : "BINTRAY_USERNAME"
170+
password = properties.getProperty('bintray.apikey')
171+
}
172+
}
173+
}
178174

175+
maven {
176+
url = 'https://oss.jfrog.org/artifactory/libs-release'
177+
name = 'jfrog'
178+
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"
179184
password = properties.getProperty('bintray.apikey')
185+
}
186+
}
187+
}
180188

189+
maven {
190+
url = 'https://api.bintray.com/content/microsoftgraph/Maven/microsoft-graph-core'
191+
name = 'bintray'
192+
193+
credentials {
194+
if (project.rootProject.file('local.properties').exists()) {
195+
Properties properties = new Properties()
196+
properties.load(project.rootProject.file('local.properties').newDataInputStream())
197+
username = (properties.containsKey('bintray.user')) ? properties.getProperty('bintray.user').toLowerCase() : "BINTRAY_USERNAME"
198+
password = properties.getProperty('bintray.apikey')
181199
}
182200
}
183201
}
184202
}
185203

186204
}
187205

188-
task sourceJar(type: Jar) {
189-
classifier = 'sources'
190-
from sourceSets.main.allJava
191-
}
192-
193206
compileJava {
194207
sourceCompatibility = 1.7
195208
targetCompatibility = 1.7
@@ -203,74 +216,12 @@ def getVersionName() {
203216
return "${mavenMajorVersion}.${mavenMinorVersion}.${mavenPatchVersion}${mavenArtifactSuffix}"
204217
}
205218

206-
uploadArchives {
207-
208-
def bintrayUsername = ""
209-
210-
def bintrayApikey = ""
211-
212-
if (project.rootProject.file('local.properties').exists()) {
213-
214-
Properties properties = new Properties()
215-
216-
properties.load(project.rootProject.file('local.properties').newDataInputStream())
217-
218-
bintrayUsername = properties.getProperty('bintray.user')
219-
220-
bintrayApikey = properties.getProperty('bintray.apikey')
221-
222-
}
223-
224-
configuration = configurations.archives
225-
226-
repositories.mavenDeployer {
227-
228-
pom {
229-
230-
setGroupId project.mavenGroupId
231-
232-
setArtifactId project.mavenArtifactId
233-
234-
setVersion getVersionName()
235-
236-
}
237-
238-
repository (url: project.mavenRepoUrl) {
239-
240-
url = url + "/" + getVersionName()
241-
242-
authentication(
243-
244-
// put these values in local file ~/.gradle/gradle.properties
245-
246-
userName: project.hasProperty("bintrayUsername") ? project.bintrayUsername : bintrayUsername,
247-
248-
password: project.hasProperty("bintrayApikey") ? project.bintrayApikey : bintrayApikey
249-
250-
)
251-
252-
}
253-
254-
}
255-
256-
}
257-
258-
task javadocJar(type: Jar, dependsOn: javadoc) {
259-
classifier = 'javadoc'
260-
from javadoc.destinationDir
261-
}
262-
263219
artifacts {
264220
archives jar
265221
archives sourceJar
266222
archives javadocJar
267223
}
268224

269-
signing {
270-
sign configurations.archives
271-
}
272-
tasks.withType(Sign)*.enabled = mavenCentralPublishingEnabled.toBoolean()
273-
274225
def customizePom(pom) {
275226
pom.withXml {
276227
def root = asNode()
@@ -332,7 +283,7 @@ model {
332283
tasks.publishMavenCentralReleasePublicationToMavenLocal {
333284
dependsOn project.tasks.signArchives
334285
}
335-
tasks.publishMavenCentralReleasePublicationToMaven2Repository {
286+
tasks.publishMavenCentralReleasePublicationToSonatypeRepository {
336287
dependsOn project.tasks.signArchives
337288
}
338289
}

gradle.properties

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@
2121
## linux requires 10G, OSX requires 11G
2222
org.gradle.jvmargs=-XX:MaxPermSize=512m -Xmx2g
2323

24-
mavenRepoUrl = https://api.bintray.com/content/microsoftgraph/Maven/microsoft-graph-core
25-
mavenBintraySnapshotUrl = http://oss.jfrog.org/artifactory/oss-snapshot-local
2624
mavenGroupId = com.microsoft.graph
2725
mavenArtifactId = microsoft-graph-core
2826
mavenMajorVersion = 1
@@ -40,7 +38,5 @@ Username="USERNAME"
4038
Password="PASSWORD"
4139

4240
#enable mavenCentralPublishingEnabled to publish to maven central
43-
mavenCentralSnapshotUrl=https://oss.sonatype.org/content/repositories/snapshots
44-
mavenCentralReleaseUrl=https://oss.sonatype.org/service/local/staging/deploy/maven2
4541
mavenCentralSnapshotArtifactSuffix = -SNAPSHOT
4642
mavenCentralPublishingEnabled=false

gradle/wrapper/gradle-wrapper.jar

4.32 KB
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-6.6-bin.zip
34
zipStoreBase=GRADLE_USER_HOME
45
zipStorePath=wrapper/dists
5-
distributionUrl=https\://services.gradle.org/distributions/gradle-4.3-bin.zip

0 commit comments

Comments
 (0)