Skip to content

Commit 7a09de3

Browse files
authored
Add AutoREST.PowerShell as submodule (#1000)
* Add AutoREST.PowerShell submodule.
1 parent 4974598 commit 7a09de3

File tree

9 files changed

+30
-9
lines changed

9 files changed

+30
-9
lines changed

.azure-pipelines/common-templates/checkout.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,14 @@ steps:
3232
git pull
3333
git status
3434
35+
- task: Bash@3
36+
displayName: "Update Git Submodules"
37+
inputs:
38+
targetType: inline
39+
script: |
40+
git pull --recurse-submodules
41+
git submodule update --init --recursive --remote
42+
3543
- task: securedevelopmentteam.vss-secure-development-tools.build-task-credscan.CredScan@2
3644
displayName: "Run CredScan"
3745
inputs:

.azure-pipelines/common-templates/install-tools-template.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ steps:
4040
Write-Host (Get-Host).Version
4141
4242
- task: NodeTool@0
43-
displayName: 'Install NodeJs 14.11.0'
43+
displayName: 'Install NodeJs'
4444
inputs:
45-
versionSpec: '14.11.0'
45+
versionSpec: '14.18.2'
4646
checkLatest: true # Optional
4747

4848
- task: Npm@1
@@ -51,6 +51,12 @@ steps:
5151
command: 'custom'
5252
customCommand: 'install -g autorest@latest'
5353

54+
- task: Npm@1
55+
displayName: 'Install Rush'
56+
inputs:
57+
command: 'custom'
58+
customCommand: 'install -g @microsoft/rush'
59+
5460
- task: PowerShell@2
5561
displayName: 'Register PS Repository'
5662
inputs:

.gitmodules

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[submodule "autorest.powershell"]
2+
path = autorest.powershell
3+
url = https://github.com/Azure/autorest.powershell.git
4+
branch = msgraph
-5.81 MB
Binary file not shown.
-5.72 MB
Binary file not shown.
-5.53 MB
Binary file not shown.

autorest.powershell

Submodule autorest.powershell added at 0132d23

src/readme.graph.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
azure: false
77
powershell: true
88
version: latest
9-
use: "./assets/autorest-powershell-2.1.600.tgz"
9+
use: "$(this-folder)../autorest.powershell"
1010
metadata:
1111
authors: Microsoft Corporation
1212
owners: Microsoft Corporation
@@ -672,10 +672,6 @@ directive:
672672
let fromJsonRegex = /(\s*FromJson<\w*>\s*\(JsonObject\s*json\s*,\s*System\.Collections\.Generic\.IDictionary.*)(\s*)({)/gm
673673
$ = $.replace(fromJsonRegex, '$1$2$3\n$2 if (excludes != null){ excludes = new System.Collections.Generic.HashSet<string>(excludes, global::System.StringComparer.OrdinalIgnoreCase);}');
674674
675-
// Serialize DictionaryEntry struct as a value type.
676-
let dictionaryEntrySerializer = 'if (vValue is System.Collections.DictionaryEntry deValue){return new JsonObject { { deValue.Key.ToString(), ToJsonValue(deValue.Value) } };}';
677-
let valueTypeSerializerRegex = /(private\s*static\s*JsonNode\s*ToJsonValue\(ValueType vValue\)\s*{\s*)/gm
678-
$ = $.replace(valueTypeSerializerRegex, `$1 ${dictionaryEntrySerializer}\n`);
679675
return $;
680676
}
681677

tools/GenerateModules.ps1

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,12 @@ $AllowPreRelease = $true
7373
if ($ModulePreviewNumber -eq -1) {
7474
$AllowPreRelease = $false
7575
}
76+
77+
# Build AutoREST.PowerShell submodule.
78+
Set-Location (Join-Path $ScriptRoot "../autorest.powershell")
79+
rush update
80+
rush build
81+
7682
# Install module locally in order to specify it as a dependency for other modules down the generation pipeline.
7783
# https://stackoverflow.com/questions/46216038/how-do-i-define-requiredmodules-in-a-powershell-module-manifest-psd1.
7884
$ExistingAuthModule = Find-Module "Microsoft.Graph.Authentication" -Repository $RepositoryName -AllowPrerelease:$AllowPreRelease
@@ -157,7 +163,7 @@ $ModulesToGenerate | ForEach-Object -ThrottleLimit $NumberOfCores -Parallel {
157163

158164
try {
159165
# Generate PowerShell modules.
160-
& autorest --module-version:$ModuleVersion --service-name:$ModuleName $ModuleLevelReadMePath --version:"3.0.6306" --verbose
166+
& autorest --module-version:$ModuleVersion --service-name:$ModuleName --version:"3.0.6306" $ModuleLevelReadMePath --verbose
161167
if ($LASTEXITCODE) {
162168
Write-Error "AutoREST failed to generate '$ModuleName' module."
163169
break;
@@ -254,4 +260,4 @@ if ($Publish) {
254260
& $PublishModulePS1 -Modules $ModuleMapping.Keys -ModulePrefix $ModulePrefix -ArtifactsLocation $ArtifactsLocation -RepositoryName $RepositoryName -RepositoryApiKey $RepositoryApiKey
255261
}
256262

257-
Write-Host -ForegroundColor Green "-------------Done-------------"
263+
Write-Host -ForegroundColor Green "-------------Done-------------"

0 commit comments

Comments
 (0)