-
Notifications
You must be signed in to change notification settings - Fork 769
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
Run custom shell script R.swift generate resources takes 60 secs regardless of the size of the Resources folder #807
Comments
From further analysis into this issue, I can see that the plugin shell scripts take different command-line arguments and hence the difference in time of execution between an SPM module and an app or app extension. The SPM module plugin will search for resources in the Resources folder of the SPM package and that's it. The app extension plugin will search for the entire project folder looking for resources, recursively. This explains why the app plugin script will take the same amount of time as the app extensions plugin, because on Xcode I can have resources everywhere and simply attribute them to different target memberships in the File inspector pane. There isn't one single place where I am bound to have resources in an Xcode project. |
R.swift is meant to be used for a single target. If your project has multiple targets, each target can use its own R.swift configuration. |
Yes, that is not the issue here. The issue has to do with the "running custom shell script" build step for R.Swift, which, by the way, runs on very clean or incremental build. This is the code in the plugin where this is determined: RSwiftInternalResources plugin and as an XcodeProjectPlugin |
I see what you mean. The fact that R.swift runs on your Xcode project is part of the design goal of the tool. You don't need to configure anything separately: "it just works". Note that even when scanning the Xcode project, it will take targets into account. So if you have a many files in a folder, but those are not part of your target, they will not be processed by R.swift. If you still want to exclude certain things, you can add a .rswiftignore file, or only enable specific generators, see: https://github.com/mac-cain13/R.swift/blob/master/Documentation/Ignoring.md |
Yes, but on a large project, this type of lookup takes a significant amount of time on every clean and incremental build, which is a problem. 60 seconds on every incremental build is an enourmous amount of time, as I am sure you can understand.
Yes I can understand this statement. But in the majority of cases, when an app is not yet modularized, or it's only partly modularized, the main app lookup for resources becomes a bottleneck. So I am guessing there is no way to add some argument to reduce this lookup scope?
Already using it, thanks! |
I understand your situation. Unfortunately we there's currently no other options than the ones I've listed to speed up the execution time of R.swift. One more thing you could try: |
Thank you for this suggestion. The time is spent on the custom shell script so I will close this issue |
I have migrated my project to R.Swift 7.2.4 using SPM and the new plugins. However, there is a strange behavior going on right now with the project. In a generic SPM module, the "run custom shell script R.swift generate resources" step is very fast. In an app-extension type takes 60 secs, which is roughly the same time it will take for the main app. The app extensions contains very few resources between them. Also, an issue I see is that these running R.swift script steps are not parallelized by XCode for the app and the app extensions, so the build gets stuck until this step is finished. Is anyone facing such issues?
The text was updated successfully, but these errors were encountered: