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
63 changes: 63 additions & 0 deletions .azure-pipelines/generation-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,16 @@ resources:
endpoint: microsoftgraph
name: microsoftgraph/msgraph-sdk-typescript
ref: dev
- repository: msgraph-sdk-python
type: github
endpoint: microsoftgraph
name: microsoftgraph/msgraph-sdk-python
ref: main
- repository: msgraph-beta-sdk-python
type: github
endpoint: microsoftgraph
name: microsoftgraph/msgraph-beta-sdk-python
ref: main
- repository: msgraph-metadata
type: github
endpoint: microsoftgraph
Expand Down Expand Up @@ -689,6 +699,59 @@ stages:
parameters:
repoName: msgraph-sdk-typescript

- stage: stage_python_v1
dependsOn:
- stage_build_and_publish_kiota
- stage_v1_openapi
condition: |
and
(
eq(dependencies.stage_build_and_publish_kiota.result, 'Succeeded'),
eq(dependencies.stage_v1_openapi.result, 'Succeeded')
)
jobs:
- job: python_v1
steps:
- template: generation-templates/language-generation-kiota.yml
parameters:
language: 'python'
version: ''
repoName: 'msgraph-sdk-python'
branchName: $(v1Branch)
targetClassName: "BaseGraphServiceClient"
targetNamespace: "msgraph.generated"
cleanMetadataFolder: $(cleanOpenAPIFolderV1)
languageSpecificSteps:
- template: generation-templates/python.yml
parameters:
repoName: msgraph-sdk-python

- stage: stage_python_beta
dependsOn:
- stage_build_and_publish_kiota
- stage_beta_openapi
condition: |
and
(
eq(dependencies.stage_build_and_publish_kiota.result, 'Succeeded'),
eq(dependencies.stage_beta_openapi.result, 'Succeeded')
)
jobs:
- job: python_beta
steps:
- template: generation-templates/language-generation-kiota.yml
parameters:
language: 'python'
version: 'beta'
repoName: 'msgraph-beta-sdk-python'
branchName: $(betaBranch)
targetClassName: "BaseGraphServiceClient"
targetNamespace: "msgraph.generated"
cleanMetadataFolder: $(cleanOpenAPIFolderBeta)
languageSpecificSteps:
- template: generation-templates/python.yml
parameters:
repoName: msgraph-beta-sdk-python
# - stage: stage_objc_v1
# dependsOn:
# - stage_build_and_publish_typewriter
Expand Down
4 changes: 4 additions & 0 deletions .azure-pipelines/generation-templates/capture-metadata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ steps:

- template: download-typewriter.yml

- template: use-dotnet-sdk.yml

## Only run if the previous step was successful
- pwsh: '$(scriptsDirectory)/run-typewriter-clean-metadata.ps1'
env:
Expand Down Expand Up @@ -114,6 +116,8 @@ steps:
# Use the clean metadata from the last step to generate DotNet files.

- template: use-dotnet-sdk.yml
parameters:
version: '6.x' # verify tool is NET6 app

# verify that generated metadata is parsable as an Edm model
- pwsh: dotnet run --project $(Build.SourcesDirectory)/msgraph-metadata/tools/MetadataParser/MetadataParser.csproj -- ${{ parameters.cleanMetadataFileWithAnnotations }}
Expand Down
2 changes: 2 additions & 0 deletions .azure-pipelines/generation-templates/capture-openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ steps:
- template: checkout-metadata.yml
- template: set-user-config.yml
- template: use-dotnet-sdk.yml
parameters:
version: '6.x' # Hidi is released as an NET6 app

- pwsh: dotnet tool install -g Microsoft.OpenApi.Hidi --prerelease
displayName: install hidi
Expand Down
17 changes: 17 additions & 0 deletions .azure-pipelines/generation-templates/python.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
parameters:
- name: repoName
type: string

steps:
- pwsh: '$(scriptsDirectory)/clean-python-files.ps1'
displayName: 'Remove generated models and requests from the repo generated folder'
env:
RepoModelsDir: '$(Build.SourcesDirectory)/${{ parameters.repoName }}/msgraph/generated'

- pwsh: '$(scriptsDirectory)/copy-python-models.ps1'
displayName: 'Update models'
env:
BuildConfiguration: $(buildConfiguration)
OutputFullPath: $(kiotaDirectory)/output/*
RepoModelsDir: '$(Build.SourcesDirectory)/${{ parameters.repoName }}/msgraph/generated'

7 changes: 6 additions & 1 deletion .azure-pipelines/generation-templates/use-dotnet-sdk.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
parameters:
- name: 'version'
type: string
default: "7.x"

steps:
- task: UseDotNet@2
displayName: 'Use .NET SDK'
inputs:
packageType: sdk
version: 7.0.100
version: ${{ parameters.version }}
installationPath: $(Agent.ToolsDirectory)/dotnet
3 changes: 3 additions & 0 deletions scripts/clean-python-files.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Remove old generated files.
Remove-Item -Recurse $env:RepoModelsDir | Write-Host
Write-Host "Removed the existing generated files in the directory: $env:RepoModelsDir." -ForegroundColor Green
9 changes: 9 additions & 0 deletions scripts/copy-python-models.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Write-Host "Path to repo models directory: $env:RepoModelsDir"

If(!(test-path $env:RepoModelsDir))
{
New-Item -ItemType Directory -Force -Path $env:RepoModelsDir
}

Copy-Item $env:OutputFullPath -Destination $env:RepoModelsDir -Recurse -Force
Write-Host "Copied the generated files from: $env:OutputFullPath to: $env:RepoModelsDir" -ForegroundColor Green