This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
plug-sdk/scripts/generate_grpc_files.ps1
2024-02-20 10:45:36 +01:00

29 lines
782 B
PowerShell

New-Item -Path "api" -Name "gRPC" -ItemType Directory -Force
$plugName = ""
protoc `
--proto_path=third_party/grpc-proto `
--go_out=api/gRPC `
--go_opt=paths=source_relative `
--go-grpc_out=api/gRPC `
--go-grpc_opt=paths=source_relative `
third_party/grpc-proto/*.proto `
function Replace-Text {
param (
[string]$Path,
[string]$OldText,
[string]$NewText
)
Get-ChildItem -Path $Path -Recurse -File | ForEach-Object {
$content = Get-Content $_.FullName
$content = $content -replace $OldText, $NewText
Set-Content -Path $_.FullName -Value $content
}
}
Replace-Text -Path "./api/gRPC" -OldText "git.dragse.it/anthrove/plug-[REPLACE_ME]/api/gRPC" -NewText "git.dragse.it/anthrove/plug-$plugName/api/gRPC"