Skip to content

Commit

Permalink
0.3.7.805
Browse files Browse the repository at this point in the history
  • Loading branch information
gleblebedev committed May 8, 2024
1 parent 4d12afc commit 68efc59
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 2 deletions.
55 changes: 55 additions & 0 deletions scripts/set-ezpipeline-version.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
param (
[Parameter(Mandatory=$true)]
[string]$version
)

function UpdateToolVersion($filePath, $version) {
# Load the existing JSON file
$json = Get-Content $filePath | ConvertFrom-Json

# Update the version
$json.tools."unofficial.Urho3DNet.Editor".version = $version

# Convert the updated object back to JSON
$json | ConvertTo-Json -Depth 100 | Set-Content $filePath
}

function UpdateVersionInPropsFile($filePath, $version) {
# Load the XML file
[xml]$xml = Get-Content $filePath

# Find the Version element and update its value
$xml.Project.PropertyGroup.Urho3DNetVersion = $version

# Create a UTF8 encoding object without BOM
$utf8NoBom = New-Object System.Text.UTF8Encoding $false

# Create an XmlTextWriter with the file path and encoding
$writer = New-Object System.Xml.XmlTextWriter($filePath, $utf8NoBom)

# Set the writer's formatting to be indented
$writer.Formatting = [System.Xml.Formatting]::Indented

# Save the updated XML back to the file
$xml.WriteTo($writer)
$writer.Flush()
$writer.Close()
}

# Get the content of the .gitmodules file
$gitmodules = Get-Content "$PSScriptRoot/../.gitmodules"

# Find all lines that start with "path = "
$paths = $gitmodules | Where-Object { $_ -match "^\s*path = " }

# Iterate through each path
foreach ($path in $paths) {
# Extract the actual path from the line
$submodulePath = $path -replace "^\s*path = ", ""

# Output the submodule path
Write-Output "Patching $submodulePath"

UpdateToolVersion -filePath "$PSScriptRoot/../$submodulePath/.config/dotnet-tools.json" -version $version
UpdateVersionInPropsFile -filePath "$PSScriptRoot/../$submodulePath/Directory.Build.props" -version $version
}

0 comments on commit 68efc59

Please sign in to comment.