Skip to content

Commit

Permalink
Fix package regex to handle 4 component package names (#37) (#38)
Browse files Browse the repository at this point in the history
We have one package (org.mixedrealitytoolkit.uxcomponents.noncanvas)
that was screwing up the version dependency hash lookup. This resolves
it so the package.json gets patched with the correct dependency.

(cherry picked from commit 5628c11)
  • Loading branch information
shaynie authored Aug 19, 2023
1 parent be84802 commit 9ddeb9d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions Pipelines/Scripts/pack-upm.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ try {

# loop through package directories, update package version, assembly version, and build version hash for updating dependencies
Get-ChildItem -Path $ProjectRoot/*/package.json | ForEach-Object {
$packageName = Select-String -Pattern "org\.mixedrealitytoolkit\.\w+|com\.microsoft\.mrtk\.\w+" -Path $_ | Select-Object -First 1
$packageName = Select-String -Pattern "org\.mixedrealitytoolkit\.\w+(\.\w+)*|com\.microsoft\.mrtk\.\w+(\.\w+)*" -Path $_ | Select-Object -First 1

if (-not $packageName) {
return # this is not an MRTK package, so skip
Expand Down Expand Up @@ -130,7 +130,8 @@ try {

# update dependencies using the versionHash map
Get-ChildItem -Path $ProjectRoot/*/package.json | ForEach-Object {
$currentPackageName = Select-String -Pattern "org\.mixedrealitytoolkit\.\w+|com\.microsoft\.mrtk\.\w+" -Path $_ | Select-Object -First 1
$currentPackageName = Select-String -Pattern "org\.mixedrealitytoolkit\.\w+(\.\w+)*|com\.microsoft\.mrtk\.\w+(\.\w+)*" -Path $_ | Select-Object -First 1

if (-not $currentPackageName) {
return # this is not an MRTK package, so skip
}
Expand All @@ -150,7 +151,7 @@ try {
continue
}

$searchRegex = "$($packageName).*:.*""(.*)"""
$searchRegex = "$($packageName)\s*"":\s*""(.*)"""
$searchMatches = Select-String $searchRegex -InputObject (Get-Content -Path $_)
if ($searchMatches.Matches.Groups) {
$newVersion = $versionHash["$($packageName)"]
Expand Down
4 changes: 2 additions & 2 deletions Pipelines/Scripts/repackage-for-release.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ try {
Write-Output "PackageSearchPath: $packageSearchPath"

Get-ChildItem -Path $packageSearchPath | ForEach-Object {
$packageName = Select-String -Pattern "org\.mixedrealitytoolkit\.\w+|com\.microsoft\.mrtk\.\w+" -Path $_.FullName | Select-Object -First 1
$packageName = Select-String -Pattern "org\.mixedrealitytoolkit\.\w+(\.\w+)*|com\.microsoft\.mrtk\.\w+(\.\w+)*" -Path $_.FullName | Select-Object -First 1

if (-not $packageName) {
return # this is not an MRTK package, so skip
Expand Down Expand Up @@ -91,7 +91,7 @@ try {
}
# update all dependencies and repackage
Get-ChildItem -Path $packageSearchPath | ForEach-Object {
$currentPackageName = Select-String -Pattern "org\.mixedrealitytoolkit\.\w+|com\.microsoft\.mrtk\.\w+" -Path $_.FullName | Select-Object -First 1
$currentPackageName = Select-String -Pattern "org\.mixedrealitytoolkit\.\w+(\.\w+)*|com\.microsoft\.mrtk\.\w+(\.\w+)*" -Path $_.FullName | Select-Object -First 1

if (-not $currentPackageName) {
return # this is not an MRTK package, so skip
Expand Down

0 comments on commit 9ddeb9d

Please sign in to comment.