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
Follow the <<sec:ip_migration_path,recommended migration steps>> to make your build logic compatible with <<sec:ip_constraints,Isolated Projects constraints>>.
35
+
Follow the <<sec:migration_path,recommended migration steps>> to make your build logic compatible with <<sec:constraints,Isolated Projects constraints>>.
36
36
37
37
[WARNING]
38
38
====
@@ -41,7 +41,7 @@ APIs and behavior may change at any time without notice.
41
41
The feature will enter incubation once Gradle's core has stronger support for this mode and more common use cases are covered.
42
42
====
43
43
44
-
[[sec:ip_changelog]]
44
+
[[sec:changelog]]
45
45
== Recent changes
46
46
47
47
While the feature is experimental, notable changes are documented here rather than in release notes:
@@ -56,11 +56,11 @@ While the feature is experimental, notable changes are documented here rather th
56
56
** Additional APIs on `TaskContainer` are treated as incompatible: `findByPath(String)` and `getByPath(String)`
57
57
methods now emit violations when a task from another project is requested.
58
58
59
-
[[sec:ip_performance]]
59
+
[[sec:performance]]
60
60
== Performance benefits and limitations
61
61
62
62
The main goal of Isolated Projects is to *speed up or entirely avoid running the <<build_lifecycle.adoc#configuration,configuration phase>>*.
63
-
This is <<sec:ip_vs_cc,similar to the Configuration Cache>> feature, which allows skipping configuration when you rerun a task without changing the build configuration inputs.
63
+
This is <<sec:vs_cc,similar to the Configuration Cache>> feature, which allows skipping configuration when you rerun a task without changing the build configuration inputs.
64
64
In fact, Isolated Projects uses Configuration Cache infrastructure as the foundation.
65
65
66
66
Builds that will get the most benefit are those that have a long configuration phase, such as large multi-project builds.
@@ -115,7 +115,7 @@ Some improvements might bring benefits only for running tasks, while others for
115
115
As the Isolated Projects feature matures, the improvements will serve more scenarios.
116
116
====
117
117
118
-
[[sec:ip_perf_tasks]]
118
+
[[sec:perf_tasks]]
119
119
==== Performance when running tasks
120
120
121
121
When running tasks, the configuration phase consists of multiple steps.
@@ -136,14 +136,14 @@ An example is running checks or tests on <<command_line_interface.adoc#executing
136
136
3. Store the work graph (Configuration Cache)
137
137
+
138
138
Isolated Projects makes this step run in **parallel**.
139
-
This is the <<sec:ip_vs_parallel_cc,same as with Parallel Configuration Cache>>,
140
-
but with the additional safety provided by the <<sec:ip_constraints,Isolated Projects constraints>>.
139
+
This is the <<sec:vs_parallel_cc,same as with Parallel Configuration Cache>>,
140
+
but with the additional safety provided by the <<sec:constraints,Isolated Projects constraints>>.
141
141
142
142
4. Load the work graph (Configuration Cache)
143
143
+
144
144
This step is **already parallel** with Configuration Cache; Isolated Projects has no additional effect here.
145
145
146
-
[[sec:ip_perf_models]]
146
+
[[sec:perf_models]]
147
147
==== Performance when building models (IDE Sync)
148
148
149
149
For scenarios such as IDE sync, Gradle provides a special mechanism of building <<tooling_api.adoc#tooling_api,tooling models>>.
@@ -197,7 +197,7 @@ via `org.gradle.tooling.parallel` or `org.gradle.parallel` Gradle properties.
197
197
====
198
198
Enabling parallel model fetching without Isolated Projects can be unsafe.
199
199
Parts of the configuration logic will run in parallel without supporting validations, potentially leading to flakiness or unreliable results.
200
-
Isolated Projects makes this safe by enforcing <<sec:ip_constraints,constraints>> that prevent projects from sharing mutable state.
200
+
Isolated Projects makes this safe by enforcing <<sec:constraints,constraints>> that prevent projects from sharing mutable state.
201
201
====
202
202
203
203
On the IDE side, the setup depends on the IDE:
@@ -216,7 +216,7 @@ The setting is only applied to the current project opened in the IDE.
216
216
If you have already been using parallel model building for IDE sync, then Isolated Projects will not provide a performance benefit in that part of the configuration phase.
217
217
However, Isolated Projects will catch violations as you change your build logic, preventing correctness issues from creeping in silently.
218
218
219
-
[[sec:ip_parallelism_controls]]
219
+
[[sec:parallelism_controls]]
220
220
=== Parallelism controls
221
221
222
222
Much of the performance benefit of Isolated Projects comes from running project configuration in parallel.
@@ -227,18 +227,18 @@ including configuration.
227
227
The default value is the number of CPU cores on your machine, which is usually a good choice.
228
228
If you've explicitly set it lower for any reason, keep in mind that it will also limit how much parallelism Isolated Projects can use.
229
229
230
-
[[sec:ip_current_limitations]]
230
+
[[sec:current_limitations]]
231
231
=== Current limitations
232
232
233
233
The current implementation of Isolated Projects has a number of limitations that might be addressed in the future.
234
234
235
-
* All projects always get configured, and <<sec:ip_vs_cod,Configuration on Demand has no effect>>.
235
+
* All projects always get configured, and <<sec:vs_cod,Configuration on Demand has no effect>>.
236
236
* A subproject can't start configuring until all its parent projects are done, which limits the parallelism.
237
237
* The configuration phase might require more memory to process more work in parallel.
238
238
* Changes to included builds invalidate all cached results, even unrelated ones.
239
239
* Tooling model caching is local only: no sharing across checkouts or remote caching.
240
240
241
-
[[sec:ip_constraints]]
241
+
[[sec:constraints]]
242
242
== Isolated Projects constraints
243
243
244
244
During configuration, Gradle runs lots of smaller units of work (evaluating settings, configuring individual projects, etc.),
@@ -250,16 +250,16 @@ What it adds is strict boundaries that prevent projects and builds from observin
250
250
251
251
With Isolated Projects, it is **not allowed to observe or change**:
252
252
253
-
* In project-scope, mutable state of other projects (<<sec:ip_cross_project_access,cross-project access>>)
254
-
* In project-scope, mutable state of the owner build (<<sec:ip_project_to_build_access,project-to-build access>>)
255
-
* In build-scope, mutable state of other builds (<<sec:ip_cross_build_access,cross-build access>>)
256
-
* In build-scope, mutable state of the build that is passed into project-scope via callbacks (<<sec:ip_build_to_project_access,build-to-project access>>)
253
+
* In project-scope, mutable state of other projects (<<sec:cross_project_access,cross-project access>>)
254
+
* In project-scope, mutable state of the owner build (<<sec:project_to_build_access,project-to-build access>>)
255
+
* In build-scope, mutable state of other builds (<<sec:cross_build_access,cross-build access>>)
256
+
* In build-scope, mutable state of the build that is passed into project-scope via callbacks (<<sec:build_to_project_access,build-to-project access>>)
257
257
258
-
Among the build logic patterns described by these constraints, <<sec:ip_cross_project_access,cross-project access>> is by far the most common.
258
+
Among the build logic patterns described by these constraints, <<sec:cross_project_access,cross-project access>> is by far the most common.
259
259
260
260
The constraints are designed to allow safely running the individual configuration units in parallel and also caching the results of their execution.
261
261
262
-
[[sec:ip_constraint_violations]]
262
+
[[sec:constraint_violations]]
263
263
=== Constraint violations
264
264
265
265
The violations of Isolated Projects constraints are detected at runtime during an invocation.
It is allowed to traverse the project structure and access immutable data of other projects.
331
331
However, it is best to reduce such interactions to a minimum and instead express them through dependencies between projects.
332
332
333
-
[[sec:ip_project_to_build_access]]
333
+
[[sec:project_to_build_access]]
334
334
=== Project-to-build access constraints
335
335
336
336
[WARNING]
@@ -344,7 +344,7 @@ A large part of the `Gradle` interface is dedicated to callback registration.
344
344
Many of the callbacks are either no-ops or throw an exception if you try registering them after settings have been evaluated.
345
345
Callbacks that do get successfully registered may execute in a different order per invocation due to parallel project configuration.
346
346
347
-
[[sec:ip_shared_build_services]]
347
+
[[sec:shared_build_services]]
348
348
==== Shared Build Services
349
349
350
350
<<build_services.adoc#build_services,Shared Build Services>> are also part of the build-scoped state.
@@ -358,7 +358,7 @@ Any mutation of the build service parameters outside of `registerIfAbsent(...) {
358
358
359
359
Accessing the set of build service registrations at `gradle.sharedServices.registrations` is unsafe.
360
360
361
-
[[sec:ip_cross_build_access]]
361
+
[[sec:cross_build_access]]
362
362
=== Cross-build access constraints
363
363
364
364
[WARNING]
@@ -372,7 +372,7 @@ Since (included) builds can be configured in parallel, access to the shared muta
372
372
373
373
With Isolated Projects, using `gradle.parent` should be avoided.
374
374
375
-
[[sec:ip_build_to_project_access]]
375
+
[[sec:build_to_project_access]]
376
376
=== Build-to-project access constraints
377
377
378
378
[WARNING]
@@ -388,7 +388,7 @@ If the callbacks capture any mutable state from the build-scope, that state beco
388
388
389
389
See the section on <<sec:isolating_lifecycle_callbacks,state-isolating callbacks>> for a better alternative.
390
390
391
-
[[sec:ip_migration]]
391
+
[[sec:migration]]
392
392
== Migration
393
393
394
394
This section covers how to migrate your build to be compatible with Isolated Projects.
@@ -399,28 +399,30 @@ Isolated Projects is an experimental feature, and it is actively changing.
399
399
Make sure to use the latest available version of Gradle and that you are reading the documentation for that version.
400
400
====
401
401
402
-
[[sec:ip_before_migration]]
402
+
[[sec:before_migration]]
403
403
=== Before the migration
404
404
405
+
Before addressing constraint violations, make sure your build setup is up to date to get the best adoption experience.
406
+
405
407
* Upgrade the build to the latest version of Gradle
406
408
+
407
409
If available, consider a pre-release version such as a milestone or a nightly to get the best experience while Isolated Projects is experimental.
408
410
409
-
* Migrate third-party plugins to their latest versions
411
+
* Update third-party plugins to their latest versions
410
412
+
411
413
Ecosystem plugins and community plugins gradually improve support for Isolated Projects.
412
414
By using the latest versions you reduce the risks of dealing with problems that have already been fixed.
413
415
414
416
* Use the latest tooling, such as the latest versions of Android Studio and IntelliJ IDEA
415
417
+
416
418
The IDE support for Isolated Projects is already in a good state for 2025.3 and later releases.
417
-
However, newer IDE versions can bring better performance as well as a better user experience, when going through the migration.
419
+
However, newer IDE versions can bring better performance as well as a better user experience when adopting Isolated Projects.
418
420
419
421
* Make your build <<configuration_cache_enabling.adoc#config_cache:adoption,compatible with Configuration Cache>>
420
422
+
421
423
The Isolated Projects feature builds on top of the Configuration Cache feature.
422
424
423
-
[[sec:ip_enable]]
425
+
[[sec:enable]]
424
426
=== Enabling Isolated Projects
425
427
426
428
Isolated Projects can be enabled by setting the `org.gradle.unsafe.isolated-projects` Gradle option to `true`.
@@ -440,13 +442,13 @@ To make use of the feature in IDE sync scenarios, it has to be enabled in the `g
440
442
org.gradle.unsafe.isolated-projects=true
441
443
----
442
444
443
-
If you have never enabled the feature in the build before, it's likely that the build is not compatible and contains Isolated Projects <<sec:ip_constraint_violations,constraint violations>>.
445
+
If you have never enabled the feature in the build before, it's likely that the build is not compatible and contains Isolated Projects <<sec:constraint_violations,constraint violations>>.
444
446
In that case the build will fail, and one or more violations will be shown in the error message.
445
447
446
-
[[sec:ip_ignore_violations]]
448
+
[[sec:ignore_violations]]
447
449
=== Temporarily ignoring violations
448
450
449
-
To guarantee reliable build results, Gradle will fail the build when any violations of <<sec:ip_constraints,Isolated Project constraints>> are detected.
451
+
To guarantee reliable build results, Gradle will fail the build when any violations of <<sec:constraints,Isolated Project constraints>> are detected.
450
452
However, in the initial stages of the Isolated Projects adoption journey,
451
453
it can be useful to gauge an estimate of the speed-up provided by the feature in your particular setup and workflow.
452
454
@@ -482,7 +484,7 @@ Warning mode is a migration and troubleshooting aid and not intended as a persis
482
484
It will also not prevent new incompatibilities being accidentally added to your build later.
483
485
====
484
486
485
-
[[sec:ip_migration_path]]
487
+
[[sec:migration_path]]
486
488
=== Recommended migration path
487
489
488
490
This section describes how to start making your build compatible with Isolated Projects.
@@ -501,15 +503,15 @@ Use the report to pinpoint the incompatible pieces of build logic and plugins.
501
503
An incompatible plugin can prevent you from getting the performance benefits of Isolated Projects.
502
504
It is best to report the incompatibilities as soon as possible so the plugin maintainers can address them, while you make your own build logic compatible.
503
505
504
-
3. Follow the <<sec:ip_adoption_strategies,build-logic refactoring strategies>> to refactor your build logic and make it compatible.
506
+
3. Follow the <<sec:migration_strategies,build-logic refactoring strategies>> to refactor your build logic and make it compatible.
505
507
+
506
508
Remember that Isolated Projects violations only detect concrete instances of the problem, e.g. one specific project touching some mutable state of another.
507
509
It might not be enough to replace one API call with another to address the problem.
508
510
509
-
[[sec:ip_adoption_strategies]]
511
+
[[sec:migration_strategies]]
510
512
=== Build-logic refactoring strategies
511
513
512
-
[[sec:ip_convention_plugins]]
514
+
[[sec:convention_plugins]]
513
515
==== Use convention plugins
514
516
515
517
The most common cause of Isolated Projects violations is projects trying to configure other projects.
<<configuration_cache.adoc#config_cache,Configuration Cache>> allows skipping the entire configuration phase when no build configuration inputs have changed.
@@ -607,7 +609,7 @@ You should make your build <<configuration_cache_enabling.adoc#config_cache:adop
607
609
It is an error to enable Isolated Projects and explicitly disable Configuration Cache.
608
610
====
609
611
610
-
[[sec:ip_vs_parallel_cc]]
612
+
[[sec:vs_parallel_cc]]
611
613
=== Parallel Configuration Cache
612
614
613
615
Configuration Cache allows enabling some parallelism in the configuration phase with <<configuration_cache_enabling.adoc#config_cache:usage:parallel,Parallel Configuration Cache>>.
@@ -616,7 +618,7 @@ This requires an opt-in because not all builds are compatible with this behavior
616
618
With Isolated Projects, Parallel Configuration Cache is enabled automatically,
617
619
since Isolated Projects constraints guarantee safe and correct results for all builds.
618
620
619
-
[[sec:ip_vs_parallel]]
621
+
[[sec:vs_parallel]]
620
622
=== Parallel Execution (`--parallel`)
621
623
622
624
<<performance.adoc#sec:enable_parallel_execution,Parallel Execution>> has to do with parallel execution of tasks.
@@ -633,7 +635,7 @@ Therefore, there is no benefit to enabling Parallel Execution alongside Isolated
633
635
634
636
The Parallel Execution flag is _ignored_ when Isolated Projects is enabled.
635
637
636
-
[[sec:ip_vs_cod]]
638
+
[[sec:vs_cod]]
637
639
=== Configuration on Demand
638
640
639
641
<<configuration_on_demand.adoc#sec:configuration_on_demand,Configuration on Demand>> lets Gradle skip configuring projects that aren't needed for the requested tasks.
0 commit comments