diff --git a/.azure-pipelines/generation-pipeline.yml b/.azure-pipelines/generation-pipeline.yml index 4c3686ad0..8315dff52 100644 --- a/.azure-pipelines/generation-pipeline.yml +++ b/.azure-pipelines/generation-pipeline.yml @@ -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 @@ -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 diff --git a/.azure-pipelines/generation-templates/capture-metadata.yml b/.azure-pipelines/generation-templates/capture-metadata.yml index ddcb2109e..894826364 100644 --- a/.azure-pipelines/generation-templates/capture-metadata.yml +++ b/.azure-pipelines/generation-templates/capture-metadata.yml @@ -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: @@ -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 }} diff --git a/.azure-pipelines/generation-templates/capture-openapi.yml b/.azure-pipelines/generation-templates/capture-openapi.yml index e60ef38f0..a6c379e56 100644 --- a/.azure-pipelines/generation-templates/capture-openapi.yml +++ b/.azure-pipelines/generation-templates/capture-openapi.yml @@ -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 diff --git a/.azure-pipelines/generation-templates/python.yml b/.azure-pipelines/generation-templates/python.yml new file mode 100644 index 000000000..6f9a2309d --- /dev/null +++ b/.azure-pipelines/generation-templates/python.yml @@ -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' + diff --git a/.azure-pipelines/generation-templates/use-dotnet-sdk.yml b/.azure-pipelines/generation-templates/use-dotnet-sdk.yml index ae1bd80fd..07716d2da 100644 --- a/.azure-pipelines/generation-templates/use-dotnet-sdk.yml +++ b/.azure-pipelines/generation-templates/use-dotnet-sdk.yml @@ -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 diff --git a/scripts/clean-python-files.ps1 b/scripts/clean-python-files.ps1 new file mode 100644 index 000000000..3a111f810 --- /dev/null +++ b/scripts/clean-python-files.ps1 @@ -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 \ No newline at end of file diff --git a/scripts/copy-python-models.ps1 b/scripts/copy-python-models.ps1 new file mode 100644 index 000000000..a6044f011 --- /dev/null +++ b/scripts/copy-python-models.ps1 @@ -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 \ No newline at end of file diff --git a/submodules/vipr b/submodules/vipr index 8bf680c6a..acad001e3 160000 --- a/submodules/vipr +++ b/submodules/vipr @@ -1 +1 @@ -Subproject commit 8bf680c6a47106eaa586265a26dd4683b1d87acc +Subproject commit acad001e321af2819eae6e48a0454d3024c29f2f