Skip to content

Commit 677a15e

Browse files
committed
- merges latest dev changes, replaces deprecated APIs
2 parents 72b58f6 + 566d653 commit 677a15e

File tree

14,034 files changed

+503485
-478906
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

14,034 files changed

+503485
-478906
lines changed
Lines changed: 175 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,175 @@
1+
# Copyright (c) Microsoft Corporation. All rights reserved.
2+
# Licensed under the MIT License.
3+
4+
name: $(BuildDefinitionName)_$(SourceBranchName)_$(Date:yyyyMMdd)$(Rev:.r)
5+
6+
trigger: none # disable triggers based on commits.
7+
pr: none # disable triggers based on pull requests.
8+
9+
resources:
10+
repositories:
11+
- repository: msgraph-sdk-java # The name used to reference this repository in the checkout step
12+
type: github
13+
endpoint: microsoftgraph
14+
name: microsoftgraph/msgraph-sdk-java
15+
ref: dev # checkout the dev branch
16+
- repository: msgraph-metadata
17+
type: github
18+
endpoint: microsoftgraph
19+
name: microsoftgraph/msgraph-metadata
20+
ref: master #
21+
pipelines:
22+
- pipeline: publishMetadata # This pipeline validates and produces an metadata artifact that we use for generation.
23+
source: (v1.0 - 3) msgraph-publish-cleanmetadata
24+
trigger:
25+
branches:
26+
- master
27+
28+
pool:
29+
vmImage: windows-latest # Info about this image: [0][1]
30+
31+
variables:
32+
- group: MicrosoftGraph # Variable group, where variables not set here come from. Set in Azure DevOps
33+
34+
steps:
35+
- checkout: msgraph-sdk-java
36+
clean: true
37+
fetchDepth: 1
38+
persistCredentials: true
39+
- checkout: msgraph-metadata
40+
clean: true
41+
fetchDepth: 1
42+
43+
- task: PowerShell@2 # Setup environment variables and make them available to all tasks. See [1] for more info.
44+
displayName: 'Calculate and set pipeline variables for this job'
45+
inputs:
46+
targetType: inline
47+
script: |
48+
$repoDir = "$env:Build_SourcesDirectory\msgraph-sdk-java\"
49+
Write-Host "Path to java repository: $repoDir"
50+
Write-Host "##vso[task.setvariable variable=repoDir]$repoDir"
51+
52+
$outputPath = Join-Path $env:Build_SourcesDirectory "output"
53+
Write-Host "Path to typewriter.exe output $outputPath"
54+
Write-Host "##vso[task.setvariable variable=outputPath]$outputPath"
55+
56+
$cleanMetadata = "https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/clean_v10_metadata/cleanMetadataWithDescriptionsv1.0.xml"
57+
Write-Host "Path to clean metadata $cleanMetadata"
58+
Write-Host "##vso[task.setvariable variable=cleanMetadata]$cleanMetadata"
59+
60+
$branchName = "v1.0/pipelinebuild/$env:Build_BuildId" # Match the spec in the GH Action
61+
Write-Host "Branch path spec for the pull request will be $branchName"
62+
Write-Host "##vso[task.setvariable variable=branchName]$branchName"
63+
64+
- task: PowerShell@2
65+
displayName: 'Git: branch from dev named with the build id: $(Build.BuildId)'
66+
inputs:
67+
targetType: inline
68+
workingDirectory: '$(Build.SourcesDirectory)/msgraph-sdk-java'
69+
script: |
70+
Write-Host "The new branch name will be: $env:branchName"
71+
git checkout -B $env:branchName | Write-Host
72+
73+
- task: PowerShell@2
74+
displayName: 'Git: set user config'
75+
inputs:
76+
targetType: inline
77+
workingDirectory: '$(Build.SourcesDirectory)/msgraph-sdk-java'
78+
script: |
79+
git config user.email "[email protected]"
80+
git config user.name "Microsoft Graph DevX Tooling"
81+
82+
- task: PowerShell@2
83+
displayName: 'Remove generated models and requests from the repo'
84+
inputs:
85+
targetType: inline
86+
script: |
87+
$mainDir = Join-Path $env:repoDir "\src\main\"
88+
$extensionsAndGeneratedDirectories = Get-ChildItem $mainDir -Include extensions,generated -Recurse -Directory
89+
90+
# this list should be updated if a new hand-crafted extension is added to one of the extensions/ directories
91+
$filesThatShouldNotBeDeleted = "UploadSession.java","DateOnly.java","TimeOfDay.java","Multipart.java","ChunkedUploadRequest.java","ChunkedUploadResult.java","CustomRequestBuilder.java"
92+
foreach ($directory in $extensionsAndGeneratedDirectories)
93+
{
94+
Remove-Item $directory.FullName -Recurse -Force -Exclude $filesThatShouldNotBeDeleted
95+
}
96+
Write-Host "Removed the existing generated files in the repo's main directory: $mainDir" -ForegroundColor Green
97+
enabled: true # The old GUI pipeline wasn't doing this. I recall that there was a reason
98+
# for this but I can't recall the reason but I think it was related to reducing number of
99+
# generated files.
100+
101+
- task: PowerShell@2
102+
displayName: 'Typewriter: generate v1.0 Java files'
103+
inputs:
104+
targetType: filePath
105+
filePath: '$(Build.SourcesDirectory)/msgraph-metadata/scripts/runTypewriter.ps1'
106+
arguments: '-verbosity Info -language Java -metadata $(cleanMetadata) -output $(outputPath) -generationMode Files'
107+
workingDirectory: '$(Build.SourcesDirectory)' # Set the root for a multi-repo pipeline. /s
108+
enabled: true
109+
110+
- task: PowerShell@2
111+
displayName: 'Copy generated requests and models into the repo'
112+
inputs:
113+
targetType: inline
114+
script: |
115+
# Path to typewriter output
116+
$comDirectory = Join-Path $env:outputPath "\com\"
117+
118+
# Path to the destination directory
119+
$comDestinationDirectory = Join-Path $env:repoDir "\src\main\java\"
120+
121+
# copies com/ directory to java SDK repo, by following all the recursive paths
122+
Copy-Item $comDirectory -Destination $comDestinationDirectory -Recurse -Force
123+
Write-Host "Copied the generated com\ files into the repo. From: $comDirectory to: $comDestinationDirectory" -ForegroundColor Green
124+
125+
- task: PowerShell@2
126+
displayName: 'Git: stage and commit generated files'
127+
env: # [2]
128+
GIT_REDIRECT_STDERR: "2>&1"
129+
inputs:
130+
targetType: inline
131+
workingDirectory: '$(Build.SourcesDirectory)/msgraph-sdk-java'
132+
script: |
133+
Write-Host "About to add files....." -ForegroundColor Green
134+
git add . | Write-Host
135+
136+
if ($env:Build_Reason -eq 'Manual') # Skip CI if manually running this pipeline.
137+
{
138+
git commit -m "Update generated v1.0 Java models and requests with build $env:Build_BuildId [skip ci]" | Write-Host
139+
}
140+
else
141+
{
142+
git commit -m "Update generated v1.0 Java models and requests with build $env:Build_BuildId" | Write-Host
143+
}
144+
145+
Write-Host "Added and committed generated java files." -ForegroundColor Green
146+
147+
- task: PowerShell@2
148+
displayName: 'Git: push updates'
149+
env: # [2]
150+
GIT_REDIRECT_STDERR: "2>&1"
151+
inputs:
152+
targetType: inline
153+
workingDirectory: '$(Build.SourcesDirectory)/msgraph-sdk-java'
154+
script: |
155+
git push --set-upstream origin $env:branchName | Write-Host
156+
Write-Host "Pushed the results of the build to the $env:branchName branch." -ForegroundColor Green
157+
enabled: true
158+
159+
# Send a notification to our Graph Tooling channel to let us know that
160+
# that automated build failed. This won't notify on manual builds.
161+
162+
- task: YodLabs.O365PostMessage.O365PostMessageBuild.O365PostMessageBuild@0
163+
displayName: 'Graph Client Tooling pipeline fail notification'
164+
inputs:
165+
addressType: serviceEndpoint
166+
serviceEndpointName: 'microsoftgraph pipeline status'
167+
title: '$(Build.DefinitionName) failure notification'
168+
text: 'This automated pipeline has failed. View the build details for further information. This is a blocking failure.'
169+
condition: and(failed(), ne(variables['Build.Reason'], 'Manual')) # Only notify if the automated build failed.
170+
enabled: true
171+
172+
# References
173+
# [0] https://docs.microsoft.com/en-us/azure/devops/pipelines/agents/hosted?view=azure-devops#use-a-microsoft-hosted-agent
174+
# [1] https://github.com/actions/virtual-environments/blob/master/images/win/Windows2019-Readme.md
175+
# [2] https://github.com/actions/virtual-environments/issues/617#issuecomment-603664319

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,6 @@ Fixes #
1616

