Skip to content

Commit

Permalink
Merge pull request #1652 from stgraber/main
Browse files Browse the repository at this point in the history
Move generators to the cmd package
  • Loading branch information
hallyn authored Feb 12, 2025
2 parents 2c48e53 + 45d911a commit d1cd220
Show file tree
Hide file tree
Showing 27 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ update-protobuf:

.PHONY: update-schema
update-schema:
cd internal/server/db/generate && $(GO) build -o $(GOPATH)/bin/incus-generate -tags "$(TAG_SQLITE3)" $(DEBUG) && cd -
cd cmd/generate-database && $(GO) build -o $(GOPATH)/bin/incus-generate -tags "$(TAG_SQLITE3)" $(DEBUG) && cd -
$(GO) generate ./...
gofmt -s -w ./internal/server/db/
goimports -w ./internal/server/db/
Expand All @@ -143,7 +143,7 @@ endif
.PHONY: update-metadata
update-metadata: build
@echo "Generating golang documentation metadata"
cd internal/server/config/generate && CGO_ENABLED=0 $(GO) build -o $(GOPATH)/bin/incus-doc
cd cmd/generate-config && CGO_ENABLED=0 $(GO) build -o $(GOPATH)/bin/incus-doc
$(GOPATH)/bin/incus-doc . --json ./internal/server/metadata/configuration.json --txt ./doc/config_options.txt

.PHONY: doc-setup
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (

"github.com/spf13/cobra"

"github.com/lxc/incus/v6/internal/server/db/generate/db"
"github.com/lxc/incus/v6/internal/server/db/generate/file"
"github.com/lxc/incus/v6/internal/server/db/generate/lex"
"github.com/lxc/incus/v6/cmd/generate-database/db"
"github.com/lxc/incus/v6/cmd/generate-database/file"
"github.com/lxc/incus/v6/cmd/generate-database/lex"
)

// Return a new db command.
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"strings"

"github.com/lxc/incus/v6/internal/server/db/generate/lex"
"github.com/lxc/incus/v6/cmd/generate-database/lex"
"github.com/lxc/incus/v6/shared/util"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"slices"
"strings"

"github.com/lxc/incus/v6/internal/server/db/generate/lex"
"github.com/lxc/incus/v6/cmd/generate-database/lex"
"github.com/lxc/incus/v6/shared/util"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import (
"path/filepath"
"strings"

"github.com/lxc/incus/v6/internal/server/db/generate/file"
"github.com/lxc/incus/v6/internal/server/db/generate/lex"
"github.com/lxc/incus/v6/cmd/generate-database/file"
"github.com/lxc/incus/v6/cmd/generate-database/lex"
"github.com/lxc/incus/v6/shared/util"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"sort"
"strings"

"github.com/lxc/incus/v6/internal/server/db/generate/lex"
"github.com/lxc/incus/v6/cmd/generate-database/lex"
)

// Packages returns the AST packages in which to search for structs.
Expand All @@ -25,7 +25,7 @@ func Packages() (map[string]*ast.Package, error) {
_, filename, _, _ := runtime.Caller(0)

for _, name := range defaultPackages {
pkg, err := lex.Parse(filepath.Join(filepath.Dir(filename), "..", "..", "..", "..", "..", name))
pkg, err := lex.Parse(filepath.Join(filepath.Dir(filename), "..", "..", "..", name))
if err != nil {
return nil, fmt.Errorf("Parse %q: %w", name, err)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"github.com/lxc/incus/v6/internal/server/db/generate/db"
"github.com/lxc/incus/v6/cmd/generate-database/db"
)

func TestPackages(t *testing.T) {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import (
"path/filepath"
"strings"

"github.com/lxc/incus/v6/internal/server/db/generate/file"
"github.com/lxc/incus/v6/internal/server/db/generate/lex"
"github.com/lxc/incus/v6/cmd/generate-database/file"
"github.com/lxc/incus/v6/cmd/generate-database/lex"
)

// Stmt generates a particular database query statement.
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"os"
"strings"

"github.com/lxc/incus/v6/internal/server/db/generate/lex"
"github.com/lxc/incus/v6/cmd/generate-database/lex"
)

// Reset an auto-generated source file, writing a new empty file header.
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"github.com/lxc/incus/v6/internal/server/db/generate/lex"
"github.com/lxc/incus/v6/cmd/generate-database/lex"
)

func TestParse(t *testing.T) {
Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit d1cd220

Please sign in to comment.