You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
chore: change gradle task for copying to new archs into JS scripts (software-mansion#2224)
## Description
This task is rewrite to JS of
software-mansion#2168 with
some improvements. General point of creating those tasks is:
> 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 pre build on example app
- 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
What it improves:
- JS tasks are much faster, as codegen is JS script anyway, we skip
gradle and java setup all together (CI task down from 7min to 30s),
- we do not put code to library, so it shouldn't be possible to mess up
something for end users,
- instead of syncing archs when running codegen we do that on paper
example build and when staged, so: when developer didn't touch the code
it will have changes after commit, when developer switched to working on
paper interfaces should be always up to date when building the app.
## Test code and steps to reproduce
Open `src/fabric/ScreenStackHeaderConfigNativeComponent.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`
---------
Co-authored-by: Kacper Kafara <kacper.kafara@swmansion.com>
if (!project.hasProperty('codegenArtifactsPaperDestination')) {
206
-
thrownewException('[RNScreens] Please fill codegenArtifactsPaperDestination variable in android/gradle.properties correct path to paper paper destination')
if (!existingFilesMap.containsKey(generatedFile.name)) {
252
-
logger.warn("[RNScreens] ${generatedFile.name} not found in paper dir, if it's used in Android you need to copy it manually and implement yourself before using auto-copy feature")
253
-
}
254
-
}
255
-
256
-
if (existingFiles.size() ==0) {
257
-
logger.warn("[RNScreens] Paper destination with codegen interfaces is empty. This might be okay if you don't have any interfaces/delegates used in Android, if that's not the case please check if codegenArtifactsPaperDestination in android/gradle.properties is correct")
258
-
}
259
-
260
-
if (existingFiles.size() > generatedFiles.size()) {
261
-
thrownewException("[RNScreens] Number od generated artifacts should be greather then or equal to paper interfaces. Please check if codegenArtifactsSource in android/gradle.properties is correct")
262
-
}
263
-
264
-
copy {
265
-
from absoluteCodegenArtifactsSource
266
-
include existingFiles.collect { it.name }
267
-
into absoluteCodegenArtifactsPaperDestination
268
-
}
269
-
}
270
-
}
271
-
272
-
if (isScreensExampleApp() && isNewArchitectureEnabled()) {
Copy file name to clipboardExpand all lines: android/gradle.properties
-7Lines changed: 0 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -21,10 +21,3 @@ android.useAndroidX=true
21
21
android.enableJetifier=true
22
22
23
23
kotlin.code.style=official
24
-
25
-
# Path to codegen output directory with this library view manager's interfaces & delegates. Used by `copyCodegenArtifacts` task that helps to synchronise newly generated files with their Paper conterparts.
# Path to directory with view manager's interfaces & delegates used while running on Paper architecture. This property is used as output path for `copyCodegenArtifacts` task.
29
-
# Used for task (copyCodegenArtifacts) that automates copying those interfaces/delegates when codegen is run
0 commit comments