-
Notifications
You must be signed in to change notification settings - Fork 3
/
kompile.go
36 lines (32 loc) · 1.14 KB
/
kompile.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package main
// Tool to more easily generate IELE sources.
// Works by calling the K framework.
// For this to work, K framework needs to be installed (https://github.com/ElrondNetwork/k)
// Also, "<K location>/k/k-distribution/target/release/k/bin/kompile" needs to be in the PATH variable.
import (
"fmt"
"go/build"
"log"
"os/exec"
"path"
)
func main() {
hookPackages := "github.com/ElrondNetwork/elrond-vm/iele/elrond/standalone/hookadapter/krypto"
goSrcPath := path.Join(build.Default.GOPATH, "src")
fmt.Println("Starting to generate elrond iele-standalone go sources ...")
cmd := exec.Command("kompile", "iele-testing.k",
"--backend", "go",
"--main-module", "IELE-TESTING",
"--syntax-module", "IELE-SYNTAX",
"--go-hook-packages", fmt.Sprintf("\"%s\"", hookPackages),
"--go-src-only",
"--go-src-path", fmt.Sprintf("\"%s\"", goSrcPath),
)
cmd.Dir = path.Join(build.Default.GOPATH, "src/github.com/ElrondNetwork/elrond-vm/iele/elrond/standalone")
output, err := cmd.Output()
if err != nil {
log.Fatal("kompile iele-node error " + err.Error())
}
fmt.Println(string(output))
fmt.Println("Done generating iele-node go sources.")
}