Skip to content

Commit 3cc93aa

Browse files
Merge pull request #35 from microsoftgraph/dev
Update master
2 parents fc7b563 + 5944b3e commit 3cc93aa

File tree

6 files changed

+233
-5
lines changed

6 files changed

+233
-5
lines changed
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
#Copyright (c) Microsoft Corporation. All rights reserved.
2+
#Licensed under the MIT License.
3+
#Building and packaging the artifacts of the Java-Core libraries using the build.gradle file.
4+
#Ready the package for deployment and release.
5+
6+
trigger:
7+
branches:
8+
include:
9+
- dev
10+
- main
11+
- master
12+
paths:
13+
include:
14+
- src/*
15+
exclude:
16+
- .gitignore
17+
- CONTRIBUTING.md
18+
- LICENSE
19+
- THIRD PARTY NOTICES
20+
- build.gradle
21+
- gradle.properties
22+
- gradlew
23+
- gradlew.bat
24+
- readme.md
25+
- settings.gradle
26+
27+
pr: none
28+
29+
pool:
30+
vmImage: 'windows-latest'
31+
32+
steps:
33+
- checkout: self
34+
clean: true
35+
fetchDepth: 1
36+
37+
- task: securedevelopmentteam.vss-secure-development-tools.build-task-credscan.CredScan@2
38+
displayName: 'Run CredScan'
39+
inputs:
40+
debugMode: false
41+
42+
- task: DownloadSecureFile@1
43+
inputs:
44+
secureFile: 'local.properties'
45+
46+
- task: DownloadSecureFile@1
47+
inputs:
48+
secureFile: 'secring.gpg'
49+
50+
- task: DownloadSecureFile@1
51+
inputs:
52+
secureFile: 'secring.gpg.lock'
53+
54+
- task: CopyFiles@2
55+
inputs:
56+
SourceFolder: '$(Agent.TempDirectory)'
57+
Contents: '**'
58+
TargetFolder: '$(System.DefaultWorkingDirectory)'
59+
60+
- task: Gradle@2
61+
inputs:
62+
gradleWrapperFile: 'gradlew'
63+
tasks: 'build'
64+
publishJUnitResults: true
65+
testResultsFiles: '**/TEST-*.xml'
66+
javaHomeOption: 'JDKVersion'
67+
sonarQubeRunAnalysis: false
68+
69+
- task: PublishBuildArtifacts@1
70+
displayName: 'Publish Artifact: drop'
71+
inputs:
72+
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
73+
74+
- task: CopyFiles@2
75+
inputs:
76+
SourceFolder: '$(System.DefaultWorkingDirectory)'
77+
Contents: |
78+
**/libs/*
79+
build.gradle
80+
gradlew
81+
gradlew.bat
82+
settings.gradle
83+
gradle.properties
84+
**/gradle/wrapper/*
85+
TargetFolder: '$(Build.ArtifactStagingDirectory)/'
86+
87+
- task: PublishBuildArtifacts@1
88+
inputs:
89+
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
90+
ArtifactName: 'drop'
91+
publishLocation: 'Container'
92+
93+
- task: YodLabs.O365PostMessage.O365PostMessageBuild.O365PostMessageBuild@0
94+
displayName: 'Graph Client Tooling pipeline fail notification'
95+
inputs:
96+
addressType: serviceEndpoint
97+
serviceEndpointName: 'microsoftgraph pipeline status'
98+
title: '$(Build.DefinitionName) failure notification'
99+
text: 'This pipeline has failed. View the build details for further information. This is a blocking failure.'
100+
condition: and(failed(), ne(variables['Build.Reason'], 'Manual'))
101+
enabled: true

.azure-pipelines/prValidate.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# Build and test Java Core to make sure a valid pull request is being made
2+
pr:
3+
branches:
4+
include:
5+
- master
6+
- main
7+
- dev
8+
paths:
9+
exclude:
10+
- .azure-pipelines
11+
- .gradle/wrapper
12+
- .gitignore
13+
- CONTRIBUTING.md
14+
- LICENSE
15+
- THIRD PARTY NOTICES
16+
- gradle.properties
17+
- gradlew
18+
- gradlew.bat
19+
- readme.md
20+
- settings.gradle
21+
22+
trigger: none # disable triggers based on commits.
23+
24+
variables:
25+
PACKAGE_NAME: 'microsoft-graph-core'
26+
PROPERTIES_PATH: '.\gradle.properties'
27+
28+
pool:
29+
vmImage: windows-latest
30+
31+
steps:
32+
- checkout: self
33+
clean: true
34+
fetchDepth: 1
35+
36+
- task: securedevelopmentteam.vss-secure-development-tools.build-task-credscan.CredScan@2
37+
displayName: 'Run CredScan'
38+
inputs:
39+
debugMode: false
40+
41+
- task: PowerShell@2
42+
condition: and(failed(), eq(variables['Build.SourceBranchName'], 'dev'))
43+
inputs:
44+
filePath: '$(System.DefaultWorkingDirectory)\Scripts\validateMavenVersion.ps1'
45+
pwsh: true
46+
arguments: '-packageName "$(PACKAGE_NAME)" -propertiesPath "$(PROPERTIES_PATH)"'
47+
48+
- task: Gradle@2
49+
inputs:
50+
gradleWrapperFile: 'gradlew'
51+
tasks: 'build'
52+
publishJUnitResults: true
53+
testResultsFiles: '**/TEST-*.xml'
54+
javaHomeOption: 'JDKVersion'
55+
sonarQubeRunAnalysis: false
56+
57+
- task: YodLabs.O365PostMessage.O365PostMessageBuild.O365PostMessageBuild@0
58+
displayName: 'Graph Client Tooling pipeline fail notification'
59+
inputs:
60+
addressType: serviceEndpoint
61+
serviceEndpointName: 'microsoftgraph pipeline status'
62+
title: '$(Build.DefinitionName) failure notification'
63+
text: 'This pipeline has failed. View the build details for further information. This is a blocking failure. '
64+
condition: and(failed(), ne(variables['Build.Reason'], 'Manual'))
65+
enabled: true

