Skip to content

Commit e745573

Browse files
authored
Polish IP docs (#37642)
2 parents d5cfd07 + f7d0e4f commit e745573

3 files changed

Lines changed: 50 additions & 46 deletions

File tree

platforms/documentation/docs/src/docs/userguide/reference/structuring-builds/isolated_projects.adoc renamed to platforms/documentation/docs/src/docs/userguide/optimizing-builds/isolated_projects.adoc

Lines changed: 46 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ or passing a flag on the command line:
3232
$ ./gradlew build -Dorg.gradle.unsafe.isolated-projects=true
3333
----
3434

35-
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>>.
3636

3737
[WARNING]
3838
====
@@ -41,7 +41,7 @@ APIs and behavior may change at any time without notice.
4141
The feature will enter incubation once Gradle's core has stronger support for this mode and more common use cases are covered.
4242
====
4343

44-
[[sec:ip_changelog]]
44+
[[sec:changelog]]
4545
== Recent changes
4646

4747
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
5656
** Additional APIs on `TaskContainer` are treated as incompatible: `findByPath(String)` and `getByPath(String)`
5757
methods now emit violations when a task from another project is requested.
5858

59-
[[sec:ip_performance]]
59+
[[sec:performance]]
6060
== Performance benefits and limitations
6161

6262
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.
6464
In fact, Isolated Projects uses Configuration Cache infrastructure as the foundation.
6565

6666
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
115115
As the Isolated Projects feature matures, the improvements will serve more scenarios.
116116
====
117117

118-
[[sec:ip_perf_tasks]]
118+
[[sec:perf_tasks]]
119119
==== Performance when running tasks
120120

121121
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
136136
3. Store the work graph (Configuration Cache)
137137
+
138138
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>>.
141141

142142
4. Load the work graph (Configuration Cache)
143143
+
144144
This step is **already parallel** with Configuration Cache; Isolated Projects has no additional effect here.
145145

146-
[[sec:ip_perf_models]]
146+
[[sec:perf_models]]
147147
==== Performance when building models (IDE Sync)
148148

149149
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.
197197
====
198198
Enabling parallel model fetching without Isolated Projects can be unsafe.
199199
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.
201201
====
202202

203203
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.
216216
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.
217217
However, Isolated Projects will catch violations as you change your build logic, preventing correctness issues from creeping in silently.
218218

219-
[[sec:ip_parallelism_controls]]
219+
[[sec:parallelism_controls]]
220220
=== Parallelism controls
221221

222222
Much of the performance benefit of Isolated Projects comes from running project configuration in parallel.
@@ -227,18 +227,18 @@ including configuration.
227227
The default value is the number of CPU cores on your machine, which is usually a good choice.
228228
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.
229229

230-
[[sec:ip_current_limitations]]
230+
[[sec:current_limitations]]
231231
=== Current limitations
232232

233233
The current implementation of Isolated Projects has a number of limitations that might be addressed in the future.
234234

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>>.
236236
* A subproject can't start configuring until all its parent projects are done, which limits the parallelism.
237237
* The configuration phase might require more memory to process more work in parallel.
238238
* Changes to included builds invalidate all cached results, even unrelated ones.
239239
* Tooling model caching is local only: no sharing across checkouts or remote caching.
240240

241-
[[sec:ip_constraints]]
241+
[[sec:constraints]]
242242
== Isolated Projects constraints
243243

244244
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
250250

251251
With Isolated Projects, it is **not allowed to observe or change**:
252252

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>>)
257257

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.
259259

260260
The constraints are designed to allow safely running the individual configuration units in parallel and also caching the results of their execution.
261261

262-
[[sec:ip_constraint_violations]]
262+
[[sec:constraint_violations]]
263263
=== Constraint violations
264264

265265
The violations of Isolated Projects constraints are detected at runtime during an invocation.
@@ -283,14 +283,14 @@ $ ./gradlew -Dorg.gradle.unsafe.isolated-projects=true
283283
BUILD FAILED in 0s
284284
----
285285

286-
[[sec:ip_cross_project_access]]
286+
[[sec:cross_project_access]]
287287
=== Cross-project access constraints
288288

289289
The cross-project access constraints apply during project configuration when a `Project` instance representing another project is involved.
290290
Each instance of `Project` has both mutable and immutable state.
291291
Accessing mutable state will result in a violation, but accessing immutable state is allowed.
292292

293-
[[sec:ip_mutable_cross_project]]
293+
[[sec:mutable_cross_project]]
294294
==== Restricted access to mutable data of other projects
295295

