different errors; readme edit
This commit is contained in:
parent
5fd9a59027
commit
e1a317c3f6
@ -303,13 +303,13 @@ The config provides information for composing a set of transformers:
|
|||||||
migrations = "to/db/migrations"
|
migrations = "to/db/migrations"
|
||||||
```
|
```
|
||||||
- `home` is the name of the package you are building the plugin for, in most cases this is github.com/vulcanize/vulcanizedb
|
- `home` is the name of the package you are building the plugin for, in most cases this is github.com/vulcanize/vulcanizedb
|
||||||
our `$GOPATH` but setting this to `true` overrides that. This needs to be set to `true` for the configs used in tests in order for them to work with Travis.
|
|
||||||
- `name` is the name used for the plugin files (.so and .go)
|
- `name` is the name used for the plugin files (.so and .go)
|
||||||
- `save` indicates whether or not the user wants to save the .go file instead of removing it after .so compilation. Sometimes useful for debugging/trouble-shooting purposes.
|
- `save` indicates whether or not the user wants to save the .go file instead of removing it after .so compilation. Sometimes useful for debugging/trouble-shooting purposes.
|
||||||
- `transformerNames` is the list of the names of the transformers we are composing together, so we know how to access their submaps in the exporter map
|
- `transformerNames` is the list of the names of the transformers we are composing together, so we know how to access their submaps in the exporter map
|
||||||
- `exporter.<transformerName>`s are the sub-mappings containing config info for the transformers
|
- `exporter.<transformerName>`s are the sub-mappings containing config info for the transformers
|
||||||
- `repository` is the path for the repository which contains the transformer and its `TransformerInitializer`
|
- `repository` is the path for the repository which contains the transformer and its `TransformerInitializer`
|
||||||
- `path` is the relative path from `repository` to the transformer's `TransformerInitializer` directory (initializer package)
|
- `path` is the relative path from `repository` to the transformer's `TransformerInitializer` directory (initializer package).
|
||||||
|
- Transformer repositories need to be cloned into the user's $GOPATH (`go get`)
|
||||||
- `type` is the type of the transformer; indicating which type of watcher it works with (for now, there are only two options: `eth_event` and `eth_storage`)
|
- `type` is the type of the transformer; indicating which type of watcher it works with (for now, there are only two options: `eth_event` and `eth_storage`)
|
||||||
- `eth_storage` indicates the transformer works with the [storage watcher](https://github.com/vulcanize/maker-vulcanizedb/blob/compose_and_execute/libraries/shared/watcher/storage_watcher.go)
|
- `eth_storage` indicates the transformer works with the [storage watcher](https://github.com/vulcanize/maker-vulcanizedb/blob/compose_and_execute/libraries/shared/watcher/storage_watcher.go)
|
||||||
that fetches state and storage diffs from an ETH node (instead of, for example, from IPFS)
|
that fetches state and storage diffs from an ETH node (instead of, for example, from IPFS)
|
||||||
|
@ -60,15 +60,15 @@ func (b *builder) BuildPlugin() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// setup env to build plugin
|
// setup env to build plugin
|
||||||
err = b.setupBuildEnv()
|
setupErr := b.setupBuildEnv()
|
||||||
if err != nil {
|
if setupErr != nil {
|
||||||
return err
|
return setupErr
|
||||||
}
|
}
|
||||||
|
|
||||||
// Build the .go file into a .so plugin
|
// Build the .go file into a .so plugin
|
||||||
err = exec.Command("go", "build", "-buildmode=plugin", "-o", soFile, b.goFile).Run()
|
execErr := exec.Command("go", "build", "-buildmode=plugin", "-o", soFile, b.goFile).Run()
|
||||||
if err != nil {
|
if execErr != nil {
|
||||||
return errors.New(fmt.Sprintf("unable to build .so file: %s", err.Error()))
|
return errors.New(fmt.Sprintf("unable to build .so file: %s", execErr.Error()))
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -87,20 +87,20 @@ func (b *builder) setupBuildEnv() error {
|
|||||||
// Import transformer dependencies so that we can build our plugin
|
// Import transformer dependencies so that we can build our plugin
|
||||||
for importPath := range repoPaths {
|
for importPath := range repoPaths {
|
||||||
dst := filepath.Join(vendorPath, importPath)
|
dst := filepath.Join(vendorPath, importPath)
|
||||||
src, err := helpers.CleanPath(filepath.Join("$GOPATH/src", importPath))
|
src, cleanErr := helpers.CleanPath(filepath.Join("$GOPATH/src", importPath))
|
||||||
if err != nil {
|
if cleanErr != nil {
|
||||||
return err
|
return cleanErr
|
||||||
}
|
}
|
||||||
|
|
||||||
err = helpers.CopyDir(src, dst, "vendor")
|
copyErr := helpers.CopyDir(src, dst, "vendor")
|
||||||
if err != nil {
|
if copyErr != nil {
|
||||||
return errors.New(fmt.Sprintf("unable to copy transformer dependency from %s to %s: %v", src, dst, err))
|
return errors.New(fmt.Sprintf("unable to copy transformer dependency from %s to %s: %v", src, dst, copyErr))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Have to clear out the copied over vendor lib or plugin won't build (see issue above)
|
// Have to clear out the copied over vendor lib or plugin won't build (see issue above)
|
||||||
err = os.RemoveAll(filepath.Join(dst, "vendor"))
|
removeErr := os.RemoveAll(filepath.Join(dst, "vendor"))
|
||||||
if err != nil {
|
if removeErr != nil {
|
||||||
return err
|
return removeErr
|
||||||
}
|
}
|
||||||
// Keep track of this vendor directory to clear later
|
// Keep track of this vendor directory to clear later
|
||||||
b.tmpVenDirs = append(b.tmpVenDirs, dst)
|
b.tmpVenDirs = append(b.tmpVenDirs, dst)
|
||||||
|
@ -80,16 +80,19 @@ func CopyDir(src string, dst string, excludeRecursiveDir string) error {
|
|||||||
var fds []os.FileInfo
|
var fds []os.FileInfo
|
||||||
var srcinfo os.FileInfo
|
var srcinfo os.FileInfo
|
||||||
|
|
||||||
if srcinfo, err = os.Stat(src); err != nil {
|
srcinfo, err = os.Stat(src)
|
||||||
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if err = os.MkdirAll(dst, srcinfo.Mode()); err != nil {
|
mkErr := os.MkdirAll(dst, srcinfo.Mode())
|
||||||
return err
|
if mkErr != nil {
|
||||||
|
return mkErr
|
||||||
}
|
}
|
||||||
|
|
||||||
if fds, err = ioutil.ReadDir(src); err != nil {
|
fds, readErr := ioutil.ReadDir(src)
|
||||||
return err
|
if err != readErr {
|
||||||
|
return readErr
|
||||||
}
|
}
|
||||||
for _, fd := range fds {
|
for _, fd := range fds {
|
||||||
srcfp := filepath.Join(src, fd.Name())
|
srcfp := filepath.Join(src, fd.Name())
|
||||||
@ -97,15 +100,15 @@ func CopyDir(src string, dst string, excludeRecursiveDir string) error {
|
|||||||
|
|
||||||
if fd.IsDir() {
|
if fd.IsDir() {
|
||||||
if fd.Name() != excludeRecursiveDir {
|
if fd.Name() != excludeRecursiveDir {
|
||||||
err = CopyDir(srcfp, dstfp, "")
|
dirErr := CopyDir(srcfp, dstfp, "")
|
||||||
if err != nil {
|
if dirErr != nil {
|
||||||
return err
|
return dirErr
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
err = CopyFile(srcfp, dstfp)
|
fileErr := CopyFile(srcfp, dstfp)
|
||||||
if err != nil {
|
if fileErr != nil {
|
||||||
return err
|
return fileErr
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user