Skip to content
This repository was archived by the owner on Mar 8, 2020. It is now read-only.

Commit 59f30c5

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

File tree

8 files changed

+137
-17
lines changed

8 files changed

+137
-17
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

+8-5
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
@@ -2,8 +2,8 @@
22
# for detailed Gopkg.toml documentation.
33

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

88
[prune]
99
go-tests = true

README.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
# C&#43;&#43; driver for [Babelfish](https://github.com/bblfsh/bblfshd) ![Driver Status](https://img.shields.io/badge/status-beta-dbd25c.svg) [![Build Status](https://travis-ci.org/bblfsh/cpp-driver.svg?branch=master)](https://travis-ci.org/bblfsh/cpp-driver) ![Native Version](https://img.shields.io/badge/cpp%20version-8.121.13--r0-aa93ea.svg) ![Go Version](https://img.shields.io/badge/go%20version-1.9-63afbf.svg)
1+
# C++ driver for [Babelfish](https://github.com/bblfsh/bblfshd) ![Driver Status](https://img.shields.io/badge/status-beta-dbd25c.svg) [![Build Status](https://travis-ci.org/bblfsh/cpp-driver.svg?branch=master)](https://travis-ci.org/bblfsh/cpp-driver) ![Native Version](https://img.shields.io/badge/cpp%20version-8.121.13--r0-aa93ea.svg) ![Go Version](https://img.shields.io/badge/go%20version-1.9-63afbf.svg)
22

33
Development Environment
44
-----------------------
55

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

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

13-
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.
13+
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.
1414

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

1818

1919
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)