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

Gradle Isolated Projects Support #497

Open
trevjonez opened this issue Oct 2, 2024 · 4 comments
Open

Gradle Isolated Projects Support #497

trevjonez opened this issue Oct 2, 2024 · 4 comments

Comments

@trevjonez
Copy link

I am starting to work thru issues coming from constraints imposed by the Isolated Projects feature coming in gradle. The razzi plugin seems to have some property lookups that are likely easily fixed by using some alternative APIs.

Project `:analytics:impl` cannot dynamically look up a property in the parent project `:analytics`
        - Exception at `io.github.takahirom.roborazzi.RoborazziPlugin.apply$configureRoborazziTasks(RoborazziPlugin.kt:221)`
org.gradle.api.InvalidUserCodeException: Project ':analytics:impl' cannot dynamically look up a property in the parent project ':analytics'
	at org.gradle.api.internal.project.DefaultProject.getProperties(DefaultProject.java:1235)
	at io.github.takahirom.roborazzi.RoborazziPlugin.apply$configureRoborazziTasks(RoborazziPlugin.kt:221)
	at io.github.takahirom.roborazzi.RoborazziPlugin.apply$configureRoborazziTasks$default(RoborazziPlugin.kt:137)
	at io.github.takahirom.roborazzi.RoborazziPlugin$apply$configureComponents$1.invoke(RoborazziPlugin.kt:467)
	at io.github.takahirom.roborazzi.RoborazziPlugin$apply$configureComponents$1.invoke(RoborazziPlugin.kt:454)
	at com.android.build.api.extension.impl.AndroidComponentsExtensionImpl$onVariants$1.execute(AndroidComponentsExtensionImpl.kt:75)
	at com.android.build.api.extension.impl.AndroidComponentsExtensionImpl$onVariants$1.execute(AndroidComponentsExtensionImpl.kt:74)
	at com.android.build.api.extension.impl.OperationsRegistrar.executeOperations(OperationsRegistrar.kt:60)

project.properties.filterKeys { it != "roborazzi" && it.startsWith("roborazzi") }

It seems the typical project level properties lookups will walk the project tree causing a break. I believe it should be safe to migrate that lookup to using the providers api.

providers.gradlePropertiesPrefixedBy("roborazzi").get().etc()

There may be other issues still but this seems to be all I can get from the issue report as things are today.

@takahirom takahirom mentioned this issue Oct 3, 2024
@takahirom
Copy link
Owner

I was able to fix the problem related to this issue. I believe this doesn't affect the user's project, but there are some allProjects{} configurations and some setups for Roborazzi. Therefore, I haven't been able to check if the test passes yet.

313 problems were found storing the configuration cache, 78 of which seem unique.
- Build file '/Users/xxxxxx/git/roborazzi/build.gradle': Project ':roborazzi' cannot access 'Project.configurations' functionality on subprojects via 'allprojects'
- Build file '/Users/xxxxxx/git/roborazzi/build.gradle': Project ':roborazzi' cannot access 'Project.plugins' functionality on subprojects via 'allprojects'
- Build file '/Users/xxxxxx/git/roborazzi/build.gradle': Project ':roborazzi' cannot access 'Project.tasks' functionality on subprojects via 'allprojects'
- Build file '/Users/xxxxxx/git/roborazzi/build.gradle': Project ':roborazzi' cannot access 'android' extension on subprojects via 'allprojects'
- Build file '/Users/xxxxxx/git/roborazzi/build.gradle': Project ':roborazzi' cannot access 'java' extension on subprojects via 'allprojects'
- Build file '/Users/xxxxxx/git/roborazzi/build.gradle': Project ':roborazzi' cannot access 'libs' extension on subprojects via 'allprojects'
- Build file '/Users/xxxxxx/git/roborazzi/build.gradle': line 18: Project ':roborazzi' cannot access 'libs' extension on subprojects via 'allprojects'
- Build file '/Users/xxxxxx/git/roborazzi/build.gradle': line 19: Project ':roborazzi' cannot access 'libs' extension on subprojects via 'allprojects'
- Build file '/Users/xxxxxx/git/roborazzi/build.gradle': line 24: Project ':roborazzi' cannot access 'Project.plugins' functionality on subprojects via 'allprojects'
- Build file '/Users/xxxxxx/git/roborazzi/build.gradle': line 32: Project ':roborazzi' cannot access 'Project.plugins' functionality on subprojects via 'allprojects'
- Build file '/Users/xxxxxx/git/roborazzi/build.gradle': line 41: Project ':roborazzi' cannot access 'Project.tasks' functionality on subprojects via 'allprojects'
- Build file '/Users/xxxxxx/git/roborazzi/build.gradle': line 46: Project ':roborazzi' cannot access 'Project.tasks' functionality on subprojects via 'allprojects'
- Build file '/Users/xxxxxx/git/roborazzi/build.gradle': line 57: Project ':roborazzi' cannot access 'Project.plugins' functionality on subprojects via 'allprojects'
- Build file '/Users/xxxxxx/git/roborazzi/build.gradle': line 87: Project ':roborazzi' cannot access 'Project.configurations' functionality on subprojects via 'allprojects'
- Build file '/Users/xxxxxx/git/roborazzi/include-build/build.gradle': Project ':roborazzi:include-build' cannot access 'Project.plugins' functionality on subprojects via 'allprojects'

@takahirom
Copy link
Owner

I created an issue for this subtask.
#500

@takahirom
Copy link
Owner

@trevjonez
I've released a version that uses gradlePropertiesPrefixedBy. Could you check it again?
https://github.com/takahirom/roborazzi/releases/tag/1.28.0

@trevjonez
Copy link
Author

Just ran it again as far as it can go and the report no longer has anything from it in razzi.

Down to primarily KSP/Hilt as the two big sources of issue now.

Might be good to leave this open a bit longer so people that are able to get further in the build have a place to dump additional info?

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

No branches or pull requests

2 participants