Skip to content

Commit

Permalink
Merge branch 'master' into support-verify-gifs
Browse files Browse the repository at this point in the history
  • Loading branch information
BraisGabin committed Mar 2, 2024
2 parents afb618b + 79bdd21 commit ee3141c
Show file tree
Hide file tree
Showing 355 changed files with 6,524 additions and 5,263 deletions.
7 changes: 7 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,17 @@ root = true

[*]
indent_size = 2
indent_style = space
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
end_of_line = lf

[*.{kt, kts}]
ij_kotlin_imports_layout = *,java.**,javax.**,kotlin.**,kotlinx.**,^
ij_kotlin_allow_trailing_comma = false
ij_kotlin_allow_trailing_comma_on_call_site = false

ktlint_standard_argument-list-wrapping = disabled
ktlint_standard_value-argument-comment = disabled
ktlint_function_naming_ignore_when_annotated_with = Composable
18 changes: 9 additions & 9 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,29 +28,29 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Configure JDK
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: ${{ matrix.java-version }}

- name: Setup Gradle
uses: gradle/gradle-build-action@v2
uses: gradle/gradle-build-action@v3

- name: Run All Tests
run: ./gradlew check

- name: Upload Test Failures
if: failure()
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: test-failures
name: test-failures-${{ matrix.os }}-${{ matrix.java-version }}
path: |
**/build/reports/tests/*/
**/build/paparazzi/failures/
paparazzi/paparazzi-gradle-plugin/src/test/projects/**/build/reports/paparazzi/images/
paparazzi-gradle-plugin/src/test/projects/**/build/reports/paparazzi/**/images/
publish:
runs-on: ubuntu-latest
Expand All @@ -60,10 +60,10 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Configure JDK
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 17
Expand All @@ -76,7 +76,7 @@ jobs:
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.ARTIFACT_SIGNING_PRIVATE_KEY }}

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: 3.8

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/gradle-wrapper.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v1
uses: gradle/wrapper-validation-action@v2
31 changes: 31 additions & 0 deletions .github/workflows/publish-layoutlib.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: publish-layoutlib

on:
workflow_dispatch:

env:
GRADLE_OPTS: "-Dorg.gradle.jvmargs=-Xmx4g -Dorg.gradle.daemon=false -Dkotlin.incremental=false"

jobs:

publish:
runs-on: ubuntu-latest
if: contains(github.ref, 'publish-layoutlib')

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Configure JDK
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 17

# VERSION_NAME needs to be a non-snapshot version to ensure we can publish signed artifacts
- name: Publish Artifacts
run: ./gradlew publishMavenNativeLibraryPublicationToMavenCentralRepository -PVERSION_NAME=1.0.0
env:
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_NEXUS_USERNAME }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_NEXUS_PASSWORD }}
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.ARTIFACT_SIGNING_PRIVATE_KEY }}
8 changes: 4 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Configure JDK
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 17
Expand All @@ -31,7 +31,7 @@ jobs:

- name: Extract release notes
id: release_notes
uses: ffurrer2/extract-release-notes@v1
uses: ffurrer2/extract-release-notes@v2

- name: Create release
uses: softprops/action-gh-release@v1
Expand All @@ -41,7 +41,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: 3.8

Expand Down
32 changes: 16 additions & 16 deletions .github/workflows/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
click==8.1.3
future==0.18.3
Jinja2==3.1.2
click==8.1.7
future==1.0.0
Jinja2==3.1.3
livereload==2.6.3
lunr==0.6.2
Markdown<3.5
MarkupSafe==2.1.3
mkdocs==1.4.3
mkdocs-macros-plugin==1.0.1
mkdocs-material==9.1.15
mkdocs-material-extensions==1.1.1
Pygments==2.15.1
pymdown-extensions==10.0.1
python-dateutil==2.8.2
PyYAML==6.0
lunr==0.7.0.post1
Markdown<3.6
MarkupSafe==2.1.5
mkdocs==1.5.3
mkdocs-macros-plugin==1.0.5
mkdocs-material==9.5.12
mkdocs-material-extensions==1.3.1
Pygments==2.17.2
pymdown-extensions==10.7
python-dateutil==2.9.0.post0
PyYAML==6.0.1
repackage==0.7.3
six==1.16.0
termcolor==2.3.0
tornado==6.3.2
termcolor==2.4.0
tornado==6.4
126 changes: 125 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,127 @@

