Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dependency com.squareup:kotlinpoet to v2 #337

Merged
merged 2 commits into from
Nov 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 6 additions & 12 deletions compile/src/test/kotlin/ExerciseProcessorActivityTests.kt
Original file line number Diff line number Diff line change
Expand Up @@ -295,13 +295,11 @@ public class ExerciseProcessorActivityTests : ExerciseProcessorTests() {
import kotlin.Int
import kotlin.String

public fun bundleForOptionalsActivity(context: Context, optionalInt: Int? = null): Bundle =
bundleOf(
public fun bundleForOptionalsActivity(context: Context, optionalInt: Int? = null): Bundle = bundleOf(
"${"$"}{context.packageName}.optionalInt" to optionalInt
)

public fun bundleForOptionalsActivity(packageName: String, optionalInt: Int? = null): Bundle =
bundleOf(
public fun bundleForOptionalsActivity(packageName: String, optionalInt: Int? = null): Bundle = bundleOf(
"${"${'$'}"}{packageName}.optionalInt" to optionalInt
)

Expand Down Expand Up @@ -329,8 +327,7 @@ public class ExerciseProcessorActivityTests : ExerciseProcessorTests() {
public val optionalInt: Int?
get() = instance.intent?.extras?.get("${"$"}{instance.packageName}.optionalInt") as Int?

public fun optionalInt(default: Int): Int =
(instance.intent?.extras?.get("${"$"}{instance.packageName}.optionalInt") as? Int?) ?: default
public fun optionalInt(default: Int): Int = (instance.intent?.extras?.get("${"$"}{instance.packageName}.optionalInt") as? Int?) ?: default
}

public val OptionalsActivity.extras: OptionalsActivityParams
Expand Down Expand Up @@ -488,10 +485,8 @@ public class ExerciseProcessorActivityTests : ExerciseProcessorTests() {
requiredValue: ThirdPartyType,
optionalValue: ThirdPartyType? = null,
): Bundle = bundleOf(
"${"$"}{context.packageName}.requiredValue" to
ThirdPartyTypeParceler.writeToMarshalledBytes(requiredValue),
"${"$"}{context.packageName}.optionalValue" to
ThirdPartyTypeParceler.writeToMarshalledBytesOrNull(optionalValue)
"${"$"}{context.packageName}.requiredValue" to ThirdPartyTypeParceler.writeToMarshalledBytes(requiredValue),
"${"$"}{context.packageName}.optionalValue" to ThirdPartyTypeParceler.writeToMarshalledBytesOrNull(optionalValue)
)

public fun bundleForParcelerActivity(
Expand All @@ -500,8 +495,7 @@ public class ExerciseProcessorActivityTests : ExerciseProcessorTests() {
optionalValue: ThirdPartyType? = null,
): Bundle = bundleOf(
"${"$"}{packageName}.requiredValue" to ThirdPartyTypeParceler.writeToMarshalledBytes(requiredValue),
"${"$"}{packageName}.optionalValue" to
ThirdPartyTypeParceler.writeToMarshalledBytesOrNull(optionalValue)
"${"$"}{packageName}.optionalValue" to ThirdPartyTypeParceler.writeToMarshalledBytesOrNull(optionalValue)
)

public class ParcelerActivityIntent : Intent {
Expand Down
3 changes: 1 addition & 2 deletions compile/src/test/kotlin/ExerciseProcessorFragmentTests.kt
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,7 @@ public class ExerciseProcessorFragmentTests : ExerciseProcessorTests() {
public val optionalInt: Int?
get() = instance.arguments?.get("optionalInt") as Int?

public fun optionalInt(default: Int): Int = (instance.arguments?.get("optionalInt") as? Int?) ?:
default
public fun optionalInt(default: Int): Int = (instance.arguments?.get("optionalInt") as? Int?) ?: default
}

public val OptionalsFragment.args: OptionalsFragmentParams
Expand Down
30 changes: 10 additions & 20 deletions compile/src/test/kotlin/ExerciseProcessorServiceTests.kt
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ public class ExerciseProcessorServiceTests : ExerciseProcessorTests() {
private val intent: Intent,
)

public fun NoExtrasService.extras(intent: Intent): NoExtrasServiceParams =
NoExtrasServiceParams(this, intent)
public fun NoExtrasService.extras(intent: Intent): NoExtrasServiceParams = NoExtrasServiceParams(this, intent)
""",
)
}
Expand Down Expand Up @@ -116,8 +115,7 @@ public class ExerciseProcessorServiceTests : ExerciseProcessorTests() {
get() = intent.extras?.get("${"$"}{instance.packageName}.fromSuperclass") as Int
}

public fun SuperclassService.extras(intent: Intent): SuperclassServiceParams =
SuperclassServiceParams(this, intent)
public fun SuperclassService.extras(intent: Intent): SuperclassServiceParams = SuperclassServiceParams(this, intent)
""",
)

Expand Down Expand Up @@ -190,8 +188,7 @@ public class ExerciseProcessorServiceTests : ExerciseProcessorTests() {
get() = intent.extras?.get("${"$"}{instance.packageName}.fromSubclass") as String
}

public fun SubclassService.extras(intent: Intent): SubclassServiceParams =
SubclassServiceParams(this, intent)
public fun SubclassService.extras(intent: Intent): SubclassServiceParams = SubclassServiceParams(this, intent)
""",
)
}
Expand Down Expand Up @@ -310,8 +307,7 @@ public class ExerciseProcessorServiceTests : ExerciseProcessorTests() {
"${"$"}{context.packageName}.optionalInt" to optionalInt
)

public fun bundleForOptionalsService(packageName: String, optionalInt: Int? = null): Bundle =
bundleOf(
public fun bundleForOptionalsService(packageName: String, optionalInt: Int? = null): Bundle = bundleOf(
"${"$"}{packageName}.optionalInt" to optionalInt
)

Expand Down Expand Up @@ -340,12 +336,10 @@ public class ExerciseProcessorServiceTests : ExerciseProcessorTests() {
public val optionalInt: Int?
get() = intent.extras?.get("${"$"}{instance.packageName}.optionalInt") as Int?

public fun optionalInt(default: Int): Int =
(intent.extras?.get("${"$"}{instance.packageName}.optionalInt") as? Int?) ?: default
public fun optionalInt(default: Int): Int = (intent.extras?.get("${"$"}{instance.packageName}.optionalInt") as? Int?) ?: default
}

public fun OptionalsService.extras(intent: Intent): OptionalsServiceParams =
OptionalsServiceParams(this, intent)
public fun OptionalsService.extras(intent: Intent): OptionalsServiceParams = OptionalsServiceParams(this, intent)
""",
)
}
Expand Down Expand Up @@ -408,10 +402,8 @@ public class ExerciseProcessorServiceTests : ExerciseProcessorTests() {
requiredValue: ThirdPartyType,
optionalValue: ThirdPartyType? = null,
): Bundle = bundleOf(
"${"$"}{context.packageName}.requiredValue" to
ThirdPartyTypeParceler.writeToMarshalledBytes(requiredValue),
"${"$"}{context.packageName}.optionalValue" to
ThirdPartyTypeParceler.writeToMarshalledBytesOrNull(optionalValue)
"${"$"}{context.packageName}.requiredValue" to ThirdPartyTypeParceler.writeToMarshalledBytes(requiredValue),
"${"$"}{context.packageName}.optionalValue" to ThirdPartyTypeParceler.writeToMarshalledBytesOrNull(optionalValue)
)

public fun bundleForParcelerService(
Expand All @@ -420,8 +412,7 @@ public class ExerciseProcessorServiceTests : ExerciseProcessorTests() {
optionalValue: ThirdPartyType? = null,
): Bundle = bundleOf(
"${"$"}{packageName}.requiredValue" to ThirdPartyTypeParceler.writeToMarshalledBytes(requiredValue),
"${"$"}{packageName}.optionalValue" to
ThirdPartyTypeParceler.writeToMarshalledBytesOrNull(optionalValue)
"${"$"}{packageName}.optionalValue" to ThirdPartyTypeParceler.writeToMarshalledBytesOrNull(optionalValue)
)

public class ParcelerServiceIntent : Intent {
Expand Down Expand Up @@ -474,8 +465,7 @@ public class ExerciseProcessorServiceTests : ExerciseProcessorTests() {
}
}

public fun ParcelerService.extras(intent: Intent): ParcelerServiceParams =
ParcelerServiceParams(this, intent)
public fun ParcelerService.extras(intent: Intent): ParcelerServiceParams = ParcelerServiceParams(this, intent)
""",
)
}
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 @@ kotlin = "2.0.21"
assertj = { module = "org.assertj:assertj-core", version = "3.26.3" }
khronicle = { module = "com.juul.khronicle:khronicle-core", version = "0.3.0" }
kotlin-parcelize-runtime = { module = "org.jetbrains.kotlin:kotlin-parcelize-runtime", version.ref = "kotlin" }
kotlinpoet = { module = "com.squareup:kotlinpoet", version = "1.18.1" }
kotlinpoet = { module = "com.squareup:kotlinpoet", version = "2.0.0" }
ksp-api = { module = "com.google.devtools.ksp:symbol-processing-api", version = "2.0.21-1.0.26" }
ksp-testing = { module = "com.github.tschuchortdev:kotlin-compile-testing-ksp", version = "1.6.0" }
robolectric = { module = "org.robolectric:robolectric", version = "4.13" }
Expand Down
Loading