Skip to content

intuit/hooks

main
Switch branches/tags
Code

Latest commit

* 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

* Get SyncHook working with Kotlin Poet

* Implement AsyncSeriesHook

* SyncBailHook and AsyncSeriesBailHook

* SyncWaterfallHook

* SyncLoopHook

* AsyncParallelBailHook

* Make all the tests pass! πŸŽ‰

* Cleanup

* compiler-plugin -> processor

* lint,dump,knit

* make knit happy (and me sad :()

* upgrade knit

* Fix the generics test

* upgrade arrow meta and handle no requested version a bit more gracefully

* remove example-library api folder

* Remove all the string-based codegen

* Fix compiler issues

* Make the apiCheck happy

Co-authored-by: Paul Hubbard <pfh@phfactor.net>

* Make the linter happy

Co-authored-by: Paul Hubbard <pfh@phfactor.net>

* Remove all the excess Poet descriptors

Co-authored-by: Paul Hubbard <pfh@phfactor.net>

* Pass TypeResolvers through to the signature

* Move all KSP -> Poet stuff into the validators

* Split all the ksp/poet stuff into different parts

* Clean up duplicate cases

* Fix external api

* More cleanup

* Switch from withEither to andThen

Co-authored-by: Jeremiah Zucker <zucker.jeremiah@gmail.com>
Co-authored-by: Paul Hubbard <pfh@phfactor.net>
44e6650

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Hooks Logo

Hooks is a little module for plugins, in Kotlin


Auto Release CircleCI Maven Central Gradle Plugin Portal GitHub top language KtLint All Contributors

Hooks represent "pluggable" points in a software model. They provide a mechanism for tapping into such points to get updates, or apply additional functionality to some typed object. Included in the hooks library are:

  • A variety of hooks to support different plugin behavior: Basic, Waterfall, Bail, Loop
  • Asynchronous support built on Kotlin coroutines
  • Support for additional hook context and interceptors

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.

Visit our site for information about how to use hooks.

Inspiration

At Intuit, we're big fans of tapable. We use it in some of our core systems to enable teams to augment and extend our frameworks to solve their customer problems. Since our backend systems are primarily JVM-based, we really missed tapable when working in service code. Hooks is our implementation of tapable as a library for the JVM plus an Arrow Meta Compiler Plugin to make it easier to use.

Structure

  • hooks - The actual implementation of the hooks
  • processor - A Kotlin Symbol Processor that generates hook subclasses for you
  • gradle-plugin - A Gradle plugin to make using the processor easier
  • maven-plugin - A Maven Kotlin plugin extension to make using the processor easier
  • example-library - A library that exposes extension points for consumers using the hooks' call function
  • example-application - The Application that demonstrates extending a library by calling the hooks' tap function

🍻 Contributing 🍻

Feel free to make an issue or open a pull request if you have an improvement and new plugin to propose!

Make sure to read our code of conduct.

πŸ”¨ Start Developing πŸ”¨

To get set up, fork and clone the project.

Build

Build and verify all checks:

./gradlew build

Publish locally to use in other projects:

./gradlew publishToMavenLocal

Test

Recompile changes and run all tests:

./gradlew test

Run example app

./gradlew run

Cleaning

./gradlew clean

Linting

Linting is done with ktlint and configured using JLLeitschuh's ktlint Gradle plugin.

Format code according to linting standards:

./gradlew ktlintFormat

Verify code meets linting standards:

./gradlew ktlintCheck

API Validation

To ensure that binary compatibility is maintained across non-breaking releases, the public API is validated using the Kotlin binary compatibility validator tool.

Update the API dumps:

./gradlew apiDump

Verify the public API matches the API dumps:

./gradlew apiCheck

Documentation

The docs site is built using the Orchid tool and takes inspiration from the stikt.io docs site.

Run the docs locally:

./gradlew orchidServe

The knit tool is also used to generate tests driven from markdown snippets to ensure documentation is maintained and up-to-date.

Update all generated markdown tests:

./gradlew knit

Verify the generated tests match the latest markdown changes:

./gradlew knitCheck

Versioning

This project follows the semantic versioning strategy and uses Auto to automate releases on CI. PRs must be labeled with an appropriate Auto label to denote what type of release should occur when merged. With the binary compatibility validator tool, we can follow this set of rules to determine release types:

  • Red on an API diff is breaking and requires a major bump
  • Green on an API diff is a new feature and requires a minor bump
  • No API diff, but has a code change requires a patch bump
  • Else, apply the corresponding label for documentation or build, etc.

Contributors ✨

Thanks goes to these wonderful people (emoji key):


Jeremiah Zucker

⚠️ πŸ’» πŸ“– πŸš‡

David Stone

πŸ“– ⚠️ πŸ’»

Andrew Lisowski

πŸ“– πŸš‡ ⚠️ πŸ’»

Kelly Harrop

🎨

This project follows the all-contributors specification. Contributions of any kind welcome!

License

FOSSA Status

This product includes software developed by the Apache Software Foundation (http://www.apache.org/).