Skip to content

Commit 9e60071

Browse files
committed
do not render JSON-ified QAPI
It's no longer necessary with the native QAPI parser.
1 parent bec2f50 commit 9e60071

File tree

3 files changed

+4
-23005
lines changed

3 files changed

+4
-23005
lines changed

internal/qmp-gen/main.go

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
package gen
1616

1717
import (
18-
"bytes"
19-
"encoding/json"
2018
"flag"
2119
"go/format"
2220
"io/ioutil"
@@ -25,10 +23,9 @@ import (
2523
const specURL = `https://raw.githubusercontent.com/qemu/qemu/stable-2.11/qapi-schema.json`
2624

2725
var (
28-
inputSpec = flag.String("input", specURL, "Input spec")
29-
outputGo = flag.String("output", "", "Generated code output")
30-
outputSpec = flag.String("spec", "", "Generated spec output")
31-
templates = flag.String("templates", "", "Template directory")
26+
inputSpec = flag.String("input", specURL, "Input spec")
27+
outputGo = flag.String("output", "", "Generated code output")
28+
templates = flag.String("templates", "", "Template directory")
3229
)
3330

3431
// Generate parses a QMP API spec and generates a Go implementation.
@@ -40,23 +37,6 @@ func Generate() error {
4037
return err
4138
}
4239

43-
// Write out the concatenated spec.
44-
var spec bytes.Buffer
45-
46-
// First add a comment with the best guess of version
47-
spec.WriteString("\n##QEMU SPECIFICATION VERSION: ")
48-
spec.WriteString(tryGetVersionFromSpecPath(*inputSpec))
49-
spec.WriteString("\n\n")
50-
51-
for _, def := range defs {
52-
spec.WriteString(def.Docstring)
53-
spec.WriteByte('\n')
54-
json.Indent(&spec, def.JSON, "", " ")
55-
spec.WriteString("\n\n")
56-
}
57-
if err = ioutil.WriteFile(*outputSpec, spec.Bytes(), 0640); err != nil {
58-
return err
59-
}
6040
// Generate and write out the code.
6141
symbols, err := parse(defs)
6242
if err != nil {

qmp/raw/doc.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@
1616
// QMP schema.
1717
package raw
1818

19-
//go:generate go run gen-api.go -output autogen.go -spec spec.txt -templates ../../internal/qmp-gen/templates
19+
//go:generate go run gen-api.go -output autogen.go -templates ../../internal/qmp-gen/templates

0 commit comments

Comments
 (0)