Skip to content

Commit

Permalink
fix: Defaults are not applied
Browse files Browse the repository at this point in the history
Closes: #107
  • Loading branch information
osipxd committed Jun 17, 2022
1 parent a65c277 commit b423378
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
## [Unreleased]

### Fixed

- Defaults from parent project are not applied to project (#107)

## [0.16.1] (2022-06-17)

### Added
Expand Down
8 changes: 6 additions & 2 deletions infrastructure-common/src/main/kotlin/WithDefaults.kt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ internal inline fun <reified T : WithDefaults<T>> ExtensionContainer.createWithD
defaults: T?,
publicType: KClass<in T>? = null,
): T {
return if (publicType == null) create(name) else (create(publicType, name, T::class) as T)
.apply { if (defaults != null) setDefaults(defaults) }
val extension = if (publicType == null) {
create(name)
} else {
create(publicType, name, T::class) as T
}
return extension.apply { if (defaults != null) setDefaults(defaults) }
}

0 comments on commit b423378

Please sign in to comment.