Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: add scripts to sync archs #2357

Merged
merged 13 commits into from
Jul 22, 2024
Merged

Conversation

maciekstosio
Copy link
Collaborator

@maciekstosio maciekstosio commented Jul 19, 2024

Changes moved from: software-mansion/react-native-screens#2224

Description

When changing native props on Fabric, codegen generates corresponding interfaces and delegates. To make sure both implementations are consistent, we implement those interfaces on Paper too. Currently, after generating interfaces using codegen, developer needs to copy corresponding files for paper manually. This task adds Gradle task, that automates this.

Changes

Current assumption:
Two scripts: check-archs-consistency and sync-archs. The first one generates codegen interfaces and compares them with what we have for paper, the second generates and copies for paper to sync the archs.

  • sync is run when staged on changes to src/paper
  • check is run on CI when src/paper or android/src/paper/java/com/facebook/react/viewmanagers changes

Test code and steps to reproduce

Open src/fabric/LineNativeComponent.ts or/and src/fabric/NativeSvgRenderableModule.ts and remove any proper form interface. Now:

  • when building paper, interface should be updated
  • when committing, interface should be updated
  • if committed and pushed, Test consistency between Paper & Fabric should fail :)
    Brining back the prop and repeating up should cause the interface back and CI green.
    Posting changes in other places should cause CI task to run.

You can also run those commands yourself using yarn check-archs-consistency and yarn sync-archs

@maciekstosio maciekstosio marked this pull request as ready for review July 19, 2024 15:09
@maciekstosio maciekstosio requested review from WoLewicki and jakex7 July 19, 2024 15:09
Copy link
Member

@WoLewicki WoLewicki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left some comments. Please answer them

@@ -3,7 +3,7 @@ apply plugin: 'com.diffplug.spotless'

spotless {
java {
target 'src/main/java/**/*.java', 'src/paper/java/com/horcrux/svg/**/*.java'
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those files at src/paper/java/com/horcrux/svg/ are autogenerated, formatting them messes up checking consistency.

@maciekstosio maciekstosio requested a review from WoLewicki July 22, 2024 12:18
Copy link
Member

@WoLewicki WoLewicki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@maciekstosio maciekstosio merged commit 567e905 into main Jul 22, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants