You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sync eng/common directory with azure-sdk-tools for PR 6272 (Azure#30620)
* Support localspecrepo if pass in this parameter
* Support regen sdk code based on local typespecs
* Added reference doc to error message
---------
Co-authored-by: raychen <raychen@microsoft.com>
Write-Error"Missing service-dir in parameters section of tspconfig.yaml. Please refer to https://github.com/Azure/azure-rest-api-specs/blob/main/specification/contosowidgetmanager/Contoso.WidgetManager/tspconfig.yaml for the right schema."
Write-Error"Missing package-dir in $emitterName options of tspconfig.yaml."
91
+
Write-Error"Missing package-dir in $emitterName options of tspconfig.yaml. Please refer to https://github.com/Azure/azure-rest-api-specs/blob/main/specification/contosowidgetmanager/Contoso.WidgetManager/tspconfig.yaml for the right schema."
# example url of tspconfig.yaml: https://github.com/Azure/azure-rest-api-specs-pr/blob/724ccc4d7ef7655c0b4d5c5ac4a5513f19bbef35/specification/containerservice/Fleet.Management/tspconfig.yaml
102
114
if ($TypeSpecProjectDirectory-match'^https://github.com/(?<repo>Azure/azure-rest-api-specs(-pr)?)/blob/(?<commit>[0-9a-f]{40})/(?<path>.*)/tspconfig.yaml$') {
@@ -121,26 +133,26 @@ if ($TypeSpecProjectDirectory -match '^https://github.com/(?<repo>Azure/azure-re
if ($TypeSpecProjectDirectory-match"^.*/(?<path>specification/.*)$") {
136
+
if ($TypeSpecProjectDirectory-match"(?<repoRoot>^.*)/(?<path>specification/.*)$") {
125
137
$TypeSpecProjectDirectory=$Matches["path"]
138
+
$specRepoRoot=$Matches["repoRoot"]
126
139
} else {
127
140
Write-Error"$TypeSpecProjectDirectory doesn't have 'specification' in path."
128
141
exit1
129
142
}
130
-
if (!$CommitHash) {
131
-
Write-Error"Parameter of Commithash is not provided in the local path scenario."
132
-
exit1
143
+
if (!$CommitHash-or!$RepoUrl) {
144
+
Write-Warning"Parameter of Commithash or RepoUrl are not provided along with the local path of tspconfig.yaml, trying to re-generate sdk code based on the local type specs."
145
+
$generateFromLocalTypeSpec=$true
133
146
}
134
-
if (!$RepoUrl) {
135
-
Write-Error"Parameter of RepoUrl:$RepoUrl is not provided in the local path scenario."
136
-
exit1
137
-
}
138
-
if ($RepoUrl-match"^https://github.com/(?<repo>[^/]*/azure-rest-api-specs(-pr)?).*") {
139
-
$repo=$Matches["repo"]
140
-
}
141
-
else {
142
-
Write-Error"Parameter 'RepoUrl' has incorrect value:$RepoUrl. It should be similar like 'https://github.com/Azure/azure-rest-api-specs'"
143
-
exit1
147
+
148
+
if ($RepoUrl) {
149
+
if ($RepoUrl-match"^https://github.com/(?<repo>[^/]*/azure-rest-api-specs(-pr)?).*") {
150
+
$repo=$Matches["repo"]
151
+
}
152
+
else {
153
+
Write-Error"Parameter 'RepoUrl' has incorrect value:$RepoUrl. It should be similar like 'https://github.com/Azure/azure-rest-api-specs'"
Write-Error"Failed to find tsp-location.yaml in '$sdkProjectFolder', please make sure to provide CommitHash and RepoUrl parameters along with the local path of tspconfig.yaml in order to create tsp-location.yaml."
0 commit comments