From bc919697541fa5b5d6f11fb6732eb5d7f354c6d1 Mon Sep 17 00:00:00 2001 From: Joshua Coffey Date: Thu, 3 Aug 2023 13:40:49 -0400 Subject: [PATCH] Remove codegen for BFF (#67) --- action.ps1 | 5 +---- action.yml | 5 ----- build_test.ps1 | 3 --- generator_targets.go | 12 ------------ lang_types/dashboard_types.go | 17 ----------------- lang_types/function_map.go | 1 - main.go | 1 - 7 files changed, 1 insertion(+), 43 deletions(-) diff --git a/action.ps1 b/action.ps1 index 83e8981..2a15adf 100644 --- a/action.ps1 +++ b/action.ps1 @@ -11,7 +11,6 @@ param( [Parameter()][string]$DocsPath, - [Parameter()][string]$DashboardBffPath, [Parameter()][string]$DashboardFrontendPath, [Parameter()][string]$BuildTarget = "sdk" @@ -29,7 +28,6 @@ $JavaKotlinPath = (Resolve-Path $JavaKotlinPath)?.Path?.Replace(":","?") ?? "*** $RubyPath = "***SKIP***" $SwiftPath = (Resolve-Path $SwiftPath)?.Path?.Replace(":","?") ?? "***SKIP***" -$DashboardBffPath = (Resolve-Path $DashboardBffPath)?.Path?.Replace(":","?") ?? "***SKIP***" $DashboardFrontendPath = (Resolve-Path $DashboardFrontendPath)?.Path?.Replace(":","?") ?? "***SKIP***" $DocsPath = (Resolve-Path $DocsPath)?.Path?.Replace(":","?") ?? "***SKIP***" @@ -44,7 +42,6 @@ $SwiftArg = "swift_path=${SwiftPath}" $DocsArg = "docs_path=${DocsPath}" -$DashboardBffArg = "dashboardbff_path=${DashboardBffPath}" $DashboardFrontendArg = "dashboardfrontend_path=${DashboardFrontendPath}" $BuildTargetArg = "build_target=${BuildTarget}" @@ -75,7 +72,7 @@ Else foreach ($Item in Get-ChildItem -Path $ProtoPath -Include *.proto -Recurse) { $File = $Item.FullName - $Expr = "protoc --plugin=protoc-gen-trinsic-sdk=${PluginPath} --trinsic-sdk_out=${BuildTargetArg},${RenamePairs},${DartArg},${PythonArg},${GolangArg},${TypescriptArg},${DotnetArg},${JavaKotlinArg},${RubyArg},${SwiftArg},${DashboardBffArg},${DashboardFrontendArg},${DocsArg}: -I $ProtoPath $File" + $Expr = "protoc --plugin=protoc-gen-trinsic-sdk=${PluginPath} --trinsic-sdk_out=${BuildTargetArg},${RenamePairs},${DartArg},${PythonArg},${GolangArg},${TypescriptArg},${DotnetArg},${JavaKotlinArg},${RubyArg},${SwiftArg},${DashboardFrontendArg},${DocsArg}: -I $ProtoPath $File" # Write-Output $Expr Invoke-Expression $Expr } diff --git a/action.yml b/action.yml index 85ab72a..7a253ba 100644 --- a/action.yml +++ b/action.yml @@ -37,10 +37,6 @@ inputs: description: 'path for swift output' required: false default: '***SKIP***' - dashboardBffPath: - description: 'path for .NET BFF output' - required: false - default: '***SKIP***' dashboardFrontendPath: description: 'path for typescript dashboard output' required: false @@ -69,7 +65,6 @@ runs: -TypescriptPath "${{ inputs.typescriptPath }}" ` -JavaKotlinPath "${{ inputs.javaKotlinPath }}" ` -SwiftPath "${{ inputs.swiftPath }}" ` - -DashboardBffPath "${{ inputs.dashboardBffPath }}" ` -DashboardFrontendPath "${{ inputs.dashboardFrontendPath }}"` -DocsPath "***SKIP***" shell: pwsh diff --git a/build_test.ps1 b/build_test.ps1 index 2ef0219..b10219d 100644 --- a/build_test.ps1 +++ b/build_test.ps1 @@ -37,7 +37,6 @@ $RenamePairs = "trust-registry=trustregistry,universal-wallet=wallet,verifiable- # Default to doing nothing $PythonPath = "***SKIP***" $DotnetPath = "***SKIP***" -$DashboardBffPath = "***SKIP***" $DashboardFrontendPath = "***SKIP***" $DartPath = "***SKIP***" $GolangPath = "***SKIP***" @@ -63,7 +62,6 @@ if ($BuildTarget -eq "sdk-swift" -or $BuildTarget -eq "docs") if ($BuildTarget -eq "server") { $ProtoPath = "$PSScriptRoot/../server/proto" - $DashboardBffPath = "$PSScriptRoot/../server/dashboard/service/Dashboard/Services" $DashboardFrontendPath = "$PSScriptRoot/../server/dashboard/app/src/services/Trinsic" $DocsPath = "***SKIP***" } @@ -73,7 +71,6 @@ if ($BuildTarget -eq "server") -RenamePairs $RenamePairs ` -PythonPath $PythonPath ` -DotnetPath $DotnetPath ` - -DashboardBffPath $DashboardBffPath ` -DashboardFrontendPath $DashboardFrontendPath ` -DartPath $DartPath ` -GolangPath $GolangPath ` diff --git a/generator_targets.go b/generator_targets.go index 862082e..2fc0251 100644 --- a/generator_targets.go +++ b/generator_targets.go @@ -142,18 +142,6 @@ func TrinsicSwift() *tpp.TrinsicModule { } } -func TrinsicDashboardBff() *tpp.TrinsicModule { - funcs := lang_types.GetTemplateFuncs() - return &tpp.TrinsicModule{ - ModuleBase: &pgs.ModuleBase{}, - ServiceTpl: template.Must(template.New("dashboardBffService").Funcs(funcs).Parse(lang_types.DashboardBFFServiceTpl)), - FileCase: pgs.Name.UpperCamelCase, - FileExt: "cs", - TargetName: "dashboardbff_path", - ServiceFileSuffix: "Service", - } -} - func TrinsicDashboardFrontend() *tpp.TrinsicModule { funcs := lang_types.GetTemplateFuncs() return &tpp.TrinsicModule{ diff --git a/lang_types/dashboard_types.go b/lang_types/dashboard_types.go index 083060a..12fc276 100644 --- a/lang_types/dashboard_types.go +++ b/lang_types/dashboard_types.go @@ -6,14 +6,6 @@ import ( "strings" ) -func DashboardBffMethodArguments(method pgs.Method) string { - if SdkNoArguments(method) { - return "" - } else { - return fmt.Sprintf("%s.Parser.ParseFrom(request.Data)", DotnetMethodParamType(method)) - } -} - func DashboardFrontendClassDefinition(method pgs.Method) string { return fmt.Sprintf("%sDefinition", method.Service().Name().UpperCamelCase()) } @@ -99,15 +91,6 @@ func getTypescriptProtoType(myType pgs.FieldType) string { //return "proto." + typeParts[len(typeParts)-1] + " | undefined" } -const DashboardBFFServiceTpl = `// BEGIN Code generated by protoc-gen-trinsic. DO NOT EDIT. -// target: {{ .TargetPath }} -{{ range .File.Services }}{{ range .Methods }}{{ if SdkTemplateGenerate . }} - case nameof(service.{{ .Name.UpperCamelCase }}): - response = await service.{{ .Name.UpperCamelCase }}Async({{ DashboardBffMethodArguments .}}); - break; -{{ end }}{{ end }}{{ end }} -// END Code generated by protoc-gen-trinsic. DO NOT EDIT.` - const DashboardFrontendServiceTpl = `// BEGIN Code generated by protoc-gen-trinsic. DO NOT EDIT. // target: {{ .TargetPath }} {{ range .File.Services }}{{ range .Methods }}{{ if SdkTemplateGenerate . }} diff --git a/lang_types/function_map.go b/lang_types/function_map.go index 6fee881..cfb09fc 100644 --- a/lang_types/function_map.go +++ b/lang_types/function_map.go @@ -35,7 +35,6 @@ func GetTemplateFuncs() map[string]interface{} { "DotnetDefaultRequestObject": DotnetDefaultRequestObject, "DotnetAnnotations": DotnetAnnotations, - "DashboardBffMethodArguments": DashboardBffMethodArguments, "DashboardFrontendClassDefinition": DashboardFrontendClassDefinition, "DashboardFrontendServicePath": DashboardFrontendServicePath, "DashboardFrontendMethodReturnType": DashboardFrontendMethodReturnType, diff --git a/main.go b/main.go index aedfc99..f94d3ad 100644 --- a/main.go +++ b/main.go @@ -11,7 +11,6 @@ func main() { pgs.Init(pgs.DebugMode(), pgs.SupportedFeatures(&supportOptional)). RegisterModule(TrinsicDart()). RegisterModule(TrinsicDotnet()). - RegisterModule(TrinsicDashboardBff()). RegisterModule(TrinsicDashboardFrontend()). RegisterModule(TrinsicGolangInterface()). RegisterModule(TrinsicGolangImplementation()).