Skip to content

Commit 2406639

Browse files
committed
put WASM plugins behind a build tag
1 parent a8bcb34 commit 2406639

File tree

12 files changed

+18
-185
lines changed

12 files changed

+18
-185
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
/.idea/
22
__pycache__
3-
cache

Makefile

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -54,18 +54,3 @@ internal/python/ast/ast.pb.go: protos/python/ast.proto
5454
--go_out=. \
5555
--go_opt=module=github.com/kyleconroy/sqlc \
5656
./protos/python/ast.proto
57-
58-
wasm: cache/sqlc-codegen-python.wasm cache/sqlc-codegen-go.wasm cache/sqlc-codegen-kotlin.wasm
59-
60-
cache/sqlc-codegen-python.wasm: cmd/sqlc-codegen-python/main.go
61-
cd cmd/sqlc-codegen-python && tinygo build -o ../../cache/sqlc-codegen-python.wasm -gc=leaking -scheduler=none -wasm-abi=generic -target=wasi
62-
63-
cache/sqlc-codegen-kotlin.wasm: cmd/sqlc-codegen-kotlin/main.go
64-
cd cmd/sqlc-codegen-kotlin && tinygo build -o ../../cache/sqlc-codegen-kotlin.wasm -gc=leaking -wasm-abi=generic -target=wasi
65-
66-
cache/sqlc-codegen-go.wasm: cmd/sqlc-codegen-go/main.go
67-
cd cmd/sqlc-codegen-go && tinygo build -o ../../cache/sqlc-codegen-go.wasm -gc=leaking -wasm-abi=generic -target=wasi
68-
69-
70-
71-

cmd/sqlc-codegen-go/main.go

Lines changed: 0 additions & 36 deletions
This file was deleted.

cmd/sqlc-codegen-kotlin/main.go

Lines changed: 0 additions & 36 deletions
This file was deleted.

cmd/sqlc-codegen-python/main.go

Lines changed: 0 additions & 36 deletions
This file was deleted.

examples/wasm/gen/python/models.py

Lines changed: 0 additions & 10 deletions
This file was deleted.

examples/wasm/gen/python/query.py

Lines changed: 0 additions & 34 deletions
This file was deleted.

examples/wasm/sqlc.json

Lines changed: 0 additions & 16 deletions
This file was deleted.

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ go 1.17
44

55
require (
66
github.com/antlr/antlr4/runtime/Go/antlr v0.0.0-20220209173558-ad29539cd2e9
7-
github.com/bytecodealliance/wasmtime-go v0.34.0
7+
github.com/bytecodealliance/wasmtime-go v0.35.0
88
github.com/davecgh/go-spew v1.1.1
99
github.com/go-sql-driver/mysql v1.6.0
1010
github.com/google/go-cmp v0.5.7

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLj
77
github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA=
88
github.com/bytecodealliance/wasmtime-go v0.34.0 h1:PaWS0DUusaXaU3aNoSYjag6WmuxjyPYBHgkrC4EXips=
99
github.com/bytecodealliance/wasmtime-go v0.34.0/go.mod h1:q320gUxqyI8yB+ZqRuaJOEnGkAnHh6WtJjMaT2CW4wI=
10+
github.com/bytecodealliance/wasmtime-go v0.35.0 h1:VZjaZ0XOY0qp9TQfh0CQj9zl/AbdeXePVTALy8V1sKs=
11+
github.com/bytecodealliance/wasmtime-go v0.35.0/go.mod h1:q320gUxqyI8yB+ZqRuaJOEnGkAnHh6WtJjMaT2CW4wI=
1012
github.com/cockroachdb/apd v1.1.0 h1:3LFP3629v+1aKXU5Q37mxmRxX/pIu1nijXydLShEq5I=
1113
github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ=
1214
github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=

internal/codegen/wasm/nowasm.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
//go:build !wasmtime
2+
3+
package wasm
4+
5+
import (
6+
"fmt"
7+
8+
"github.com/kyleconroy/sqlc/internal/plugin"
9+
)
10+
11+
func Generate(req *plugin.CodeGenRequest) (*plugin.CodeGenResponse, error) {
12+
return nil, fmt.Errorf("sqlc built without wasmtime support")
13+
}

internal/codegen/wasm/wasm.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//go:build wasmtime
2+
13
package wasm
24

35
import (

0 commit comments

Comments
 (0)