Skip to content

Commit

Permalink
Add README section of outputDir (#593)
Browse files Browse the repository at this point in the history
  • Loading branch information
takahirom authored Dec 9, 2024
2 parents 0c2a00b + 9acb103 commit afeaa98
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,29 @@ uses [JetNew from Compose Samples](https://github.com/android/compose-samples/tr
You can check the pull request introducing Roborazzi to the
compose-samples [here](https://github.com/takahirom/compose-samples/pull/1/files).

## Gradle DSL Options (Optional)
Roborazzi uses `module/build/outputs/roborazzi` as the default directory for reference images and comparison images. You can customize these paths in your `build.gradle` file:

```kotlin
roborazzi {
// Directory for reference images
outputDir.set(file("src/screenshots"))
// Directory for comparison images
compare {
outputDir.set(file("build/outputs/screenshots_comparison"))
}
}
```

> [!NOTE]
> By default, when you use `captureRoboImage("image.png")`, the image will be saved as `module/image.png`.
> You can customize the file path strategy for the recorded image. The default strategy is `relativePathFromCurrentDirectory`. If you select `relativePathFromRoborazziContextOutputDirectory`, the file will be saved in the output directory specified by `RoborazziRule.Options.outputDirectoryPath`.
> This can be configured in your `gradle.properties` file:
```properties
roborazzi.record.filePathStrategy=relativePathFromRoborazziContextOutputDirectory
```

### Add dependencies

| Description | Dependencies |
Expand Down
23 changes: 23 additions & 0 deletions docs/topics/build_setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,29 @@ uses [JetNew from Compose Samples](https://github.com/android/compose-samples/tr
You can check the pull request introducing Roborazzi to the
compose-samples [here](https://github.com/takahirom/compose-samples/pull/1/files).

## Gradle DSL Options (Optional)
Roborazzi uses `module/build/outputs/roborazzi` as the default directory for reference images and comparison images. You can customize these paths in your `build.gradle` file:

```kotlin
roborazzi {
// Directory for reference images
outputDir.set(file("src/screenshots"))
// Directory for comparison images
compare {
outputDir.set(file("build/outputs/screenshots_comparison"))
}
}
```

> [!NOTE]
> By default, when you use `captureRoboImage("image.png")`, the image will be saved as `module/image.png`.
> You can customize the file path strategy for the recorded image. The default strategy is `relativePathFromCurrentDirectory`. If you select `relativePathFromRoborazziContextOutputDirectory`, the file will be saved in the output directory specified by `RoborazziRule.Options.outputDirectoryPath`.
> This can be configured in your `gradle.properties` file:
```properties
roborazzi.record.filePathStrategy=relativePathFromRoborazziContextOutputDirectory
```

### Add dependencies

| Description | Dependencies |
Expand Down

0 comments on commit afeaa98

Please sign in to comment.