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

Commit

Permalink
update sdk version
Browse files Browse the repository at this point in the history
Signed-off-by: Denys Smirnov <[email protected]>
  • Loading branch information
Denys Smirnov authored and dennwc committed Mar 22, 2019
1 parent e9d079f commit 7177072
Show file tree
Hide file tree
Showing 8 changed files with 137 additions and 19 deletions.
8 changes: 4 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ services:
- docker

env:
- BBLFSHD_VERSION=v2.11.7
- BBLFSHD_VERSION=v2.11.8

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

script:
- bblfsh-sdk update --dry-run
- bblfsh-sdk build ci-build
- bblfsh-sdk test --bblfshd $BBLFSHD_VERSION ci-build
- go test ./driver/...
- go run build.go ci-build
- go run test.go --bblfshd $BBLFSHD_VERSION ci-build

after_success:
- bblfsh-sdk push ci-build
17 changes: 9 additions & 8 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

[[constraint]]
name = "gopkg.in/bblfsh/sdk.v2"
version = "2.15.x"
version = "2.16.x"

[prune]
go-tests = true
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ Development Environment

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

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

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.
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.

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


License
Expand Down
35 changes: 35 additions & 0 deletions build.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package main

import (
"flag"
"fmt"
"os"

"gopkg.in/bblfsh/sdk.v2/build"
)

func main() {
flag.Parse()
if err := runBuild("."); err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
}

func runBuild(root string) error {
args := flag.Args()
name := ""
if len(args) != 0 {
name = args[0]
}
d, err := build.NewDriver(root)
if err != nil {
return err
}
id, err := d.Build(name)
if err != nil {
return err
}
fmt.Println(id)
return nil
}
23 changes: 23 additions & 0 deletions driver/sdk_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package main_test

import (
"testing"

"gopkg.in/bblfsh/sdk.v2/build"
)

func TestSDKUpToDate(t *testing.T) {
printf := func(format string, args ...interface{}) (int, error) {
t.Logf(format, args...)
return 0, nil
}
err := build.UpdateSDK("../", &build.UpdateOptions{
DryRun: true,
Debug: printf,
Notice: printf,
Warning: printf,
})
if err != nil {
t.Fatal(err)
}
}
35 changes: 35 additions & 0 deletions test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package main

import (
"flag"
"fmt"
"os"

"gopkg.in/bblfsh/sdk.v2/build"
)

var (
fBblfshd = flag.String("bblfshd", "", "bblfshd version to test with")
fBench = flag.Bool("bench", false, "benchmark the driver")
)

func main() {
flag.Parse()
if err := runTest("."); err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
}

func runTest(root string) error {
args := flag.Args()
image := ""
if len(args) != 0 {
image = args[0]
}
d, err := build.NewDriver(root)
if err != nil {
return err
}
return d.Test(*fBblfshd, image, *fBench)
}
24 changes: 24 additions & 0 deletions update.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package main

import (
"flag"
"fmt"
"os"

"gopkg.in/bblfsh/sdk.v2/build"
)

func main() {
flag.Parse()
if err := runUpdate("."); err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
}

func runUpdate(root string) error {
return build.UpdateSDK(root, &build.UpdateOptions{
Notice: fmt.Printf,
Warning: fmt.Printf,
})
}

0 comments on commit 7177072

Please sign in to comment.