cashapp / paparazzi

Render your Android screens without a physical device or emulator
https://cashapp.github.io/paparazzi/
Apache License 2.0
2.24k stars 212 forks source link

Document how to override paparazzi system properties #1335

Closed AlexanderGH closed 4 months ago

AlexanderGH commented 4 months ago

Related to https://github.com/cashapp/paparazzi/issues/1334, I wanted to move the snapshots out of src/test and into the root of the module, however, it's not clear what the recommended way to set system properties to override the default paparazzi options is. It would be nice if the paparazzi docs could be updated with the recommended pattern for Gradle integrations.

jrodbx commented 4 months ago

Setting jvm system properties is neither unique to Paparazzi nor Gradle; this is by design in case someone decided to contribute a bazel plugin in the future.

The following should work, in your build.gradle:

tasks.withType(Test).configureEach {
  systemProperty(
    "paparazzi.snapshot.dir",
    YOUR_CUSTOM_SNAPSHOT_DIR
  )
}

I'm reluctant to call this the "recommended" way, since moving things into the root module might break Gradle's overlapping outputs even more (since all modules will share a single rather than separate output directories), but that should unblock what you're looking to accomplish.

AlexanderGH commented 4 months ago

Thanks. Yep, when i said root, i meant root of each module not the entire gradle build project. But at this point I'll likely just end up waiting for a formal fix for #1334 so it's a moot point in my case.