MobileNativeFoundation / rules_xcodeproj

Bazel rules for generating Xcode projects.
MIT License
502 stars 76 forks source link

Feature Request: Ability to configure what generated file types get pulled into the project #3014

Closed thiagohmcruz closed 2 months ago

thiagohmcruz commented 2 months ago

As a rules_ios user I've noticed that some generated files that are an implementation detail of rules_ios are being pulled into Xcode. I'd appreciate the ability to filter those out.

When generating a project, I noticed some performance issues while editing code in a big codebase with many rules_ios frameworks and filtering out unneeded file types has improved the experience for me.

As an example, run this from this repo's root:

cd examples/rules_ios
bazel run //:xcodeproj-incremental 

and note how you can cmd+shift+o and find *_vfs.yaml or *.extended.modulemap files:

Screenshot 2024-04-16 at 12 45 14 PM Screenshot 2024-04-16 at 12 45 27 PM

We could introduce a global setting here that allows consumers to configure this (say by specifying which generated files .extension types are allowed/not allowed to be processed). That could be a feature consumers are supposed to set in their rc files or a setting specified at the xcodeproj macro level? For example:

xcodeproj(
  ...
  allowed_generated_file_extensions = [".h", ".m"],
  # or
  exclude_generated_file_extensions = [".yaml", ".modulemap"],
)

Thoughts? cc @brentleyjones.

thiagohmcruz commented 2 months ago

Alternatively we can simply not process any generated file here.

dnkoutso commented 2 months ago

Perhaps a combination of both in which some generated files are automatically not processed and also ability to specify additional file types?

thiagohmcruz commented 2 months ago

Perhaps a combination of both in which some generated files are automatically not processed and also ability to specify additional file types?

@dnkoutso We're considering to stop processing generated files and effectively stop over collecting here instead of trying to come up with a way to expose something configurable to users.

This is a lot simpler than what I suggested and we can ensure that generated source files continue to be collected elsewhere. We'll keep this issue updated!

thiagohmcruz commented 2 months ago

For future reference, this branch illustrates my use case btw: https://github.com/MobileNativeFoundation/rules_xcodeproj/compare/thiago/generated-file-extensions

cd examples/rules_ios
bazel run //:xcodeproj-incremental

My intent is to continue to allow such a project to index *.pbobjc.m and *.pbobjc.h files since those are relevant to developers and they might want to cmd+shift+o these and inspect APIs and types. But, most other files rules_ios generates (including but not limited to some .h files) are implementation details and not necessary in Xcode.

brentleyjones commented 2 months ago

I think #3017 addresses this.

thiagohmcruz commented 2 months ago

I think #3017 addresses this.

It does, thank you!