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

Migrate Robolectric's deprecated code to the recommended alternatives #989

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

MGaetan89
Copy link
Contributor

@MGaetan89 MGaetan89 commented Feb 16, 2025

Description

This commit updates references to Robolectric's deprecated symbols to use the recommended alternatives.

Changes

  • Add :libraries:robolectric-base to the list of Gradle modules to load.
  • Add missing jUnit dependency to :libraries:robolectric-base.
  • Replace BuckRobolectricTestRunner#getAppManifest(Config) with BuckRobolectricTestRunner#getManifestFactory(Config). The former is no longer public, and the recommended alternative is to use a custom ManifestFactory.
  • Create BuckManifestFactory to provide custom information for the creation of AndroidManifest.

@CLAassistant
Copy link

CLAassistant commented Feb 16, 2025

CLA assistant check
All committers have signed the CLA.

@MGaetan89
Copy link
Contributor Author

It looks like the build failed downloading some dependencies. Is it possible to restart it?

@MGaetan89 MGaetan89 marked this pull request as draft February 19, 2025 07:59
@MGaetan89
Copy link
Contributor Author

The build issues are being discussed here: #990 (comment)
So I'm putting this PR in draft for the moment.

@MGaetan89 MGaetan89 marked this pull request as ready for review February 23, 2025 19:06
@MGaetan89
Copy link
Contributor Author

I've updated my branch with the latest changes from master. It should be ready for review now.

@MGaetan89
Copy link
Contributor Author

I think I'll have to update the Java version used in the project to make this work.
I'll submit a dedicated PR for that, because it seems to impact other things too.

@MGaetan89 MGaetan89 marked this pull request as draft February 24, 2025 08:47
- Add `:libraries:robolectric-base` to the list of Gradle modules to load.
- Add missing jUnit dependency to `:libraries:robolectric-base`.
- Replace `BuckRobolectricTestRunner#getAppManifest(Config)` with `BuckRobolectricTestRunner#getManifestFactory(Config)`. The former is no longer public, and the recommended alternative is to use a custom `ManifestFactory`.
- Create `BuckManifestFactory` to provide custom information for the creation of `AndroidManifest`.
@MGaetan89 MGaetan89 force-pushed the update_robolectric branch from d99e229 to 7a8a3dd Compare March 4, 2025 08:36
@MGaetan89 MGaetan89 changed the title Update Robolectric to 4.14.1 Migrate Robolectric's deprecated code to the recommended alternatives Mar 4, 2025
@MGaetan89
Copy link
Contributor Author

I've updated this PR to just migrate deprecated code from Robolectric with the recommended alternatives.
Upgrading Robolectric itself needs too many additional changes throughout the project.

@MGaetan89 MGaetan89 marked this pull request as ready for review March 4, 2025 08:39
@MGaetan89
Copy link
Contributor Author

The build is successful now 🎉

@gpolak
Copy link
Contributor

gpolak commented Mar 11, 2025

Thanks @MGaetan89. Looks good, but let me do some local verification before merging. Stay tuned...

And yes, we need to build Buck against JDK 17 before we can move to later versions of Robolectric.

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.

3 participants