296296
Most parts of the `Project` state are directly or indirectly mutable via the methods on the interface.
@@ -307,7 +307,7 @@ Most of those methods indirectly access the mutable state and are also not allow
307307
In general, it is easier to assume calling any method on another `Project` is forbidden,
308308
unless it is one of the handful getters that provide _immutable data_.
309309

310-
[[sec:ip_immutable_cross_project]]
310+
[[sec:immutable_cross_project]]
311311
==== Unrestricted access to immutable data of other projects
312312

313313
Immutable project state includes data that was configured during settings evaluation and finalized before any project configuration has begun.
@@ -330,7 +330,7 @@ Project hierarchy navigation::
330330
It is allowed to traverse the project structure and access immutable data of other projects.
331331
However, it is best to reduce such interactions to a minimum and instead express them through dependencies between projects.
332332

333-
[[sec:ip_project_to_build_access]]
333+
[[sec:project_to_build_access]]
334334
=== Project-to-build access constraints
335335

336336
[WARNING]
@@ -344,7 +344,7 @@ A large part of the `Gradle` interface is dedicated to callback registration.
344344
Many of the callbacks are either no-ops or throw an exception if you try registering them after settings have been evaluated.
345345
Callbacks that do get successfully registered may execute in a different order per invocation due to parallel project configuration.
346346

347-
[[sec:ip_shared_build_services]]
347+
[[sec:shared_build_services]]
348348
==== Shared Build Services
349349

