Skip to content

Commit

Permalink
Remove the target dir prefix from the implementations directory path …
Browse files Browse the repository at this point in the history
…making it absolute
  • Loading branch information
bdragon300 committed Jan 1, 2025
1 parent ef3bf12 commit 5ec4a32
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion assets/default_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ runtimeModule: github.com/bdragon300/go-asyncapi/run
directories:
templates:
target: ./asyncapi
implementations: impl
implementations: ./asyncapi/impl

selections:
- objectKinds: ["schema"]
Expand Down
10 changes: 4 additions & 6 deletions cmd/go-asyncapi/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,7 @@ func generate(cmd *GenerateCmd) error {
if err != nil {
return fmt.Errorf("%w: %w", ErrWrongCliArgs, err)
}
implDir := path.Join(mergedConfig.Directories.Target, mergedConfig.Directories.Implementations)
logger.Debugf("Target implementations directory is %s", implDir)
logger.Debugf("Target implementations directory is %s", mergedConfig.Directories.Implementations)
tmpl.ParseTemplates(mergedConfig.Directories.Templates)

// Compilation
Expand Down Expand Up @@ -160,7 +159,7 @@ func generate(cmd *GenerateCmd) error {
// Rendering the selected implementations
if !mergedConfig.NoImplementations {
selectedImpls := getImplementationsOpts(mergedConfig.Implementations)
if err = generationWriteImplementations(selectedImpls, mainModule.Protocols(), implDir); err != nil {
if err = generationWriteImplementations(selectedImpls, mainModule.Protocols(), mergedConfig.Directories.Implementations); err != nil {
return err
}
}
Expand All @@ -170,11 +169,10 @@ func generate(cmd *GenerateCmd) error {
}

func generateImplementation(cmd *generateImplementationArgs, conf toolConfig) error {
implDir := path.Join(conf.Directories.Target, conf.Directories.Implementations) // TODO: remove this line
log.GetLogger("").Debugf("Target implementations directory is %s", implDir)
log.GetLogger("").Debugf("Target implementations directory is %s", conf.Directories.Implementations)
proto := cmd.Protocol
name := cmd.Name
if err := generationWriteImplementations(map[string]string{proto: name}, []string{proto}, implDir); err != nil {
if err := generationWriteImplementations(map[string]string{proto: name}, []string{proto}, conf.Directories.Implementations); err != nil {
return err
}

Expand Down

0 comments on commit 5ec4a32

Please sign in to comment.