Skip to content

Commit

Permalink
Using simpler build target
Browse files Browse the repository at this point in the history
Signed-off-by: Shivansh Vij <[email protected]>
  • Loading branch information
ShivanshVij committed Sep 20, 2023
1 parent cf1013b commit f8c8f27
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 24 deletions.
7 changes: 4 additions & 3 deletions cmd/function/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import (
"github.com/loopholelabs/scale-cli/client/registry"
"github.com/loopholelabs/scale-cli/internal/config"
"github.com/loopholelabs/scale-cli/utils"
"github.com/loopholelabs/scale-cli/version"
"github.com/loopholelabs/scale/build"
"github.com/loopholelabs/scale/scalefile"
"github.com/loopholelabs/scale/scalefunc"
Expand Down Expand Up @@ -144,12 +143,14 @@ func BuildCmd(hidden bool) command.SetupCommand[*config.Config] {
}
}

out := ch.Printer.Out()

end := ch.Printer.PrintProgress(fmt.Sprintf("Building scale function local/%s:%s...", sf.Name, sf.Tag))
var scaleFunc *scalefunc.Schema
switch scalefunc.Language(sf.Language) {
case scalefunc.Go:
opts := &build.LocalGolangOptions{
Version: version.Version,
Output: out,
Scalefile: sf,
SourceDirectory: sourceDir,
SignatureSchema: signatureSchema,
Expand All @@ -163,7 +164,7 @@ func BuildCmd(hidden bool) command.SetupCommand[*config.Config] {
scaleFunc, err = build.LocalGolang(opts)
case scalefunc.Rust:
opts := &build.LocalRustOptions{
Version: version.Version,
Output: out,
Scalefile: sf,
SourceDirectory: sourceDir,
SignatureSchema: signatureSchema,
Expand Down
2 changes: 1 addition & 1 deletion cmd/function/new.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ func NewCmd(hidden bool) command.SetupCommand[*config.Config] {

err = cargofileTempl.Execute(dependencyFile, map[string]interface{}{
"package": functionName,
"version": signatureVersion,
"version": "0.1.0",
"signature_dependency": "signature",
"signature_package": fmt.Sprintf("%s_%s_%s_guest", parsedSignature.Organization, parsedSignature.Name, parsedSignature.Tag),
"signature_version": signatureVersion,
Expand Down
5 changes: 2 additions & 3 deletions cmd/function/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ import (
func RunCmd(hidden bool) command.SetupCommand[*config.Config] {
return func(cmd *cobra.Command, ch *cmdutils.Helper[*config.Config]) {
var listen string
var pooling bool
runCmd := &cobra.Command{
Use: "run [ ...[ <org>/<name>:<tag> ] ] [flags]",
Args: cobra.MinimumNArgs(1),
Expand Down Expand Up @@ -145,7 +144,8 @@ func RunCmd(hidden bool) command.SetupCommand[*config.Config] {
return fmt.Errorf("failed to create type check signature: %w", err)
}

s, err := scale.New(scale.NewConfig(typecheckSignature.Signature).WithContext(ctx).WithFunctions(fns).WithPooling(pooling))
writer := ch.Printer.Out()
s, err := scale.New(scale.NewConfig(typecheckSignature.Signature).WithContext(ctx).WithFunctions(fns).WithStdout(writer).WithStderr(writer))
if err != nil {
return fmt.Errorf("failed to create scale: %w", err)
}
Expand Down Expand Up @@ -215,7 +215,6 @@ func RunCmd(hidden bool) command.SetupCommand[*config.Config] {
}

runCmd.Flags().StringVarP(&listen, "listen", "l", ":8080", "the address to listen on")
runCmd.Flags().BoolVar(&pooling, "pooling", false, "whether to enable pooling of functions")
cmd.AddCommand(runCmd)
}
}
4 changes: 2 additions & 2 deletions cmd/signature/use.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ func UseCmd(hidden bool) command.SetupCommand[*config.Config] {
return fmt.Errorf("failed to use signature %s/%s:%s: %w", parsed.Organization, parsed.Name, parsed.Tag, err)
}

err = m.RemoveReplacement("signature", golang.DefaultVersion)
err = m.RemoveReplacement("signature", "v0.1.0")
if err != nil {
return fmt.Errorf("failed to use signature %s/%s:%s: %w", parsed.Organization, parsed.Name, parsed.Tag, err)
}
Expand All @@ -142,7 +142,7 @@ func UseCmd(hidden bool) command.SetupCommand[*config.Config] {
return fmt.Errorf("failed to use signature %s/%s:%s: %w", parsed.Organization, parsed.Name, parsed.Tag, err)
}

err = m.AddReplacement("signature", golang.DefaultVersion, signaturePath, signatureVersion)
err = m.AddReplacement("signature", "v0.1.0", signaturePath, signatureVersion)
if err != nil {
return fmt.Errorf("failed to use signature %s/%s:%s: %w", parsed.Organization, parsed.Name, parsed.Tag, err)
}
Expand Down
10 changes: 5 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ require (
github.com/go-openapi/swag v0.22.4
github.com/go-openapi/validate v0.22.1
github.com/loopholelabs/auth v0.2.47
github.com/loopholelabs/cmdutils v0.1.3
github.com/loopholelabs/cmdutils v0.1.4
github.com/loopholelabs/releaser v0.1.1
github.com/loopholelabs/scale v0.3.20-dev32
github.com/loopholelabs/scale v0.4.0
github.com/mitchellh/go-homedir v1.1.0
github.com/natefinch/lumberjack v2.0.0+incompatible
github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8
Expand All @@ -22,7 +22,7 @@ require (
github.com/spf13/cobra v1.7.0
github.com/spf13/pflag v1.0.5
github.com/spf13/viper v1.16.0
github.com/valyala/fasthttp v1.48.0
github.com/valyala/fasthttp v1.50.0
)

require (
Expand All @@ -35,7 +35,7 @@ require (
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect
github.com/briandowns/spinner v1.23.0 // indirect
github.com/dustin/go-humanize v1.0.0 // indirect
github.com/evanw/esbuild v0.19.2 // indirect
github.com/evanw/esbuild v0.19.3 // indirect
github.com/fatih/color v1.15.0 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/go-logr/logr v1.2.3 // indirect
Expand Down Expand Up @@ -92,7 +92,7 @@ require (
golang.org/x/net v0.12.0 // indirect
golang.org/x/sys v0.10.0 // indirect
golang.org/x/term v0.10.0 // indirect
golang.org/x/text v0.12.0 // indirect
golang.org/x/text v0.13.0 // indirect
google.golang.org/protobuf v1.31.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
Expand Down
20 changes: 10 additions & 10 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1m
github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5ynNVH9qI8YYLbd1fK2po=
github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk=
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/evanw/esbuild v0.19.2 h1:Ju+VvhVepfXW+sNQ189j9aLK4brlN36lEZUajJaK3Ig=
github.com/evanw/esbuild v0.19.2/go.mod h1:iINY06rn799hi48UqEnaQvVfZWe6W9bET78LbvN8VWk=
github.com/evanw/esbuild v0.19.3 h1:foPr0xwQM3lBWKBtscauTN9FrmJzRDVI2+EGOs82H/I=
github.com/evanw/esbuild v0.19.3/go.mod h1:iINY06rn799hi48UqEnaQvVfZWe6W9bET78LbvN8VWk=
github.com/fatih/color v1.15.0 h1:kOqh6YHBtK8aywxGerMG2Eq3H6Qgoqeo13Bk2Mv/nBs=
github.com/fatih/color v1.15.0/go.mod h1:0h5ZqXfHYED7Bhv2ZJamyIOUej9KtShiJESRwBDUSsw=
github.com/frankban/quicktest v1.14.4 h1:g2rn0vABPOOXmZUj+vbmUp0lPoXEMuhTpIluN0XL9UY=
Expand Down Expand Up @@ -285,14 +285,14 @@ github.com/lensesio/tableprinter v0.0.0-20201125135848-89e81fc956e7 h1:k/1ku0yeh
github.com/lensesio/tableprinter v0.0.0-20201125135848-89e81fc956e7/go.mod h1:YR/zYthNdWfO8+0IOyHDcIDBBBS2JMnYUIwSsnwmRqU=
github.com/loopholelabs/auth v0.2.47 h1:pPkM0I42uXamcpLbnggHz0QwmJXnIDlWwwR97PsUD+c=
github.com/loopholelabs/auth v0.2.47/go.mod h1:XDaKoNTVaobyD4Ak6It5Tbrasdnhk3wSqWuQkgT2hRg=
github.com/loopholelabs/cmdutils v0.1.3 h1:qMfho22k6e0qHLTkQnA6PwuCTVHh0pea5/c+js/cnqI=
github.com/loopholelabs/cmdutils v0.1.3/go.mod h1:qEl0ttfGzdPhG2V1l/CKMdbD0xNAt/Q2M1qONgcU+FE=
github.com/loopholelabs/cmdutils v0.1.4 h1:ra29W27eOerdqQresmVJrq98Wepb6Em7smZLfc+fGdQ=
github.com/loopholelabs/cmdutils v0.1.4/go.mod h1:qEl0ttfGzdPhG2V1l/CKMdbD0xNAt/Q2M1qONgcU+FE=
github.com/loopholelabs/polyglot v1.1.3 h1:WUTcSZ2TQ1lv7CZ4I9nHFBUjf0hKJN+Yfz1rZZJuTP0=
github.com/loopholelabs/polyglot v1.1.3/go.mod h1:EA88BEkIluKHAWxhyOV88xXz68YkRdo9IzZ+1dj+7Ao=
github.com/loopholelabs/releaser v0.1.1 h1:o8Z4jIR4TcaSRiwFpAGIJSAkAUOxlXL1ML3EscGqxDU=
github.com/loopholelabs/releaser v0.1.1/go.mod h1:51hV+lDDYeJNzeVOZCQnGS5cJN8ODg/V5AxYtiL67UA=
github.com/loopholelabs/scale v0.3.20-dev32 h1:SwaFht/ZHKeBvVuxXuey88XHrjy0nKqYAcBDH6Aek1Y=
github.com/loopholelabs/scale v0.3.20-dev32/go.mod h1:vWVeJ14g7QKSXetP3fYb80tADdYQS0EiCh/K21N5vjU=
github.com/loopholelabs/scale v0.4.0 h1:40x4q+Ch71YMMJBJFJo+2qB1XS95N8gbpjUg3U1Icpc=
github.com/loopholelabs/scale v0.4.0/go.mod h1:3dsQQCsIbJ5oOEpI/53jVBuDPYyi/Z85ZjroPDTKIzw=
github.com/loopholelabs/scale-signature-interfaces v0.1.7 h1:aOJJZpCKn/Q5Q0Gj+/Q6c7/iABEbojjbCzIqw7Mxyi0=
github.com/loopholelabs/scale-signature-interfaces v0.1.7/go.mod h1:3XLMjJjBf5lYxMtNKk+2XAWye4UyrkvUBJ9L6x2QCAk=
github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY=
Expand Down Expand Up @@ -402,8 +402,8 @@ github.com/urfave/cli v1.22.5/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtX
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
github.com/valyala/fasthttp v1.31.0/go.mod h1:2rsYD01CKFrjjsvFxx75KlEUNpWNBY9JWD3K/7o2Cus=
github.com/valyala/fasthttp v1.48.0 h1:oJWvHb9BIZToTQS3MuQ2R3bJZiNSa2KiNdeI8A+79Tc=
github.com/valyala/fasthttp v1.48.0/go.mod h1:k2zXd82h/7UZc3VOdJ2WaUqt1uZ/XpXAfE9i+HBC3lA=
github.com/valyala/fasthttp v1.50.0 h1:H7fweIlBm0rXLs2q0XbalvJ6r0CUPFWK3/bB4N13e9M=
github.com/valyala/fasthttp v1.50.0/go.mod h1:k2zXd82h/7UZc3VOdJ2WaUqt1uZ/XpXAfE9i+HBC3lA=
github.com/valyala/fasttemplate v1.2.1 h1:TVEnxayobAdVkhQfrfes2IzOB6o+z4roRkPF52WA1u4=
github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ=
github.com/valyala/tcplisten v1.0.0 h1:rBHj/Xf+E1tRGZyWIWwJDiRY0zc1Js+CV5DqwacVSA8=
Expand Down Expand Up @@ -617,8 +617,8 @@ golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.12.0 h1:k+n5B8goJNdU7hSvEtMUz3d1Q6D/XW4COJSJR6fN0mc=
golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k=
golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
Expand Down

0 comments on commit f8c8f27

Please sign in to comment.