Skip to content

Commit

Permalink
put WASM plugins behind a build tag
Browse files Browse the repository at this point in the history
  • Loading branch information
kyleconroy committed Apr 23, 2022
1 parent a8bcb34 commit 2406639
Show file tree
Hide file tree
Showing 12 changed files with 18 additions and 185 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
/.idea/
__pycache__
cache
15 changes: 0 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -54,18 +54,3 @@ internal/python/ast/ast.pb.go: protos/python/ast.proto
--go_out=. \
--go_opt=module=github.com/kyleconroy/sqlc \
./protos/python/ast.proto

wasm: cache/sqlc-codegen-python.wasm cache/sqlc-codegen-go.wasm cache/sqlc-codegen-kotlin.wasm

cache/sqlc-codegen-python.wasm: cmd/sqlc-codegen-python/main.go
cd cmd/sqlc-codegen-python && tinygo build -o ../../cache/sqlc-codegen-python.wasm -gc=leaking -scheduler=none -wasm-abi=generic -target=wasi

cache/sqlc-codegen-kotlin.wasm: cmd/sqlc-codegen-kotlin/main.go
cd cmd/sqlc-codegen-kotlin && tinygo build -o ../../cache/sqlc-codegen-kotlin.wasm -gc=leaking -wasm-abi=generic -target=wasi

cache/sqlc-codegen-go.wasm: cmd/sqlc-codegen-go/main.go
cd cmd/sqlc-codegen-go && tinygo build -o ../../cache/sqlc-codegen-go.wasm -gc=leaking -wasm-abi=generic -target=wasi




36 changes: 0 additions & 36 deletions cmd/sqlc-codegen-go/main.go

This file was deleted.

36 changes: 0 additions & 36 deletions cmd/sqlc-codegen-kotlin/main.go

This file was deleted.

36 changes: 0 additions & 36 deletions cmd/sqlc-codegen-python/main.go

This file was deleted.

10 changes: 0 additions & 10 deletions examples/wasm/gen/python/models.py

This file was deleted.

34 changes: 0 additions & 34 deletions examples/wasm/gen/python/query.py

This file was deleted.

16 changes: 0 additions & 16 deletions examples/wasm/sqlc.json

This file was deleted.

2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.17

require (
github.com/antlr/antlr4/runtime/Go/antlr v0.0.0-20220209173558-ad29539cd2e9
github.com/bytecodealliance/wasmtime-go v0.34.0
github.com/bytecodealliance/wasmtime-go v0.35.0
github.com/davecgh/go-spew v1.1.1
github.com/go-sql-driver/mysql v1.6.0
github.com/google/go-cmp v0.5.7
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLj
github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA=
github.com/bytecodealliance/wasmtime-go v0.34.0 h1:PaWS0DUusaXaU3aNoSYjag6WmuxjyPYBHgkrC4EXips=
github.com/bytecodealliance/wasmtime-go v0.34.0/go.mod h1:q320gUxqyI8yB+ZqRuaJOEnGkAnHh6WtJjMaT2CW4wI=
github.com/bytecodealliance/wasmtime-go v0.35.0 h1:VZjaZ0XOY0qp9TQfh0CQj9zl/AbdeXePVTALy8V1sKs=
github.com/bytecodealliance/wasmtime-go v0.35.0/go.mod h1:q320gUxqyI8yB+ZqRuaJOEnGkAnHh6WtJjMaT2CW4wI=
github.com/cockroachdb/apd v1.1.0 h1:3LFP3629v+1aKXU5Q37mxmRxX/pIu1nijXydLShEq5I=
github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ=
github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
Expand Down
13 changes: 13 additions & 0 deletions internal/codegen/wasm/nowasm.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//go:build !wasmtime

package wasm

import (
"fmt"

"github.com/kyleconroy/sqlc/internal/plugin"
)

func Generate(req *plugin.CodeGenRequest) (*plugin.CodeGenResponse, error) {
return nil, fmt.Errorf("sqlc built without wasmtime support")
}
2 changes: 2 additions & 0 deletions internal/codegen/wasm/wasm.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build wasmtime

package wasm

import (
Expand Down

0 comments on commit 2406639

Please sign in to comment.