33# Ackee Android Snapshots
44
55[ ![ License] ( https://img.shields.io/badge/license-Apache%202.0-blue.svg )] ( LICENSE )
6- [ ![ Maven Central] ( https://img.shields.io/maven-central/v/io.github.ackeecz/snapshots-annotations )] ( https://central.sonatype.com/artifact/io.github.ackeecz/snapshots-annotations )
6+ [ ![ Maven Central] ( https://img.shields.io/maven-central/v/io.github.ackeecz/snapshots-bom )] ( https://central.sonatype.com/artifact/io.github.ackeecz/snapshots-bom )
77
88## Overview
99
@@ -14,9 +14,9 @@ components. It leverages Paparazzi for rendering snapshots, Showkase for compone
1414
1515The framework is designed with extensibility in mind, using a modular architecture:
1616
17+ - ` annotations ` module contains shared code for preview annotations
1718- ` framework ` module defines the base interfaces (` SnapshotEngine ` , ` SnapshotStrategy ` ) and common testing infrastructure
1819- ` paparazzi ` module provides a concrete implementation of the snapshot engine using Paparazzi
19- - ` annotations ` module contains shared code for preview annotations
2020- Additional snapshot engine implementations can be added by implementing the ` SnapshotEngine ` interface
2121
2222## Features
@@ -34,86 +34,70 @@ The framework is designed with extensibility in mind, using a modular architectu
3434
3535## Installation
3636
37- Add the following dependencies to your ` libs.versions.toml ` :
37+ Add the following configuration, depending on what you need. You should always use BOM to be sure to
38+ get binary compatible dependencies. If you have a custom snapshots engine, you will need only
39+ ` annotations ` and ` framework ` dependencies. Additionally, you can add ` paparazzi ` as well for our
40+ Paparazzi engine implementation.
41+
42+ ### Annotations & Framework
43+ For ` annotations ` and ` framework ` artifacts you will need the following configuration:
3844
3945``` toml
4046[versions ]
41- ackee-snapshots-annotations = " SPECIFY_VERSION"
42- ackee-snapshots-framework = " SPECIFY_VERSION"
43- ackee-snapshots-paparazzi = " SPECIFY_VERSION"
44- compose-bom = " SPECIFY_VERSION"
47+ ackee-snapshots-bom = " SPECIFY_VERSION"
4548showkase = " SPECIFY_VERSION"
46- paparazzi = " SPECIFY_VERSION"
4749
4850[dependencies ]
49- ackee-snapshots-framework = { group = " io.github.ackeecz" , name = " snapshots-framework " , version.ref = " ackee-snapshots-framework " }
50- ackee-snapshots-paparazzi = { group = " io.github.ackeecz" , name = " snapshots-paparazzi " , version.ref = " ackee-snapshots-paparazzi " }
51- ackee-snapshots-annotations = { group = " io.github.ackeecz" , name = " snapshots-annotations " , version.ref = " ackee-snapshots-annotations " }
51+ ackee-snapshots-bom = { group = " io.github.ackeecz" , name = " snapshots-bom " , version.ref = " ackee-snapshots-bom " }
52+ ackee-snapshots-annotations = { group = " io.github.ackeecz" , name = " snapshots-annotations " }
53+ ackee-snapshots-framework = { group = " io.github.ackeecz" , name = " snapshots-framework " }
5254
53- # Required dependencies - versions need to be specified by the consumer
54- androidx-compose-bom = { group = " androidx.compose" , name = " compose-bom" , version = " compose-bom" }
55+ # Showcase is needed for annotating previews and passing a selected PreviewSnapshotStrategy
5556showkase-core = { module = " com.airbnb.android:showkase" , version.ref = " showkase" }
5657showkase-processor = { module = " com.airbnb.android:showkase-processor" , version.ref = " showkase" }
57-
58- [plugins ]
59- paparazzi = { id = " app.cash.paparazzi" , version.ref = " paparazzi" }
60- ```
61-
62- Apply the Paparazzi Gradle plugin in your app's ` build.gradle.kts ` :
63-
64- ``` kotlin
65- plugins {
66- id(" app.cash.paparazzi" )
67- }
6858```
6959
7060and specify dependencies
7161
7262``` kotlin
63+ implementation(platform(libs.ackee.snapshots.bom))
7364implementation(libs.ackee.snapshots.annotations)
65+ testImplementation(libs.ackee.snapshots.framework)
66+
7467implementation(libs.showkase.core)
7568ksp(libs.showkase.processor)
76-
77- testImplementation(libs.ackee.snapshots.framework)
78- testImplementation(libs.ackee.snapshots.paparazzi)
7969```
8070
81- ## Versioning
71+ ### Paparazzi
72+ If you use ` paparazzi ` artifact, you will need the following additional configuration:
8273
83- The library uses a versioning scheme that reflects compatibility with its core dependencies:
74+ ``` toml
75+ [versions ]
76+ # Ensure that this version is equal or greater than Paparazzi version in this project. Otherwise
77+ # there might be incompatibility between Paparazzi runtime used in Ackee Snapshots and Paparazzi
78+ # Gradle plugin used by your app.
79+ paparazzi = " SPECIFY_VERSION"
8480
85- ### Framework Module
81+ [dependencies ]
82+ ackee-snapshots-paparazzi = { group = " io.github.ackeecz" , name = " snapshots-paparazzi" }
8683
87- The framework module version includes the Compose BOM version as a suffix:
88- ```
89- {base_version}-{compose_bom_version}
84+ [plugins ]
85+ paparazzi = { id = " app.cash.paparazzi" , version.ref = " paparazzi" }
9086```
9187
92- Example: ` 0.1.0-2024.02.00 `
88+ Apply the Paparazzi Gradle plugin in your module's ` build.gradle.kts ` :
9389
94- ### Paparazzi Module
95- The Paparazzi module version includes the Paparazzi version as a suffix:
96- ```
97- {base_version}-{paparazzi_version }
90+ ``` kotlin
91+ plugins {
92+ id(libs.plugins.paparazzi)
93+ }
9894```
9995
100- Example: ` 0.1.0-1.3.1 `
101-
102- ### Annotations Module
96+ and specify dependencies
10397
104- The annotations module uses only the base version without any suffix:
105- ```
106- {base_version}
98+ ``` kotlin
99+ testImplementation(libs.ackee.snapshots.paparazzi)
107100```
108- Example: ` 0.1.0 `
109-
110- This versioning strategy helps users:
111- - Track compatibility with specific Compose and Paparazzi versions
112- - Choose the right artifact version for their setup
113- - Avoid version conflicts with their project's dependencies
114-
115- Note: The library intentionally does not set Compose or Paparazzi versions to prevent version conflicts. You need to specify these versions in your
116- project to ensure compatibility with your setup.
117101
118102## Configuration
119103
@@ -320,6 +304,7 @@ This setup will:
320304
321305## Project Structure
322306
307+ - ** bom** : BOM module
323308- ** annotations** : Shared code for preview annotations. Used in test and production source sets.
324309- ** framework** : Core framework and testing infrastructure
325310- ** paparazzi** : Paparazzi integration for snapshot generation
@@ -352,7 +337,6 @@ To verify that your UI components haven't changed unexpectedly, run:
352337If there are any differences between the recorded and current snapshots, the test will fail and Paparazzi will generate a report showing the
353338differences.
354339
355-
356340## Contributing
357341
358342Contributions are welcome! Please feel free to submit a Pull Request.
0 commit comments