Scripts/validateMavenVersion.ps1

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Copyright (c) Microsoft Corporation. All rights reserved.
2+
# Licensed under the MIT License.
3+
4+
<#
5+
.Synopsis
6+
Ensure the maven version is updated in the case that the pull request is
7+
to the main/master branch of the repo.
8+
.Description
9+
Retrieves the local, Maven, and Bintray versions of the Java-Core build.
10+
Checks that the Maven and Bintray versions are aligned, trigger warning if not.
11+
Checks that the current local version is greater than those currently deployed.
12+
#>
13+
14+
.Parameter packageName
15+
.Parameter propertiesPath
16+
17+
Param(
18+
[parameter(Mandatory = $true)]
19+
[string]$packageName,
20+
21+
[parameter(Mandatory = $true)]
22+
[string]$propertiesPath
23+
)
24+
25+
#Find the local version from the Gradle.Properties file
26+
$file = get-item $propertiesPath
27+
$findLocalVersions = $file | Select-String -Pattern "mavenMajorVersion" -Context 0,2
28+
$findLocalVersions = $findLocalVersions -split "`r`n"
29+
30+
$localMajor = $findLocalVersions[0].Substring($findLocalVersions[0].Length-1)
31+
$localMinor = $findLocalVersions[1].Substring($findLocalVersions[1].Length-1)
32+
$localPatch = $findLocalVersions[2].Substring($findLocalVersions[2].Length-1)
33+
$localVersion = [version]"$localMajor.$localMinor.$localPatch"
34+
35+
#Set Web Client and retrieve Maven and Bintray versions from their respective repos.
36+
$web_client = New-Object System.Net.WebClient
37+
38+
$mavenAPIurl = "https://search.maven.org/solrsearch/select?q=$packageName&rows=20&wt=json"
39+
$jsonResult = $web_client.DownloadString($mavenAPIurl) | ConvertFrom-Json
40+
$mavenVersion = [version]$jsonResult.response.docs.latestVersion
41+
42+
$bintrayAPIurl = "https://api.bintray.com/search/packages?name=$packageName"
43+
$jsonResult = $web_client.DownloadString($bintrayAPIurl) | ConvertFrom-Json
44+
$bintrayVersion = [version]$jsonResult.latest_version
45+
46+
#Inform host of current Maven and Bintray versions
47+
write-host 'The current version in the Maven central repository is:' $mavenVersion
48+
write-host 'The current version in the Bintray central repository is:' $bintrayVersion
49+
50+
#Warn in case Maven and Bintray versions are not the same.
51+
if($mavenVersion -ne $bintrayVersion){
52+
Write-Warning "The current Maven and Bintray versions are not the same"
53+
}
54+
#Success if Local version has been updated, Error otherwise.
55+
if($localVersion -gt $bintrayVersion){
56+
Write-Host "The current pull request is of a greater version"
57+
}
58+
else{
59+
Write-Error "The current local version is not updated. Please update the local version in the Gradle.Properties file."
60+
}

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ mavenGroupId = com.microsoft.graph
2727
mavenArtifactId = microsoft-graph-core
2828
mavenMajorVersion = 1
2929
mavenMinorVersion = 0
30-
mavenPatchVersion = 0
30+
mavenPatchVersion = 1
3131
mavenArtifactSuffix =
3232
nightliesUrl = http://dl.bintray.com/MicrosoftGraph/Maven
3333

readme.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ repository {
1919
2020
dependency {
2121
// Include the sdk as a dependency
22-
compile('com.microsoft.graph:microsoft-graph-core:1.0.0')
22+
compile('com.microsoft.graph:microsoft-graph-core:1.0.1')
2323
}
2424
```
2525

@@ -29,7 +29,7 @@ Add the dependency in `dependencies` in pom.xml
2929
<dependency>
3030
<groupId>com.microsoft.graph</groupId>
3131
<artifactId>microsoft-graph-core</artifactId>
32-
<version>1.0.0</version>
32+
<version>1.0.1</version>
3333
</dependency>
3434
```
3535

src/main/java/com/microsoft/graph/httpcore/TelemetryHandler.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@
1111
public class TelemetryHandler implements Interceptor{
1212

1313
public static final String SDK_VERSION = "SdkVersion";
14-
public static final String VERSION = "v1.0.0";
14+
public static final String VERSION = "v1.0.1";
1515
public static final String GRAPH_VERSION_PREFIX = "graph-java-core";
16+
public static final String JAVA_VERSION_PREFIX = "java";
1617
public static final String CLIENT_REQUEST_ID = "client-request-id";
1718

1819
@Override
@@ -25,7 +26,8 @@ public Response intercept(Chain chain) throws IOException {
2526
telemetryOptions = new TelemetryOptions();
2627

2728
String featureUsage = "(featureUsage=" + telemetryOptions.getFeatureUsage() + ")";
28-
String sdkversion_value = GRAPH_VERSION_PREFIX + "/" + VERSION + " " + featureUsage;
29+
String javaVersion = System.getProperty("java.version");
30+
String sdkversion_value = GRAPH_VERSION_PREFIX + "/" + VERSION + " " + featureUsage + " " + JAVA_VERSION_PREFIX + "/" + javaVersion;
2931
telemetryAddedBuilder.addHeader(SDK_VERSION, sdkversion_value);
3032

3133
if(request.header(CLIENT_REQUEST_ID) == null) {

0 commit comments

Comments
 (0)