Skip to content

Fix: Remove deprecated project.projectDir usage in android-hook.gradle.kts#9651

Open
benjaminpeters wants to merge 1 commit into
software-mansion:mainfrom
benjaminpeters:fix/remove-deprecated-projectdir-api
Open

Fix: Remove deprecated project.projectDir usage in android-hook.gradle.kts#9651
benjaminpeters wants to merge 1 commit into
software-mansion:mainfrom
benjaminpeters:fix/remove-deprecated-projectdir-api

Conversation

@benjaminpeters

Copy link
Copy Markdown

Summary

I was seeing react-native-worklets/android/build.gradle.kts:281:36: 'getter for buildDir: File!' is deprecated. Deprecated in Java while running react-native-worklets 0.9.1
This PR will fix it so it isn't run during configuration - I still think its a good idea to replace deprecated project.projectDir calls with project.layout.projectDirectory.asFile to use the modern Gradle API. This addresses deprecation warnings and ensures compatibility with newer Gradle versions.

Test plan

Build System Verification

  • Clean builds succeed: Run ./gradlew clean followed by ./gradlew build in both debug
    and release configurations
  • Prefab headers generation works: Verify that the prefab headers are correctly
    generated at the new path by checking that build/prefab-headers/worklets/ contains the
    expected header files after build
  • Native compilation succeeds: Ensure CMake builds complete without errors and the
    worklets library is properly linked
  • Integration with example app: Test that the example app in the repo builds and runs
    correctly with the changes

Cross-Platform Testing

  • Different Gradle versions: Test with minimum supported Gradle version and latest
    stable version
  • Different AGP versions: Verify compatibility with Android Gradle Plugin versions the
    project supports
  • CI/CD pipeline: Ensure all automated build checks pass

Backwards Compatibility

  • Existing projects: Verify that existing React Native projects using worklets
    continue to build without issues
  • Custom build configurations: Test with projects that have custom buildDir
    configurations

Validation Steps

Verify the prefab headers are generated correctly

./gradlew :react-native-worklets:prepareWorkletsHeadersForPrefabs
ls -la packages/react-native-worklets/android/build/prefab-headers/worklets/

Check that the path is correctly used in CMake

./gradlew :react-native-worklets:externalNativeBuildDebug --info | grep "prefab-headers"

This test plan covers the key areas that could be affected by changing from the deprecated
buildDir to layout.buildDirectory.get().asFile, ensuring the build system continues to
work correctly across different environments.

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.

1 participant