Files

18 lines
865 B
PowerShell

# Builds one jar per supported Minecraft version (versions\*.properties) into dist\.
# Requires a Java 25+ JVM to run Gradle; Java 17 targets are compiled with --release 17.
$ErrorActionPreference = 'Stop'
Set-Location $PSScriptRoot
$dist = Join-Path $PSScriptRoot 'dist'
New-Item -ItemType Directory -Force $dist | Out-Null
Remove-Item "$dist\*.jar" -ErrorAction SilentlyContinue
foreach ($file in Get-ChildItem versions\*.properties) {
$props = @()
Get-Content $file | Where-Object { $_ -match '^\s*[^#\s].*=' } | ForEach-Object { $props += "-P$($_.Trim())" }
Write-Host "== Building Minecraft $($file.BaseName) =="
& .\gradlew.bat clean build @props
if ($LASTEXITCODE -ne 0) { throw "Build failed for $($file.BaseName)" }
Copy-Item build\libs\*-$($file.BaseName)-*.jar $dist -Exclude '*-sources.jar'
}
Write-Host "Jars written to $dist"