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 unstable scheme generation #790
Fix unstable scheme generation #790
Conversation
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.
Nice work - the stable generation tests are really useful π
@@ -572,7 +572,7 @@ final class SchemesGenerator: SchemesGenerating { | |||
private func commandlineArgruments(_ arguments: [String: Bool]) -> [XCScheme.CommandLineArguments.CommandLineArgument] { | |||
arguments.map { key, enabled in | |||
XCScheme.CommandLineArguments.CommandLineArgument(name: key, enabled: enabled) | |||
} | |||
}.sorted { $0.name < $1.name } |
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.
Does order matter when generating schemes?
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.
Wondering, why there are differences in order when generating subsequent times, can we identify the root cause of the problem?
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.
Generally it does, but this change is not regressing as the order is currently indeterministic. Please check #791 for more details.
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.
@lakpa Arguments are stored as a dictionary in the manifest, that's why they're shuffled.
public struct Arguments: Equatable, Codable {
public let environment: [String: String]
public let launch: [String: Bool]
public init(environment: [String: String] = [:],
launch: [String: Bool] = [:]) {
self.environment = environment
self.launch = launch
}
}
Good to merge! |
Nice fix π |
Short description π
Running
tuist generate
second time without modifying the project can result in unexpected differences in project.xcscheme
files.Solution π¦
Sort both arguments and environment variables by name during the generation process.
Implementation π©βπ»π¨βπ»