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

Fix shouldUseLaunchSchemeArgsEnv disabling logic #254

Merged
merged 3 commits into from
Feb 28, 2018
Merged

Conversation

toshi0383
Copy link
Collaborator

Adding environmentVariables was not disabling the shouldUseLaunchSchemeArgsEnv flag.
Therefore the process could not read the variables.

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.

@turekj any thoughts, since you implemented the envs?

@@ -121,7 +121,7 @@ public class ProjectGenerator {
buildConfiguration: scheme.profile?.config ?? defaultReleaseConfig.name,
preActions: scheme.profile?.preActions.map(getExecutionAction) ?? [],
postActions: scheme.profile?.postActions.map(getExecutionAction) ?? [],
shouldUseLaunchSchemeArgsEnv: scheme.profile?.commandLineArguments.isEmpty ?? true,
shouldUseLaunchSchemeArgsEnv: profileCommandLineArgs == nil && profileVariables == nil,
Copy link
Owner

Choose a reason for hiding this comment

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

What about when they’re empty?

@turekj
Copy link
Contributor

turekj commented Feb 28, 2018

That's a great catch! 👍

@yonaskolb the environment variables won't ever be empty in that particular context, because they are re-mapped to nil when empty:

let testVariables = scheme.test.flatMap { $0.environmentVariables.isEmpty ? nil : $0.environmentVariables }

The command line arguments behave the other way I believe, it's a dict that is initialized to empty one by default and profileCommandLineArgs can only be nil if there is no profile scheme. Which means that the change will break the correct behavior.

I think the cleanest solution would be to add an extension on a Profile struct and Test struct that computes that:

extension Profile {
    var shouldUseLaunchSchemeArgsEnv: Bool {
        return commandLineArguments.isEmpty && environmentVariables.isEmpty
    }
}

What do you think @toshi0383?

@toshi0383
Copy link
Collaborator Author

@yonaskolb @turekj Good point. Fixed in 0a37fd5 👌

@yonaskolb yonaskolb merged commit d504f48 into master Feb 28, 2018
@toshi0383 toshi0383 deleted the should-use-cond branch March 1, 2018 00:31
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.

3 participants