Skip to content

Commit 1fadfcb

Browse files
committed
feat: update protobuf and apigen processes, regen protos
Signed-off-by: Christian Stewart <[email protected]>
1 parent e6e55d1 commit 1fadfcb

File tree

105 files changed

+140942
-66714
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

105 files changed

+140942
-66714
lines changed

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "generator/GameTracking-Dota2"]
2+
path = generator/GameTracking-Dota2
3+
url = https://github.com/SteamDatabase/GameTracking-Dota2

Gopkg.lock

Lines changed: 0 additions & 78 deletions
This file was deleted.

Gopkg.toml

Lines changed: 0 additions & 35 deletions
This file was deleted.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ This mechanism is used everywhere, these objects are not exposed in their own ev
4040

4141
```go
4242
import (
43-
gcmm "github.com/paralin/go-dota2/protocol/dota_gcmessages_common_match_management"
43+
gcmm "github.com/paralin/go-dota2/protocol"
4444
"github.com/paralin/go-dota2/cso"
4545
)
4646

apigen/api_generate.go

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
"strings"
1010
"unicode"
1111

12-
gcm "github.com/paralin/go-dota2/protocol/dota_gcmessages_msgid"
12+
gcm "github.com/paralin/go-dota2/protocol"
1313
"github.com/pkg/errors"
1414
"github.com/serenize/snaker"
1515
)
@@ -29,14 +29,13 @@ func GenerateAPI(ctx context.Context, clientOutput, eventsOutput io.Writer) erro
2929
var requestFuncs []*generatedRequestFunc
3030

3131
eventsImports := make(map[string]struct{})
32-
eventsImports["github.com/paralin/go-dota2/protocol/dota_gcmessages_msgid"] = struct{}{}
32+
eventsImports["github.com/paralin/go-dota2/protocol"] = struct{}{}
3333
eventsImports["github.com/golang/protobuf/proto"] = struct{}{}
3434

3535
clientImports := make(map[string]struct{})
3636
clientImports["context"] = struct{}{}
37-
clientImports["github.com/paralin/go-dota2/protocol/dota_shared_enums"] = struct{}{}
37+
clientImports["github.com/paralin/go-dota2/protocol"] = struct{}{}
3838
clientImports["github.com/faceit/go-steam/steamid"] = struct{}{}
39-
clientImports["github.com/paralin/go-dota2/protocol/dota_gcmessages_msgid"] = struct{}{}
4039
clientImports["github.com/paralin/go-dota2/events"] = struct{}{}
4140

4241
// responseMsgs are messages that are known to be responses.
@@ -236,11 +235,11 @@ func GenerateAPI(ctx context.Context, clientOutput, eventsOutput io.Writer) erro
236235
return err
237236
}
238237
fmt.Fprintf(clientOutput, "{}\n\n\treturn resp, d.MakeRequest(\n")
239-
fmt.Fprintf(clientOutput, "\t\tctx,\n\t\tuint32(dota_gcmessages_msgid.EDOTAGCMsg_%s),\n", f.reqMsgID.String())
240-
fmt.Fprintf(clientOutput, "\t\treq,\n\t\tuint32(dota_gcmessages_msgid.EDOTAGCMsg_%s),\n", f.respMsgID.String())
238+
fmt.Fprintf(clientOutput, "\t\tctx,\n\t\tuint32(protocol.EDOTAGCMsg_%s),\n", f.reqMsgID.String())
239+
fmt.Fprintf(clientOutput, "\t\treq,\n\t\tuint32(protocol.EDOTAGCMsg_%s),\n", f.respMsgID.String())
241240
fmt.Fprintf(clientOutput, "\t\tresp,\n\t)\n")
242241
} else {
243-
fmt.Fprintf(clientOutput, "\td.write(uint32(dota_gcmessages_msgid.EDOTAGCMsg_%s), req)\n", f.reqMsgID.String())
242+
fmt.Fprintf(clientOutput, "\td.write(uint32(protocol.EDOTAGCMsg_%s), req)\n", f.reqMsgID.String())
244243
}
245244

246245
fmt.Fprintf(clientOutput, "}\n")
@@ -270,8 +269,8 @@ func GenerateAPI(ctx context.Context, clientOutput, eventsOutput io.Writer) erro
270269
fmt.Fprintf(eventsOutput, "\n}\n")
271270

272271
fmt.Fprintf(eventsOutput, "\n// GetDotaEventMsgID returns the dota message ID of the event.\n")
273-
fmt.Fprintf(eventsOutput, "func (e *%s) GetDotaEventMsgID() dota_gcmessages_msgid.EDOTAGCMsg {\n", eventHandler.eventName)
274-
fmt.Fprintf(eventsOutput, "\treturn dota_gcmessages_msgid.EDOTAGCMsg_%s\n", eventHandler.msgID.String())
272+
fmt.Fprintf(eventsOutput, "func (e *%s) GetDotaEventMsgID() protocol.EDOTAGCMsg {\n", eventHandler.eventName)
273+
fmt.Fprintf(eventsOutput, "\treturn protocol.EDOTAGCMsg_%s\n", eventHandler.msgID.String())
275274
fmt.Fprintf(eventsOutput, "}\n")
276275

277276
fmt.Fprintf(eventsOutput, "\n// GetEventBody returns the event body.\n")
@@ -286,7 +285,7 @@ func GenerateAPI(ctx context.Context, clientOutput, eventsOutput io.Writer) erro
286285

287286
fmt.Fprintf(
288287
clientOutput,
289-
"\td.handlers[uint32(dota_gcmessages_msgid.EDOTAGCMsg_%s)] = d.getEventEmitter(func() events.Event {\n",
288+
"\td.handlers[uint32(protocol.EDOTAGCMsg_%s)] = d.getEventEmitter(func() events.Event {\n",
290289
eventHandler.msgID.String(),
291290
)
292291
fmt.Fprintf(clientOutput, "\t\treturn &events.%s{}\n\t})\n", eventHandler.eventName)

apigen/api_generate_event.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package main
33
import (
44
"fmt"
55

6-
gcm "github.com/paralin/go-dota2/protocol/dota_gcmessages_msgid"
6+
gcm "github.com/paralin/go-dota2/protocol"
77
)
88

99
type generatedEventHandler struct {

apigen/api_generate_func.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"strings"
77

88
"github.com/fatih/camelcase"
9-
gcm "github.com/paralin/go-dota2/protocol/dota_gcmessages_msgid"
9+
gcm "github.com/paralin/go-dota2/protocol"
1010
"github.com/pkg/errors"
1111
)
1212

apigen/apigen.bash

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
set -eo pipefail
3+
4+
echo "This script should be run in GOPATH due to go-mod compatibility issues."
5+
GO111MODULE=on go build -o apigen ./
6+
GO111MODULE=on go mod vendor
7+
GO111MODULE=off ./apigen generate-api

apigen/msg.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package main
33
import (
44
"sort"
55

6-
"github.com/paralin/go-dota2/protocol/dota_gcmessages_msgid"
6+
dota_gcmessages_msgid "github.com/paralin/go-dota2/protocol"
77
)
88

99
// IsValidMsg checks if the message is valid.

apigen/msg_event_name.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package main
33
import (
44
"strings"
55

6-
"github.com/paralin/go-dota2/protocol/dota_gcmessages_msgid"
6+
dota_gcmessages_msgid "github.com/paralin/go-dota2/protocol"
77
)
88

99
// GetMessageEventName returns the event name for the message.

0 commit comments

Comments
 (0)