Skip to content

Commit 1f616a6

Browse files
committed
Merge branch 'main' into eslint-plugin-tsv
2 parents 21348ee + d832234 commit 1f616a6

38 files changed

+3979
-511
lines changed

.github/package-lock.json

-475
This file was deleted.

.gitignore

+1-2
Original file line numberDiff line numberDiff line change
@@ -132,10 +132,9 @@ eng/tools/**/dist
132132
# TypeScript cache
133133
*.tsbuildinfo
134134

135-
# No package-lock.json files should be commited except the top-level and .github
135+
# No package-lock.json files should be commited except the top-level.
136136
**/package-lock.json
137137
!/package-lock.json
138-
!/.github/package-lock.json
139138

140139
# No Armstrong outputs should be commited except the tf files.
141140
**/terraform/**/*.json

eng/common/scripts/SemVer.ps1

+88-19
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,10 @@ class AzureEngSemanticVersion : IComparable {
7878

7979
if ($null -eq $matches['prelabel'])
8080
{
81-
# artifically provide these values for non-prereleases to enable easy sorting of them later than prereleases.
82-
$this.PrereleaseLabel = "zzz"
83-
$this.PrereleaseNumber = 99999999
8481
$this.IsPrerelease = $false
8582
$this.VersionType = "GA"
8683
if ($this.Major -eq 0) {
87-
# Treat initial 0 versions as a prerelease beta's
84+
# Treat initial 0 versions as a prerelease beta's
8885
$this.VersionType = "Beta"
8986
$this.IsPrerelease = $true
9087
}
@@ -116,7 +113,7 @@ class AzureEngSemanticVersion : IComparable {
116113
# See https://azure.github.io/azure-sdk/policies_releases.html#package-versioning
117114
[bool] HasValidPrereleaseLabel()
118115
{
119-
if ($this.IsPrerelease -eq $true) {
116+
if ($this.PrereleaseLabel) {
120117
if ($this.PrereleaseLabel -ne $this.DefaultPrereleaseLabel -and $this.PrereleaseLabel -ne $this.DefaultAlphaReleaseLabel) {
121118
Write-Host "Unexpected pre-release identifier '$($this.PrereleaseLabel)', "`
122119
"should be '$($this.DefaultPrereleaseLabel)' or '$($this.DefaultAlphaReleaseLabel)'"
@@ -136,7 +133,7 @@ class AzureEngSemanticVersion : IComparable {
136133
{
137134
$versionString = "{0}.{1}.{2}" -F $this.Major, $this.Minor, $this.Patch
138135

139-
if ($this.IsPrerelease -and $this.PrereleaseLabel -ne "zzz")
136+
if ($this.PrereleaseLabel)
140137
{
141138
$versionString += $this.PrereleaseLabelSeparator + $this.PrereleaseLabel + `
142139
$this.PrereleaseNumberSeparator + $this.PrereleaseNumber
@@ -147,24 +144,42 @@ class AzureEngSemanticVersion : IComparable {
147144
return $versionString;
148145
}
149146

150-
[void] IncrementAndSetToPrerelease() {
151-
if ($this.IsPrerelease -eq $false)
147+
[void] IncrementAndSetToPrerelease($Segment) {
148+
if ($this.BuildNumber)
152149
{
153-
$this.PrereleaseLabel = $this.DefaultPrereleaseLabel
154-
$this.PrereleaseNumber = 1
155-
$this.Minor++
156-
$this.Patch = 0
157-
$this.IsPrerelease = $true
150+
throw "Cannot increment releases tagged with azure pipelines build numbers"
151+
}
152+
153+
if ($this.PrereleaseLabel)
154+
{
155+
$this.PrereleaseNumber++
158156
}
159157
else
160158
{
161-
if ($this.BuildNumber) {
162-
throw "Cannot increment releases tagged with azure pipelines build numbers"
159+
$this.$Segment++
160+
if($Segment -eq "Major") {
161+
$this.Minor = 0
162+
$this.Patch = 0
163163
}
164-
$this.PrereleaseNumber++
164+
if($Segment -eq "Minor") {
165+
$this.Patch = 0
166+
}
167+
168+
# If the major version is 0, we don't need a prerelease label
169+
if ($this.Major -ne 0)
170+
{
171+
$this.PrereleaseLabel = $this.DefaultPrereleaseLabel
172+
$this.PrereleaseNumber = 1
173+
}
174+
175+
$this.IsPrerelease = $true
165176
}
166177
}
167178

179+
[void] IncrementAndSetToPrerelease() {
180+
$this.IncrementAndSetToPrerelease("Minor")
181+
}
182+
168183
[void] SetupPythonConventions()
169184
{
170185
# Python uses no separators and "b" for beta so this sets up the the object to work with those conventions
@@ -198,11 +213,30 @@ class AzureEngSemanticVersion : IComparable {
198213
$ret = $this.Patch.CompareTo($other.Patch)
199214
if ($ret) { return $ret }
200215

216+
# provide artificial prerelease values for non-prereleases to sort them later than prereleases.
217+
if ($this.PrereleaseLabel) {
218+
$thisPrereleaseLabel = $this.PrereleaseLabel
219+
$thisPrereleaseNumber = $this.PrereleaseNumber
220+
}
221+
else {
222+
$thisPrereleaseLabel = "zzz"
223+
$thisPrereleaseNumber = 99999999
224+
}
225+
226+
if ($other.PrereleaseLabel) {
227+
$otherPrereleaseLabel = $other.PrereleaseLabel
228+
$otherPrereleaseNumber = $other.PrereleaseNumber
229+
}
230+
else {
231+
$otherPrereleaseLabel = "zzz"
232+
$otherPrereleaseNumber = 99999999
233+
}
234+
201235
# Mimic PowerShell that uses case-insensitive comparisons by default.
202-
$ret = [string]::Compare($this.PrereleaseLabel, $other.PrereleaseLabel, $true)
236+
$ret = [string]::Compare($thisPrereleaseLabel, $otherPrereleaseLabel, $true)
203237
if ($ret) { return $ret }
204238

205-
$ret = $this.PrereleaseNumber.CompareTo($other.PrereleaseNumber)
239+
$ret = $thisPrereleaseNumber.CompareTo($otherPrereleaseNumber)
206240
if ($ret) { return $ret }
207241

208242
return ([int] $this.BuildNumber).CompareTo([int] $other.BuildNumber)
@@ -360,6 +394,41 @@ class AzureEngSemanticVersion : IComparable {
360394
Write-Host "Error: Python beta string did not correctly increment"
361395
}
362396

397+
$version = [AzureEngSemanticVersion]::ParseVersionString("0.1.2")
398+
$version.IncrementAndSetToPrerelease()
399+
$expected = "0.2.0"
400+
if ($expected -ne $version.ToString()) {
401+
Write-Host "Error: version string did not correctly increment. Expected: $expected, Actual: $version"
402+
}
403+
404+
$version = [AzureEngSemanticVersion]::ParseVersionString("0.1.2")
405+
$version.IncrementAndSetToPrerelease("patch")
406+
$expected = "0.1.3"
407+
if ($expected -ne $version.ToString()) {
408+
Write-Host "Error: version string did not correctly increment. Expected: $expected, Actual: $version"
409+
}
410+
411+
$version = [AzureEngSemanticVersion]::ParseVersionString("0.1.2")
412+
$version.IncrementAndSetToPrerelease("minor")
413+
$expected = "0.2.0"
414+
if ($expected -ne $version.ToString()) {
415+
Write-Host "Error: version string did not correctly increment. Expected: $expected, Actual: $version"
416+
}
417+
418+
$version = [AzureEngSemanticVersion]::ParseVersionString("0.1.2")
419+
$version.IncrementAndSetToPrerelease("major")
420+
$expected = "1.0.0-beta.1"
421+
if ($expected -ne $version.ToString()) {
422+
Write-Host "Error: version string did not correctly increment. Expected: $expected, Actual: $version"
423+
}
424+
425+
$version = [AzureEngSemanticVersion]::ParseVersionString("1.0.0-beta.1")
426+
$version.IncrementAndSetToPrerelease()
427+
$expected = "1.0.0-beta.2"
428+
if ($expected -ne $version.ToString()) {
429+
Write-Host "Error: version string did not correctly increment. Expected: $expected, Actual: $version"
430+
}
431+
363432
Write-Host "QuickTests done"
364433
}
365-
}
434+
}

package-lock.json

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"@azure-tools/typespec-client-generator-core": "0.50.0",
1212
"@azure-tools/typespec-liftr-base": "0.7.0",
1313
"@azure/avocado": "^0.9.1",
14-
"@autorest/openapi-to-typespec": "0.10.7",
14+
"@autorest/openapi-to-typespec": "0.10.8",
1515
"@typespec/compiler": "0.64.0",
1616
"@typespec/http": "0.64.0",
1717
"@typespec/openapi": "0.64.0",

specification/computeschedule/ComputeSchedule.Management/client.tsp

+5
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ using Azure.ClientGenerator.Core;
55
using Microsoft.ComputeSchedule;
66

77
@@clientName(Microsoft.ComputeSchedule, "ComputeScheduleMgmt", "python");
8+
@@clientName(Microsoft.ComputeSchedule, "ComputeScheduleMgmtClient", "java");
9+
@@clientNamespace(Microsoft.ComputeSchedule,
10+
"com.azure.resourcemanager.computeschedule",
11+
"java"
12+
);
813

914
@@clientName(ScheduledActions.virtualMachinesSubmitDeallocate,
1015
"SubmitVirtualMachineDeallocate",

specification/computeschedule/ComputeSchedule.Management/tspconfig.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ options:
3434
"@azure-tools/typespec-java":
3535
package-dir: "azure-resourcemanager-computeschedule"
3636
flavor: "azure"
37-
namespace: "com.azure.resourcemanager.computeschedule"
3837
service-name: "Compute Schedule"
3938
linter:
4039
extends:
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"parameters": {
3+
"api-version": "2024-10-01",
4+
"subscriptionId": "00000000-0000-0000-0000-000000000000",
5+
"resourceGroupName": "myResourceGroup",
6+
"workspaceName": "myWorkspace"
7+
},
8+
"responses": {
9+
"200": {
10+
"body": {
11+
"saasSubscriptionDetails": {
12+
"planId": "amg_globalplan",
13+
"offerId": "amg_test",
14+
"publisherId": "isvtestuklegacy",
15+
"term": {
16+
"termUnit": "P1M",
17+
"startDate": "2022-10-04T00:00:00Z",
18+
"endDate": "2022-11-03T00:00:00Z"
19+
}
20+
},
21+
"marketplaceTrialQuota": {
22+
"availablePromotion": "None",
23+
"grafanaResourceId": "/subscriptions/e1e3b30d-e7ec-4e25-8587-db037bcb9a4d/resourcegroups/amg-local-script-test-rg/providers/microsoft.dashboard/grafana/eus2-enterprise-1001-07",
24+
"trialStartAt": "2022-10-04T01:06:00.447Z",
25+
"trialEndAt": "2022-11-03T01:06:00.447Z"
26+
}
27+
}
28+
}
29+
}
30+
}

0 commit comments

Comments
 (0)