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

Allow changing macro expansions on test actions. #1468

Merged

Conversation

erneestoc
Copy link
Contributor

@erneestoc erneestoc commented Apr 16, 2024

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.

@erneestoc
Copy link
Contributor Author

So basically, I'm trying to achieve a scheme where I can:

  • Run a full version of an app.
  • Build and launch mock app during tests action.
  • Be able to execute my tests.

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 $(SOURCE_ROOT) in my test env vars and instead hardcode the paths. However, I'm inclined to explore a solution that utilizes macros. What are your thoughts on this? @giginet @yonaskolb @freddi-kit

@erneestoc
Copy link
Contributor Author

Maybe this instead? #1471

Copy link
Owner

@yonaskolb yonaskolb left a 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 👍

Sources/XcodeGenKit/SchemeGenerator.swift Outdated Show resolved Hide resolved
@erneestoc erneestoc requested a review from yonaskolb June 20, 2024 19:58
Copy link
Owner

@yonaskolb yonaskolb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, we can merge this after the merge conflict 👍

@erneestoc
Copy link
Contributor Author

@yonaskolb I had some conflicting logic with the previous PR I had to fix - if you can give it another check 🙏🏻

@@ -620,6 +623,7 @@ extension Scheme.Test: JSONObjectConvertible {
customLLDBInit = jsonDictionary.json(atKeyPath: "customLLDBInit")
captureScreenshotsAutomatically = jsonDictionary.json(atKeyPath: "captureScreenshotsAutomatically") ?? Scheme.Test.captureScreenshotsAutomaticallyDefault
deleteScreenshotsWhenEachTestSucceeds = jsonDictionary.json(atKeyPath: "deleteScreenshotsWhenEachTestSucceeds") ?? Scheme.Test.deleteScreenshotsWhenEachTestSucceedsDefault
macroExpansion = jsonDictionary.json(atKeyPath: "macroExpansion")
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, just missing the encoding in toJSONValue below as well

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done 0195336

@erneestoc erneestoc requested a review from yonaskolb July 9, 2024 20:26
@yonaskolb yonaskolb merged commit 45151c2 into yonaskolb:master Jul 10, 2024
2 checks passed
@erneestoc erneestoc deleted the erneestoc/test-macro-expansion-override branch July 10, 2024 17:21
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

Successfully merging this pull request may close these issues.

2 participants