mirror of
https://github.com/revenz/FileFlowsPlugins.git
synced 2025-12-30 17:10:01 -06:00
93 lines
3.4 KiB
PowerShell
93 lines
3.4 KiB
PowerShell
Write-Output "##################################"
|
|
Write-Output "### Building Plugins ###"
|
|
Write-Output "##################################"
|
|
|
|
|
|
& dotnet utils/spellcheck/spellcheck.dll ../
|
|
if ($LASTEXITCODE -ne 0 ) {
|
|
Write-Error "Spellcheck failed"
|
|
exit
|
|
}
|
|
|
|
$output = $args[0]
|
|
if ([String]::IsNullOrEmpty($output)) {
|
|
$output = '../deploy';
|
|
}
|
|
|
|
$output = $output | Resolve-Path
|
|
|
|
Remove-Item Builds -Recurse -ErrorAction SilentlyContinue
|
|
|
|
$revision = (git rev-list --count --first-parent HEAD) -join "`n"
|
|
$version = "0.1.0.$revision"
|
|
|
|
$json = "[`n"
|
|
|
|
Get-ChildItem -Path ..\ -Filter *.csproj -Recurse -File -Name | ForEach-Object {
|
|
$csproj = '../' + $_
|
|
# update version number of builds
|
|
(Get-Content $csproj) `
|
|
-replace '(?<=(Version>))([\d]+\.){3}[\d]+)(?=<)', $version |
|
|
Out-File $csproj
|
|
|
|
|
|
$package = [System.IO.Path]::GetFileNameWithoutExtension($_)
|
|
Write-Output "Building Plugin $package"
|
|
# build an instance for FileFlow local code
|
|
dotnet build $csproj /p:WarningLevel=1 --configuration Release /property:GenerateFullPaths=true /consoleloggerparameters:NoSummary --output:$output/$package/
|
|
Remove-Item $output/$package/FileFlows.Plugin.dll -ErrorAction SilentlyContinue
|
|
Remove-Item $output/$package/FileFlows.Plugin.pdb -ErrorAction SilentlyContinue
|
|
Remove-Item $output/$package/*.deps.json -ErrorAction SilentlyContinue
|
|
Remove-Item $output/$package/ref -Recurse -ErrorAction SilentlyContinue
|
|
|
|
& dotnet utils/PluginInfoGenerator/PluginInfoGenerator.dll $output/$package/$package.dll $csproj
|
|
|
|
Move-Item $output/$package/*.plugininfo $output/$package/.plugininfo -Force
|
|
Move-Item $output/$package/*.nfo $output/$package/.nfo -Force
|
|
|
|
if ( (Test-Path -Path $output/$package/.plugininfo -PathType Leaf) -and (Test-Path -Path $output/$package/.nfo -PathType Leaf)) {
|
|
|
|
# only actually create the plugin if plugins were found in it
|
|
|
|
#read nfo file
|
|
# build server needs ../, locally we cant have it
|
|
if ([System.IO.File]::Exists("$output/$package/.nfo") -eq $false) {
|
|
Write-Error "Failed to locate nfo file $output/$package/.nfo"
|
|
}
|
|
$pluginNfo = [System.IO.File]::ReadAllText("$output/$package/.nfo");
|
|
Write-Output "Plugin NFO: $pluginNfo"
|
|
$json += $pluginNfo + ",`n"
|
|
[System.IO.File]::Delete("$output/$package/.nfo")
|
|
|
|
Move-Item $output/$package/*.en.json $output/$package/en.json -Force
|
|
|
|
# construct .ffplugin file
|
|
$compress = @{
|
|
Path = "$output/$package/*"
|
|
CompressionLevel = "Optimal"
|
|
DestinationPath = "$output/$package.zip"
|
|
}
|
|
Write-Output "Creating zip file $output/$package.zip"
|
|
|
|
Compress-Archive @compress
|
|
|
|
Write-Output "Creating plugin file $output/$package.ffplugin"
|
|
Move-Item "$output/$package.zip" "$output/$package.ffplugin" -Force
|
|
|
|
if ([String]::IsNullOrEmpty($output2) -eq $false) {
|
|
Write-Output "Moving file to $output2"
|
|
Copy-Item "$output/$package.ffplugin" "$output2/" -Force
|
|
}
|
|
}
|
|
else {
|
|
Write-Warning "WARNING: Failed to generate plugin info files for: $package"
|
|
}
|
|
|
|
Remove-Item $output/$package -Recurse -ErrorAction SilentlyContinue
|
|
}
|
|
|
|
$json = $json.Substring(0, $json.lastIndexOf(',')) + "`n"
|
|
$json += ']';
|
|
|
|
Set-Content -Path "$output/plugins.json" -Value $json
|