ALCompiler.psm1
function Get-ALCompiler { param( [string]$vsix, [string]$path ) Process { $zippath = Join-Path -Path $path -ChildPath "al.zip" if(-not (Test-Path -Path $path)) { $null = New-Item -Path $path -ItemType Directory Rename-Item -Path $vsix -NewName $zippath Expand-Archive -Path $zippath -DestinationPath $path } } } function Invoke-ALCompiler { param ( [string]$compilerpath, [string]$projectpath, [int]$buildnumber, [string]$outputpath ) process { #Update build number $jsonpath = Join-Path -Path $projectpath -ChildPath "app.json" $oldjson = Get-Content -Path $jsonpath -raw $newjson = $oldjson | ConvertFrom-Json $oldversion = (New-Object Version -ArgumentList $newjson.version) $newversion = (New-Object Version -ArgumentList $oldversion.Major, $oldversion.Minor, $oldversion.Build, $buildnumber).ToString() $newjson.Version = $newversion $newjson | ConvertTo-Json -depth 32 | set-content -Path $jsonpath $outputfile = Join-Path -Path $outputpath -ChildPath "$($newjson.Publisher)_$($newjson.Name)_$($newversion).app"; $cachepath = Join-Path -Path $projectpath -ChildPath ".alpackages"; $compiler = Join-Path -Path $compilerpath -ChildPath "extension\bin\alc.exe" & $compiler /project:$projectpath /out:$outputfile /packagecachepath:$cachepath $oldjson | set-content -Path $jsonpath } } |