Reusing the main output base for Xcode builds #2975
Replies: 7 comments 5 replies
-
From our experience at Cash App.
|
Beta Was this translation helpful? Give feedback.
-
From our experience at Spotify:
|
Beta Was this translation helpful? Give feedback.
-
From our experience at Square:
Yes. We're in the process rolling out To be clear, a lot of that is likely from the size/complexity of our graph which causes everything to be more expensive (memory, CPU, disk usage). The analysis phase is very expensive for us when it has to run and it's easy to see the impact of that in index build times, memory used by the Bazel servers for each output base (15GB+ if we don't cap it using JVM settings), many cores being used (e.g. Regardless, any Bazel server we can stop running or any output base we can stop creating would improve DX for our devs significantly and also reduce our burden to maintain the infra.
Yes.
I believe detailed documentation and examples would help a lot. If there's anything that Anything that is specifically built to address the "big/complex codebase" use case is welcomed too IMO. Last, I honestly have to idea if my org would be willing to sponsor this (but it's not gonna hurt to ask worst case). |
Beta Was this translation helpful? Give feedback.
-
I'll keep mine short since most of it is redundant:
Similar to Thiago, but mostly disk space. I feel we could optimize some things so our output bases aren't always filled with hundreds of 300MB test binaries, but I also would rather not have to think about disk space any more than we already do.
Yes. While I do wish developers leveraged Bazel directly more than they do (the vast majority only do via Xcode and project gen), the reality is the benefit of separate output bases is rarely felt by our non-tooling-team developers.
It's hard for me to anticipate how much we'd be annoyed by the downsides of moving to a shared output base. Both what we'd want rules_xcodeproj to do for us, and our own investment, would probably be informed by just observing it for a while. |
Beta Was this translation helpful? Give feedback.
-
Yes.. memory is the top concern for us because we use 16GB macbooks, and Bazel takes 4GB~ of ram by itself (the 3 output bases combined).
Yes, I would try it.
I think it would be a great optimization, but we are very happy with rules_xcodeproj as-is. |
Beta Was this translation helpful? Give feedback.
-
Yes, it consumes CPU and RAM a lot for two output bases. For our main application project, it takes about 20GB of RAM for running one bazel server. And having another one is impactful to local environments. Same with disk space. We have a choppy disk clean up logic that we hope to remove after Bazel 7.2 release with in flight disk garbage collection feature.
Yes.
Like others commented, having a clear way to view the flag difference between CLI bazel build vs XCode bazel build would be helpful.
Yes, as this is direly exhausting our local developer machines. |
Beta Was this translation helpful? Give feedback.
-
I've merged the normal Xcode build output base and the Index build output base with #3074. Longer term I think I'll be able to merge the command-line output base as well (by de-nesting the Xcode one), with an optional flag similar to the VS Code extension. |
Beta Was this translation helpful? Give feedback.
-
Currently rules_xcodeproj makes use of two additional output bases, nested inside of the output base that you run the generation from; one for project generation and Xcode builds, and one for Index Build.
For people that also build on the command-line (and aren’t using rules_xcodeproj’s command-line API), this means outputs end up in up to three output bases and up to three Bazel servers retain analysis cache memory.
Currently there isn’t a way around the Index Build output base, otherwise you can run into weird delays in starting builds. So let’s ignore that one for now. But the build output base, why does that one exist?
There are a couple reasons for the different build output base:
The first reason is something that people can choose to deal with, so let’s focus on the second one. When build-affecting command-line flags change between bazel commands, the analysis cache is discarded. This can result in a substantial delay before your command even starts to do meaningful work. rules_xcodeproj sets various command-line flags for performance and correctness reasons, which means it would be incredibly easy to invalidate the analysis cache if it shared an output base with normal bazel commands.
But let’s say that you find a way to ensure the same flags are set when you run bazel commands (e.g. with a properly configured
tools/bazel
wrapper script). Then you would theoretically not need one of the additional output bases. There are some additional problems that would need to be tackled, like getting cache hits on building targets (because of the transitions that rules_xcodeproj uses), but otherwise this would “work”.Which brings me to the questions I have for everyone:
Beta Was this translation helpful? Give feedback.
All reactions