## [Unreleased]

## [1.3.3] - 2024-03-01

### New
* Migrate Paparazzi to layoutlib Hedgehog 2023.1.1
* Compose 1.5.8
* Kotlin 1.9.22
* [Gradle Plugin] Gradle 8.6
* [Gradle Plugin] Android Gradle Plugin 8.2.1

### Fixed
* Update the DeviceConfig screenWidth internally for accessibility tests
* Fix variant caching issues in new resource/asset loading mechanisms
* Remove legacy resources/assets loading mechanism
* Set HardwareConfig width and height based on orientation
* Apply round screen qualifier to device config
* Restrict Paparazzi's public API
* Remove obsolete NEXUS_5_LAND DeviceConfig
* Fix formatting so that all digits show upon failure
* Stop resolving dependencies at configuration time
* Use our own internal HandlerDispatcher for Compose Ui tests
* Include generated string resources
* Reset logger to prevent swallowing exceptions

Kudos to @gamepro65, @kevinzheng-ap, @BrianGardnerAtl, @adamalyyan, and others for contributions this release!

## [1.3.2] - 2024-01-13

### NOTE: Due to a known issue with [how Guava now publishes its artifact](https://github.com/google/guava/issues/6567), you will need to apply the following snippet workaround to your root build.gradle:
```
subprojects {
plugins.withId("app.cash.paparazzi") {
// Defer until afterEvaluate so that testImplementation is created by Android plugin.
afterEvaluate {
dependencies.constraints {
add("testImplementation", "com.google.guava:guava") {
attributes {
attribute(
TargetJvmEnvironment.TARGET_JVM_ENVIRONMENT_ATTRIBUTE,
objects.named(TargetJvmEnvironment, TargetJvmEnvironment.STANDARD_JVM)
)
}
because("LayoutLib and sdk-common depend on Guava's -jre published variant." +
"See https://github.com/cashapp/paparazzi/issues/906.")
}
}
}
}
}
```
See also: https://github.com/google/guava/issues/6801.

### New
* Support for pseudolocalization tests! To get started:
```agsl
@RunWith(TestParameterInjector::class)
class PseudolocalizationTest(
@TestParameter locale: Locale
) {
@get:Rule val paparazzi = Paparazzi(
deviceConfig = DeviceConfig.PIXEL_5.copy(locale = locale.tag)
)
@Test fun test() {
paparazzi.snapshot { SomeComposable() }
}
enum class Locale(val tag: String?) {
Default(null),
Accent("en-rXA"),
Bidi("ar-rXB")
}
}
```

* Migrate Paparazzi to layoutlib Giraffe 2022.3.1
* Compose 1.5.0
* Kotlin 1.9.0
* [Gradle Plugin] Gradle 8.5
* [Gradle Plugin] Android Gradle Plugin 8.1.1

### Fixed
* Fix relativePath bug in port of ResourceFile
* Resolve report dir from ReportingExtension instead of hardcoding
* Make report folder variant-aware
* Remove reliance on kotlinx.coroutines.main.delay
* Use a class file locator that queries the system class loader
* Filter out unrecognized java-symbol tag warning
* Skip synthetic fields in R classes
* Update task inputs for resources and assets to account for file renames and moves
* Update delta images to support showing diff when width and height differ

Kudos to @kevinzheng-ap, @TWiStErRob, @gamepro65, @adamalyyan, @larryng, and others for contributions this release!

