We'd love to accept your patches and contributions to this project. There are just a few small guidelines you need to follow.
Contributions to this project must be accompanied by a Contributor License Agreement (CLA). You (or your employer) retain the copyright to your contribution; this simply gives us permission to use and redistribute your contributions as part of the project. Head over to https://cla.developers.google.com/ to see your current agreements on file or to sign a new one.
You generally only need to submit a CLA once, so if you‘ve already submitted one (even if it was for a different project), you probably don’t need to do it again.
All submissions, including submissions by project members, require review. We use GitHub pull requests for this purpose. Consult GitHub Help for more information on using pull requests.
This project follows Google's Open Source Community Guidelines.
For changes that involves API changes(new API, API signature change), please also update api.base file. You can monitor api change with ./gradlew :api:checkApi, and./gradlew :api:updateApi to generate new api signature.
If you want to submit a bug fix or report a bug via a test, follow this workflow:
@Bug requires a linked GitHub issue).runFailingTest or runThrowingTest respectively (annotated with @Bug(..., BugState.OPEN)).runFailingTest/runThrowingTest to runTest and update the BugState value (e.g., to BugState.FIXED).You may choose to follow any or all of the above steps as long as they are in that order.
For incoming PRs, we request that changes are covered by tests for good practice. We do end-to-end testing for KSP, which means you write a lightweight processor to be loaded with KSP for testing. The form of the test itself is flexible as long as the logic is covered.
[!NOTE] The
test-utilsdirectory is deprecated. Unit tests should be placed inkotlin-analysis-api.
Here are some sample test processors for your reference.
List<String>.toResult() function to collect test results..kt file under the testData folder in kotlin-analysis-api (e.g. kotlin-analysis-api/testData). Every .kt file under this folder corresponds to a test case.// WITH_RUNTIME to the top if you need access to the standard library.// TEST PROCESSOR:<Your test processor name> to provide the test processor for this test case. Processors can be reused if necessary.// PROCESSOR INPUT: <input/predicate> to specify inputs or predicates for the test processor (e.g. // PROCESSOR INPUT: Anno or // PROCESSOR INPUT: kotlin.annotation.Retention, kotlin.annotation.Target, as in aliasedAnnotation.kt). Note: for a processor to accept input, its constructor must have a single List<String> parameter. This is a handy way of writing a parametric test processor.// (with a space after //).// END to indicate the end of expected test results.// FILE: <file name> to create files that will be available at runtime of the test.// FILE: a.kt will result in a file named a.kt at runtime.KSPUnitTestSuite in kotlin-analysis-api.@Bug and @BugState.@Bug annotation requires a link to an open or existing GitHub issue (e.g., @Bug("https://github.com/google/ksp/issues/<issue_number>", BugState.OPEN)).@Negative marker annotation if applicable.:compiler-plugin:test and :kotlin-analysis-api:test gradle tasks.--tests "com.google.devtools.ksp.test.KSPUnitTestSuite.<name of your test>"