Skip to content

Commit 299b3a9

Browse files
nhinze23cesmarvin
authored andcommitted
Merge branch 'release/v0.14.2' into main
2 parents df7982a + 66d9007 commit 299b3a9

File tree

4 files changed

+31
-3
lines changed

4 files changed

+31
-3
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

88
## [Unreleased]
99

10+
## [v0.14.2] - 2024-10-18
11+
### Fixed
12+
- [#44] fix, that dogus with irrelevant optional dependencies were not included when sorting by dependency
13+
1014
## [v0.14.1] - 2024-10-17
1115
### Changed
1216
- use topological sorting to sort dogus by dependency

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Set these to the desired values
22
ARTIFACT_ID=cesapp-lib
3-
VERSION=0.14.1
3+
VERSION=0.14.2
44

55
GOTAG?=1.18.6
66
MAKEFILES_VERSION=7.4.0

core/dogu-sort.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,8 @@ func (bd *sortByDependency) getDependencyEdges() []toposort.Edge {
101101
var dependencyEdges []toposort.Edge
102102
for _, dogu := range bd.dogus {
103103
dependencies := dogu.GetAllDependenciesOfType(DependencyTypeDogu)
104-
if len(dependencies) > 0 {
105-
dependentDogus := bd.dependenciesToDogus(dependencies)
104+
dependentDogus := bd.dependenciesToDogus(dependencies)
105+
if len(dependentDogus) > 0 {
106106
for _, dependency := range dependentDogus {
107107
dependencyEdges = append(dependencyEdges, toposort.Edge{dependency, dogu})
108108
}

core/dogu-sort_test.go

+24
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,18 @@ func TestSortDogusByDependencyWithError(t *testing.T) {
143143
assert.Nil(t, dogus)
144144
})
145145

146+
t.Run("should return dogu if only irrelevant optional dependencies are set", func(t *testing.T) {
147+
a := &Dogu{
148+
Name: "a",
149+
OptionalDependencies: []Dependency{{Type: DependencyTypeDogu, Name: "c"}},
150+
}
151+
152+
dogus, err := SortDogusByDependencyWithError([]*Dogu{a})
153+
assert.NoError(t, err)
154+
assert.Len(t, dogus, 1)
155+
assert.Equal(t, "a", dogus[0].Name)
156+
})
157+
146158
}
147159

148160
func stringSliceContains(slice []string, item string) bool {
@@ -310,6 +322,18 @@ func TestSortDogusByInvertedDependency(t *testing.T) {
310322
dogus := SortDogusByInvertedDependency([]*Dogu{a, b, c})
311323
assert.Nil(t, dogus)
312324
})
325+
326+
t.Run("should return dogu if only irrelevant optional dependencies are set", func(t *testing.T) {
327+
a := &Dogu{
328+
Name: "a",
329+
OptionalDependencies: []Dependency{{Type: DependencyTypeDogu, Name: "c"}},
330+
}
331+
332+
dogus, err := SortDogusByInvertedDependencyWithError([]*Dogu{a})
333+
assert.NoError(t, err)
334+
assert.Len(t, dogus, 1)
335+
assert.Equal(t, "a", dogus[0].Name)
336+
})
313337
}
314338

315339
func TestTransformsDependencyListToDoguList(t *testing.T) {

0 commit comments

Comments
 (0)