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 <denys@sourced.tech>
  • Loading branch information
Denys Smirnov authored and dennwc committed Mar 26, 2019
1 parent dfc7c13 commit 59f30c5
Show file tree
Hide file tree
Showing 8 changed files with 137 additions and 17 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
13 changes: 8 additions & 5 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 @@ -2,8 +2,8 @@
# for detailed Gopkg.toml documentation.

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

[prune]
go-tests = true
Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
# 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)
# 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)

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 59f30c5

Please sign in to comment.