Compare commits
No commits in common. "3deeb4cf8006f65a6178ae51f67bda83b6eb094f" and "0d9c02dff6a87bf83d66977293bffa941cf61b15" have entirely different histories.
3deeb4cf80
...
0d9c02dff6
12 changed files with 69 additions and 103 deletions
|
@ -1,4 +1,25 @@
|
||||||
ARG VARIANT="1.21-bullseye"
|
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.231.5/containers/go/.devcontainer/base.Dockerfile
|
||||||
FROM mcr.microsoft.com/devcontainers/go:1-${VARIANT}
|
|
||||||
|
|
||||||
USER vscode
|
# [Choice] Go version (use -bullseye variants on local arm64/Apple Silicon): 1, 1.16, 1.17, 1-bullseye, 1.16-bullseye, 1.17-bullseye, 1-buster, 1.16-buster, 1.17-buster
|
||||||
|
ARG VARIANT="1.18-bullseye"
|
||||||
|
FROM mcr.microsoft.com/vscode/devcontainers/go:0-${VARIANT}
|
||||||
|
|
||||||
|
# [Choice] Node.js version: none, lts/*, 16, 14, 12, 10
|
||||||
|
ARG NODE_VERSION="none"
|
||||||
|
RUN if [ "${NODE_VERSION}" != "none" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi
|
||||||
|
|
||||||
|
# [Optional] Uncomment this section to install additional OS packages.
|
||||||
|
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
|
||||||
|
&& apt-get -y install --no-install-recommends graphviz cmake zlib1g-dev genisoimage
|
||||||
|
RUN cd /tmp && git clone https://github.com/hamstergene/libdmg-hfsplus \
|
||||||
|
&& cd libdmg-hfsplus && cmake . -B build && make -C build/dmg -j8 && cp build/dmg/dmg /usr/local/bin \
|
||||||
|
&& rm -rf /tmp/libdmg-hfsplus
|
||||||
|
|
||||||
|
# [Optional] Uncomment the next lines to use go get to install anything else you need
|
||||||
|
USER vscode
|
||||||
|
# RUN go get -x <your-dependency-or-tool>
|
||||||
|
# RUN npm install -g @angular/CLI
|
||||||
|
# [Optional] Uncomment this line to install global node packages.
|
||||||
|
# RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g <your-package-here>" 2>&1
|
||||||
|
RUN go install github.com/tc-hib/go-winres@latest \
|
||||||
|
&& go install github.com/goreleaser/goreleaser@latest
|
|
@ -1,32 +1,40 @@
|
||||||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
|
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
|
||||||
// README at: https://github.com/devcontainers/templates/tree/main/src/go
|
// https://github.com/microsoft/vscode-dev-containers/tree/v0.231.5/containers/go
|
||||||
{
|
{
|
||||||
"name": "Go",
|
"name": "Go",
|
||||||
"build": {
|
"build": {
|
||||||
"dockerfile": "Dockerfile",
|
"dockerfile": "Dockerfile",
|
||||||
"args": {
|
"args": {
|
||||||
"VARIANT": "1.21"
|
// Update the VARIANT arg to pick a version of Go: 1, 1.18, 1.17
|
||||||
|
// Append -bullseye or -buster to pin to an OS version.
|
||||||
|
// Use -bullseye variants on local arm64/Apple Silicon.
|
||||||
|
"VARIANT": "1.18",
|
||||||
|
// Options
|
||||||
|
"NODE_VERSION": "lts/*"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"customizations": {
|
"runArgs": [
|
||||||
// Configure properties specific to VS Code.
|
"--cap-add=SYS_PTRACE",
|
||||||
"vscode": {
|
"--security-opt",
|
||||||
// Set *default* container specific settings.json values on container create.
|
"seccomp=unconfined"
|
||||||
"settings": {
|
],
|
||||||
"go.toolsManagement.checkForUpdates": "local",
|
// Set *default* container specific settings.json values on container create.
|
||||||
"go.useLanguageServer": true,
|
"settings": {
|
||||||
"go.gopath": "/go"
|
"go.toolsManagement.checkForUpdates": "local",
|
||||||
},
|
"go.useLanguageServer": true,
|
||||||
"extensions": [
|
"go.gopath": "/go"
|
||||||
"golang.Go",
|
|
||||||
"jinliming2.vscode-go-template",
|
|
||||||
"golang.go"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"features": {
|
// Add the IDs of extensions you want installed when the container is created.
|
||||||
"ghcr.io/devcontainers-contrib/features/apt-get-packages:1": {
|
"extensions": [
|
||||||
"packages": "genisoimage"
|
"golang.Go",
|
||||||
}
|
"jinliming2.vscode-go-template",
|
||||||
}
|
"golang.go"
|
||||||
|
],
|
||||||
|
// Use 'forwardPorts' to make a list of ports inside the container available locally.
|
||||||
|
// "forwardPorts": [],
|
||||||
|
// Use 'postCreateCommand' to run commands after the container is created.
|
||||||
|
// "postCreateCommand": "go version",
|
||||||
|
// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
|
||||||
|
"remoteUser": "vscode",
|
||||||
|
"features": {}
|
||||||
}
|
}
|
6
.github/workflows/build.yml
vendored
6
.github/workflows/build.yml
vendored
|
@ -18,7 +18,7 @@ jobs:
|
||||||
- name: Set up Go
|
- name: Set up Go
|
||||||
uses: actions/setup-go@v3
|
uses: actions/setup-go@v3
|
||||||
with:
|
with:
|
||||||
go-version: 1.21
|
go-version: 1.18
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: cd backend && go build -v ./...
|
run: cd backend && go build -v ./...
|
||||||
|
@ -33,13 +33,13 @@ jobs:
|
||||||
- name: Set up Go
|
- name: Set up Go
|
||||||
uses: actions/setup-go@v2
|
uses: actions/setup-go@v2
|
||||||
with:
|
with:
|
||||||
go-version: 1.21
|
go-version: 1.18
|
||||||
|
|
||||||
- name: Run GoReleaser
|
- name: Run GoReleaser
|
||||||
uses: goreleaser/goreleaser-action@v2
|
uses: goreleaser/goreleaser-action@v2
|
||||||
with:
|
with:
|
||||||
version: latest
|
version: latest
|
||||||
workdir: backend
|
workdir: backend
|
||||||
args: release --clean
|
args: release --rm-dist
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
@ -1,5 +1,2 @@
|
||||||
gen:
|
gen:
|
||||||
go run analyze.go -g=true
|
go run analyze.go -g=true
|
||||||
|
|
||||||
analyze:
|
|
||||||
go run analyze.go -l -a /workspaces/LegendsBrowser2/inputs4
|
|
|
@ -4281,7 +4281,6 @@
|
||||||
"Base": true,
|
"Base": true,
|
||||||
"Plus": false,
|
"Plus": false,
|
||||||
"Values": {
|
"Values": {
|
||||||
"as a symbol of everlasting peace": true,
|
|
||||||
"part of trade negotiation": true
|
"part of trade negotiation": true
|
||||||
},
|
},
|
||||||
"Enum": true
|
"Enum": true
|
||||||
|
@ -12297,8 +12296,7 @@
|
||||||
"Values": {
|
"Values": {
|
||||||
"Autumn": true,
|
"Autumn": true,
|
||||||
"Spring": true,
|
"Spring": true,
|
||||||
"Summer": true,
|
"Summer": true
|
||||||
"Winter": true
|
|
||||||
},
|
},
|
||||||
"Enum": true
|
"Enum": true
|
||||||
},
|
},
|
||||||
|
|
|
@ -21,14 +21,9 @@ func enumValue(s string) string {
|
||||||
}
|
}
|
||||||
func enumString(s string) string { return strcase.ToDelimited(s, ' ') }
|
func enumString(s string) string { return strcase.ToDelimited(s, ' ') }
|
||||||
|
|
||||||
func startswith(str, prefix string) bool {
|
|
||||||
return strings.HasPrefix(str, prefix)
|
|
||||||
}
|
|
||||||
|
|
||||||
var backendTemplate = template.Must(template.New("").Funcs(template.FuncMap{
|
var backendTemplate = template.Must(template.New("").Funcs(template.FuncMap{
|
||||||
"enum": enumValue,
|
"enum": enumValue,
|
||||||
"enumString": enumString,
|
"enumString": enumString,
|
||||||
"startswith": startswith,
|
|
||||||
}).Parse(`// Code generated by legendsbrowser; DO NOT EDIT.
|
}).Parse(`// Code generated by legendsbrowser; DO NOT EDIT.
|
||||||
package model
|
package model
|
||||||
|
|
||||||
|
@ -239,9 +234,6 @@ func parse{{ $obj.Name }}{{ if $plus }}Plus{{ end }}(p *util.XMLParser{{ if $plu
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
default:
|
default:
|
||||||
{{- if not (startswith $obj.Name "HistoricalEventCollection") }}
|
|
||||||
obj.Details = NewHistoricalEventUnknown(string(data))
|
|
||||||
{{- end }}
|
|
||||||
p.Skip()
|
p.Skip()
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -15,7 +15,7 @@ package model
|
||||||
|
|
||||||
{{- range $name, $obj := $.Objects }}
|
{{- range $name, $obj := $.Objects }}
|
||||||
{{- if $obj.IsSubTypeOf "HistoricalEvent" }}
|
{{- if $obj.IsSubTypeOf "HistoricalEvent" }}
|
||||||
func (x *{{ $obj.Name }}) Html(c *context) string { return "UNKNOWN {{ $obj.Name }}" }
|
func (x *{{ $obj.Name }}) Html(c *context) string { return "UNKNWON {{ $obj.Name }}" }
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
`))
|
`))
|
||||||
|
|
|
@ -18,17 +18,11 @@ builds:
|
||||||
- amd64
|
- amd64
|
||||||
archives:
|
archives:
|
||||||
- format: zip
|
- format: zip
|
||||||
name_template: >-
|
name_template: "legendsbrowser-{{ .Version }}-{{ .Os }}"
|
||||||
legendsbrowser-
|
replacements:
|
||||||
{{- .Version }}-
|
darwin: macos
|
||||||
{{- if eq .Os "darwin" }}macos
|
linux: linux
|
||||||
{{- else if eq .Os "windows" }}win
|
windows: win
|
||||||
{{- else }}{{ .Os }}{{ end }}
|
|
||||||
# name_template: "legendsbrowser-{{ .Version }}-{{ .Os }}"
|
|
||||||
# replacements:
|
|
||||||
# darwin: macos
|
|
||||||
# linux: linux
|
|
||||||
# windows: win
|
|
||||||
changelog:
|
changelog:
|
||||||
sort: asc
|
sort: asc
|
||||||
filters:
|
filters:
|
||||||
|
|
|
@ -8,7 +8,7 @@ buildMacOs:
|
||||||
GOOS=darwin GOARCH=amd64 go build -o ../bin/legendsbrowser-mac
|
GOOS=darwin GOARCH=amd64 go build -o ../bin/legendsbrowser-mac
|
||||||
GOOS=darwin GOARCH=arm64 go build -o ../bin/legendsbrowser-mac-m1
|
GOOS=darwin GOARCH=arm64 go build -o ../bin/legendsbrowser-mac-m1
|
||||||
|
|
||||||
buildMacOsApp: buildMacOs
|
buildMacOsApp:
|
||||||
mkdir -p /tmp/build/macos
|
mkdir -p /tmp/build/macos
|
||||||
cp -r macos/LegendsBrowser.app /tmp/build/macos/
|
cp -r macos/LegendsBrowser.app /tmp/build/macos/
|
||||||
GOOS=darwin GOARCH=amd64 go build -o /tmp/build/macos/LegendsBrowser.app/Contents/MacOS/LegendsBrowser
|
GOOS=darwin GOARCH=amd64 go build -o /tmp/build/macos/LegendsBrowser.app/Contents/MacOS/LegendsBrowser
|
||||||
|
|
|
@ -142,7 +142,7 @@ func (x *HistoricalEventAgreementConcluded) Html(c *Context) string { // TODO wo
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *HistoricalEventAgreementFormed) Html(c *Context) string { // TODO no info
|
func (x *HistoricalEventAgreementFormed) Html(c *Context) string { // TODO no info
|
||||||
return "UNKNOWN HistoricalEventAgreementFormed"
|
return "UNKNWON HistoricalEventAgreementFormed"
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *HistoricalEventAgreementMade) Html(c *Context) string {
|
func (x *HistoricalEventAgreementMade) Html(c *Context) string {
|
||||||
|
@ -537,7 +537,7 @@ func (x *HistoricalEventChangeHfState) Html(c *Context) string {
|
||||||
case HistoricalEventChangeHfStateMood_Secretive:
|
case HistoricalEventChangeHfStateMood_Secretive:
|
||||||
return c.hf(x.Hfid) + " withdrew from society " + c.site(x.SiteId, "in") + r
|
return c.hf(x.Hfid) + " withdrew from society " + c.site(x.SiteId, "in") + r
|
||||||
}
|
}
|
||||||
return "UNKNOWN HistoricalEventChangeHfState"
|
return "UNKNWON HistoricalEventChangeHfState"
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *HistoricalEventChangedCreatureType) Html(c *Context) string {
|
func (x *HistoricalEventChangedCreatureType) Html(c *Context) string {
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package model
|
package model
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"html/template"
|
"html/template"
|
||||||
"sort"
|
"sort"
|
||||||
|
@ -290,34 +289,3 @@ func (r *Reference) Html(c *Context) template.HTML {
|
||||||
func (r *River) Id() int {
|
func (r *River) Id() int {
|
||||||
return r.Id_
|
return r.Id_
|
||||||
}
|
}
|
||||||
|
|
||||||
type HistoricalEventUnknown struct {
|
|
||||||
EventType string
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewHistoricalEventUnknown(eventType string) *HistoricalEventUnknown {
|
|
||||||
return &HistoricalEventUnknown{
|
|
||||||
EventType: eventType,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *HistoricalEventUnknown) Type() string { return x.EventType }
|
|
||||||
func (x *HistoricalEventUnknown) RelatedToEntity(id int) bool { return false }
|
|
||||||
func (x *HistoricalEventUnknown) RelatedToHf(id int) bool { return false }
|
|
||||||
func (x *HistoricalEventUnknown) RelatedToArtifact(id int) bool { return false }
|
|
||||||
func (x *HistoricalEventUnknown) RelatedToSite(id int) bool { return false }
|
|
||||||
func (x *HistoricalEventUnknown) RelatedToStructure(siteId, id int) bool { return false }
|
|
||||||
func (x *HistoricalEventUnknown) RelatedToRegion(id int) bool { return false }
|
|
||||||
func (x *HistoricalEventUnknown) RelatedToWorldConstruction(id int) bool { return false }
|
|
||||||
func (x *HistoricalEventUnknown) RelatedToWrittenContent(id int) bool { return false }
|
|
||||||
func (x *HistoricalEventUnknown) RelatedToDanceForm(id int) bool { return false }
|
|
||||||
func (x *HistoricalEventUnknown) RelatedToMusicalForm(id int) bool { return false }
|
|
||||||
func (x *HistoricalEventUnknown) RelatedToPoeticForm(id int) bool { return false }
|
|
||||||
func (x *HistoricalEventUnknown) RelatedToMountain(id int) bool { return false }
|
|
||||||
func (x *HistoricalEventUnknown) RelatedToIdentity(id int) bool { return false }
|
|
||||||
func (x *HistoricalEventUnknown) CheckFields() {}
|
|
||||||
func (x *HistoricalEventUnknown) Html(c *Context) string { return x.EventType }
|
|
||||||
|
|
||||||
func (x *HistoricalEventUnknown) MarshalJSON() ([]byte, error) {
|
|
||||||
return json.Marshal(make(map[string]any))
|
|
||||||
}
|
|
||||||
|
|
|
@ -4431,14 +4431,11 @@ type HistoricalEventArtifactGivenReason int
|
||||||
|
|
||||||
const (
|
const (
|
||||||
HistoricalEventArtifactGivenReason_Unknown HistoricalEventArtifactGivenReason = iota
|
HistoricalEventArtifactGivenReason_Unknown HistoricalEventArtifactGivenReason = iota
|
||||||
HistoricalEventArtifactGivenReason_AsASymbolOfEverlastingPeace
|
|
||||||
HistoricalEventArtifactGivenReason_PartOfTradeNegotiation
|
HistoricalEventArtifactGivenReason_PartOfTradeNegotiation
|
||||||
)
|
)
|
||||||
|
|
||||||
func parseHistoricalEventArtifactGivenReason(s string) HistoricalEventArtifactGivenReason {
|
func parseHistoricalEventArtifactGivenReason(s string) HistoricalEventArtifactGivenReason {
|
||||||
switch s {
|
switch s {
|
||||||
case "as a symbol of everlasting peace":
|
|
||||||
return HistoricalEventArtifactGivenReason_AsASymbolOfEverlastingPeace
|
|
||||||
case "part of trade negotiation":
|
case "part of trade negotiation":
|
||||||
return HistoricalEventArtifactGivenReason_PartOfTradeNegotiation
|
return HistoricalEventArtifactGivenReason_PartOfTradeNegotiation
|
||||||
}
|
}
|
||||||
|
@ -4447,8 +4444,6 @@ func parseHistoricalEventArtifactGivenReason(s string) HistoricalEventArtifactGi
|
||||||
|
|
||||||
func (s HistoricalEventArtifactGivenReason) String() string {
|
func (s HistoricalEventArtifactGivenReason) String() string {
|
||||||
switch s {
|
switch s {
|
||||||
case HistoricalEventArtifactGivenReason_AsASymbolOfEverlastingPeace:
|
|
||||||
return "as a symbol of everlasting peace"
|
|
||||||
case HistoricalEventArtifactGivenReason_PartOfTradeNegotiation:
|
case HistoricalEventArtifactGivenReason_PartOfTradeNegotiation:
|
||||||
return "part of trade negotiation"
|
return "part of trade negotiation"
|
||||||
}
|
}
|
||||||
|
@ -18622,7 +18617,6 @@ const (
|
||||||
HistoricalEventSiteTributeForcedSeason_Autumn
|
HistoricalEventSiteTributeForcedSeason_Autumn
|
||||||
HistoricalEventSiteTributeForcedSeason_Spring
|
HistoricalEventSiteTributeForcedSeason_Spring
|
||||||
HistoricalEventSiteTributeForcedSeason_Summer
|
HistoricalEventSiteTributeForcedSeason_Summer
|
||||||
HistoricalEventSiteTributeForcedSeason_Winter
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func parseHistoricalEventSiteTributeForcedSeason(s string) HistoricalEventSiteTributeForcedSeason {
|
func parseHistoricalEventSiteTributeForcedSeason(s string) HistoricalEventSiteTributeForcedSeason {
|
||||||
|
@ -18633,8 +18627,6 @@ func parseHistoricalEventSiteTributeForcedSeason(s string) HistoricalEventSiteTr
|
||||||
return HistoricalEventSiteTributeForcedSeason_Spring
|
return HistoricalEventSiteTributeForcedSeason_Spring
|
||||||
case "Summer":
|
case "Summer":
|
||||||
return HistoricalEventSiteTributeForcedSeason_Summer
|
return HistoricalEventSiteTributeForcedSeason_Summer
|
||||||
case "Winter":
|
|
||||||
return HistoricalEventSiteTributeForcedSeason_Winter
|
|
||||||
}
|
}
|
||||||
return HistoricalEventSiteTributeForcedSeason_Unknown
|
return HistoricalEventSiteTributeForcedSeason_Unknown
|
||||||
}
|
}
|
||||||
|
@ -18647,8 +18639,6 @@ func (s HistoricalEventSiteTributeForcedSeason) String() string {
|
||||||
return "spring"
|
return "spring"
|
||||||
case HistoricalEventSiteTributeForcedSeason_Summer:
|
case HistoricalEventSiteTributeForcedSeason_Summer:
|
||||||
return "summer"
|
return "summer"
|
||||||
case HistoricalEventSiteTributeForcedSeason_Winter:
|
|
||||||
return "winter"
|
|
||||||
}
|
}
|
||||||
return "unknown"
|
return "unknown"
|
||||||
}
|
}
|
||||||
|
@ -25197,7 +25187,6 @@ func parseHistoricalEvent(p *util.XMLParser) (*HistoricalEvent, error) {
|
||||||
case "written content composed":
|
case "written content composed":
|
||||||
obj.Details, err = parseHistoricalEventWrittenContentComposed(p)
|
obj.Details, err = parseHistoricalEventWrittenContentComposed(p)
|
||||||
default:
|
default:
|
||||||
obj.Details = NewHistoricalEventUnknown(string(data))
|
|
||||||
p.Skip()
|
p.Skip()
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -25341,7 +25330,6 @@ func parseHistoricalEventPlus(p *util.XMLParser, obj *HistoricalEvent) (*Histori
|
||||||
case "war_peace_rejected":
|
case "war_peace_rejected":
|
||||||
obj.Details, err = parseHistoricalEventPeaceRejectedPlus(p, obj.Details.(*HistoricalEventPeaceRejected))
|
obj.Details, err = parseHistoricalEventPeaceRejectedPlus(p, obj.Details.(*HistoricalEventPeaceRejected))
|
||||||
default:
|
default:
|
||||||
obj.Details = NewHistoricalEventUnknown(string(data))
|
|
||||||
p.Skip()
|
p.Skip()
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in a new issue