I’m looking to gain a better understanding of the upcoming project isolation features. I’ve recently upgraded to gradle 8.8, and am trying to wrap my head around IsolatedProject
and gradle.lifecycle.beforeProject
/afterProject
. I mostly understand the gist of it, but I am confused why the lambda parameter of gradle.lifecycle.beforeProject
/afterProject
is a Project
and not an IsolatedProject
:
public interface GradleLifecycle {
void beforeProject(IsolatedAction<? super Project> action);
void afterProject(IsolatedAction<? super Project> action);
}
The code above is the current implementation. What I would expect to see, however, would be:
public interface GradleLifecycle {
void beforeProject(IsolatedAction<? super IsolatedProject> action);
void afterProject(IsolatedAction<? super IsolatedProject> action);
}
If I understand correctly, an IsolatedAction
is a serializable configuration operation which cannot modify global state, and thus is parallel-safe. And also if I understand correctly, an IsolatedProject
is a constrained view of a Project
which cannot access other projects, making it more parallel safe. Therefore, why would a Project
be passed into the IsolatedAction
instead of an IsolatedProject
? It seems to me that whatever extra features Project
has that IsolatedProject
does not have wouldn’t be safe to use in an IsolatedAction
.