Skip to content

Commit 200b606

Browse files
authored
Migrate from Arrow Meta to Kotlin Symbol Processor (#24)
* conditionally sign * wip * wip on version catalog * wip ksp * finish compiler plugin re-org * fix all tests for compiler plugin and enhance validations * re-enable docs + example-application * gradle plugin * maven plugin * fix some links * fix gradle and maven readmes and lint * try to fix signing * fix dependency * hacky way to fix test dependency * api dump * remove unnecessary option * add missing deps to version catalog * compiler-plugin -> processor * lint,dump,knit * make knit happy (and me sad :() * upgrade knit * upgrade arrow meta and handle no requested version a bit more gracefully * remove example-library api folder
1 parent 6e223e2 commit 200b606

File tree

71 files changed

+1679
-1406
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+1679
-1406
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
- image: circleci/openjdk:8-jdk
3232

3333
steps:
34-
- run: curl -vkL -o - https://github.com/intuit/auto/releases/download/v10.32.1/auto-linux.gz | gunzip > ~/auto
34+
- run: curl -vkL -o - https://github.com/intuit/auto/releases/download/v10.36.5/auto-linux.gz | gunzip > ~/auto
3535
- run: chmod a+x ~/auto
3636
- checkout
3737
- run: ~/auto shipit -vvv

.fossa.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,6 @@ cli:
88
project: [email protected]:intuit/hooks
99
analyze:
1010
modules:
11-
- name: compiler-plugin
12-
type: gradle
13-
target: 'compiler-plugin:'
14-
path: .
1511
- name: docs
1612
type: gradle
1713
target: 'docs:'
@@ -36,3 +32,7 @@ analyze:
3632
type: gradle
3733
target: 'maven-plugin:'
3834
path: .
35+
- name: processor
36+
type: gradle
37+
target: 'processor:'
38+
path: .

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Hooks represent "pluggable" points in a software model. They provide a mechanism
3131
- Asynchronous support built on Kotlin [coroutines](https://kotlinlang.org/docs/coroutines-guide.html)
3232
- Support for additional [hook context](https://intuit.github.io/hooks/wiki/key-concepts/#hook-context) and [interceptors](https://intuit.github.io/hooks/wiki/key-concepts/#interceptors)
3333

34-
Along with the base library, we created a Kotlin compiler plugin to enable hooks to be created with a simple typed-based DSL, limiting the redundancy and overhead required to subclass a hook.
34+
Along with the base library, we created a Kotlin symbol processor to enable hooks to be created with a simple typed-based DSL, limiting the redundancy and overhead required to subclass a hook.
3535

3636
Visit our [site](https://intuit.github.io/hooks/) for information about how to use hooks.
3737

@@ -44,12 +44,12 @@ library for the JVM plus an [Arrow Meta](https://meta.arrow-kt.io/) Compiler Plu
4444

4545
## Structure
4646

47-
- [hooks](https://github.com/intuit/hooks/tree/master/hooks) - The actual implementation of the hooks
48-
- [compiler-plugin](https://github.com/intuit/hooks/tree/master/compiler-plugin) - An Arrow Meta compiler plugin that generates hook subclasses for you
49-
- [gradle-plugin](https://github.com/intuit/hooks/tree/master/gradle-plugin) - A gradle plugin to make using the compiler plugin easier
50-
- [maven-plugin](https://github.com/intuit/hooks/tree/master/maven-plugin) - A maven Kotlin plugin extension to make using the compiler plugin easier
51-
- [example-library](https://github.com/intuit/hooks/tree/master/example-library) - A library that exposes extension points for consumers using the hooks' `call` function
52-
- [example-application](https://github.com/intuit/hooks/tree/master/example-application) - The Application that demonstrates extending a library by calling the hooks' `tap` function
47+
- [hooks](https://github.com/intuit/hooks/tree/main/hooks) - The actual implementation of the hooks
48+
- [processor](https://github.com/intuit/hooks/tree/main/processor) - A Kotlin Symbol Processor that generates hook subclasses for you
49+
- [gradle-plugin](https://github.com/intuit/hooks/tree/main/gradle-plugin) - A Gradle plugin to make using the processor easier
50+
- [maven-plugin](https://github.com/intuit/hooks/tree/main/maven-plugin) - A Maven Kotlin plugin extension to make using the processor easier
51+
- [example-library](https://github.com/intuit/hooks/tree/main/example-library) - A library that exposes extension points for consumers using the hooks' `call` function
52+
- [example-application](https://github.com/intuit/hooks/tree/main/example-application) - The Application that demonstrates extending a library by calling the hooks' `tap` function
5353

5454
## :beers: Contributing :beers:
5555

build.gradle.kts

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
77

88
allprojects {
99
repositories {
10-
jcenter()
1110
mavenLocal()
1211
mavenCentral()
1312
maven("https://plugins.gradle.org/m2/")
@@ -16,16 +15,16 @@ allprojects {
1615
}
1716

1817
plugins {
19-
kotlin("jvm") apply false
20-
id("jacoco")
18+
alias(libs.plugins.kotlin.jvm) apply false
19+
jacoco
2120

22-
id("net.researchgate.release")
23-
id("io.github.gradle-nexus.publish-plugin")
21+
alias(libs.plugins.release)
22+
alias(libs.plugins.nexus)
2423

25-
id("org.jlleitschuh.gradle.ktlint")
26-
id("org.jetbrains.kotlinx.binary-compatibility-validator")
24+
alias(libs.plugins.ktlint)
25+
alias(libs.plugins.api)
2726

28-
id("org.jetbrains.dokka")
27+
alias(libs.plugins.dokka)
2928
}
3029

3130
val shouldntPublish = listOf("docs", "example-library", "example-application")
@@ -83,11 +82,12 @@ subprojects {
8382
plugin("jacoco")
8483
plugin("org.jlleitschuh.gradle.ktlint")
8584
}
85+
8686
jacoco {
8787
toolVersion = "0.8.7"
8888
}
8989

90-
if (publishModules.contains(name)) {
90+
if (publishModules.contains(name) && name != "gradle-plugin") {
9191
apply {
9292
plugin("maven-publish")
9393
plugin("signing")
@@ -133,15 +133,6 @@ subprojects {
133133
}
134134
}
135135

136-
configure<SigningExtension> {
137-
val signingKey by auth {
138-
it?.replace("\\n", "\n")
139-
}
140-
val signingPassword by auth
141-
useInMemoryPgpKeys(signingKey, signingPassword)
142-
sign(extensions.findByType(PublishingExtension::class.java)!!.publications)
143-
}
144-
145136
tasks {
146137
register<Jar>("javadocJar") {
147138
dependsOn("dokkaJavadoc")
@@ -157,9 +148,21 @@ subprojects {
157148
}
158149
}
159150

151+
extensions.findByType<SigningExtension>()?.apply {
152+
val signingKey by auth {
153+
it?.replace("\\n", "\n")
154+
}
155+
signingKey?.let {
156+
val signingPassword by auth
157+
useInMemoryPgpKeys(signingKey, signingPassword)
158+
sign(extensions.findByType(PublishingExtension::class.java)!!.publications)
159+
} ?: run {
160+
isRequired = false
161+
}
162+
}
163+
160164
ktlint {
161165
filter {
162-
exclude("**/*Impl.kt")
163166
exclude("**/example/**/*.kt")
164167
}
165168
}
@@ -172,8 +175,6 @@ subprojects {
172175
tasks {
173176
val configure: KotlinCompile.() -> Unit = {
174177
kotlinOptions {
175-
val JVM_TARGET_VERSION: String by project
176-
jvmTarget = JVM_TARGET_VERSION
177178
freeCompilerArgs += "-Xopt-in=kotlin.RequiresOptIn"
178179
}
179180
}

buildSrc/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ plugins {
22
`kotlin-dsl`
33
}
44
repositories {
5-
jcenter()
5+
mavenCentral()
66
}

buildSrc/src/main/kotlin/Jar.kt

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,12 @@ import org.gradle.api.tasks.bundling.Jar
22
import org.gradle.api.NamedDomainObjectProvider
33
import org.gradle.api.artifacts.Configuration
44
import org.gradle.api.file.CopySpec
5+
import org.gradle.api.file.DuplicatesStrategy
56

6-
fun Jar.fromConfiguration(configuration: NamedDomainObjectProvider<Configuration>, block: CopySpec.() -> Unit = {}) =
7-
fromConfiguration(configuration.get(), block)
7+
fun Jar.fromConfiguration(configuration: NamedDomainObjectProvider<Configuration>, block: CopySpec.() -> Unit = {
8+
this.duplicatesStrategy = DuplicatesStrategy.INCLUDE
9+
}) = fromConfiguration(configuration.get(), block)
810

9-
fun Jar.fromConfiguration(configuration: Configuration, block: CopySpec.() -> Unit = {}) =
10-
from(configuration.map { if (it.isDirectory) it else getProject().zipTree(it) }, block)
11+
fun Jar.fromConfiguration(configuration: Configuration, block: CopySpec.() -> Unit = {
12+
this.duplicatesStrategy = DuplicatesStrategy.INCLUDE
13+
}) = from(configuration.map { if (it.isDirectory) it else project.zipTree(it) }, block)

compiler-plugin/README.md

Lines changed: 0 additions & 58 deletions
This file was deleted.

0 commit comments

Comments
 (0)