Skip to content

Commit

Permalink
MOD: module and variable name
Browse files Browse the repository at this point in the history
  • Loading branch information
RicardoJiang committed Nov 7, 2023
1 parent 4d44653 commit 80eb151
Show file tree
Hide file tree
Showing 13 changed files with 29 additions and 28 deletions.
File renamed without changes.
1 change: 1 addition & 0 deletions kudos-android-json-reader/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
POM_NAME=kudos-android-json-reader
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package com.kanyun.kudos.json.reader
import android.util.JsonReader
import com.kanyun.kudos.json.reader.adapter.KudosJsonAdapter

object KudosJsonReader {
object KudosAndroidJsonReader {
inline fun <reified T> fromJson(json: String): T {
return fromJson(json, T::class.java)
}
Expand Down
2 changes: 1 addition & 1 deletion kudos-compiler/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ dependencies {
testImplementation(kotlin("test-junit"))
testImplementation(project(":kudos-gson"))
testImplementation(project(":kudos-jackson"))
testImplementation(project(":kudos-json-reader"))
testImplementation(project(":kudos-android-json-reader"))
testImplementation(project(":android-json-reader"))
testImplementation("org.jetbrains.kotlin:kotlin-noarg:1.8.20")
testImplementation("org.jetbrains.kotlin:kotlin-compiler-embeddable")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,11 @@ class KudosSyntheticResolveExtension : SyntheticResolveExtension {
)
}
if (KUDOS_JSON_ADAPTER !in superTypeNames) {
val kudosValidator = thisDescriptor.module.findClassAcrossModuleDependencies(KUDOS_JSON_ADAPTER_CLASS_ID)!!
val kudosJsonAdapter = thisDescriptor.module.findClassAcrossModuleDependencies(KUDOS_JSON_ADAPTER_CLASS_ID)!!
supertypes.add(
KotlinTypeFactory.simpleNotNullType(
TypeAttributes.Empty,
kudosValidator,
kudosJsonAdapter,
listOf(TypeProjectionImpl(thisDescriptor.defaultType)),
),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,11 @@ open class TestBase {
private fun jsonReaderDeserialize(): String {
return """
// FILE: JsonReader.kt
import com.kanyun.kudos.json.reader.KudosJsonReader
import com.kanyun.kudos.json.reader.KudosAndroidJsonReader
inline fun <reified T: Any> deserialize(string: String): T? {
return try {
val t: T = KudosJsonReader.fromJson(string)
val t: T = KudosAndroidJsonReader.fromJson(string)
println(t)
t
} catch (e: Exception) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,26 +62,27 @@ fun main() {
*/
class KudosTests : TestBase() {
${caseDir.listFiles().orEmpty()
.flatMap {
if (it.isDirectory) {
it.listFiles().orEmpty().toList()
} else {
listOf(it)
${
caseDir.listFiles().orEmpty()
.flatMap {
if (it.isDirectory) {
it.listFiles().orEmpty().toList()
} else {
listOf(it)
}
}
}
.map {
val parentDir = it.parentFile.name
if (parentDir == "testData") {
it.nameWithoutExtension
}else {
"${parentDir}_${it.nameWithoutExtension}"
.map {
val parentDir = it.parentFile.name
if (parentDir == "testData") {
it.nameWithoutExtension
} else {
"${parentDir}_${it.nameWithoutExtension}"
}
}
.sortedBy { it }
.joinToString("\n") {
"@Test\nfun `${it.replaceFirstChar { it.lowercaseChar() }}`() = testBase()\n"
}
}
.sortedBy { it }
.joinToString("\n") {
"@Test\nfun `${it.replaceFirstChar { it.lowercaseChar() }}`() = testBase()\n"
}
}
}
""".trimIndent()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ open class KudosGradlePlugin : KotlinCompilerPluginSupportPlugin {
config += "${BuildConfig.KOTLIN_PLUGIN_GROUP}:kudos-jackson:${BuildConfig.KOTLIN_PLUGIN_VERSION}"
}
// TODO: Add json reader config
config += "${BuildConfig.KOTLIN_PLUGIN_GROUP}:kudos-json-reader:${BuildConfig.KOTLIN_PLUGIN_VERSION}"
config += "${BuildConfig.KOTLIN_PLUGIN_GROUP}:kudos-android-json-reader:${BuildConfig.KOTLIN_PLUGIN_VERSION}"
config += "${BuildConfig.KOTLIN_PLUGIN_GROUP}:kudos-annotations:${BuildConfig.KOTLIN_PLUGIN_VERSION}"
config += "${BuildConfig.KOTLIN_PLUGIN_GROUP}:kudos-runtime:${BuildConfig.KOTLIN_PLUGIN_VERSION}"
}
Expand Down
1 change: 0 additions & 1 deletion kudos-json-reader/gradle.properties

This file was deleted.

2 changes: 1 addition & 1 deletion kudos-sample/kudos-maven-sample/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
</dependency>
<dependency>
<groupId>com.kanyun.kudos</groupId>
<artifactId>kudos-json-reader</artifactId>
<artifactId>kudos-android-json-reader</artifactId>
<version>${kudos.version}</version>
</dependency>
<dependency>
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ include(":kudos-annotations")
include(":kudos-runtime")
include(":kudos-gson")
include(":kudos-jackson")
include(":kudos-json-reader")
include(":kudos-android-json-reader")
include(":android-json-reader")

0 comments on commit 80eb151

Please sign in to comment.