This repository has been archived by the owner on Mar 8, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Denys Smirnov <[email protected]>
- Loading branch information
Showing
8 changed files
with
137 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
}) | ||
} |