350350
<<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(...) {
358358

359359
Accessing the set of build service registrations at `gradle.sharedServices.registrations` is unsafe.
360360

361-
[[sec:ip_cross_build_access]]
361+
[[sec:cross_build_access]]
362362
=== Cross-build access constraints
363363

364364
[WARNING]
@@ -372,7 +372,7 @@ Since (included) builds can be configured in parallel, access to the shared muta
372372

373373
With Isolated Projects, using `gradle.parent` should be avoided.
374374

375-
[[sec:ip_build_to_project_access]]
375+
[[sec:build_to_project_access]]
376376
=== Build-to-project access constraints
377377

378378
[WARNING]
@@ -388,7 +388,7 @@ If the callbacks capture any mutable state from the build-scope, that state beco
388388

389389
See the section on <<sec:isolating_lifecycle_callbacks,state-isolating callbacks>> for a better alternative.
390390

391-
[[sec:ip_migration]]
391+
[[sec:migration]]
392392
== Migration
393393

394394
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.
399399
Make sure to use the latest available version of Gradle and that you are reading the documentation for that version.
400400
====
401401

402-
[[sec:ip_before_migration]]
402+
[[sec:before_migration]]
403403
=== Before the migration
404404

405+
Before addressing constraint violations, make sure your build setup is up to date to get the best adoption experience.
406+
405407
* Upgrade the build to the latest version of Gradle
406408
+
407409
If available, consider a pre-release version such as a milestone or a nightly to get the best experience while Isolated Projects is experimental.
408410

409-
* Migrate third-party plugins to their latest versions
411+
* Update third-party plugins to their latest versions
410412
+
411413
Ecosystem plugins and community plugins gradually improve support for Isolated Projects.
412414
By using the latest versions you reduce the risks of dealing with problems that have already been fixed.
413415

414416
* Use the latest tooling, such as the latest versions of Android Studio and IntelliJ IDEA
415417
+
416418
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.
418420

419421
* Make your build <<configuration_cache_enabling.adoc#config_cache:adoption,compatible with Configuration Cache>>
420422
+
421423
The Isolated Projects feature builds on top of the Configuration Cache feature.
422424

423-
[[sec:ip_enable]]
425+
[[sec:enable]]
424426
=== Enabling Isolated Projects
425427

426428
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
440442
org.gradle.unsafe.isolated-projects=true
441443
----
442444

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>>.
444446
In that case the build will fail, and one or more violations will be shown in the error message.
445447

446-
[[sec:ip_ignore_violations]]
448+
[[sec:ignore_violations]]
447449
=== Temporarily ignoring violations
448450

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.
450452
However, in the initial stages of the Isolated Projects adoption journey,
451453
it can be useful to gauge an estimate of the speed-up provided by the feature in your particular setup and workflow.
452454

@@ -482,7 +484,7 @@ Warning mode is a migration and troubleshooting aid and not intended as a persis
482484
It will also not prevent new incompatibilities being accidentally added to your build later.
483485
====
484486

485-
[[sec:ip_migration_path]]
487+
[[sec:migration_path]]
486488
=== Recommended migration path
487489

488490
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.
501503
An incompatible plugin can prevent you from getting the performance benefits of Isolated Projects.
502504
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.
503505

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.
505507
+
506508
Remember that Isolated Projects violations only detect concrete instances of the problem, e.g. one specific project touching some mutable state of another.
507509
It might not be enough to replace one API call with another to address the problem.
508510

509-
[[sec:ip_adoption_strategies]]
511+
[[sec:migration_strategies]]
510512
=== Build-logic refactoring strategies
511513

512-
[[sec:ip_convention_plugins]]
514+
[[sec:convention_plugins]]
513515
==== Use convention plugins
514516

515517
The most common cause of Isolated Projects violations is projects trying to configure other projects.
@@ -565,7 +567,7 @@ gradle.lifecycle.beforeProject {
565567
}
566568
----
567569

568-
[[sec:ip_isolated_project_api]]
570+
[[sec:isolated_project_api]]
569571
==== Use `IsolatedProject` instead of `Project`
570572

571573
You can get a simplified view of a project by calling link:{javadocPath}/org/gradle/api/Project.html#getIsolated--[`project.isolated`],
@@ -587,10 +589,10 @@ gradle.lifecycle.beforeProject {
587589
}
588590
----
589591

590-
[[sec:ip_vs_other_features]]
592+
[[sec:vs_other_features]]
591593
== Isolated Projects and other Gradle features
592594

593-
[[sec:ip_vs_cc]]
595+
[[sec:vs_cc]]
594596
=== Configuration Cache
595597

596598
<<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
607609
It is an error to enable Isolated Projects and explicitly disable Configuration Cache.
608610
====
609611

610-
[[sec:ip_vs_parallel_cc]]
612+
[[sec:vs_parallel_cc]]
611613
=== Parallel Configuration Cache
612614

613615
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
616618
With Isolated Projects, Parallel Configuration Cache is enabled automatically,
617619
since Isolated Projects constraints guarantee safe and correct results for all builds.
618620

619-
[[sec:ip_vs_parallel]]
621+
[[sec:vs_parallel]]
620622
=== Parallel Execution (`--parallel`)
621623

622624
<<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
633635

634636
The Parallel Execution flag is _ignored_ when Isolated Projects is enabled.
635637

636-
[[sec:ip_vs_cod]]
638+
[[sec:vs_cod]]
637639
=== Configuration on Demand
638640

639641
<<configuration_on_demand.adoc#sec:configuration_on_demand,Configuration on Demand>> lets Gradle skip configuring projects that aren't needed for the requested tasks.

platforms/documentation/docs/src/docs/userguide/userguide_single.adoc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,6 @@ include::multi_project_builds.adoc[leveloffset=+2]
290290
include::sharing_build_logic_between_subprojects.adoc[leveloffset=+2]
291291
include::composite_builds.adoc[leveloffset=+2]
292292
include::configuration_on_demand.adoc[leveloffset=+2]
293-
include::isolated_projects.adoc[leveloffset=+2]
294293

295294
[[part:optimizing_build_times]]
296295
== OPTIMIZING GRADLE BUILDS
@@ -314,6 +313,9 @@ include::configuration_cache_requirements.adoc[leveloffset=+2]
314313
include::configuration_cache_debugging.adoc[leveloffset=+2]
315314
include::configuration_cache_status.adoc[leveloffset=+2]
316315

316+
// Isolated Projects
317+
include::isolated_projects.adoc[leveloffset=+2]
318+
317319
[[part:securing_builds]]
318320
== SECURING BUILDS
319321

platforms/documentation/docs/src/main/resources/header.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -586,7 +586,6 @@ <h3 id="structuring-builds">Structuring Gradle Builds</h3>
586586
<li><a href="../userguide/sharing_build_logic_between_subprojects.html">Sharing Build Logic</a></li>
587587
<li><a href="../userguide/composite_builds.html">Composite Builds</a></li>
588588
<li><a href="../userguide/configuration_on_demand.html">Configuration on Demand</a></li>
589-
<li><a href="../userguide/isolated_projects.html">Isolated Projects</a></li>
590589
</ul>
591590

592591
<h3 id="optimizing-build-performance">Optimizing Gradle Builds</h3>
@@ -613,6 +612,7 @@ <h3 id="optimizing-build-performance">Optimizing Gradle Builds</h3>
613612
<li><a href="../userguide/configuration_cache_status.html">Status</a></li>
614613
</ul>
615614
</li>
615+
<li><a href="../userguide/isolated_projects.html">Isolated Projects</a></li>
616616
</ul>
617617

618618
<h3 id="securing-builds">Securing Gradle Builds</h3>

0 commit comments

Comments
 (0)