1717
<!-- Optional. Provide related links. This might be other pull requests, code files, StackOverflow posts. Delete this section if it is not used. -->
1818
### Other links
19+
20+
<!-- Is this PR adding a new hand crafted extension class? If so, please update $filesThatShouldNotBeDeleted variable in .azure-pipelines/generate-v1.0-models.yml file, so that it doesn't get deleted by auto generation pipeline.-->
1921
-

.github/dependabot.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: gradle
4+
directory: "/"
5+
schedule:
6+
interval: daily
7+
open-pull-requests-limit: 10
8+
- package-ecosystem: maven
9+
directory: "/"
10+
schedule:
11+
interval: daily
12+
open-pull-requests-limit: 10
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: "CodeQL"
2+
3+
on:
4+
push:
5+
branches: [dev, master]
6+
pull_request:
7+
# The branches below must be a subset of the branches above
8+
branches: [dev]
9+
schedule:
10+
- cron: '0 1 * * 4'
11+
12+
jobs:
13+
analyze:
14+
name: Analyze
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- name: Checkout repository
19+
uses: actions/checkout@v2
20+
with:
21+
# We must fetch at least the immediate parents so that if this is
22+
# a pull request then we can checkout the head.
23+
fetch-depth: 2
24+
25+
# If this run was triggered by a pull request event, then checkout
26+
# the head of the pull request instead of the merge commit.
27+
- run: git checkout HEAD^2
28+
if: ${{ github.event_name == 'pull_request' }}
29+
30+
# Initializes the CodeQL tools for scanning.
31+
- name: Initialize CodeQL
32+
uses: github/codeql-action/init@v1
33+
# Override language selection by uncommenting this and choosing your languages
34+
with:
35+
languages: java
36+
37+
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
38+
# If this step fails, then you should remove it and run the build manually (see below)
39+
- name: Autobuild
40+
uses: github/codeql-action/autobuild@v1
41+
42+
# ℹ️ Command-line programs to run using the OS shell.
43+
# 📚 https://git.io/JvXDl
44+
45+
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
46+
# and modify them (or add more) to build your code if your project
47+
# uses a compiled language
48+
49+
#- run: |
50+
# make bootstrap
51+
# make release
52+
53+
- name: Perform CodeQL Analysis
54+
uses: github/codeql-action/analyze@v1
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# This is a basic workflow to help you get started with Actions
2+
3+
name: PullRequestConflicting
4+
5+
# Controls when the action will run. Triggers the workflow on push or pull request
6+
# events but only for the master branch
7+
on:
8+
push:
9+
branches: [ master, dev ]
10+
pull_request:
11+
types: [synchronize]
12+
branches: [ master, dev ]
13+
14+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
15+
jobs:
16+
# This workflow contains a single job called "build"
17+
build:
18+
# The type of runner that the job will run on
19+
runs-on: ubuntu-latest
20+
21+
# Steps represent a sequence of tasks that will be executed as part of the job
22+
steps:
23+
- name: check if prs are dirty
24+
uses: eps1lon/actions-label-merge-conflict@releases/2.x
25+
if: env.LABELING_TOKEN != '' && env.LABELING_TOKEN != null
26+
id: check
27+
with:
28+
dirtyLabel: "conflicting"
29+
repoToken: "${{ secrets.GITHUB_TOKEN }}"
30+
continueOnMissingPermissions: true
31+
commentOnDirty: 'This pull request has conflicting changes, the author must resolve the conflicts before this pull request can be merged.'
32+
commentOnClean: 'Conflicts have been resolved. A maintainer will take a look shortly.'
33+
env:
34+
LABELING_TOKEN: ${{secrets.GITHUB_TOKEN }}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Copyright (c) Microsoft Corporation. All rights reserved.
2+
# Licensed under the MIT License.
3+
4+
# This action will automatically create a pull request against master if the pushed branch
5+
# has a branch path spec likev 1.0/pipelinebuild/*. Configure this action by updating the
6+
# environment variable values[0].
7+
8+
name: "create pull request"
9+
10+
# Controls when the action will run. Triggers the workflow on push
11+
# events but only for branches with the following branch spec: "v1.0/pipelinebuild/*"
12+
on:
13+
push:
14+
branches:
15+
- "v1.0/pipelinebuild/*"
16+
paths:
17+
- 'src/**/*.java'
18+
19+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
20+
jobs:
21+
# This workflow contains a single job called "create-pull-request"
22+
create-pull-request:
23+
# GitHub Actions don't support skip ci yet like Azure Pipelines so this check will do the same.
24+
if: github.event_name == 'push' && contains(toJson(github.event.commits), '***NO_CI***') == false && contains(toJson(github.event.commits), '[ci skip]') == false && contains(toJson(github.event.commits), '[skip ci]') == false
25+
# The type of runner that the job will run on
26+
runs-on: ubuntu-latest
27+
# https://github.com/actions/virtual-environments/blob/master/images/linux/Ubuntu1804-README.md
28+
29+
# Steps represent a sequence of tasks that will be executed as part of the job
30+
steps:
31+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
32+
- uses: actions/checkout@v2
33+
34+
# Create a pull request [1]
35+
- name: Create PR using the GitHub REST API via hub
36+
shell: bash
37+
env:
38+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
39+
MESSAGE_TITLE: Generated v1.0 models and request builders using Typewriter
40+
MESSAGE_BODY: "This pull request was automatically created by the GitHub Action, **${{github.workflow}}**. \n\n The commit hash is _${{github.sha}}_. \n\n **Important** Check for unexpected deletions or changes in this PR. \n\n - [ ] update version in gradle.properties and Constants.java. \n\n - [ ] update version in readme.md\n\n- [ ] create tag and release\n\n cc: @darrelmiller"
41+
REVIEWERS: peombwa,ddyett,zengin,nikithauc,baywet
42+
ASSIGNEDTO: baywet
43+
LABELS: generated
44+
BASE: dev
45+
run: |
46+
curl -fsSL https://github.com/github/hub/raw/master/script/get | bash -s 2.14.1
47+
bin/hub pull-request -b "$BASE" -h "$GITHUB_REF" -m "$MESSAGE_TITLE" -m "$MESSAGE_BODY" -r "$REVIEWERS" -a "$ASSIGNEDTO" -l "$LABELS"
48+
# References
49+
# [0] https://help.github.com/en/actions/configuring-and-managing-workflows/using-environment-variables
50+
# [1] https://hub.github.com/hub-pull-request.1.html
51+
# https://help.github.com/en/actions/configuring-and-managing-workflows/authenticating-with-the-github_token

.travis.yml

Lines changed: 0 additions & 1 deletion
This file was deleted.

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"java.configuration.updateBuildConfiguration": "interactive"
3+
}

0 commit comments

Comments
 (0)