mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 20:34:37 +03:00
Upgrade to go 1.19 and update dependencies (#3069)
* Update to go 1.19 * Update dependencies * Update cross-compile script * Add missing targets to cross-compile-all * Update cache action to remove warning
This commit is contained in:
48
vendor/github.com/99designs/gqlgen/codegen/data.go
generated
vendored
48
vendor/github.com/99designs/gqlgen/codegen/data.go
generated
vendored
@@ -2,7 +2,10 @@ package codegen
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
"github.com/vektah/gqlparser/v2/ast"
|
||||
|
||||
@@ -30,6 +33,26 @@ type Data struct {
|
||||
QueryRoot *Object
|
||||
MutationRoot *Object
|
||||
SubscriptionRoot *Object
|
||||
AugmentedSources []AugmentedSource
|
||||
}
|
||||
|
||||
func (d *Data) HasEmbeddableSources() bool {
|
||||
hasEmbeddableSources := false
|
||||
for _, s := range d.AugmentedSources {
|
||||
if s.Embeddable {
|
||||
hasEmbeddableSources = true
|
||||
}
|
||||
}
|
||||
return hasEmbeddableSources
|
||||
}
|
||||
|
||||
// AugmentedSource contains extra information about graphql schema files which is not known directly from the Config.Sources data
|
||||
type AugmentedSource struct {
|
||||
// path relative to Config.Exec.Filename
|
||||
RelativePath string
|
||||
Embeddable bool
|
||||
BuiltIn bool
|
||||
Source string
|
||||
}
|
||||
|
||||
type builder struct {
|
||||
@@ -147,6 +170,31 @@ func BuildData(cfg *config.Config) (*Data, error) {
|
||||
// otherwise show a generic error message
|
||||
return nil, fmt.Errorf("invalid types were encountered while traversing the go source code, this probably means the invalid code generated isnt correct. add try adding -v to debug")
|
||||
}
|
||||
aSources := []AugmentedSource{}
|
||||
for _, s := range cfg.Sources {
|
||||
wd, err := os.Getwd()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to get working directory: %w", err)
|
||||
}
|
||||
outputDir := cfg.Exec.Dir()
|
||||
sourcePath := filepath.Join(wd, s.Name)
|
||||
relative, err := filepath.Rel(outputDir, sourcePath)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to compute path of %s relative to %s: %w", sourcePath, outputDir, err)
|
||||
}
|
||||
relative = filepath.ToSlash(relative)
|
||||
embeddable := true
|
||||
if strings.HasPrefix(relative, "..") || s.BuiltIn {
|
||||
embeddable = false
|
||||
}
|
||||
aSources = append(aSources, AugmentedSource{
|
||||
RelativePath: relative,
|
||||
Embeddable: embeddable,
|
||||
BuiltIn: s.BuiltIn,
|
||||
Source: s.Input,
|
||||
})
|
||||
}
|
||||
s.AugmentedSources = aSources
|
||||
|
||||
return &s, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user