Skip to content
This repository was archived by the owner on Sep 27, 2019. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 0 additions & 39 deletions PSSwagger/PSSwagger.Azure.Helpers/PSSwagger.Azure.Helpers.psd1

This file was deleted.

141 changes: 0 additions & 141 deletions PSSwagger/PSSwagger.Azure.Helpers/PSSwagger.Azure.Helpers.psm1

This file was deleted.

This file was deleted.

This file was deleted.

1 change: 1 addition & 0 deletions PSSwagger/PSSwagger.Resources.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ ConvertFrom-StringData @'
SamePropertyName=Same property name '{0}' is defined in a definition '{1}' with AllOf inheritance.
DataTypeNotImplemented=Please get an implementation of '{0}' for '{1}'
AutoRestNotInPath=Unable to find AutoRest in PATH environment. Ensure the PATH is updated.
CscExeNotInPath=Unable to find CSC.exe in PATH environment. Ensure the PATH is updated with CSC.exe location.
AutoRestError=AutoRest resulted in an error
SwaggerParamsMissing=No parameters in the Swagger
SwaggerDefinitionsMissing=No definitions in the Swagger
Expand Down
12 changes: 8 additions & 4 deletions PSSwagger/PSSwagger.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,12 @@ function ConvertTo-CsharpCode

$autoRestExePath = "AutoRest"
if (-not (get-command -name $autoRestExePath)) {
throw $LocalizedData.AutoRestNotInPath
throw $LocalizedData.AutoRestNotInPath
}

if (-not (Get-OperatingSystemInfo).IsCore -and
(-not (Get-Command -Name 'Csc.Exe' -ErrorAction Ignore))) {
throw $LocalizedData.CscExeNotInPath
}

$outputDirectory = $SwaggerMetaDict['outputDirectory']
Expand Down Expand Up @@ -718,7 +723,7 @@ function ConvertTo-CsharpCode
-CliXmlTmpPath $cliXmlTmpPath"

$success = & "powershell" -command "& {$command}"

$codeReflectionResult = Import-CliXml -Path $cliXmlTmpPath
if ($codeReflectionResult.ContainsKey('VerboseMessages') -and $codeReflectionResult.VerboseMessages -and ($codeReflectionResult.VerboseMessages.Count -gt 0)) {
$verboseMessages = $codeReflectionResult.VerboseMessages -Join [Environment]::NewLine
Expand Down Expand Up @@ -773,8 +778,7 @@ function ConvertTo-CsharpCode
}
$dependencies = Get-PSSwaggerExternalDependencies -Azure:$codeCreatedByAzureGenerator -Framework 'netstandard1'
$microsoftRestClientRuntimeAzureRequiredVersion = if ($dependencies.ContainsKey('Microsoft.Rest.ClientRuntime.Azure')) { $dependencies['Microsoft.Rest.ClientRuntime.Azure'].RequiredVersion } else { '' }
$command = "Import-Module '$PSScriptRoot\PSSwaggerUtility';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Import-Module '$PSScriptRoot\PSSwaggerUtility' [](start = 20, length = 46)

Consider separating this fix if a 0.2.1 hotfix release sounds correct.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you mean by "if a 0.2.1 hotfix release sounds correct."?

We should not use $PSScriptRoot for importing the PSSwaggerUtility module. I am not sure, how a hotfix will fix this without removing below line.
Import-Module '$PSScriptRoot\PSSwaggerUtility'

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If releasing a 0.2.1 hotfix to gallery sounds correct to resolve this breaking issue, consider separating this fix from the CSC changes. Otherwise, to fix this issue, we will have to release the CSC changes as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change doesn't qualify to be hotfix for PSSwagger module as this line just writes an Import-Module error in verbose stream and it wont block the cmdlet execution. I am planning to release the new versions of our modules after enabling latest AutoRest support.

Add-PSSwaggerClientType -OutputAssemblyName '$outAssembly' ``
$command = "PSSwaggerUtility\Add-PSSwaggerClientType -OutputAssemblyName '$outAssembly' ``
-ClrPath '$clrPath' ``
-CSharpFiles $allCSharpFilesArrayString ``
-MicrosoftRestClientRuntimeAzureRequiredVersion '$microsoftRestClientRuntimeAzureRequiredVersion' ``
Expand Down
Loading