Skip to content

Commit a621d63

Browse files
authored
Merge pull request #9 from microsoftgraph/feature/gradle-upgrade
- upgrades gradle from 4.5 to 6.6
2 parents 93113bd + 93535bb commit a621d63

File tree

7 files changed

+119
-179
lines changed

7 files changed

+119
-179
lines changed

build.gradle

Lines changed: 59 additions & 124 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +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'
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+
}
1617

1718
// In this section you declare where to find the dependencies of your project
1819
repositories {
@@ -23,21 +24,18 @@ repositories {
2324
}
2425

2526
dependencies {
26-
// This dependency is exported to consumers, that is to say found on their compile classpath.
27-
api 'org.apache.commons:commons-math3:3.6.1'
28-
2927
// This dependency is used internally, and not exposed to consumers on their own compile classpath.
3028
implementation 'com.google.guava:guava:20.0'
3129

3230
// Use JUnit test framework
3331
testImplementation 'junit:junit:4.13'
3432

35-
compile 'com.google.code.gson:gson:2.8.6'
33+
implementation 'com.google.code.gson:gson:2.8.6'
3634

37-
compile 'com.sun.jersey:jersey-server:1.19.4'
35+
implementation 'com.sun.jersey:jersey-server:1.19.4'
3836

3937
// Core Http library
40-
compile('com.microsoft.graph:microsoft-graph-core:1.0.1')
38+
implementation 'com.microsoft.graph:microsoft-graph-core:1.0.1'
4139
}
4240

4341
def pomConfig = {
@@ -54,23 +52,33 @@ def pomConfig = {
5452
//Maven Central Snapshot: publishSnapshotPublicationToMavenRepository
5553
//Maven Central Release: publishMavenCentralReleasePublicationToMaven2Repository
5654
//Bintray Snapshot: publishSnapshotPublicationToMaven3Repository
57-
//Bintray Release: uploadArchives
5855

59-
publishing {
56+
task sourceJar(type: Jar) {
57+
from sourceSets.main.allJava
58+
archiveClassifier = 'sources'
59+
}
6060

61-
publications {
61+
task javadocJar(type: Jar, dependsOn: javadoc) {
62+
from javadoc.destinationDir
63+
archiveClassifier = 'javadoc'
64+
}
6265

63-
maven(MavenPublication) {
66+
signing {
67+
sign configurations.archives
68+
}
69+
tasks.withType(Sign)*.enabled = mavenCentralPublishingEnabled.toBoolean()
6470

65-
groupId 'com.microsoft.graph'
71+
publishing {
6672

67-
artifactId 'microsoft-graph-beta'
73+
publications {
6874

75+
maven(MavenPublication) {
76+
groupId project.property('mavenGroupId')
77+
artifactId project.property('mavenArtifactId')
6978
version "${mavenMajorVersion}.${mavenMinorVersion}.${mavenPatchVersion}${mavenArtifactSuffix}"
70-
7179
from components.java
72-
7380
artifact sourceJar
81+
artifact javadocJar
7482
pom.withXml {
7583
def root = asNode()
7684
root.appendNode('name', 'Microsoft Graph Beta SDK for Java')
@@ -83,26 +91,22 @@ publishing {
8391
}
8492
Snapshot(MavenPublication) {
8593
customizePom(pom)
86-
groupId 'com.microsoft.graph'
87-
artifactId 'microsoft-graph-beta'
94+
groupId project.property('mavenGroupId')
95+
artifactId project.property('mavenArtifactId')
8896
version "${mavenMajorVersion}.${mavenMinorVersion}.${mavenPatchVersion}${mavenCentralSnapshotArtifactSuffix}"
8997
from components.java
9098
pom.withXml {
9199
def pomFile = file("${project.buildDir}/generated-pom.xml")
92100
writeTo(pomFile)
93101
}
94-
artifact(sourceJar) {
95-
classifier = 'sources'
96-
}
97-
artifact(javadocJar) {
98-
classifier = 'javadoc'
99-
}
102+
artifact sourceJar
103+
artifact javadocJar
100104
}
101105

102106
mavenCentralRelease(MavenPublication) {
103107
customizePom(pom)
104-
groupId 'com.microsoft.graph'
105-
artifactId 'microsoft-graph-beta'
108+
groupId project.property('mavenGroupId')
109+
artifactId project.property('mavenArtifactId')
106110
version "${mavenMajorVersion}.${mavenMinorVersion}.${mavenPatchVersion}"
107111
from components.java
108112
pom.withXml {
@@ -114,12 +118,8 @@ publishing {
114118
extension = 'pom.asc'
115119
}
116120
}
117-
artifact(sourceJar) {
118-
classifier = 'sources'
119-
}
120-
artifact(javadocJar) {
121-
classifier = 'javadoc'
122-
}
121+
artifact sourceJar
122+
artifact javadocJar
123123
project.tasks.signArchives.signatureFiles.each {
124124
artifact(it) {
125125
def matcher = it.file =~ /-(sources|javadoc)\.jar\.asc$/
@@ -136,67 +136,64 @@ publishing {
136136
}
137137
repositories {
138138
maven {
139-
url = project.property('mavenCentralSnapshotUrl')
139+
url = 'https://oss.sonatype.org/content/repositories/snapshots'
140+
name = 'sonatypeSnapshot'
140141

141142
credentials {
142143
if (project.rootProject.file('local.properties').exists()) {
143-
144144
Properties properties = new Properties()
145-
146145
properties.load(project.rootProject.file('local.properties').newDataInputStream())
147-
148146
username = properties.getProperty('sonatypeUsername')
149-
150147
password = properties.getProperty('sonatypePassword')
151-
152148
}
153149
}
154150
}
155151

156152
maven {
157-
url = project.property('mavenCentralReleaseUrl')
153+
url = 'https://oss.sonatype.org/service/local/staging/deploy/maven2'
154+
name = 'sonatype'
158155

159156
credentials {
160157
if (project.rootProject.file('local.properties').exists()) {
161-
162158
Properties properties = new Properties()
163-
164159
properties.load(project.rootProject.file('local.properties').newDataInputStream())
165-
166160
username = properties.getProperty('sonatypeUsername')
167-
168161
password = properties.getProperty('sonatypePassword')
169-
170162
}
171163
}
172164
}
173165

174166
maven {
175-
url = project.property('mavenBintraySnapshotUrl')
167+
url = 'http://oss.jfrog.org/artifactory/oss-snapshot-local'
168+
name = 'jfrogSnapshot'
176169

177170
credentials {
178171
if (project.rootProject.file('local.properties').exists()) {
179-
180172
Properties properties = new Properties()
181-
182173
properties.load(project.rootProject.file('local.properties').newDataInputStream())
183-
184174
username = (properties.containsKey('bintray.user')) ? properties.getProperty('bintray.user').toLowerCase() : "BINTRAY_USERNAME"
185-
186175
password = properties.getProperty('bintray.apikey')
176+
}
177+
}
178+
}
187179

180+
maven {
181+
url = 'https://oss.jfrog.org/artifactory/libs-release'
182+
name = 'jfrog'
183+
184+
credentials {
185+
if (project.rootProject.file('local.properties').exists()) {
186+
Properties properties = new Properties()
187+
properties.load(project.rootProject.file('local.properties').newDataInputStream())
188+
username = (properties.containsKey('bintray.user')) ? properties.getProperty('bintray.user').toLowerCase() : "BINTRAY_USERNAME"
189+
password = properties.getProperty('bintray.apikey')
188190
}
189191
}
190192
}
191193
}
192194

193195
}
194196

195-
task sourceJar(type: Jar) {
196-
classifier = 'sources'
197-
from sourceSets.main.allJava
198-
}
199-
200197
compileJava {
201198
sourceCompatibility = 1.8
202199
targetCompatibility = 1.8
@@ -210,74 +207,12 @@ def getVersionName() {
210207
return "${mavenMajorVersion}.${mavenMinorVersion}.${mavenPatchVersion}${mavenArtifactSuffix}"
211208
}
212209

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

276-
signing {
277-
sign configurations.archives
278-
}
279-
tasks.withType(Sign)*.enabled = mavenCentralPublishingEnabled.toBoolean()
280-
281216
def customizePom(pom) {
282217
pom.withXml {
283218
def root = asNode()
@@ -339,7 +274,7 @@ model {
339274
tasks.publishMavenCentralReleasePublicationToMavenLocal {
340275
dependsOn project.tasks.signArchives
341276
}
342-
tasks.publishMavenCentralReleasePublicationToMaven2Repository {
277+
tasks.publishMavenCentralReleasePublicationToSonatypeRepository {
343278
dependsOn project.tasks.signArchives
344279
}
345280
}

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-beta
25-
mavenBintraySnapshotUrl = http://oss.jfrog.org/artifactory/oss-snapshot-local
2624
mavenGroupId = com.microsoft.graph
2725
mavenArtifactId = microsoft-graph-beta
2826
mavenMajorVersion = 0
@@ -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.76 KB
Binary file not shown.
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
#Thu Dec 07 16:02:17 AEDT 2017
21
distributionBase=GRADLE_USER_HOME
32
distributionPath=wrapper/dists
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-6.6-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-4.5.1-bin.zip

0 commit comments

Comments
 (0)