Skip to content

Commit

Permalink
WIP - fixing test error
Browse files Browse the repository at this point in the history
Signed-off-by: Juan Bustamante <[email protected]>
  • Loading branch information
jjbustamante committed Apr 14, 2023
1 parent 3368d87 commit bef7256
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion internal/builder/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ func (b *Builder) AddExtensions(main buildpack.BuildModule, dependencies []build
b.additionalExtensions.AddModules(main, dependencies...)
b.metadata.Extensions = append(b.metadata.Extensions, main.Descriptor().Info())
for _, dep := range dependencies {
b.metadata.Extensions = append(b.metadata.Buildpacks, dep.Descriptor().Info())
b.metadata.Extensions = append(b.metadata.Extensions, dep.Descriptor().Info())
}
}

Expand Down
17 changes: 8 additions & 9 deletions pkg/buildpack/module_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ package buildpack
type ModuleManager struct {
modules []BuildModule
flattenModules [][]BuildModule
Flatten bool
flatten bool
}

func NewModuleManager(flatten bool) *ModuleManager {
return &ModuleManager{
Flatten: flatten,
flatten: flatten,
}
}

Expand All @@ -21,24 +21,23 @@ func (f *ModuleManager) Modules() []BuildModule {
}

func (f *ModuleManager) GetFlattenModules() [][]BuildModule {
return f.flattenModules
}

func (f *ModuleManager) AddFlattenModules(modules []BuildModule) {
f.flattenModules = append(f.flattenModules, modules)
if f.flatten {
return f.flattenModules
}
return nil
}

func (f *ModuleManager) AddModules(main BuildModule, deps ...BuildModule) {
modules := append([]BuildModule{main}, deps...)
if f.Flatten && len(deps) > 0 {
if f.flatten && len(deps) > 0 {
f.flattenModules = append(f.flattenModules, modules)
} else {
f.modules = append(f.modules, modules...)
}
}

func (f *ModuleManager) IsFlatten(module BuildModule) bool {
if f.Flatten {
if f.flatten {
for _, modules := range f.flattenModules {
for _, v := range modules {
if v == module {
Expand Down

0 comments on commit bef7256

Please sign in to comment.