From 831d9ae37f7ddccf196a744d2e4b27a31a468ee0 Mon Sep 17 00:00:00 2001 From: 2BAB Date: Mon, 4 Apr 2022 20:58:17 +0800 Subject: [PATCH 1/5] fix: plugin name with hashcode invalidate the cache Incremental processing will be disabled due to it --- .../kotlin/me/xx2bab/koncat/gradle/base/KoncatBasePlugin.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/koncat-gradle-plugin/src/main/kotlin/me/xx2bab/koncat/gradle/base/KoncatBasePlugin.kt b/koncat-gradle-plugin/src/main/kotlin/me/xx2bab/koncat/gradle/base/KoncatBasePlugin.kt index ad4d26b..779e997 100644 --- a/koncat-gradle-plugin/src/main/kotlin/me/xx2bab/koncat/gradle/base/KoncatBasePlugin.kt +++ b/koncat-gradle-plugin/src/main/kotlin/me/xx2bab/koncat/gradle/base/KoncatBasePlugin.kt @@ -20,7 +20,7 @@ class KoncatBasePlugin : Plugin { val argumentsContract = KoncatArgumentsContract( projectName = project.name, koncatVersion = BuildConfig.KONCAT_VERSION, - gradlePlugins = plugins.map { it.toString() }, + gradlePlugins = plugins.map { it.toString().split("@")[0] }, declaredAsMainProject = baseExt.isMainProject.get(), variantAwareIntermediates = baseExt.mainProjectOutputDir.get().asFile, // TODO: it may be consumed eagerly ) From 59cec8b67d17819c3085aea54336cb339c16da4d Mon Sep 17 00:00:00 2001 From: 2BAB Date: Mon, 4 Apr 2022 21:01:01 +0800 Subject: [PATCH 2/5] test: enable the ksp incremental log --- sample/gradle.properties | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sample/gradle.properties b/sample/gradle.properties index d8cc43e..da46ce5 100644 --- a/sample/gradle.properties +++ b/sample/gradle.properties @@ -19,4 +19,7 @@ android.useAndroidX=true android.enableJetifier=true # Kotlin code style for this project: "official" or "obsolete": kotlin.code.style=official -org.gradle.caching=true \ No newline at end of file +org.gradle.caching=true + +ksp.incremental=true +ksp.incremental.log=true \ No newline at end of file From 67e6431f3f05cc57f704916ac179b99f58e58eaf Mon Sep 17 00:00:00 2001 From: 2BAB Date: Mon, 4 Apr 2022 21:08:35 +0800 Subject: [PATCH 3/5] refactor: KONCAT_FILE_SEPARATOR -> KONCAT_STRING_SEPARATOR --- .../src/main/kotlin/me/xx2bab/koncat/contract/Constants.kt | 2 +- .../me/xx2bab/koncat/contract/KoncatArgumentsContract.kt | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/koncat-contract/src/main/kotlin/me/xx2bab/koncat/contract/Constants.kt b/koncat-contract/src/main/kotlin/me/xx2bab/koncat/contract/Constants.kt index e34ac81..0dc6185 100644 --- a/koncat-contract/src/main/kotlin/me/xx2bab/koncat/contract/Constants.kt +++ b/koncat-contract/src/main/kotlin/me/xx2bab/koncat/contract/Constants.kt @@ -2,7 +2,7 @@ package me.xx2bab.koncat.contract const val KONCAT_FILE_EXTENSION = "koncat" const val KONCAT_PROCESSOR_ARGUMENT_KEY = "KONCAT." -const val KONCAT_FILE_SEPARATOR = "\\0" +const val KONCAT_STRING_SEPARATOR = "<@KONCAT@>" const val LOG_TAG = "[Koncat] " const val ARGUMENT_PARSE_ERROR = "Koncat arguments can not match due to %s" diff --git a/koncat-contract/src/main/kotlin/me/xx2bab/koncat/contract/KoncatArgumentsContract.kt b/koncat-contract/src/main/kotlin/me/xx2bab/koncat/contract/KoncatArgumentsContract.kt index 10208bf..8edf90e 100644 --- a/koncat-contract/src/main/kotlin/me/xx2bab/koncat/contract/KoncatArgumentsContract.kt +++ b/koncat-contract/src/main/kotlin/me/xx2bab/koncat/contract/KoncatArgumentsContract.kt @@ -47,12 +47,12 @@ class KoncatArgumentsContract { } for ((k, v) in koncatArgumentMap) { - logger.info("Koncat receives the argument: $k = $v") + logger.info("$LOG_TAG Koncat receives the argument: $k = $v") } projectName = koncatArgumentMap[KoncatArgument.PROJECT_NAME.name]!! koncatVersion = koncatArgumentMap[KoncatArgument.KONCAT_VERSION.name]!! - gradlePlugins = koncatArgumentMap[KoncatArgument.GRADLE_PLUGINS.name]!!.split(KONCAT_FILE_SEPARATOR) + gradlePlugins = koncatArgumentMap[KoncatArgument.GRADLE_PLUGINS.name]!!.split(KONCAT_STRING_SEPARATOR) declaredAsMainProject = koncatArgumentMap[KoncatArgument.DECLARED_AS_MAIN_MODULE.name]!!.toBoolean() variantAwareIntermediates = File(koncatArgumentMap[KoncatArgument.VARIANT_AWARE_INTERMEDIATES.name]!!) } @@ -61,7 +61,7 @@ class KoncatArgumentsContract { val map = HashMap() map[KoncatArgument.PROJECT_NAME.name] = projectName map[KoncatArgument.KONCAT_VERSION.name] = koncatVersion - map[KoncatArgument.GRADLE_PLUGINS.name] = gradlePlugins.joinToString(separator = KONCAT_FILE_SEPARATOR) + map[KoncatArgument.GRADLE_PLUGINS.name] = gradlePlugins.joinToString(separator = KONCAT_STRING_SEPARATOR) map[KoncatArgument.DECLARED_AS_MAIN_MODULE.name] = declaredAsMainProject.toString() map[KoncatArgument.VARIANT_AWARE_INTERMEDIATES.name] = variantAwareIntermediates.absolutePath return map.mapKeys { From ed9571e85b2fcf2d9b63258b677ff513669c4536 Mon Sep 17 00:00:00 2001 From: 2BAB Date: Mon, 4 Apr 2022 21:09:39 +0800 Subject: [PATCH 4/5] test: upgrade the sample project to showcase the ksp Dependency usage --- ...ExportedAndroidLibraryExternalRunnable.kt} | 4 +-- .../android/ExportedAndroidLibraryRunnable.kt | 2 +- .../ExportedPureKotlinLibraryRunnable2.kt | 11 +++++++ .../1.0/koncat-sample-lib2-1.0-sources.jar | Bin 1910 -> 1927 bytes .../koncat-sample-lib2-1.0-sources.jar.md5 | 2 +- .../koncat-sample-lib2-1.0-sources.jar.sha1 | 2 +- .../koncat-sample-lib2-1.0-sources.jar.sha256 | 2 +- .../koncat-sample-lib2-1.0-sources.jar.sha512 | 2 +- .../1.0/koncat-sample-lib2-1.0.aar | Bin 2128 -> 2135 bytes .../1.0/koncat-sample-lib2-1.0.aar.md5 | 2 +- .../1.0/koncat-sample-lib2-1.0.aar.sha1 | 2 +- .../1.0/koncat-sample-lib2-1.0.aar.sha256 | 2 +- .../1.0/koncat-sample-lib2-1.0.aar.sha512 | 2 +- .../1.0/koncat-sample-lib2-1.0.module | 30 +++++++++--------- .../1.0/koncat-sample-lib2-1.0.module.md5 | 2 +- .../1.0/koncat-sample-lib2-1.0.module.sha1 | 2 +- .../1.0/koncat-sample-lib2-1.0.module.sha256 | 2 +- .../1.0/koncat-sample-lib2-1.0.module.sha512 | 2 +- .../koncat-sample-lib2/maven-metadata.xml | 2 +- .../koncat-sample-lib2/maven-metadata.xml.md5 | 2 +- .../maven-metadata.xml.sha1 | 2 +- .../maven-metadata.xml.sha256 | 2 +- .../maven-metadata.xml.sha512 | 2 +- .../kotlin/ExportAnnotationProcessor.kt | 16 +++++++--- .../koncat/sample/kotlin/ExportMetadata.kt | 5 ++- 25 files changed, 62 insertions(+), 40 deletions(-) rename sample/android-lib-external/src/main/java/me/xx2bab/koncat/sample/android/{ExportedAndroidLibraryRunnable2.kt => ExportedAndroidLibraryExternalRunnable.kt} (51%) create mode 100644 sample/kotlin-lib/src/main/kotlin/me/xx2bab/koncat/sample/kotlin/ExportedPureKotlinLibraryRunnable2.kt diff --git a/sample/android-lib-external/src/main/java/me/xx2bab/koncat/sample/android/ExportedAndroidLibraryRunnable2.kt b/sample/android-lib-external/src/main/java/me/xx2bab/koncat/sample/android/ExportedAndroidLibraryExternalRunnable.kt similarity index 51% rename from sample/android-lib-external/src/main/java/me/xx2bab/koncat/sample/android/ExportedAndroidLibraryRunnable2.kt rename to sample/android-lib-external/src/main/java/me/xx2bab/koncat/sample/android/ExportedAndroidLibraryExternalRunnable.kt index d5a21d8..3eaf30d 100644 --- a/sample/android-lib-external/src/main/java/me/xx2bab/koncat/sample/android/ExportedAndroidLibraryRunnable2.kt +++ b/sample/android-lib-external/src/main/java/me/xx2bab/koncat/sample/android/ExportedAndroidLibraryExternalRunnable.kt @@ -3,8 +3,8 @@ package me.xx2bab.koncat.sample.android import me.xx2bab.koncat.sample.annotation.ExportAPI @ExportAPI -class ExportedAndroidLibraryRunnable2: Runnable { +class ExportedAndroidLibraryExternalRunnable: Runnable { override fun run() { - println("ExportedAndroidLibraryAPI2 is running...") + println("ExportedAndroidLibraryExternalRunnable is running...") } } \ No newline at end of file diff --git a/sample/android-lib/src/main/kotlin/me/xx2bab/koncat/sample/android/ExportedAndroidLibraryRunnable.kt b/sample/android-lib/src/main/kotlin/me/xx2bab/koncat/sample/android/ExportedAndroidLibraryRunnable.kt index bb188f4..c576ef2 100644 --- a/sample/android-lib/src/main/kotlin/me/xx2bab/koncat/sample/android/ExportedAndroidLibraryRunnable.kt +++ b/sample/android-lib/src/main/kotlin/me/xx2bab/koncat/sample/android/ExportedAndroidLibraryRunnable.kt @@ -5,6 +5,6 @@ import me.xx2bab.koncat.sample.annotation.ExportAPI @ExportAPI class ExportedAndroidLibraryRunnable: Runnable { override fun run() { - println("ExportedAndroidLibraryAPI is running") + println("ExportedAndroidLibraryAPI is running...") } } \ No newline at end of file diff --git a/sample/kotlin-lib/src/main/kotlin/me/xx2bab/koncat/sample/kotlin/ExportedPureKotlinLibraryRunnable2.kt b/sample/kotlin-lib/src/main/kotlin/me/xx2bab/koncat/sample/kotlin/ExportedPureKotlinLibraryRunnable2.kt new file mode 100644 index 0000000..b7bb5a8 --- /dev/null +++ b/sample/kotlin-lib/src/main/kotlin/me/xx2bab/koncat/sample/kotlin/ExportedPureKotlinLibraryRunnable2.kt @@ -0,0 +1,11 @@ +package me.xx2bab.koncat.sample.kotlin + +import me.xx2bab.koncat.sample.annotation.ExportAPI + +@ExportAPI +class ExportedPureKotlinLibraryRunnable2 : Runnable { + override fun run() { + println("ExportedPureKotlinLibraryAPI2 is running...") + } +} + diff --git a/sample/localm2/repository/me/2bab/koncat-sample-lib2/1.0/koncat-sample-lib2-1.0-sources.jar b/sample/localm2/repository/me/2bab/koncat-sample-lib2/1.0/koncat-sample-lib2-1.0-sources.jar index 0bbe4432bdc5afbede8e63229c9afd5a552f504d..411a2b647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%%|{fy7@l!Qv2yH(M*~`kOr}kmyx`;%T(DOY->c1^NJDa~d@w%&6l0*D|&E_V?OD7WM75ur+-SerO z|N6P+7r$EmHg0g5Eq{7z&4o1I+-Vyl@0&Rt688GA@Bm|)K#pyb&Z3T)PmlASRYR=w?YE{NEGhJYu>B8bHz9=;(HL*BVFMm6~BquX3J~uz5G$%DV zAt50Rh*^@%*fau?E+jE9pxWVgL~wyOkQWHV>OhRmXdnYrXz67Y=jZ7`QqSrzueBN{ z^tB3kK7?%Q3OnU{b@d7ZFE5`s9k7p~*!-y;G9183Vi-nHZRHm#8qXt&xFR+g00000Qmy0a diff --git a/sample/localm2/repository/me/2bab/koncat-sample-lib2/1.0/koncat-sample-lib2-1.0.aar.md5 b/sample/localm2/repository/me/2bab/koncat-sample-lib2/1.0/koncat-sample-lib2-1.0.aar.md5 index 51df429..9a00bf9 100644 --- a/sample/localm2/repository/me/2bab/koncat-sample-lib2/1.0/koncat-sample-lib2-1.0.aar.md5 +++ b/sample/localm2/repository/me/2bab/koncat-sample-lib2/1.0/koncat-sample-lib2-1.0.aar.md5 @@ -1 +1 @@ -d3e4ed3931b14f36a59bac36d9db02c6 \ No newline at end of file +d57118295d7758b3529d7e7c0e13b289 \ No newline at end of file diff --git a/sample/localm2/repository/me/2bab/koncat-sample-lib2/1.0/koncat-sample-lib2-1.0.aar.sha1 b/sample/localm2/repository/me/2bab/koncat-sample-lib2/1.0/koncat-sample-lib2-1.0.aar.sha1 index c3f793f..f460e29 100644 --- a/sample/localm2/repository/me/2bab/koncat-sample-lib2/1.0/koncat-sample-lib2-1.0.aar.sha1 +++ b/sample/localm2/repository/me/2bab/koncat-sample-lib2/1.0/koncat-sample-lib2-1.0.aar.sha1 @@ -1 +1 @@ -7ccc739654cbb0f86643c967c1e881a53ef9e896 \ No newline at end of file +24a478cf198244465d7550d69015f7efd66bf3b7 \ No newline at end of file diff --git a/sample/localm2/repository/me/2bab/koncat-sample-lib2/1.0/koncat-sample-lib2-1.0.aar.sha256 b/sample/localm2/repository/me/2bab/koncat-sample-lib2/1.0/koncat-sample-lib2-1.0.aar.sha256 index 2446591..9bb2d29 100644 --- a/sample/localm2/repository/me/2bab/koncat-sample-lib2/1.0/koncat-sample-lib2-1.0.aar.sha256 +++ b/sample/localm2/repository/me/2bab/koncat-sample-lib2/1.0/koncat-sample-lib2-1.0.aar.sha256 @@ -1 +1 @@ -b370f6ffc354178d656568bba4066e52a1360a3c1cd01830bfde2e65a1553ea3 \ No newline at end of file +9b40b12b4aa08808adbcbbb5161d62a693d1e44146f362a9d3919eaf146565ae \ No newline at end of file diff --git a/sample/localm2/repository/me/2bab/koncat-sample-lib2/1.0/koncat-sample-lib2-1.0.aar.sha512 b/sample/localm2/repository/me/2bab/koncat-sample-lib2/1.0/koncat-sample-lib2-1.0.aar.sha512 index fd2fbeb..90ff747 100644 --- a/sample/localm2/repository/me/2bab/koncat-sample-lib2/1.0/koncat-sample-lib2-1.0.aar.sha512 +++ b/sample/localm2/repository/me/2bab/koncat-sample-lib2/1.0/koncat-sample-lib2-1.0.aar.sha512 @@ -1 +1 @@ -c50f2822fa0c6ddf354ad89c9acd7891f2e6d812ad670b103117f1a9f5d350fa7a0945c5e0229747b3ba6ea0a6b69cf39f4995c79fe1b7b6c06a6a4522ee8b85 \ No newline at end of file +40181afb95227f3a67ebde9f764c19db651236a52bb131daa322e89fe9b92c373a3c988a272bb29d176b850775715dc52fc48557f88c6fcc8facdbd77c44fd02 \ No newline at end of file diff --git a/sample/localm2/repository/me/2bab/koncat-sample-lib2/1.0/koncat-sample-lib2-1.0.module b/sample/localm2/repository/me/2bab/koncat-sample-lib2/1.0/koncat-sample-lib2-1.0.module index e71ae2d..6b7175e 100644 --- a/sample/localm2/repository/me/2bab/koncat-sample-lib2/1.0/koncat-sample-lib2-1.0.module +++ b/sample/localm2/repository/me/2bab/koncat-sample-lib2/1.0/koncat-sample-lib2-1.0.module @@ -26,11 +26,11 @@ { "name": "koncat-sample-lib2-1.0.aar", "url": "koncat-sample-lib2-1.0.aar", - "size": 2128, - "sha512": "c50f2822fa0c6ddf354ad89c9acd7891f2e6d812ad670b103117f1a9f5d350fa7a0945c5e0229747b3ba6ea0a6b69cf39f4995c79fe1b7b6c06a6a4522ee8b85", - "sha256": "b370f6ffc354178d656568bba4066e52a1360a3c1cd01830bfde2e65a1553ea3", - "sha1": "7ccc739654cbb0f86643c967c1e881a53ef9e896", - "md5": "d3e4ed3931b14f36a59bac36d9db02c6" + "size": 2135, + "sha512": "40181afb95227f3a67ebde9f764c19db651236a52bb131daa322e89fe9b92c373a3c988a272bb29d176b850775715dc52fc48557f88c6fcc8facdbd77c44fd02", + "sha256": "9b40b12b4aa08808adbcbbb5161d62a693d1e44146f362a9d3919eaf146565ae", + "sha1": "24a478cf198244465d7550d69015f7efd66bf3b7", + "md5": "d57118295d7758b3529d7e7c0e13b289" } ] }, @@ -62,11 +62,11 @@ { "name": "koncat-sample-lib2-1.0.aar", "url": "koncat-sample-lib2-1.0.aar", - "size": 2128, - "sha512": "c50f2822fa0c6ddf354ad89c9acd7891f2e6d812ad670b103117f1a9f5d350fa7a0945c5e0229747b3ba6ea0a6b69cf39f4995c79fe1b7b6c06a6a4522ee8b85", - "sha256": "b370f6ffc354178d656568bba4066e52a1360a3c1cd01830bfde2e65a1553ea3", - "sha1": "7ccc739654cbb0f86643c967c1e881a53ef9e896", - "md5": "d3e4ed3931b14f36a59bac36d9db02c6" + "size": 2135, + "sha512": "40181afb95227f3a67ebde9f764c19db651236a52bb131daa322e89fe9b92c373a3c988a272bb29d176b850775715dc52fc48557f88c6fcc8facdbd77c44fd02", + "sha256": "9b40b12b4aa08808adbcbbb5161d62a693d1e44146f362a9d3919eaf146565ae", + "sha1": "24a478cf198244465d7550d69015f7efd66bf3b7", + "md5": "d57118295d7758b3529d7e7c0e13b289" } ] }, @@ -82,11 +82,11 @@ { "name": "koncat-sample-lib2-1.0-sources.jar", "url": "koncat-sample-lib2-1.0-sources.jar", - "size": 1910, - "sha512": "b697b895f649c54e8be2661402e79c715fabf94dd5321c5dce41ec65ae84cdd2ee708815dd8af603b860ec85b20239a4f66b2c177d987087bea962962b361cd6", - "sha256": "6928ce7fe9caaa2467c338e4af9636990d5760d18229d25b883a9f937b91ad85", - "sha1": "b18f9f7159bc26b7f0373b6289bee4a91555d48d", - "md5": "a918d3a03335223b04be41fa88e41ad9" + "size": 1927, + "sha512": "1197e79e9b0f653a5fff63f3149f0ad4d6a128144fbb02959ffc5a059b97aa1999627bb54388f6cc6e476dda42f8bf2c5a1f34e2517b81a21c7e6b3d1c5def93", + "sha256": "fad543449f3a21305fb163a035cba7351f2814fa7edb6eeeec6d9f1eddb8c5cb", + "sha1": "b7cce7a652357bc1831daedd90f2f8fbdac5f304", + "md5": "db6efe85432f2376d86a0d362a050056" } ] } diff --git a/sample/localm2/repository/me/2bab/koncat-sample-lib2/1.0/koncat-sample-lib2-1.0.module.md5 b/sample/localm2/repository/me/2bab/koncat-sample-lib2/1.0/koncat-sample-lib2-1.0.module.md5 index f480a42..3743ca5 100644 --- a/sample/localm2/repository/me/2bab/koncat-sample-lib2/1.0/koncat-sample-lib2-1.0.module.md5 +++ b/sample/localm2/repository/me/2bab/koncat-sample-lib2/1.0/koncat-sample-lib2-1.0.module.md5 @@ -1 +1 @@ -26d5b84b4e5231ed20835515e9489980 \ No newline at end of file +7de8f6969db7351fb020984752a0b8b0 \ No newline at end of file diff --git a/sample/localm2/repository/me/2bab/koncat-sample-lib2/1.0/koncat-sample-lib2-1.0.module.sha1 b/sample/localm2/repository/me/2bab/koncat-sample-lib2/1.0/koncat-sample-lib2-1.0.module.sha1 index 319c91c..1d0130a 100644 --- a/sample/localm2/repository/me/2bab/koncat-sample-lib2/1.0/koncat-sample-lib2-1.0.module.sha1 +++ b/sample/localm2/repository/me/2bab/koncat-sample-lib2/1.0/koncat-sample-lib2-1.0.module.sha1 @@ -1 +1 @@ -8d90d03a7034e4156e907707e8020fb51a51b018 \ No newline at end of file +d5e7ace6eb7d8a6b82263a14d09cc95fef298857 \ No newline at end of file diff --git a/sample/localm2/repository/me/2bab/koncat-sample-lib2/1.0/koncat-sample-lib2-1.0.module.sha256 b/sample/localm2/repository/me/2bab/koncat-sample-lib2/1.0/koncat-sample-lib2-1.0.module.sha256 index f89fb5b..c85d3d8 100644 --- a/sample/localm2/repository/me/2bab/koncat-sample-lib2/1.0/koncat-sample-lib2-1.0.module.sha256 +++ b/sample/localm2/repository/me/2bab/koncat-sample-lib2/1.0/koncat-sample-lib2-1.0.module.sha256 @@ -1 +1 @@ -4ef954cdb03b3ea3b4d1cf81c17b434849ace65875041b3456d180a6bdaabac1 \ No newline at end of file +fc6d76b49e43b980a67db49ecf148d359224123b81339c7648502ffbe55f60d0 \ No newline at end of file diff --git a/sample/localm2/repository/me/2bab/koncat-sample-lib2/1.0/koncat-sample-lib2-1.0.module.sha512 b/sample/localm2/repository/me/2bab/koncat-sample-lib2/1.0/koncat-sample-lib2-1.0.module.sha512 index 1789445..226d1c3 100644 --- a/sample/localm2/repository/me/2bab/koncat-sample-lib2/1.0/koncat-sample-lib2-1.0.module.sha512 +++ b/sample/localm2/repository/me/2bab/koncat-sample-lib2/1.0/koncat-sample-lib2-1.0.module.sha512 @@ -1 +1 @@ -39114f6eb3ff1ca07caaa6466ed851a5c393b96eafd0dd2f0f7f72cb540a0c6bc354a5ffab113471eab13d12ec712905dd599e1ce2c4c2b60c49e17f8dc9f501 \ No newline at end of file +c950acd6cc1f4ea9bc54f052e5137039e54c82475b3f6696c61030281e0d927bebc00d5601642e97ecbd9c254fbe77eb83c1fbfc9503db60aca1390b8915f8f9 \ No newline at end of file diff --git a/sample/localm2/repository/me/2bab/koncat-sample-lib2/maven-metadata.xml b/sample/localm2/repository/me/2bab/koncat-sample-lib2/maven-metadata.xml index a1f53b7..0527ea4 100644 --- a/sample/localm2/repository/me/2bab/koncat-sample-lib2/maven-metadata.xml +++ b/sample/localm2/repository/me/2bab/koncat-sample-lib2/maven-metadata.xml @@ -8,6 +8,6 @@ 1.0 - 20220331064103 + 20220404021729 diff --git a/sample/localm2/repository/me/2bab/koncat-sample-lib2/maven-metadata.xml.md5 b/sample/localm2/repository/me/2bab/koncat-sample-lib2/maven-metadata.xml.md5 index b2dc8ee..8a8e8b3 100644 --- a/sample/localm2/repository/me/2bab/koncat-sample-lib2/maven-metadata.xml.md5 +++ b/sample/localm2/repository/me/2bab/koncat-sample-lib2/maven-metadata.xml.md5 @@ -1 +1 @@ -762ce58486f74beacf1914390c43c23c \ No newline at end of file +5a5f841d29a108fd9a60a34f61ddbea6 \ No newline at end of file diff --git a/sample/localm2/repository/me/2bab/koncat-sample-lib2/maven-metadata.xml.sha1 b/sample/localm2/repository/me/2bab/koncat-sample-lib2/maven-metadata.xml.sha1 index dc2aebf..8f9fe66 100644 --- a/sample/localm2/repository/me/2bab/koncat-sample-lib2/maven-metadata.xml.sha1 +++ b/sample/localm2/repository/me/2bab/koncat-sample-lib2/maven-metadata.xml.sha1 @@ -1 +1 @@ -92aa2640d89c2d1b6347808288ce2d05b70b5d84 \ No newline at end of file +22d46a565af0f83035db384f240f658424c62d40 \ No newline at end of file diff --git a/sample/localm2/repository/me/2bab/koncat-sample-lib2/maven-metadata.xml.sha256 b/sample/localm2/repository/me/2bab/koncat-sample-lib2/maven-metadata.xml.sha256 index 957a69e..24d7c4b 100644 --- a/sample/localm2/repository/me/2bab/koncat-sample-lib2/maven-metadata.xml.sha256 +++ b/sample/localm2/repository/me/2bab/koncat-sample-lib2/maven-metadata.xml.sha256 @@ -1 +1 @@ -aeb3f1dc3665d60a7f1a183fca27c45b0c73a5bd11ddfa4ca9718a2b7e449f17 \ No newline at end of file +9985ed947d48d7f7d9210d1cb50d22c9701e6f34bf1c072907262193abfc8c87 \ No newline at end of file diff --git a/sample/localm2/repository/me/2bab/koncat-sample-lib2/maven-metadata.xml.sha512 b/sample/localm2/repository/me/2bab/koncat-sample-lib2/maven-metadata.xml.sha512 index edb0c26..6898c05 100644 --- a/sample/localm2/repository/me/2bab/koncat-sample-lib2/maven-metadata.xml.sha512 +++ b/sample/localm2/repository/me/2bab/koncat-sample-lib2/maven-metadata.xml.sha512 @@ -1 +1 @@ -7fcec7ee04d0dc497012d750226d40b85850a0522446e1aa73946380be542c678a018c395c0be8a1aa9a247a3538b4407f2db4a7434344a2b8de1171031b9665 \ No newline at end of file +fd4b320f87f44c43945133b1f2460625851138baa76f09608d46bebdb0a9218d4e813cae948e012b2e444f6f39fedc4594e03fe9f703cdef4f79030fe7920005 \ No newline at end of file diff --git a/sample/processors/src/main/kotlin/me/xx2bab/koncat/sample/kotlin/ExportAnnotationProcessor.kt b/sample/processors/src/main/kotlin/me/xx2bab/koncat/sample/kotlin/ExportAnnotationProcessor.kt index e9bdaf5..2473986 100644 --- a/sample/processors/src/main/kotlin/me/xx2bab/koncat/sample/kotlin/ExportAnnotationProcessor.kt +++ b/sample/processors/src/main/kotlin/me/xx2bab/koncat/sample/kotlin/ExportAnnotationProcessor.kt @@ -38,6 +38,7 @@ class ExportAnnotationProcessor( private var exportMetadata = ExportMetadata() override fun process(resolver: Resolver): List { + logger.info("$LOG_TAG [process]") val symbols = resolver.getSymbolsWithAnnotation("me.xx2bab.koncat.sample.annotation.ExportAPI") val ret = symbols.filter { !it.validate() }.toList() @@ -50,6 +51,7 @@ class ExportAnnotationProcessor( @OptIn(KotlinPoetKspPreview::class) override fun finish() { super.finish() + logger.info("$LOG_TAG [finish]") if (koncat.isMainProject()) { logger.info( LOG_TAG + "Query all sub projects meta data from " @@ -71,11 +73,11 @@ class ExportAnnotationProcessor( all.addAll(subProjectMetadataList) // Generate the final file val fileSpec = RouterClassBuilder(all).build() - fileSpec.writeTo(codeGenerator, Dependencies(aggregating = false)) + fileSpec.writeTo(codeGenerator, Dependencies.ALL_FILES) } else { // Generate intermediate JSON file val os = codeGenerator.createNewFile( - Dependencies(aggregating = false), + Dependencies(aggregating = true, *exportMetadata.mapKSFiles.toTypedArray()), "", koncat.projectName + "-export", "json.$KONCAT_FILE_EXTENSION" @@ -85,12 +87,18 @@ class ExportAnnotationProcessor( } } + override fun onError() { + super.onError() + logger.info("$LOG_TAG [onError]") + } + inner class BuilderVisitor() : KSVisitorWithExportMetadata() { override fun visitClassDeclaration( classDeclaration: KSClassDeclaration, data: ExportMetadata ) { - data.exportAPI.add(classDeclaration.qualifiedName!!.asString()) + data.exportAPIs.add(classDeclaration.qualifiedName!!.asString()) + classDeclaration.containingFile?.let { data.mapKSFiles.add(it) } } } @@ -101,7 +109,7 @@ class ExportAnnotationProcessor( val routerInterface = ClassName("me.xx2bab.koncat.sample", "ExportCapabilityRouter") val list = ClassName("kotlin.collections", "List") val listOfString = list.parameterizedBy(String::class.asTypeName()) - val exportAPIs = dataList.flatMap { it.exportAPI } + val exportAPIs = dataList.flatMap { it.exportAPIs } .map { "\"$it\"" } .joinToString(separator = ", ") diff --git a/sample/processors/src/main/kotlin/me/xx2bab/koncat/sample/kotlin/ExportMetadata.kt b/sample/processors/src/main/kotlin/me/xx2bab/koncat/sample/kotlin/ExportMetadata.kt index c62f298..dc89472 100644 --- a/sample/processors/src/main/kotlin/me/xx2bab/koncat/sample/kotlin/ExportMetadata.kt +++ b/sample/processors/src/main/kotlin/me/xx2bab/koncat/sample/kotlin/ExportMetadata.kt @@ -1,8 +1,11 @@ package me.xx2bab.koncat.sample.kotlin +import com.google.devtools.ksp.symbol.KSFile import kotlinx.serialization.Serializable +import kotlinx.serialization.Transient @Serializable data class ExportMetadata( - val exportAPI: MutableList = mutableListOf() + val exportAPIs: MutableList = mutableListOf(), + @Transient val mapKSFiles: MutableList = mutableListOf() ) From 97fa765a1e39aac9fbbdb7d4a2f45305bf0d0443 Mon Sep 17 00:00:00 2001 From: 2BAB Date: Mon, 4 Apr 2022 21:10:28 +0800 Subject: [PATCH 5/5] release: 1.0.1 --- deps.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deps.versions.toml b/deps.versions.toml index 9fe3e9c..b8788c1 100644 --- a/deps.versions.toml +++ b/deps.versions.toml @@ -1,5 +1,5 @@ [versions] -koncatVer = "1.0.0" +koncatVer = "1.0.1" kotlinVer = "1.6.10" agpVer = "7.1.2" agpBetaVer = "7.2.0-beta04"