diff --git a/build.gradle.kts b/build.gradle.kts index f382891..26c943c 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -82,6 +82,9 @@ subprojects { plugin("jacoco") plugin("org.jlleitschuh.gradle.ktlint") } + jacoco { + toolVersion = "0.8.7" + } if (publishModules.contains(name)) { apply { diff --git a/compiler-plugin/api/compiler-plugin.api b/compiler-plugin/api/compiler-plugin.api index e42e99a..4163ba1 100644 --- a/compiler-plugin/api/compiler-plugin.api +++ b/compiler-plugin/api/compiler-plugin.api @@ -10,7 +10,6 @@ public class com/intuit/hooks/plugin/HooksMetaPlugin : arrow/meta/Meta { public fun declarationChecker (Lkotlin/jvm/functions/Function4;)Larrow/meta/phases/config/StorageComponentContainer; public fun enableIr ()Larrow/meta/phases/ExtensionPhase; public fun extraImports (Lkotlin/jvm/functions/Function2;)Larrow/meta/phases/analysis/ExtraImports; - public fun installArrowPlugin ()V public fun intercept (Larrow/meta/phases/CompilerContext;)Ljava/util/List; public fun irAnonymousInitializer (Larrow/meta/Meta;Lkotlin/jvm/functions/Function2;)Larrow/meta/phases/codegen/ir/IRGeneration; public fun irBlock (Larrow/meta/Meta;Lkotlin/jvm/functions/Function2;)Larrow/meta/phases/codegen/ir/IRGeneration; @@ -35,6 +34,7 @@ public class com/intuit/hooks/plugin/HooksMetaPlugin : arrow/meta/Meta { public fun irDelegatingConstructorCall (Larrow/meta/Meta;Lkotlin/jvm/functions/Function2;)Larrow/meta/phases/codegen/ir/IRGeneration; public fun irDoWhileLoop (Larrow/meta/Meta;Lkotlin/jvm/functions/Function2;)Larrow/meta/phases/codegen/ir/IRGeneration; public fun irDump (Larrow/meta/Meta;)Larrow/meta/phases/codegen/ir/IRGeneration; + public fun irDumpKotlinLike (Larrow/meta/Meta;Lorg/jetbrains/kotlin/ir/util/KotlinLikeDumpOptions;)Larrow/meta/phases/codegen/ir/IRGeneration; public fun irDynamicExpression (Larrow/meta/Meta;Lkotlin/jvm/functions/Function2;)Larrow/meta/phases/codegen/ir/IRGeneration; public fun irDynamicMemberExpression (Larrow/meta/Meta;Lkotlin/jvm/functions/Function2;)Larrow/meta/phases/codegen/ir/IRGeneration; public fun irDynamicOperatorExpression (Larrow/meta/Meta;Lkotlin/jvm/functions/Function2;)Larrow/meta/phases/codegen/ir/IRGeneration; @@ -67,7 +67,7 @@ public class com/intuit/hooks/plugin/HooksMetaPlugin : arrow/meta/Meta { public fun irPropertyReference (Larrow/meta/Meta;Lkotlin/jvm/functions/Function2;)Larrow/meta/phases/codegen/ir/IRGeneration; public fun irReturn (Larrow/meta/Meta;Lkotlin/jvm/functions/Function2;)Larrow/meta/phases/codegen/ir/IRGeneration; public fun irSetField (Larrow/meta/Meta;Lkotlin/jvm/functions/Function2;)Larrow/meta/phases/codegen/ir/IRGeneration; - public fun irSetVariable (Larrow/meta/Meta;Lkotlin/jvm/functions/Function2;)Larrow/meta/phases/codegen/ir/IRGeneration; + public fun irSetValue (Larrow/meta/Meta;Lkotlin/jvm/functions/Function2;)Larrow/meta/phases/codegen/ir/IRGeneration; public fun irSimpleFunction (Larrow/meta/Meta;Lkotlin/jvm/functions/Function2;)Larrow/meta/phases/codegen/ir/IRGeneration; public fun irSingletonReference (Larrow/meta/Meta;Lkotlin/jvm/functions/Function2;)Larrow/meta/phases/codegen/ir/IRGeneration; public fun irSpreadElement (Larrow/meta/Meta;Lkotlin/jvm/functions/Function2;)Larrow/meta/phases/codegen/ir/IRGeneration; @@ -111,7 +111,6 @@ public class com/intuit/hooks/plugin/HooksMetaPlugin : arrow/meta/Meta { public fun suppressDiagnosticWithTrace (Lkotlin/jvm/functions/Function2;)Larrow/meta/phases/ExtensionPhase; public fun syntheticResolver (Lkotlin/jvm/functions/Function3;Lkotlin/jvm/functions/Function6;Lkotlin/jvm/functions/Function6;Lkotlin/jvm/functions/Function6;Lkotlin/jvm/functions/Function6;Lkotlin/jvm/functions/Function4;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function2;)Larrow/meta/phases/resolve/synthetics/SyntheticResolver; public fun syntheticScopes (Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function3;Lkotlin/jvm/functions/Function3;Lkotlin/jvm/functions/Function4;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function4;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function3;)Larrow/meta/phases/ExtensionPhase; - public fun typeChecker (Larrow/meta/Meta;Lkotlin/jvm/functions/Function1;)Larrow/meta/phases/ExtensionPhase; public fun updateConfig (Lkotlin/jvm/functions/Function2;)Larrow/meta/phases/config/Config; } diff --git a/compiler-plugin/build.gradle.kts b/compiler-plugin/build.gradle.kts index 4a6371f..9e6f338 100644 --- a/compiler-plugin/build.gradle.kts +++ b/compiler-plugin/build.gradle.kts @@ -11,7 +11,7 @@ dependencies { pluginDependency("io.arrow-kt", "arrow-annotations", ARROW_VERSION) pluginDependency("io.arrow-kt", "arrow-syntax", ARROW_VERSION) pluginDependency("io.arrow-kt", "arrow-core-data", ARROW_VERSION) - pluginDependency("io.arrow-kt", "compiler-plugin", ARROW_META_VERSION) + pluginDependency("io.arrow-kt", "arrow-meta", ARROW_META_VERSION) compileOnly(kotlin("stdlib")) compileOnly(kotlin("compiler-embeddable")) @@ -28,7 +28,7 @@ dependencies { testImplementation(project(":hooks")) testImplementation("io.arrow-kt:arrow-meta-prelude:$ARROW_META_VERSION") testImplementation("io.arrow-kt:arrow-core:$ARROW_VERSION") - testImplementation("io.arrow-kt:compiler-plugin:$ARROW_META_VERSION") + testImplementation("io.arrow-kt:arrow-meta:$ARROW_META_VERSION") testImplementation("io.arrow-kt:meta-test:$ARROW_META_VERSION") } diff --git a/compiler-plugin/src/main/kotlin/com/intuit/hooks/plugin/Hooks.kt b/compiler-plugin/src/main/kotlin/com/intuit/hooks/plugin/Hooks.kt index 986de03..47d0240 100644 --- a/compiler-plugin/src/main/kotlin/com/intuit/hooks/plugin/Hooks.kt +++ b/compiler-plugin/src/main/kotlin/com/intuit/hooks/plugin/Hooks.kt @@ -17,11 +17,11 @@ internal val Meta.hooks: CliPlugin get() = "Hooks" { meta( - classDeclaration(this, KtClass::isHooksDslClass) { c -> + classDeclaration(this, { this.element.isHooksDslClass }) { c -> findHooks().map> { codeGen -> - val `package` = c.containingKtFile.packageDirective?.text ?: "" + val `package` = c.element.containingKtFile.packageDirective?.text ?: "" val (classes, properties) = codeGen.map(::generateHookClass).unzip() - val imports = createImportDirectives(c, codeGen) + val imports = createImportDirectives(c.element, codeGen) val newSource = """|${`package`} diff --git a/compiler-plugin/src/main/kotlin/com/intuit/hooks/plugin/Utility.kt b/compiler-plugin/src/main/kotlin/com/intuit/hooks/plugin/Utility.kt index 077abce..5cbc766 100644 --- a/compiler-plugin/src/main/kotlin/com/intuit/hooks/plugin/Utility.kt +++ b/compiler-plugin/src/main/kotlin/com/intuit/hooks/plugin/Utility.kt @@ -18,7 +18,7 @@ private val KtClass.containsHooksDslImport get() = containingKtFile.importList?. it.text.contains("com.intuit.hooks.dsl.") } ?: false -internal fun String.capitalizeFirstLetter(): String = this.mapIndexed { i, c -> if (i == 0) c.toUpperCase() else c }.joinToString(separator = "") +internal fun String.capitalizeFirstLetter(): String = this.mapIndexed { i, c -> if (i == 0) c.uppercaseChar() else c }.joinToString(separator = "") internal fun CompilerContext.reportHookErrors(invalid: NonEmptyList) = invalid.forEach { messageCollector?.report(it) } diff --git a/gradle.properties b/gradle.properties index a1aae39..1f2b3bf 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,12 +1,7 @@ JVM_TARGET_VERSION=1.8 -KOTLIN_VERSION=1.4.21 -COROUTINES_VERSION=1.4.0 -ARROW_META_VERSION=1.4.10-SNAPSHOT - -# These are for our eventual IDE plugin... -#KOTLIN_IDEA_VERSION=203-1.4.21-release-IJ6682.9 -#INTELLIJ_IDEA_VERSION=2020.3 -#OPENAPI_VERSION=7.0.3 +KOTLIN_VERSION=1.5.0 +COROUTINES_VERSION=1.5.0-RC +ARROW_META_VERSION=1.5.0-SNAPSHOT ARROW_VERSION=0.11.0 JUNIT_VERSION=5.7.0