From a548393406973a302a40f6054ab8bbab100ef416 Mon Sep 17 00:00:00 2001 From: Ilya Gorbunov Date: Tue, 18 Oct 2022 22:40:17 +0200 Subject: [PATCH] Document inputJar feature in README --- README.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/README.md b/README.md index 93ea405d..aa41c338 100644 --- a/README.md +++ b/README.md @@ -125,6 +125,26 @@ apiValidation { } ``` +### Producing dump of a jar + +By default, binary compatibility validator analyzes project output class files from `build/classes` directory when building an API dump. +If you pack these classes into an output jar not in a regular way, for example, by excluding certain classes, applying `shadow` plugin, and so on, +the API dump built from the original class files may no longer reflect the resulting jar contents accurately. +In that case, it makes sense to use the resulting jar as an input of the `apuBuild` task: + +Kotlin +```kotlin +tasks { + apiBuild { + // "jar" here is the name of the default Jar task producing the resulting jar file + // in a multiplatform project it can be named "jvmJar" + // if you applied the shadow plugin, it creates the "shadowJar" task that produces the transformed jar + inputJar.value(jar.flatMap { it.archiveFile }) + } +} +``` + + ### Workflow When starting to validate your library public API, we recommend the following workflow: