Skip to content

Commit c8b8c16

Browse files
Denys Smirnovdennwc
Denys Smirnov
authored andcommitted
update sdk version
Signed-off-by: Denys Smirnov <[email protected]>
1 parent 3e2bcee commit c8b8c16

File tree

8 files changed

+131
-105
lines changed

8 files changed

+131
-105
lines changed

.travis.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ services:
77
- docker
88

99
env:
10-
- BBLFSHD_VERSION=v2.11.7
10+
- BBLFSHD_VERSION=v2.11.8
1111

1212
install:
1313
- curl -L https://github.com/golang/dep/releases/download/v0.4.1/dep-linux-amd64 > $GOPATH/bin/dep
@@ -18,9 +18,9 @@ install:
1818
- docker pull bblfsh/bblfshd:$BBLFSHD_VERSION
1919

2020
script:
21-
- bblfsh-sdk update --dry-run
22-
- bblfsh-sdk build ci-build
23-
- bblfsh-sdk test --bblfshd $BBLFSHD_VERSION ci-build
21+
- go test ./driver/...
22+
- go run build.go ci-build
23+
- go run test.go --bblfshd $BBLFSHD_VERSION ci-build
2424

2525
after_success:
2626
- bblfsh-sdk push ci-build

Gopkg.lock

+3-94
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Gopkg.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
[[constraint]]
55
name = "gopkg.in/bblfsh/sdk.v2"
6-
version = "2.15.x"
6+
version = "2.16.x"
77

88
[prune]
99
go-tests = true

README.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ Development Environment
88

99
Requirements:
1010
- `docker`
11-
- [`bblfsh-sdk`](https://github.com/bblfsh/sdk) _(go get -u gopkg.in/bblfsh/sdk.v2/...)_
12-
- UAST converter dependencies _(dep ensure --vendor-only)_
11+
- Go 1.11+
12+
- SDK dependencies _(dep ensure --vendor-only)_
1313

14-
To initialize the build system execute: `bblfsh-sdk update`, at the root of the project. This will generate the `Dockerfile` for this driver.
14+
To initialize the build system execute: `go test ./driver`, at the root of the project. This will generate the `Dockerfile` for this driver.
1515

16-
To execute the tests just execute `bblfsh-sdk test`, this will execute the test over the native and the go components of the driver using Docker.
16+
To execute the tests just execute `go run test.go`, this will execute the test over the native and the go components of the driver using Docker.
1717

18-
The build is done executing `bblfsh-sdk build`. To evaluate the result using a docker container, execute:
19-
`bblfsh-sdk build test-driver && docker run -it test-driver`.
18+
The build is done executing `go run build.go`. To evaluate the result using a docker container, execute:
19+
`go run build.go test-driver && docker run -it test-driver`.
2020

2121

2222
License

build.go

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
package main
2+
3+
import (
4+
"flag"
5+
"fmt"
6+
"os"
7+
8+
"gopkg.in/bblfsh/sdk.v2/build"
9+
)
10+
11+
func main() {
12+
flag.Parse()
13+
if err := runBuild("."); err != nil {
14+
fmt.Fprintln(os.Stderr, err)
15+
os.Exit(1)
16+
}
17+
}
18+
19+
func runBuild(root string) error {
20+
args := flag.Args()
21+
name := ""
22+
if len(args) != 0 {
23+
name = args[0]
24+
}
25+
d, err := build.NewDriver(root)
26+
if err != nil {
27+
return err
28+
}
29+
id, err := d.Build(name)
30+
if err != nil {
31+
return err
32+
}
33+
fmt.Println(id)
34+
return nil
35+
}

driver/sdk_test.go

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package main_test
2+
3+
import (
4+
"testing"
5+
6+
"gopkg.in/bblfsh/sdk.v2/build"
7+
)
8+
9+
func TestSDKUpToDate(t *testing.T) {
10+
printf := func(format string, args ...interface{}) (int, error) {
11+
t.Logf(format, args...)
12+
return 0, nil
13+
}
14+
err := build.UpdateSDK("../", &build.UpdateOptions{
15+
DryRun: true,
16+
Debug: printf,
17+
Notice: printf,
18+
Warning: printf,
19+
})
20+
if err != nil {
21+
t.Fatal(err)
22+
}
23+
}

test.go

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
package main
2+
3+
import (
4+
"flag"
5+
"fmt"
6+
"os"
7+
8+
"gopkg.in/bblfsh/sdk.v2/build"
9+
)
10+
11+
var (
12+
fBblfshd = flag.String("bblfshd", "", "bblfshd version to test with")
13+
fBench = flag.Bool("bench", false, "benchmark the driver")
14+
)
15+
16+
func main() {
17+
flag.Parse()
18+
if err := runTest("."); err != nil {
19+
fmt.Fprintln(os.Stderr, err)
20+
os.Exit(1)
21+
}
22+
}
23+
24+
func runTest(root string) error {
25+
args := flag.Args()
26+
image := ""
27+
if len(args) != 0 {
28+
image = args[0]
29+
}
30+
d, err := build.NewDriver(root)
31+
if err != nil {
32+
return err
33+
}
34+
return d.Test(*fBblfshd, image, *fBench)
35+
}

update.go

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package main
2+
3+
import (
4+
"flag"
5+
"fmt"
6+
"os"
7+
8+
"gopkg.in/bblfsh/sdk.v2/build"
9+
)
10+
11+
func main() {
12+
flag.Parse()
13+
if err := runUpdate("."); err != nil {
14+
fmt.Fprintln(os.Stderr, err)
15+
os.Exit(1)
16+
}
17+
}
18+
19+
func runUpdate(root string) error {
20+
return build.UpdateSDK(root, &build.UpdateOptions{
21+
Notice: fmt.Printf,
22+
Warning: fmt.Printf,
23+
})
24+
}

0 commit comments

Comments
 (0)