-
Notifications
You must be signed in to change notification settings - Fork 809
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
Allow changing macro expansions on test actions. #1468
base: master
Are you sure you want to change the base?
Allow changing macro expansions on test actions. #1468
Conversation
So basically, I'm trying to achieve a scheme where I can:
It seems to work for the most part except I'm losing my test macroExpansions. The problem is that I'm relying on my tests to be able to expand macros to find some files. When setting up a scheme like this, the action will pick up the first buildable reference it finds, and sometimes, for some reason, none. So, I would like to explicitly define which buildable reference to use for the test macro expansion. One potential solution is to avoid relying on |
Maybe this instead? #1471 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Happy to have both this and the other PR too. Better defaults with the ability to override 👍
@@ -228,6 +228,10 @@ public class SchemeGenerator { | |||
let buildableReference = buildActionEntries.first(where: { $0.buildableReference.blueprintName == schemeTarget?.name })?.buildableReference ?? buildActionEntries.first!.buildableReference | |||
let runnables = makeProductRunnables(for: schemeTarget, buildableReference: buildableReference) | |||
|
|||
let testMacroExpansion: XCScheme.BuildableReference = buildActionEntries.first( | |||
where: { $0.buildableReference.blueprintName == scheme.test?.macroExpansion } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just in case buildableReference.blueprintName
ever became nil and the where clause returned true when you hadn't set the macroExpansion, can you add a check that macroExpansion exists first (eg if let macroExpansion = scheme.test?.macroExpansion {...
There are cases where it's useful to specify an alternate target as macro expansion for tests instead of the default which it's currently the first buildable reference.