## [1.3.1] - 2023-07-18

### New
* Migrated to new resource and asset loading mechanisms. To explicitly opt-out and fall back to the
legacy mechanisms, add either/both of the following to your `gradle.properties`:
```
app.cash.paparazzi.legacy.resource.loading=true
app.cash.paparazzi.legacy.asset.loading=true
```

* The Android system ui (status + navigation bar) is now hidden by default; to re-enable:
```
@get:Rule
val paparazzi = Paparazzi(
showSystemUi = true
)
```

* Relocate failure deltas from `PROJECT_ROOT/out/failures/` to `BUILD_DIR/paparazzi/failures/`
* Support for application and dynamic feature modules
* [Gradle Plugin] Gradle 8.2.1

### Fixed
* Fix accessibility labels when mergeDescendants is true
* Fixes compose alert dialogs not rendering when using RenderingMode.SHRINK

Kudos to @kevinzheng-ap, @adamalyyan and others for contributions this release!

## [1.3.0] - 2023-05-31

As of this release, consumers must build on Java 17+ environments.
Expand Down Expand Up @@ -236,7 +357,10 @@ As of this release, consumers must build on Java 11 environments.



[Unreleased]: https://github.com/cashapp/paparazzi/compare/1.3.0...HEAD
[Unreleased]: https://github.com/cashapp/paparazzi/compare/1.3.3...HEAD
[1.3.3]: https://github.com/cashapp/paparazzi/releases/tag/1.3.3
[1.3.2]: https://github.com/cashapp/paparazzi/releases/tag/1.3.2
[1.3.1]: https://github.com/cashapp/paparazzi/releases/tag/1.3.1
[1.3.0]: https://github.com/cashapp/paparazzi/releases/tag/1.3.0
[1.2.0]: https://github.com/cashapp/paparazzi/releases/tag/1.2.0
[1.1.0]: https://github.com/cashapp/paparazzi/releases/tag/1.1.0
Expand Down
35 changes: 33 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,37 @@ exclude bundled Android dependencies.
android.jetifier.ignorelist=android-base-common,common
```

Lottie
--------

When taking screenshots of Lottie animations, you need to force Lottie to not run on a background thread, otherwise Paparazzi can throw exceptions [#494](https://github.com/cashapp/paparazzi/issues/494), [#630](https://github.com/cashapp/paparazzi/issues/630).

```kotlin
@Before
fun setup() {
LottieTask.EXECUTOR = Executor(Runnable::run)
}
```

LocalInspectionMode
--------
Some Composables -- such as `GoogleMap()` -- check for `LocalInspectionMode` to short-circuit to a `@Preview`-safe Composable.

However, Paparazzi does not set `LocalInspectionMode` globally to ensure that the snapshot represents the true production output, similar to how it overrides `View.isInEditMode` for legacy views.

As a workaround, we recommend wrapping such a Composable in a custom Composable with a `CompositionLocalProvider` and setting `LocalInspectionMode` there.

```kotlin
@Test
fun inspectionModeView() {
paparazzi.snapshot(
CompositionLocalProvider(LocalInspectionMode provides true) {
YourComposable()
}
)
}
```

Releases
--------

Expand All @@ -117,7 +148,7 @@ buildscript {
google()
}
dependencies {
classpath 'app.cash.paparazzi:paparazzi-gradle-plugin:1.3.0'
classpath 'app.cash.paparazzi:paparazzi-gradle-plugin:1.3.3'
}
}
Expand All @@ -127,7 +158,7 @@ apply plugin: 'app.cash.paparazzi'
Using the plugins DSL:
```groovy
plugins {
id 'app.cash.paparazzi' version '1.3.0'
id 'app.cash.paparazzi' version '1.3.3'
}
```

Expand Down
Loading

0 comments on commit ee3141c

Please sign in to comment.