Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
945da79
- adds pom placeholder so dependency graph shows up
baywet Oct 1, 2020
ca02f8e
- removes dependabot configuration for maven
baywet Oct 5, 2020
167ca9d
Merge pull request #81 from microsoftgraph/feature/pom-placeholder
baywet Oct 5, 2020
55052b2
- adds dependabot for actions
baywet Oct 7, 2020
dd1d15b
Merge pull request #83 from microsoftgraph/feature/dependabot-actions
baywet Oct 7, 2020
d874ba0
Bump junit from 4.13 to 4.13.1
dependabot[bot] Oct 12, 2020
d0fbb70
Merge pull request #84 from microsoftgraph/dependabot/gradle/junit-ju…
baywet Oct 12, 2020
028e2cc
- adds a script to automatically increment minor version
baywet Nov 25, 2020
44a3458
- updates synopsis to reflect script effects
baywet Nov 25, 2020
72df8da
- improves batches replacement by using regex saving compute
baywet Nov 25, 2020
6f58268
- restores wrongly deleted script
baywet Nov 26, 2020
6696aec
Merge pull request #90 from microsoftgraph/feature/url-regex-replace-…
baywet Nov 30, 2020
8b523e7
- improves performance by precompiling regex
baywet Dec 1, 2020
0cef256
- replaces regex parsing by the version class
baywet Dec 1, 2020
3357a78
Merge branch 'dev' into feature/version-increment
baywet Dec 1, 2020
862acfd
Merge pull request #91 from microsoftgraph/feature/regex-pre-compile
baywet Dec 1, 2020
4172c36
Merge branch 'dev' into feature/version-increment
baywet Dec 1, 2020
9a864ed
Merge pull request #89 from microsoftgraph/feature/version-increment
baywet Dec 1, 2020
726f88e
- adds editor config
baywet Dec 1, 2020
9eb7fcb
Merge pull request #92 from microsoftgraph/feature/editor-config
baywet Dec 1, 2020
2b047ff
- fixes a bug where regex replacement on multithreading could cross w…
baywet Dec 2, 2020
e7e31aa
Merge pull request #93 from microsoftgraph/bugfix/compile-regex-multi…
baywet Dec 2, 2020
88eaadf
- updates link to getting started and adds link to javadoc
baywet Dec 3, 2020
6f4354e
Merge pull request #94 from microsoftgraph/baywet-patch-1
baywet Dec 3, 2020
89a6d3b
- adds codeowners for the repository
baywet Dec 9, 2020
6a93bff
Merge pull request #96 from microsoftgraph/feature/codeowners
baywet Dec 9, 2020
790a976
- adds android api version in telemetry handler
baywet Dec 10, 2020
61ae79b
- bumps patch
baywet Dec 10, 2020
49a107b
- space/tabs fix to make @zengin happy :)
baywet Dec 14, 2020
cbb9444
Merge pull request #98 from microsoftgraph/feature/android-telemetry
baywet Dec 14, 2020
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
2 changes: 1 addition & 1 deletion .azure-pipelines/buildAndPackage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ steps:
settings.gradle
gradle.properties
**/gradle/wrapper/*
Scripts/getLatestVersion.ps1
Scripts/**
TargetFolder: '$(Build.ArtifactStagingDirectory)/'

- task: PublishBuildArtifacts@1
Expand Down
7 changes: 0 additions & 7 deletions .azure-pipelines/prValidate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,6 @@ steps:
inputs:
debugMode: false

- task: PowerShell@2
condition: and(failed(), eq(variables['Build.SourceBranchName'], 'dev'))
inputs:
filePath: '$(System.DefaultWorkingDirectory)\Scripts\validateMavenVersion.ps1'
pwsh: true
arguments: '-packageName "$(PACKAGE_NAME)" -propertiesPath "$(PROPERTIES_PATH)"'

- task: Gradle@2
inputs:
gradleWrapperFile: 'gradlew'
Expand Down
5 changes: 5 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[*.java]
indent_style = space
indent_size = 4
insert_final_newline = true
trim_trailing_whitespace = true
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @baywet @ddyett @MichaelMainer @nikithauc @zengin
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ updates:
schedule:
interval: daily
open-pull-requests-limit: 10
- package-ecosystem: maven
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: daily
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,4 @@ hs_err_pid*

# Maven
/target/
/pom.xml
local.properties
59 changes: 59 additions & 0 deletions Scripts/incrementMinorVersion.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.

<#
.Synopsis
Increment the minor version string in the gradle.properties if the major,
minor, or patch version hasn't been manually updated.
.Description
Assumptions:
Targets Gradle.properties
This script assumes it is run from the repo root.
Minor version is typically auto-incremented.

#>

function Update-ReadmeVersion([string]$readmeFilePath, [version]$version) {
$readmeFileContent = Get-Content -Path $readmeFilePath -Raw
$readmeFileContent = $readmeFileContent -replace "\d{1,}\.\d{1,}\.\d{1,}", $version.ToString()
Set-Content -Path $readmeFilePath $readmeFileContent
}

function Update-TelemetryVersion([string]$telemetryFilePath, [version]$version) {
$telemetryFileContent = Get-Content -Path $telemetryFilePath -Raw
$telemetryFileContent = $telemetryFileContent -replace "\d{1,}\.\d{1,}\.\d{1,}", $version.ToString()
Set-Content -Path $telemetryFilePath $telemetryFileContent
}

function Update-PackageVersion([string]$propertiesFilePath, [version]$version) {
$propertiesFileContent = Get-Content -Path $propertiesFilePath -Raw
$propertiesFileContent = $propertiesFileContent -replace "mavenMajorVersion\s+=\s+\d{1,}", "mavenMajorVersion = $($version.Major)"
$propertiesFileContent = $propertiesFileContent -replace "mavenMinorVersion\s+=\s+\d{1,}", "mavenMinorVersion = $($version.Minor)"
$propertiesFileContent = $propertiesFileContent -replace "mavenPatchVersion\s+=\s+\d{1,}", "mavenPatchVersion = $($version.Build)"
Set-Content -Path $propertiesFilePath $propertiesFileContent
}
function Get-CurrentTelemetryVersion([string]$telemetryFilePath) {
$telemetryFileContent = Get-Content -Path $telemetryFilePath -Raw
if($telemetryFileContent -match "(\d{1,}\.\d{1,}\.\d{1,})") {
return [version]::Parse($Matches[1])
} else {
Write-Error "Invalid version number format"
return $null;
}
}

function Update-MinorVersionNumber([version]$currentVersion) {
return [version]::new($currentVersion.Major, $currentVersion.Minor + 1, 0);
}

function Update-MinorVersion() {
$readmeFilePath = Join-Path -Path $PWD.ToString() -ChildPath "../readme.md"
$propertiesFilePath = Join-Path -Path $PWD.ToString() -ChildPath "../gradle.properties"
$telemetryFilePath = Join-Path -Path $PWD.ToString() -ChildPath "../src/main/java/com/microsoft/graph/httpcore/TelemetryHandler.java"
$currentVersion = Get-CurrentTelemetryVersion -telemetryFilePath $telemetryFilePath
$nextVersion = Update-MinorVersionNumber -currentVersion $currentVersion
Update-ReadmeVersion -version $nextVersion -readmeFilePath $readmeFilePath
Update-TelemetryVersion -version $nextVersion -telemetryFilePath $telemetryFilePath
Update-PackageVersion -version $nextVersion -propertiesFilePath $propertiesFilePath
}
Update-MinorVersion
67 changes: 0 additions & 67 deletions Scripts/validateMavenVersion.ps1

This file was deleted.

10 changes: 9 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ java {
modularity.inferModulePath = true
}

sourceSets {
main {
java {
exclude 'pom.xml'
}
}
}

// In this section you declare where to find the dependencies of your project
repositories {
// Use jcenter for resolving your dependencies.
Expand All @@ -30,7 +38,7 @@ repositories {

dependencies {
// Use JUnit test framework
testImplementation 'junit:junit:4.13'
testImplementation 'junit:junit:4.13.1'

api 'com.squareup.okhttp3:okhttp:3.12.1'

Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ mavenGroupId = com.microsoft.graph
mavenArtifactId = microsoft-graph-core
mavenMajorVersion = 1
mavenMinorVersion = 0
mavenPatchVersion = 5
mavenPatchVersion = 6
mavenArtifactSuffix =
nightliesUrl = http://dl.bintray.com/MicrosoftGraph/Maven

Expand Down
26 changes: 26 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<project>
<!--
This package file is a place holder to enable the dependency graph https://github.com/microsoftgraph/msgraph-sdk-java-core/network/dependencies
as the dependency graph is not compatible with gradle https://docs.github.com/en/free-pro-team@latest/github/visualizing-repository-data-with-graphs/about-the-dependency-graph#supported-package-ecosystems
build.gradle is the source of truth
-->
<modelVersion>4.0.0</modelVersion>

<groupId>com.microsoft.graph</groupId>
<artifactId>microsoft-graph-core</artifactId>
<version>1.0.6</version>
<packaging>pom</packaging>

<dependencies>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.6</version>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>gson</artifactId>
<version>3.12.1</version>
</dependency>
</dependencies>
</project>
6 changes: 3 additions & 3 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Microsoft Graph Core SDK for Java

Get started with the Microsoft Graph Core SDK for Java by integrating the [Microsoft Graph API](https://graph.microsoft.io/en-us/getting-started) into your Java and Android application!
Get started with the Microsoft Graph Core SDK for Java by integrating the [Microsoft Graph API](https://developer.microsoft.com/en-us/graph/get-started/java) into your Java and Android application! You can also have a look at the [Javadoc](https://docs.microsoft.com/en-us/java/api/com.microsoft.graph.httpcore?view=graph-core-java)

## Samples and usage guide

Expand All @@ -20,7 +20,7 @@ repositories {

dependencies {
// Include the sdk as a dependency
implementation 'com.microsoft.graph:microsoft-graph-core:1.0.5'
implementation 'com.microsoft.graph:microsoft-graph-core:1.0.6'
}
```

Expand All @@ -32,7 +32,7 @@ Add the dependency in `dependencies` in pom.xml
<dependency>
<groupId>com.microsoft.graph</groupId>
<artifactId>microsoft-graph-core</artifactId>
<version>1.0.5</version>
<version>1.0.6</version>
</dependency>
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import java.util.List;
import java.util.Map;
import java.util.concurrent.ThreadLocalRandom;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
Expand All @@ -27,7 +29,7 @@ public class MSBatchRequestContent {

/*
* Creates Batch request content using list provided
*
*
* @param batchRequestStepsArray List of batch steps for batching
*/
public MSBatchRequestContent(final List<MSBatchRequestStep> batchRequestStepsArray) {
Expand All @@ -48,7 +50,7 @@ public MSBatchRequestContent() {

/*
* @param batchRequestStep Batch request step adding to batch content
*
*
* @return true or false based on addition or no addition of batch request step
* given
*/
Expand Down Expand Up @@ -79,7 +81,7 @@ public String addBatchRequestStep(final Request request, final String... arrayOf

/*
* @param requestId Id of Batch request step to be removed
*
*
* @return true or false based on removal or no removal of batch request step
* with given id
*/
Expand Down Expand Up @@ -113,13 +115,14 @@ public String getBatchRequestContent() {
return content;
}

private static final Pattern protocolAndHostReplacementPattern = Pattern.compile("(?i)^http[s]?:\\/\\/graph\\.microsoft\\.com\\/(?>v1\\.0|beta)\\/?"); // (?i) case insensitive
private JsonObject getBatchRequestObjectFromRequestStep(final MSBatchRequestStep batchRequestStep) {
final JsonObject contentmap = new JsonObject();
contentmap.add("id", new JsonPrimitive(batchRequestStep.getRequestId()));

final String url = batchRequestStep.getRequest().url().toString()
.replaceAll("https://graph.microsoft.com/v1.0/", "").replaceAll("http://graph.microsoft.com/v1.0/", "")
.replaceAll("https://graph.microsoft.com/beta/", "").replaceAll("http://graph.microsoft.com/beta/", "");
final Matcher protocolAndHostReplacementMatcher = protocolAndHostReplacementPattern.matcher(batchRequestStep.getRequest().url().toString());

final String url = protocolAndHostReplacementMatcher.replaceAll("");
contentmap.add("url", new JsonPrimitive(url));

contentmap.add("method", new JsonPrimitive(batchRequestStep.getRequest().method().toString()));
Expand Down Expand Up @@ -178,5 +181,5 @@ private JsonObject requestBodyToJSONObject(final Request request) throws IOExcep
else
return requestBodyElement.getAsJsonObject();
}

}
Loading