Skip to content

Commit 9ed906e

Browse files
authored
Merge branch 'main' into added-handletype-translation2d
2 parents ea75af1 + 114b6a3 commit 9ed906e

File tree

82 files changed

+1063
-33737
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+1063
-33737
lines changed

Pipelines/Config/settings.yaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,4 @@ variables:
44
# match (see scripts/packaging/versionmetadata.ps1)
55
# ProjectSettings/ProjectSettings.asset: bundleVersion: x.x.x
66
# ProjectSettings/ProjectSettings.asset: metroPackageVersion: x.x.x.0
7-
MRTKVersion: 3.0.0 # used for overall build number, but each package version is read from the package.json file in each package directory.
8-
MRTKReleaseTag: 'pre.20' # final version component, e.g. 'RC2.1' or empty string.
9-
ReleasePackages: '"org.mixedrealitytoolkit.audio,org.mixedrealitytoolkit.core,org.mixedrealitytoolkit.diagnostics,org.mixedrealitytoolkit.extendedassets,org.mixedrealitytoolkit.input,org.mixedrealitytoolkit.spatialmanipulation,org.mixedrealitytoolkit.standardassets,org.mixedrealitytoolkit.tools,org.mixedrealitytoolkit.uxcomponents,org.mixedrealitytoolkit.uxcomponents.noncanvas,org.mixedrealitytoolkit.uxcore,org.mixedrealitytoolkit.windowsspeech"' # array of packages that shouldn't get the prerelease tag e.g. '"org.mixedrealitytoolkit.core,org.mixedrealitytoolkit.tools"'
7+
ProjectVersion: 3.0.0 # used for overall build number of sample projects

Pipelines/Scripts/edit-version.ps1

Lines changed: 0 additions & 101 deletions
This file was deleted.

Pipelines/Scripts/pack-upm.ps1

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,31 +10,24 @@
1010
The root folder of the project.
1111
.PARAMETER OutputDirectory
1212
Where should we place the output? Defaults to ".\artifacts"
13-
.PARAMETER BuildNumber
14-
The fourth digit for the full version number for assembly versioning. This is the build number.
15-
.PARAMETER ReleaseLabel
16-
The tag to append after the version (e.g. "internal" or "prerelease"). Leave blank for a release build.
17-
.PARAMETER ExperimentLabel
18-
An additional tag to append after the version, to append after the release label (e.g. "pre.1"). Historically used for the MRTK3 packages that are still experimental.
13+
.PARAMETER PrereleaseTag
14+
The tag to append after the version (e.g. "build", "internal" or "prerelease"). Leave blank for a release build.
1915
.PARAMETER Revision
2016
The revision number for the build, to append after the release labal and suffix.
21-
.PARAMETER ReleasePackages
22-
An array of the package names that have been released, and no longer in experimentation. If the package isn't in this array, it will get labeled with the ExperimentLabel.
17+
.PARAMETER BuildNumber
18+
The fourth digit for the full version number for assembly versioning. This is the build number.
2319
2420
#>
2521
param(
2622
[Parameter(Mandatory = $true)]
2723
[string]$ProjectRoot,
2824
[string]$OutputDirectory = "./artifacts/upm",
29-
[ValidatePattern("\d+")]
30-
[string]$BuildNumber,
3125
[ValidatePattern("[A-Za-z]*")]
32-
[string]$ReleaseLabel = "",
33-
[ValidatePattern("([A-Za-z]+\.\d+)?")]
34-
[string]$ExperimentLabel = "",
26+
[string]$PrereleaseTag = "",
3527
[ValidatePattern("(\d(\.\d+)*)?")]
3628
[string]$Revision = "",
37-
[string]$ReleasePackages = ""
29+
[ValidatePattern("\d+")]
30+
[string]$BuildNumber
3831
)
3932

