Skip to content

Commit

Permalink
Update kotlinpoet to v2 (major) (#75)
Browse files Browse the repository at this point in the history
This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
|
[com.squareup:kotlinpoet-ksp](https://redirect.github.com/square/kotlinpoet)
| `1.18.1` -> `2.0.0` |
[![age](https://developer.mend.io/api/mc/badges/age/maven/com.squareup:kotlinpoet-ksp/2.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/maven/com.squareup:kotlinpoet-ksp/2.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/maven/com.squareup:kotlinpoet-ksp/1.18.1/2.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/maven/com.squareup:kotlinpoet-ksp/1.18.1/2.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
|
[com.squareup:kotlinpoet](https://redirect.github.com/square/kotlinpoet)
| `1.18.1` -> `2.0.0` |
[![age](https://developer.mend.io/api/mc/badges/age/maven/com.squareup:kotlinpoet/2.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/maven/com.squareup:kotlinpoet/2.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/maven/com.squareup:kotlinpoet/1.18.1/2.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/maven/com.squareup:kotlinpoet/1.18.1/2.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

> [!WARNING]
> Some dependencies could not be looked up. Check the Dependency
Dashboard for more information.

---

### Release Notes

<details>
<summary>square/kotlinpoet (com.squareup:kotlinpoet-ksp)</summary>

###
[`v2.0.0`](https://redirect.github.com/square/kotlinpoet/releases/tag/2.0.0)

[Compare
Source](https://redirect.github.com/square/kotlinpoet/compare/1.18.1...2.0.0)

Thanks to
[@&#8203;brokenhappy](https://redirect.github.com/brokenhappy),
[@&#8203;tajobe](https://redirect.github.com/tajobe),
[@&#8203;niyajali](https://redirect.github.com/niyajali),
[@&#8203;ForteScarlet](https://redirect.github.com/ForteScarlet) for
contributing to this release.

This release is source- and binary-compatible with KotlinPoet 1.x.

The most important behavior change in this release is that spaces in
generated code don't wrap by default anymore.

KotlinPoet 1.x used to replace space characters with newline characters
whenever a given line of code exceeded the length limit. This usually
led to better code formatting, but could also lead to compilation errors
in generated code. Non-breaking spaces could be marked by the `·`
character, but the discoverability of this feature wasn't great.

KotlinPoet 2.0 does not wrap spaces, even if the line of code they occur
in exceeds the length limit. The newly introduced `♢` character can be
used to mark spaces that are safe to wrap, which can improve code
formatting. The `·` character has been preserved for compatibility, but
its behavior is now equivalent to a regular space character.

-   New: Kotlin 2.0.10.
-   New: Spaces don't break by default.
-   New: New `♢` placeholder representing a space that is safe to wrap.
- New: Add `KSTypeAlias.toClassName()`.
([#&#8203;1956](https://redirect.github.com/square/kotlinpoet/issues/1956))
- New: Add `KSType.toClassNameOrNull()`.
([#&#8203;1956](https://redirect.github.com/square/kotlinpoet/issues/1956))
- Fix: Enum classes that only have an init block now also generate the
required semicolon.
([#&#8203;1953](https://redirect.github.com/square/kotlinpoet/issues/1953))
- Fix: Preserve typealiases in `KSAnnotation.toAnnotationSpec()`.
([#&#8203;1956](https://redirect.github.com/square/kotlinpoet/issues/1956))
- Fix: Preserve nullability in `KSType.toClassName()`.
([#&#8203;1956](https://redirect.github.com/square/kotlinpoet/issues/1956))

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about these
updates again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/r0adkll/kimchi).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOC4xMjAuMSIsInVwZGF0ZWRJblZlciI6IjM4LjEyMC4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJyZW5vdmF0ZSJdfQ==-->

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: r0adkll <[email protected]>
  • Loading branch information
renovate[bot] and r0adkll authored Nov 9, 2024
1 parent 6999886 commit dc9ab99
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ import com.google.devtools.ksp.getAllSuperTypes
import com.google.devtools.ksp.symbol.KSClassDeclaration
import com.google.devtools.ksp.symbol.KSName
import com.squareup.kotlinpoet.ClassName
import com.squareup.kotlinpoet.ksp.toClassName
import com.squareup.kotlinpoet.ksp.toTypeName

/**
* Return whether or not this [KSClassDeclaration] has a supertype of type [clazz] anywhere
* it its supertype hierarchy
*/
public fun KSClassDeclaration.implements(className: ClassName): Boolean {
return getAllSuperTypes().any {
it.toClassName() == className
it.toTypeName() == className
}
}

Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ junit5 = "5.11.3"
kotlin = "2.0.21"
kotlin-compile-testing = "0.5.1"
kotlin-inject = "0.7.2"
kotlinpoet = "1.18.1"
kotlinpoet = "2.0.0"
ksp = "2.0.21-1.0.27"
ksp-autoservce = "1.2.0"
ktlint = "0.49.1"
Expand Down

0 comments on commit dc9ab99

Please sign in to comment.