diff --git a/cmd/function/new.go b/cmd/function/new.go index cfab11e..0af5e08 100644 --- a/cmd/function/new.go +++ b/cmd/function/new.go @@ -124,10 +124,16 @@ func NewCmd(hidden bool) command.SetupCommand[*config.Config] { extensionData = append(extensionData, extension.ExtensionInfo{ Name: ext.Schema.Name, Path: path.Join(extensionPath, "golang", "guest"), - Version: "v0.1.0", + Version: "0.1.0", + }) + case scalefunc.Rust: + extensionData = append(extensionData, extension.ExtensionInfo{ + Name: ext.Schema.Name, + Path: path.Join(extensionPath, "rust", "guest"), + Version: "0.1.0", }) default: - panic("Only go extension for now") + panic("Only go or rust extension for now") } } else { panic("Only local extension for now") @@ -292,6 +298,7 @@ func NewCmd(hidden bool) command.SetupCommand[*config.Config] { "signature_version": signatureVersion, "signature_path": signaturePath, "registry": "scale", + "extensions": extensionData, }) if err != nil { _ = dependencyFile.Close() diff --git a/ext.sh b/ext.sh index 470672f..ae43b90 100755 --- a/ext.sh +++ b/ext.sh @@ -32,21 +32,22 @@ echo "Exporting function" mkdir ext/fn-rs echo "Creating function" ./cmd/cmd function new -d ext/fn-rs -s local/testsig:latest -e local/testext:latest -l rust testfnrs:latest -# cat ext/fn_code.rs > ext/fn-rs/main.rs +cat ext/fn_code.rs > ext/fn-rs/lib.rs echo "Building function" ./cmd/cmd function build -d ext/fn-rs echo "Exporting function" ./cmd/cmd function export local/testfnrs:latest ext/ + # Create a function using the extension in Typescript -mkdir ext/fn-ts -echo "Creating function" -./cmd/cmd function new -d ext/fn-ts -s local/testsig:latest -e local/testext:latest -l rust testfnts:latest +#mkdir ext/fn-ts +#echo "Creating function" +#./cmd/cmd function new -d ext/fn-ts -s local/testsig:latest -e local/testext:latest -l rust testfnts:latest # cat ext/fn_code.ts > ext/fn-ts/main.ts -echo "Building function" -./cmd/cmd function build -d ext/fn-ts -echo "Exporting function" -./cmd/cmd function export local/testfnts:latest ext/ +#echo "Building function" +#./cmd/cmd function build -d ext/fn-ts +#echo "Exporting function" +#./cmd/cmd function export local/testfnts:latest ext/ # Sort out runner echo "Updating runner go.mod..." diff --git a/ext/runner/go.mod b/ext/runner/go.mod index cba1669..1c05f31 100644 --- a/ext/runner/go.mod +++ b/ext/runner/go.mod @@ -34,5 +34,6 @@ require ( + replace signature => /home/jimmy/.config/scale/signatures/local_testsig_latest_e6ddebc792ee929e2654b4281baca1376e05bf5a96d4bdf63a05a2aab5f9e749_signature/golang/host replace HttpFetch => /home/jimmy/.config/scale/extensions/local_testext_latest_5c7d22390f9101d459292d76c11b5e9f66c327b1766aae34b9cc75f9f40e8206_extension/golang/host diff --git a/template/template.go b/template/template.go index 26986ca..ee7e8e4 100644 --- a/template/template.go +++ b/template/template.go @@ -77,6 +77,10 @@ path = "lib.rs" {{ .signature_dependency }} = { package = "{{ .signature_package }}", version = "{{ .signature_version }}", registry = "scale" } {{ end }} +{{ range $extension := .extensions -}} +{{ $extension.Name }} = { package = "{{ $extension.Name }}", path = "{{ $extension.Path }}" } +{{end -}} + [profile.release] opt-level = 3 lto = true