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

Epic: Incremental generation mode #2701

Closed
18 tasks done
brentleyjones opened this issue Oct 30, 2023 · 1 comment
Closed
18 tasks done

Epic: Incremental generation mode #2701

brentleyjones opened this issue Oct 30, 2023 · 1 comment
Assignees

Comments

@brentleyjones
Copy link
Contributor

brentleyjones commented Oct 30, 2023

This issue doesn't include every PR that went into implementing incremental generation mode. It's primary purpose is to track high level changes on the way to completion of the feature.

What is it/why should I use it?

Incremental generation mode is a new way for rules_xcodeproj to generate your project. Unlike the Build Mode (BwB or BwX), this should only really affect the process by which rules_xcodeproj takes to generate the project, not how the project itself behaves (with some small caveats). Here are some of the benefits of using incremental generation mode over the current (a.k.a "legacy") generation mode:

  • Much faster generation. Numbers from a large example project:
    • Clean
      • Analysis: 12% faster (62s vs 71s)
      • Execution: 41% faster (72s vs 123s)
    • Minimal incremental (add file to a top-level target)
      • Analysis: 36% faster (13s vs 21s)
      • Execution: 93% faster (8.5s vs 123s)
  • Lower Starlark memory usage (I need to do a little more work to get bigger gains)
    • Currently estimated to be about 33% lower
  • Improved target consolidation and target merging
    • Some targets can now consolidate better
    • Libraries can merge into multiple top-level targets
    • Mixed-language targets merge better
  • Improved indexing
    • All Swift compiler flags are now in the project, working around more SourceKit issues
  • Improved debugging
  • Improved handling of extra files (mainly around target focusing)
  • Improved Xcode Previews support
  • (for maintainers:) Vastly improved maintainability (docs, tests, code structure, etc.)

Early access

You can try out incremental generation mode before everything lands by doing the following:

  • Check out the wip/incremental-generation-mode branch
  • Create a release archive
  • Depend on that release archive with archive_override (Bzlmod) or http_archive (WORKSPACE)
    • Be sure to set the hash correctly, to pick up changes if you upgrade to a newer version
    • I highly recommend using this method, instead of pointing to a source archive or git_repository, because incremental generation mode uses many generators, and your initial generation time can be a lot slower without using a release archive
  • Use xcodeproj.generation_mode = "incremental"
  • (Optionally) use xcodeproj.xcschemes (you need to use this instead ofxcodeproj.schemes)

The //tools:xcodeproj target shows an example.

Progress

pbxproj_prefix

files_and_groups

pbxtargetdependencies

import_indexstores

xcschemes

target_build_settings

swift_debug_settings

pbxnativetargets

.xcfilelists

project.pbxproj

Other Starlark

@brentleyjones
Copy link
Contributor Author

Deferred some tests to non-blocking issues.

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

1 participant