4033
$ProjectRoot = Resolve-Path -Path $ProjectRoot
@@ -55,7 +48,7 @@ try {
5548
Push-Location $OutputDirectory
5649

5750
# Update package versions
58-
. $PSScriptRoot\update-versions.ps1 -PackagesRoot $ProjectRoot -BuildNumber $BuildNumber -ReleaseLabel $ReleaseLabel -ExperimentLabel $ExperimentLabel -Revision $Revision -ReleasePackages $ReleasePackages
51+
. $PSScriptRoot\update-versions.ps1 -PackagesRoot $ProjectRoot -PrereleaseTag $PrereleaseTag -Revision $Revision -BuildNumber $BuildNumber
5952

6053
# Loop through package directories and copy documentation
6154
Get-ChildItem -Path $ProjectRoot/*/package.json | ForEach-Object {

Pipelines/Scripts/repackage-for-release.ps1

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -63,21 +63,9 @@ try {
6363
Write-Host -ForegroundColor Green "======================================="
6464
Write-Host -ForegroundColor Green "Updating package to release package"
6565
Write-Host -ForegroundColor Green "======================================="
66-
67-
$inlineVersion = Select-String '^.*"version":\s*"(?<sem>[0-9]\.[0-9]\.[0-9])(-(?<label>[a-zA-Z]+)(\.(?<experiment>[a-zA-Z]+\.\d+))?(\.(?<revision>\d(\.\d+)*))?)?' -InputObject (Get-Content -Path $_)
68-
$version = $inlineVersion.Matches[0].Groups['sem'].Value
69-
$releaseLabel = $inlineVersion.Matches[0].Groups['label'].Value
70-
$experimentLabel = $inlineVersion.Matches[0].Groups['experiment'].Value
71-
$revision = $inlineVersion.Matches[0].Groups['revision'].Value
72-
73-
Write-Host "Package name: $packageName"
74-
Write-Host "Old version: $version"
75-
Write-Host "Old release label: $releaseLabel"
76-
Write-Host "Old experiment label: $experimentLabel"
77-
Write-Host "Old revision: $revision"
7866

79-
# Update package versions
80-
. $PSScriptRoot\update-versions.ps1 -PackagesRoot $packagePath -ExperimentLabel $experimentLabel -ReleasePackages $ReleasePackages
67+
# Update package versions for release
68+
. $PSScriptRoot\update-versions.ps1 -PackagesRoot $packagePath
8169
}
8270

8371
# Repackage the package directories

Pipelines/Scripts/update-versions.ps1

Lines changed: 74 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -3,50 +3,40 @@
33

44
<#
55
.SYNOPSIS
6-
Updates the version of the UPM packages in the project.
6+
Updates the version of the UPM packages in the project with a release label, revision, and build number.
77
.DESCRIPTION
8-
Updates the version of the UPM packages in the project.
8+
The script will update the version of the package.json file with the new version label and revision number. This
9+
script will also update the AssemblyInfo.cs file with the new version number and build number. Finally, this
10+
script will update the CHANGELOG.md file with the new version number and release date.
911
.PARAMETER PackagesRoot
1012
The root folder containing the packages.
13+
.PARAMETER PrereleaseTag
14+
The tag to append after the version (e.g. "build", "internal" or "prerelease"). Leave blank for a release build.
15+
.PARAMETER Revision
16+
The revision number for the build, to append after the release labal.
1117
.PARAMETER BuildNumber
1218
The fourth digit for the full version number for assembly versioning. This is the build number.
13-
.PARAMETER ReleaseLabel
14-
The tag to append after the version (e.g. "internal" or "prerelease"). Leave blank for a release build.
15-
.PARAMETER ExperimentLabel
16-
An additional tag to append after the version, to append after the release label (e.g. "pre.1"). Historically used for the MRTK3 packages that are still experimental.
17-
.PARAMETER Revision
18-
The revision number for the build, to append after the release labal and suffix.
19-
.PARAMETER ReleasePackages
20-
An array of the package names that are no longer If the package isn't in this array, it will get labeled with the ExperimentLabel.
2119
#>
2220
param(
2321
[Parameter(Mandatory = $true)]
2422
[string]$PackagesRoot,
25-
[ValidatePattern("\d+")]
26-
[string]$BuildNumber,
2723
[ValidatePattern("[A-Za-z]*")]
28-
[string]$ReleaseLabel = "",
29-
[ValidatePattern("([A-Za-z]+\.\d+)?")]
30-
[string]$ExperimentLabel = "",
24+
[string]$PrereleaseTag = "",
3125
[ValidatePattern("(\d(\.\d+)*)?")]
3226
[string]$Revision = "",
33-
[string]$ReleasePackages = ""
27+
[ValidatePattern("\d+")]
28+
[string]$BuildNumber
3429
)
3530

36-
$releasePkgs = $ReleasePackages.Split(",")
3731
$PackagesRoot = Resolve-Path -Path $PackagesRoot
3832

3933
if (-not [string]::IsNullOrEmpty($BuildNumber)) {
4034
$BuildNumber = $BuildNumber.Trim('.')
4135
$BuildNumber = ".$BuildNumber"
4236
}
4337

44-
if (-not [string]::IsNullOrEmpty($ReleaseLabel)) {
45-
$ReleaseLabel = $ReleaseLabel.Trim('.')
46-
}
47-
48-
if (-not [string]::IsNullOrEmpty($ExperimentLabel)) {
49-
$ExperimentLabel = $ExperimentLabel.Trim('.')
38+
if (-not [string]::IsNullOrEmpty($PrereleaseTag)) {
39+
$PrereleaseTag = $PrereleaseTag.Trim('.')
5040
}
5141

5242
if (-not [string]::IsNullOrEmpty($Revision)) {
@@ -58,21 +48,28 @@ Write-Host -ForegroundColor Green "======================================="
5848
Write-Host -ForegroundColor Green "Updating All Package Versions"
5949
Write-Host -ForegroundColor Green "======================================="
6050
Write-Output "Project root: $PackagesRoot"
61-
Write-Output "Release packages: $releasePkgs"
6251

6352
$year = "{0:D4}" -f (Get-Date).Year
6453
$month = "{0:D2}" -f (Get-Date).Month
6554
$day = "{0:D2}" -f (Get-Date).Day
6655

6756
# loop through package directories, update package version, assembly version, and build version hash for updating dependencies
6857
Get-ChildItem -Path $PackagesRoot -Filter "package.json" -Recurse | ForEach-Object {
69-
$packageName = Select-String -Pattern "org\.mixedrealitytoolkit\.\w+(\.\w+)*" -Path $_ | Select-Object -First 1
58+
# Get the content of the package.json file
59+
$jsonContent = Get-Content $_.FullName | Out-String | ConvertFrom-Json
60+
61+
# Read the package name
62+
$packageName = $jsonContent.name
7063

71-
if (-not $packageName) {
72-
return # this is not an MRTK package, so skip
64+
# Test is package name starts with org.mixedrealitytoolkit to verify it's an MRTK package
65+
if ($packageName -notmatch "^org\.mixedrealitytoolkit\.\w+(\.\w+)*") {
66+
return
7367
}
7468

75-
$packageName = $packageName.Matches[0].Value
69+
# Read the version value
70+
$version = $jsonContent.version
71+
72+
# Get the package path
7673
$packagePath = $_.Directory
7774

7875
Write-Host ""
@@ -81,32 +78,61 @@ Get-ChildItem -Path $PackagesRoot -Filter "package.json" -Recurse | ForEach-Obje
8178
Write-Host -ForegroundColor Green "======================================="
8279
Write-Output "Package name: $packageName"
8380

84-
$inlineVersion = Select-String '"version" *: *"([0-9.]+)(-?[a-zA-Z0-9.]*)' -InputObject (Get-Content -Path $_)
85-
$version = $inlineVersion.Matches.Groups[1].Value
81+
# This regex will match the a valid version is the package.json file. Some examples of valid versions are:
82+
#
83+
# 1.0.0
84+
# 1.0.0-pre.1
85+
# 1.0.0-development.pre.1
86+
# 1.0.0-development
87+
#
88+
# In these example "development" is the prerelease tag and "pre.1" is the meta tag.
89+
$validVersion = $version -match '(?<version>[0-9.]+)(-((?<prereleaseTag>[a-zA-Z0-9]*)?(?=$|\.[a-zA-Z])|)((?(?<=-)|\.)(?<metaTag>[a-zA-Z][a-zA-Z0-9]*)\.(?<metaTagVersion>[1-9][0-9]*))?)'
90+
if (-not $validVersion) {
91+
throw "Failed to parse version out of the package.json file at $($_.FullName)"
92+
}
8693

87-
$labelParts = @()
94+
# Get the version parts from the $Matches variable, and verify that the version key exists.
95+
$versionParts = $Matches
96+
if (-not $versionParts.ContainsKey('version')) {
97+
throw "Failed to parse version out of the package.json file at $($_.FullName)"
98+
}
99+
100+
# Get the version
101+
$version = $versionParts['version']
102+
103+
# Get all tag parts to append to the version
104+
$tagParts = @()
88105

89-
if (-not [string]::IsNullOrEmpty($ReleaseLabel)) {
90-
$labelParts += $ReleaseLabel
106+
# Add the new version label if it's not empty
107+
if (-not [string]::IsNullOrEmpty($PrereleaseTag)) {
108+
$tagParts += $PrereleaseTag
91109
}
92110

93-
if ((-not [string]::IsNullOrEmpty($ExperimentLabel)) -and
94-
(-not $releasePkgs.Contains($packageName))) {
95-
$labelParts += $ExperimentLabel
111+
# Add the optional metatag tag and version if found in match
112+
if ($versionParts.ContainsKey('metaTag') -and $versionParts.ContainsKey('metaTagVersion')) {
113+
$tagParts += $versionParts['metaTag']
114+
$tagParts += $versionParts['metaTagVersion']
96115
}
97116

117+
# Add the revision number if it's not empty
98118
if (-not [string]::IsNullOrEmpty($Revision)) {
99-
$labelParts += $Revision
119+
$tagParts += $Revision
100120
}
101121

102-
$label = $labelParts -join "."
103-
if (-not [string]::IsNullOrEmpty($label)) {
104-
$label = "-" + $label
122+
# Create a full tag string with prerelease tag and the meta tag
123+
$tag = $tagParts -join "."
124+
if (-not [string]::IsNullOrEmpty($tag)) {
125+
$tag = "-" + $tag
105126
}
106127

107-
Write-Output "Patching package version to $version$label"
108-
((Get-Content -Path $_ -Raw) -Replace '("version": )"(?:[0-9.]+|%version%)-?[a-zA-Z0-9.]*', "`$1`"$version$label") | Set-Content -Path $_ -NoNewline
128+
# Update the version with the new tag
129+
$jsonContent.version = "$version$tag"
130+
131+
# Write json content back to the file
132+
Write-Output "Patching package version to $version$tag"
133+
$jsonContent | ConvertTo-Json -Depth 10 | Set-Content -Path $_.FullName
109134

135+
# Update the assembly version in the AssemblyInfo.cs file
110136
Get-ChildItem -Path $packagePath/AssemblyInfo.cs -Recurse | ForEach-Object {
111137
$assemblyInfo = Get-Content -Path $_ -Raw
112138

@@ -120,19 +146,20 @@ Get-ChildItem -Path $PackagesRoot -Filter "package.json" -Recurse | ForEach-Obje
120146
$assemblyInfo += "[assembly: AssemblyFileVersion(`"$version$BuildNumber`")]`r`n"
121147
}
122148

123-
Write-Output "Patching assembly information version to $version$label"
149+
Write-Output "Patching assembly information version to $version$tag"
124150
if ($assemblyInfo -Match "\[assembly: AssemblyInformationalVersion\`(\`".*\`"\)\]") {
125-
$assemblyInfo = $assemblyInfo -Replace "\[assembly: AssemblyInformationalVersion\`(\`".*\`"\)\]", "[assembly: AssemblyInformationalVersion(`"$version$label`")]"
151+
$assemblyInfo = $assemblyInfo -Replace "\[assembly: AssemblyInformationalVersion\`(\`".*\`"\)\]", "[assembly: AssemblyInformationalVersion(`"$version$tag`")]"
126152
} else {
127-
$assemblyInfo += "[assembly: AssemblyInformationalVersion(`"$version$label`")]`r`n"
153+
$assemblyInfo += "[assembly: AssemblyInformationalVersion(`"$version$tag`")]`r`n"
128154
}
129155

130156
Set-Content -Path $_ -Value $assemblyInfo -NoNewline
131157
}
132158

133-
Write-Output "Patching CHANGELOG.md version to [$version$label] - $year-$month-$day"
159+
# Update the CHANGELOG.md file with the new version and release date
160+
Write-Output "Patching CHANGELOG.md version to [$version$tag] - $year-$month-$day"
134161
Get-ChildItem -Path $packagePath/CHANGELOG.md -Recurse | ForEach-Object {
135-
(Get-Content -Path $_ -Raw) -Replace "## \[$version(-[a-zA-Z0-9.]+)?\] - \b\d{4}\b-\b(0[1-9]|1[0-2])\b-\b(0[1-9]|[12][0-9]|3[01])\b", "## [$version$label] - $year-$month-$day" | Set-Content -Path $_ -NoNewline
162+
(Get-Content -Path $_ -Raw) -Replace "## \[$version(-[a-zA-Z0-9.]+)?\] - \b\d{4}\b-\b(0[1-9]|1[0-2])\b-\b(0[1-9]|[12][0-9]|3[01])\b", "## [$version$tag] - $year-$month-$day" | Set-Content -Path $_ -NoNewline
136163
}
137164
}
138165

Pipelines/Templates/docs.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ steps:
1818
filePath: ${{ parameters.mrtkProjectRoot }}/Pipelines/Scripts/update-versions.ps1
1919
arguments: >
2020
-PackagesRoot: ${{ parameters.mrtkProjectRoot }}
21-
-ReleasePackages: $(ReleasePackages)
2221
2322
- task: PowerShell@2
2423
displayName: "Generate DocTool Unity asset package"

0 commit comments

Comments
 (0)