Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
183 changes: 59 additions & 124 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
/*
* This build file was generated by the Gradle 'init' task.
* This file was generated by the Gradle 'init' task.
*
* This generated file contains a sample Java Library project to get you started.
* For more details take a look at the Java Libraries chapter in the Gradle
* user guide available at https://docs.gradle.org/4.5/userguide/java_library_plugin.html
* User Manual available at https://docs.gradle.org/6.6/userguide/java_library_plugin.html
*/

// Apply the java-library plugin to add support for Java Library
apply plugin: 'java-library'
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'maven'
apply plugin: 'maven-publish'
apply plugin: 'signing'
plugins {
// Apply the java-library plugin to add support for Java Library
id 'java-library'
id 'java'
id 'eclipse'
id 'maven-publish'
id 'signing'
}

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

dependencies {
// This dependency is exported to consumers, that is to say found on their compile classpath.
api 'org.apache.commons:commons-math3:3.6.1'

// This dependency is used internally, and not exposed to consumers on their own compile classpath.
implementation 'com.google.guava:guava:20.0'

// Use JUnit test framework
testImplementation 'junit:junit:4.13'

compile 'com.google.code.gson:gson:2.8.6'
implementation 'com.google.code.gson:gson:2.8.6'

compile 'com.sun.jersey:jersey-server:1.19.4'
implementation 'com.sun.jersey:jersey-server:1.19.4'

// Core Http library
compile('com.microsoft.graph:microsoft-graph-core:1.0.1')
implementation 'com.microsoft.graph:microsoft-graph-core:1.0.1'
}

