Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support flexible folder structures #542

Merged
merged 1 commit into from
Feb 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
345 changes: 166 additions & 179 deletions codegen/module.go

Large diffs are not rendered by default.

32 changes: 16 additions & 16 deletions codegen/module_system.go
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ func NewDefaultModuleSystem(
h *PackageHelper,
hooks ...PostGenHook,
) (*ModuleSystem, error) {
system := NewModuleSystem(hooks...)
system := NewModuleSystem(h.moduleSearchPaths, hooks...)

tmpl, err := NewDefaultTemplate()
if err != nil {
Expand All @@ -267,9 +267,9 @@ func NewDefaultModuleSystem(

// Register client module class and type generators
if err := system.RegisterClass(ModuleClass{
Name: "client",
Directories: []string{"clients"},
ClassType: MultiModule,
Name: "client",
NamePlural: "clients",
ClassType: MultiModule,
}); err != nil {
return nil, errors.Wrapf(err, "Error registering client class")
}
Expand Down Expand Up @@ -305,10 +305,10 @@ func NewDefaultModuleSystem(
}

if err := system.RegisterClass(ModuleClass{
Name: "middleware",
Directories: []string{"middlewares"},
ClassType: MultiModule,
DependsOn: []string{"client"},
Name: "middleware",
NamePlural: "middlewares",
ClassType: MultiModule,
DependsOn: []string{"client"},
}); err != nil {
return nil, errors.Wrapf(
err,
Expand Down Expand Up @@ -338,10 +338,10 @@ func NewDefaultModuleSystem(

// Register endpoint module class and type generators
if err := system.RegisterClass(ModuleClass{
Name: "endpoint",
Directories: []string{"endpoints"},
ClassType: MultiModule,
DependsOn: []string{"client", "middleware"},
Name: "endpoint",
NamePlural: "endpoints",
ClassType: MultiModule,
DependsOn: []string{"client", "middleware"},
}); err != nil {
return nil, errors.Wrapf(err, "Error registering endpoint class")
}
Expand All @@ -367,10 +367,10 @@ func NewDefaultModuleSystem(
}

if err := system.RegisterClass(ModuleClass{
Name: "service",
Directories: []string{"services"},
ClassType: MultiModule,
DependsOn: []string{"endpoint"},
Name: "service",
NamePlural: "services",
ClassType: MultiModule,
DependsOn: []string{"endpoint"},
}); err != nil {
return nil, errors.Wrapf(
err,
Expand Down
Loading