Skip to content
This repository was archived by the owner on Sep 27, 2019. It is now read-only.

Commit d7a5528

Browse files
authored
Change warninglevel to 1 for generating assembly for Azure Swagger specs. (#331)
```powershell Generating module for 'C:\temp\AzureSwaggerSpecs\SwaggerSpecs\monitor\autoscale_API.json'. PSSwaggerUtility\Add-PSSwaggerClientType : C:\temp\AzureSwaggerSpecs\AzModules\symbols\Azmonitor\0.0.1\Generated.Microsoft.PowerShell.Azmonitor.v001.cs(433,23): warning CS0108: 'ActivityLogAlertLeafCondition.Equals' hides inherited member 'object. the new keyword if hiding was intended. At C:\Code\PSSwagger\PSSwagger\PSSwagger.psm1:900 char:14 + ... if(-not (PSSwaggerUtility\Add-PSSwaggerClientType @AddPSSwaggerCli ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException + FullyQualifiedErrorId : SOURCE_CODE_ERROR,Add-PSSwaggerClientType ConvertTo-CsharpCode : Unable to generate 'Microsoft.PowerShell.Azmonitor.v001.dll' assembly At C:\Code\PSSwagger\PSSwagger\PSSwagger.psm1:545 char:37 + ... lyGenerationResult = ConvertTo-CsharpCode @ConvertToCsharpCode_params + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException + FullyQualifiedErrorId : UnableToGenerateAssembly,ConvertTo-CsharpCode ``` Minor additional changes - Fixed the issue for setting $env:PSModulePath to compile coreclr binary - Added verb mapping for 'Verify' --> 'Test'.
1 parent 37e72af commit d7a5528

File tree

3 files changed

+103
-103
lines changed

3 files changed

+103
-103
lines changed

PSSwagger/PSCommandVerbMap.ps1

Lines changed: 100 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -9,134 +9,135 @@
99
#########################################################################################
1010
$script:PSCommandVerbMap = @{
1111

12-
Access = 'Get'
13-
List = 'Get'
14-
Cat = 'Get'
15-
Type = 'Get'
16-
Dir = 'Get'
17-
Obtain = 'Get'
18-
Dump = 'Get'
19-
Acquire = 'Get'
20-
Examine = 'Get'
21-
Suggest = 'Get'
22-
23-
Create = 'New'
24-
Generate = 'New'
25-
Allocate = 'New'
26-
Provision = 'New'
27-
Make = 'New'
12+
Access = 'Get'
13+
List = 'Get'
14+
Cat = 'Get'
15+
Type = 'Get'
16+
Dir = 'Get'
17+
Obtain = 'Get'
18+
Dump = 'Get'
19+
Acquire = 'Get'
20+
Examine = 'Get'
21+
Suggest = 'Get'
22+
23+
Create = 'New'
24+
Generate = 'New'
25+
Allocate = 'New'
26+
Provision = 'New'
27+
Make = 'New'
2828

2929
CreateOrUpdate = 'New,Set'
30-
Failover = 'Set'
31-
Assign = 'Set'
32-
Configure = 'Set'
30+
Failover = 'Set'
31+
Assign = 'Set'
32+
Configure = 'Set'
3333

34-
Activate = 'Initialize'
34+
Activate = 'Initialize'
3535

36-
Build = 'Build'
37-
Compile = 'Build'
36+
Build = 'Build'
37+
Compile = 'Build'
3838

39-
Deploy = 'Deploy'
39+
Deploy = 'Deploy'
4040

41-
Apply = 'Add'
42-
Append = 'Add'
43-
Attach = 'Add'
44-
Concatenate = 'Add'
45-
Insert = 'Add'
41+
Apply = 'Add'
42+
Append = 'Add'
43+
Attach = 'Add'
44+
Concatenate = 'Add'
45+
Insert = 'Add'
4646

47-
Delete = 'Remove'
48-
Cut = 'Remove'
49-
Dispose = 'Remove'
50-
Discard = 'Remove'
47+
Delete = 'Remove'
48+
Cut = 'Remove'
49+
Dispose = 'Remove'
50+
Discard = 'Remove'
5151

52-
Generalize = 'Reset'
53-
54-
Patch = 'Update'
55-
Refresh = 'Update'
56-
Regenerate = 'Update' # Alternatives: Redo, New, Reset
57-
Reprocess = "Update" # Alternatives: Redo
58-
Upgrade = 'Update'
59-
Reimage = 'Update' # Alternatives: Format, Reset
60-
61-
Validate = 'Test'
62-
Check = 'Test'
63-
Analyze = 'Test'
64-
Is = 'Test'
65-
Evaluate = 'Test' # Alternatives: Invoke
66-
67-
Power = 'Start'
68-
PowerOn = 'Start'
69-
Run = 'Start' # Alternatives: Invoke
70-
Trigger = 'Start'
71-
72-
Pause = 'Suspend'
52+
Generalize = 'Reset'
53+
54+
Patch = 'Update'
55+
Refresh = 'Update'
56+
Regenerate = 'Update' # Alternatives: Redo, New, Reset
57+
Reprocess = "Update" # Alternatives: Redo
58+
Upgrade = 'Update'
59+
Reimage = 'Update' # Alternatives: Format, Reset
60+
61+
Validate = 'Test'
62+
Check = 'Test'
63+
Verify = 'Test'
64+
Analyze = 'Test'
65+
Is = 'Test'
66+
Evaluate = 'Test' # Alternatives: Invoke
67+
68+
Power = 'Start'
69+
PowerOn = 'Start'
70+
Run = 'Start' # Alternatives: Invoke
71+
Trigger = 'Start'
72+
73+
Pause = 'Suspend'
7374

74-
Cancel = 'Stop'
75-
PowerOff = 'Stop'
76-
End = 'Stop'
77-
Shutdown = 'Stop'
75+
Cancel = 'Stop'
76+
PowerOff = 'Stop'
77+
End = 'Stop'
78+
Shutdown = 'Stop'
7879

79-
Reboot = 'Restart'
80-
ForceReboot = 'Restart'
80+
Reboot = 'Restart'
81+
ForceReboot = 'Restart'
8182

82-
Finish = 'Complete'
83+
Finish = 'Complete'
8384

84-
Wipe = 'Clear'
85-
Purge = 'Clear' # Alternatives: Remove
86-
Flush = 'Clear'
87-
Erase = 'Clear'
88-
Unmark = 'Clear'
89-
Unset = 'Clear'
90-
Nullify = 'Clear'
85+
Wipe = 'Clear'
86+
Purge = 'Clear' # Alternatives: Remove
87+
Flush = 'Clear'
88+
Erase = 'Clear'
89+
Unmark = 'Clear'
90+
Unset = 'Clear'
91+
Nullify = 'Clear'
9192

92-
Recover = 'Restore'
93-
Undelete = 'Restore'
93+
Recover = 'Restore'
94+
Undelete = 'Restore'
9495

95-
Synchronize = 'Sync'
96-
Synch = 'Sync'
96+
Synchronize = 'Sync'
97+
Synch = 'Sync'
9798

98-
Load = 'Import'
99+
Load = 'Import'
99100

100-
Capture = 'Export' # Alternatives: Trace
101+
Capture = 'Export' # Alternatives: Trace
101102

102-
Migrate = 'Move' # Alternatives: Export
103-
Transfer = 'Move'
104-
Name = 'Move'
103+
Migrate = 'Move' # Alternatives: Export
104+
Transfer = 'Move'
105+
Name = 'Move'
105106

106-
Change = 'Rename'
107+
Change = 'Rename'
107108

108-
Swap = 'Switch' # Alternatives: Move
109+
Swap = 'Switch' # Alternatives: Move
109110

110-
Execute = 'Invoke'
111+
Execute = 'Invoke'
111112

112-
Discover = 'Find' # Alternatives: Search
113-
Locate = 'Find'
113+
Discover = 'Find' # Alternatives: Search
114+
Locate = 'Find'
114115

115-
Release = 'Publish' # Alternatives: Clear, Unlock
116+
Release = 'Publish' # Alternatives: Clear, Unlock
116117

117-
Resubmit = 'Submit'
118+
Resubmit = 'Submit'
118119

119-
Duplicate = 'Copy'
120-
Clone = 'Copy'
121-
Replicate = 'Copy'
120+
Duplicate = 'Copy'
121+
Clone = 'Copy'
122+
Replicate = 'Copy'
122123

123-
Into = 'Enter'
124+
Into = 'Enter'
124125

125-
Combine = 'Join'
126-
Unite = 'Join'
127-
Associate = 'Join'
126+
Combine = 'Join'
127+
Unite = 'Join'
128+
Associate = 'Join'
128129

129-
Restrict = 'Lock'
130-
Secure = 'Lock'
130+
Restrict = 'Lock'
131+
Secure = 'Lock'
131132

132-
Unrestrict = 'Unlock'
133-
Unsecure = 'Unlock'
133+
Unrestrict = 'Unlock'
134+
Unsecure = 'Unlock'
134135

135-
Display = 'Show'
136-
Produce = 'Show'
136+
Display = 'Show'
137+
Produce = 'Show'
137138

138-
Bypass = 'Skip'
139-
Jump = 'Skip'
139+
Bypass = 'Skip'
140+
Jump = 'Skip'
140141

141-
Separate = 'Split'
142+
Separate = 'Split'
142143
}

PSSwagger/PSSwagger.psm1

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -927,7 +927,7 @@ function ConvertTo-CsharpCode
927927

928928
# In some cases, PSCore doesn't inherit this process's PSModulePath
929929
$command = @"
930-
`$env:PSModulePath = `"$env:PSModulePath`";
930+
`$env:PSModulePath += ';$env:PSModulePath'
931931
`$AddPSSwaggerClientType_params = @{
932932
OutputAssemblyName = '$outAssembly'
933933
ClrPath = '$clrPath'
@@ -938,7 +938,6 @@ function ConvertTo-CsharpCode
938938
CodeCreatedByAzureGenerator = `$$codeCreatedByAzureGenerator
939939
BootstrapConsent = `$$UserConsent
940940
}
941-
`$env:PSModulePath += ';$env:PSModulePath'
942941
PSSwaggerUtility\Add-PSSwaggerClientType @AddPSSwaggerClientType_params
943942
"@
944943
$success = & "$PowerShellCorePath" -command "& {$command}"

PSSwagger/PSSwaggerUtility/PSSwaggerUtility.psm1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -733,7 +733,7 @@ function Get-AddTypeParameters {
733733
if (-not (Get-OperatingSystemInfo).IsCore) {
734734
$AddTypeParams['Path'] = $SourceCodeFilePath
735735
$compilerParameters = New-Object -TypeName System.CodeDom.Compiler.CompilerParameters
736-
$compilerParameters.WarningLevel = 3
736+
$compilerParameters.WarningLevel = 1
737737
$compilerParameters.CompilerOptions = '/debug:full'
738738
if ($TestBuild) {
739739
$compilerParameters.IncludeDebugInformation = $true
@@ -807,7 +807,7 @@ function Get-CscParameters {
807807
$SourceCodeFilePath
808808
'/nologo',
809809
'/checked',
810-
'/warn:3',
810+
'/warn:1',
811811
'/debug:full',
812812
'/platform:anycpu',
813813
"/target:$TargetType"

0 commit comments

Comments
 (0)