def pomConfig = {
Expand All @@ -54,23 +52,33 @@ def pomConfig = {
//Maven Central Snapshot: publishSnapshotPublicationToMavenRepository
//Maven Central Release: publishMavenCentralReleasePublicationToMaven2Repository
//Bintray Snapshot: publishSnapshotPublicationToMaven3Repository
//Bintray Release: uploadArchives

publishing {
task sourceJar(type: Jar) {
from sourceSets.main.allJava
archiveClassifier = 'sources'
}

publications {
task javadocJar(type: Jar, dependsOn: javadoc) {
from javadoc.destinationDir
archiveClassifier = 'javadoc'
}

maven(MavenPublication) {
signing {
sign configurations.archives
}
tasks.withType(Sign)*.enabled = mavenCentralPublishingEnabled.toBoolean()

groupId 'com.microsoft.graph'
publishing {

artifactId 'microsoft-graph-beta'
publications {

maven(MavenPublication) {
groupId project.property('mavenGroupId')
artifactId project.property('mavenArtifactId')
version "${mavenMajorVersion}.${mavenMinorVersion}.${mavenPatchVersion}${mavenArtifactSuffix}"

from components.java

artifact sourceJar
artifact javadocJar
pom.withXml {
def root = asNode()
root.appendNode('name', 'Microsoft Graph Beta SDK for Java')
Expand All @@ -83,26 +91,22 @@ publishing {
}
Snapshot(MavenPublication) {
customizePom(pom)
groupId 'com.microsoft.graph'
artifactId 'microsoft-graph-beta'
groupId project.property('mavenGroupId')
artifactId project.property('mavenArtifactId')
version "${mavenMajorVersion}.${mavenMinorVersion}.${mavenPatchVersion}${mavenCentralSnapshotArtifactSuffix}"
from components.java
pom.withXml {
def pomFile = file("${project.buildDir}/generated-pom.xml")
writeTo(pomFile)
}
artifact(sourceJar) {
classifier = 'sources'
}
artifact(javadocJar) {
classifier = 'javadoc'
}
artifact sourceJar
artifact javadocJar
}

mavenCentralRelease(MavenPublication) {
customizePom(pom)
groupId 'com.microsoft.graph'
artifactId 'microsoft-graph-beta'
groupId project.property('mavenGroupId')
artifactId project.property('mavenArtifactId')
version "${mavenMajorVersion}.${mavenMinorVersion}.${mavenPatchVersion}"
from components.java
pom.withXml {
Expand All @@ -114,12 +118,8 @@ publishing {
extension = 'pom.asc'
}
}
artifact(sourceJar) {
classifier = 'sources'
}
artifact(javadocJar) {
classifier = 'javadoc'
}
artifact sourceJar
artifact javadocJar
project.tasks.signArchives.signatureFiles.each {
artifact(it) {
def matcher = it.file =~ /-(sources|javadoc)\.jar\.asc$/
Expand All @@ -136,67 +136,64 @@ publishing {
}
repositories {
maven {
url = project.property('mavenCentralSnapshotUrl')
url = 'https://oss.sonatype.org/content/repositories/snapshots'
name = 'sonatypeSnapshot'

credentials {
if (project.rootProject.file('local.properties').exists()) {

Properties properties = new Properties()

properties.load(project.rootProject.file('local.properties').newDataInputStream())

username = properties.getProperty('sonatypeUsername')

password = properties.getProperty('sonatypePassword')

}
}
}

maven {
url = project.property('mavenCentralReleaseUrl')
url = 'https://oss.sonatype.org/service/local/staging/deploy/maven2'
name = 'sonatype'

credentials {
if (project.rootProject.file('local.properties').exists()) {

Properties properties = new Properties()

properties.load(project.rootProject.file('local.properties').newDataInputStream())

username = properties.getProperty('sonatypeUsername')

password = properties.getProperty('sonatypePassword')

}
}
}

maven {
url = project.property('mavenBintraySnapshotUrl')
url = 'http://oss.jfrog.org/artifactory/oss-snapshot-local'
name = 'jfrogSnapshot'

credentials {
if (project.rootProject.file('local.properties').exists()) {

Properties properties = new Properties()

properties.load(project.rootProject.file('local.properties').newDataInputStream())

username = (properties.containsKey('bintray.user')) ? properties.getProperty('bintray.user').toLowerCase() : "BINTRAY_USERNAME"

password = properties.getProperty('bintray.apikey')
}
}
}

maven {
url = 'https://oss.jfrog.org/artifactory/libs-release'
name = 'jfrog'

credentials {
if (project.rootProject.file('local.properties').exists()) {
Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())
username = (properties.containsKey('bintray.user')) ? properties.getProperty('bintray.user').toLowerCase() : "BINTRAY_USERNAME"
password = properties.getProperty('bintray.apikey')
}
}
}
}

}

task sourceJar(type: Jar) {
classifier = 'sources'
from sourceSets.main.allJava
}

compileJava {
sourceCompatibility = 1.8
targetCompatibility = 1.8
Expand All @@ -210,74 +207,12 @@ def getVersionName() {
return "${mavenMajorVersion}.${mavenMinorVersion}.${mavenPatchVersion}${mavenArtifactSuffix}"
}

uploadArchives {

def bintrayUsername = ""

def bintrayApikey = ""

if (project.rootProject.file('local.properties').exists()) {

Properties properties = new Properties()

properties.load(project.rootProject.file('local.properties').newDataInputStream())

bintrayUsername = properties.getProperty('bintray.user')

bintrayApikey = properties.getProperty('bintray.apikey')

}

configuration = configurations.archives

repositories.mavenDeployer {

pom {

setGroupId project.mavenGroupId

setArtifactId project.mavenArtifactId

setVersion getVersionName()

}

repository (url: project.mavenRepoUrl) {

url = url + "/" + getVersionName()

authentication(

// put these values in local file ~/.gradle/gradle.properties

userName: project.hasProperty("bintrayUsername") ? project.bintrayUsername : bintrayUsername,

password: project.hasProperty("bintrayApikey") ? project.bintrayApikey : bintrayApikey

)

}

}

}

task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}

artifacts {
archives jar
archives sourceJar
archives javadocJar
}

signing {
sign configurations.archives
}
tasks.withType(Sign)*.enabled = mavenCentralPublishingEnabled.toBoolean()

def customizePom(pom) {
pom.withXml {
def root = asNode()
Expand Down Expand Up @@ -339,7 +274,7 @@ model {
tasks.publishMavenCentralReleasePublicationToMavenLocal {
dependsOn project.tasks.signArchives
}
tasks.publishMavenCentralReleasePublicationToMaven2Repository {
tasks.publishMavenCentralReleasePublicationToSonatypeRepository {
dependsOn project.tasks.signArchives
}
}
4 changes: 0 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
## linux requires 10G, OSX requires 11G
org.gradle.jvmargs=-XX:MaxPermSize=512m -Xmx2g

mavenRepoUrl = https://api.bintray.com/content/microsoftgraph/Maven/microsoft-graph-beta
mavenBintraySnapshotUrl = http://oss.jfrog.org/artifactory/oss-snapshot-local
mavenGroupId = com.microsoft.graph
mavenArtifactId = microsoft-graph-beta
mavenMajorVersion = 0
Expand All @@ -40,7 +38,5 @@ Username="USERNAME"
Password="PASSWORD"

#enable mavenCentralPublishingEnabled to publish to maven central
mavenCentralSnapshotUrl=https://oss.sonatype.org/content/repositories/snapshots
mavenCentralReleaseUrl=https://oss.sonatype.org/service/local/staging/deploy/maven2
mavenCentralSnapshotArtifactSuffix = -SNAPSHOT
mavenCentralPublishingEnabled=false
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 1 addition & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#Thu Dec 07 16:02:17 AEDT 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.6-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.5.1-bin.zip
Loading