Skip to content

Commit

Permalink
7.2.1 (#223)
Browse files Browse the repository at this point in the history
  • Loading branch information
vendelieu authored Aug 20, 2024
1 parent 6aeb8d8 commit 6ff5138
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 9 deletions.
9 changes: 7 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Telegram-bot (KtGram) changelog

### 7.2.1

* Fix ksp applying flow in plugin.

## 7.2.0

* Added new plugin for a more convenient installation of the library.
Expand All @@ -14,7 +18,7 @@

* Fix ksp generation artifact

# 7.0.0
# 7.0.0**

#### Common

Expand Down Expand Up @@ -248,7 +252,8 @@

* Added `send` method for `Chat` to `Action<>`.
* Changed ambiguous for `User`/`Chat`
names: `MessageOrigin` (`User` > `UserOrigin`, `Chat` > `ChatOrigin`), `BotCommandScope.Chat` > `BotCommandScope.ChatScope`.
names: `MessageOrigin` (`User` > `UserOrigin`, `Chat` > `ChatOrigin`), `BotCommandScope.Chat` >
`BotCommandScope.ChatScope`.
* Enhanced `linkPreviewOptions`: Introduced `disableWebPagePreview()` for easier disabling, and `linkPreviewOptions{}`
for setting through lambda.
* Improved sealed class structure for better accessibility to general
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ abstract class KtGramPlugin : Plugin<Project> {
if (group == "eu.vendeli" && name == "ksp") kspProcessorApplied = true
}
}
project.applyDependencies(libVer, isMultiplatform, kspProcessorApplied)

project.afterEvaluate {
val targetVer = pluginExtension.forceVersion.getOrElse(libVer)
Expand All @@ -36,7 +37,17 @@ abstract class KtGramPlugin : Plugin<Project> {
}
}

project.applyDependencies(targetVer, isMultiplatform, kspProcessorApplied)
// correct version by forced one
if (pluginExtension.forceVersion.isPresent) project.configurations.configureEach cfg@{
dependencies.forEach {
if (it.group == "eu.vendeli" && (it.name == "telegram-bot" || it.name == "ksp")) {
dependencies.remove(it)
dependencies {
add(this@cfg.name, "eu.vendeli:${it.name}:$targetVer")
}
}
}
}

project.extensions.configure<KspExtension> {
pluginExtension.packages.orNull?.takeIf { it.isNotEmpty() }?.joinToString(";")?.let {
Expand All @@ -53,12 +64,12 @@ abstract class KtGramPlugin : Plugin<Project> {
}

private fun Project.applyDependencies(depVersion: String, isMultiplatform: Boolean, kspProcessorApplied: Boolean) {
if (isMultiplatform) project.extensions.configure<KotlinMultiplatformExtension> {
if (isMultiplatform) extensions.configure<KotlinMultiplatformExtension> {
targets.forEach { target ->
val tName = if (target.targetName == "metadata") "CommonMainMetadata"
else target.targetName.replaceFirstChar { it.uppercaseChar() }

project.dependencies.add(
dependencies.add(
"ksp$tName",
"eu.vendeli:ksp:$depVersion",
)
Expand All @@ -68,22 +79,22 @@ abstract class KtGramPlugin : Plugin<Project> {
when {
kspProcessorApplied -> {}
isMultiplatform -> {
project.extensions.configure(KotlinProjectExtension::class.java) {
extensions.configure(KotlinProjectExtension::class.java) {
sourceSets["commonMain"].apply {
dependencies {
implementation("eu.vendeli:telegram-bot:$depVersion")
}
}
}

project.dependencies {
dependencies {
add("ksp", "eu.vendeli:ksp:$depVersion")
}
}

else -> {
project.dependencies.add("implementation", "eu.vendeli:telegram-bot:$depVersion")
project.dependencies {
dependencies.add("implementation", "eu.vendeli:telegram-bot:$depVersion")
dependencies {
add("ksp", "eu.vendeli:ksp:$depVersion")
}
}
Expand Down

0 comments on commit 6ff5138

Please sign in to comment.