Skip to content

Refactor describe(), add llbuild tool types #175

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

Merged
merged 1 commit into from
Mar 9, 2016

Conversation

aciidgh
Copy link
Contributor

@aciidgh aciidgh commented Mar 5, 2016

This PR adds models for the llbuild tools used by swift-build and method which can take array of llbuild Targets to produce YAML.

extension Array: YAMLRepresentable {
var YAML: String {
let stringArray = self.flatMap { $0 as? String }
guard stringArray.count == self.count else { return "" }
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't we throw an error here if array has non String elements?
like, fatalError("Unimplemented YAML type")

Copy link
Contributor Author

Choose a reason for hiding this comment

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

probably yeah. Actually I was trying to write something like "Array conforms to YAMLRep where Element = String" but couldn't get that to work. Not sure if it's possible right now?

Copy link
Contributor

Choose a reason for hiding this comment

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

How about extension Array where Element: YAMLRepresentable

That's not the same, but that should work in your use-case. Array doesn't confirm to YAMLRepresentable, but you still can call YAML method on array where elements are YAMLRepresentable like

["-", "1", "2", "3"].YAML //  "["-", "@", 1, 2, 3]"
[1, 2, 3].YAML   //Compile Error

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I thought about it when I was doing it but as you said Array will not conform to YAMLRepresentable but it will work for the current use case and provide better compile time checks. Updating code.

@aciidgh aciidgh force-pushed the describe_refactor branch from 07e760b to 2dfd20a Compare March 7, 2016 16:39
@kostiakoval
Copy link
Contributor

LGTM. @mxcl can you trigger CI-tests?

@aciidgh
Copy link
Contributor Author

aciidgh commented Mar 8, 2016

@mxcl CI pls

@mxcl
Copy link
Contributor

mxcl commented Mar 9, 2016

@swift-ci Please test

@aciidgh aciidgh force-pushed the describe_refactor branch from 2dfd20a to 51d170c Compare March 9, 2016 02:26
@aciidgh
Copy link
Contributor Author

aciidgh commented Mar 9, 2016

CI failed due to import func libc.fclose, Added that
also sqashed and rebased

@mxcl
Copy link
Contributor

mxcl commented Mar 9, 2016

@swift-ci Please test

aciidgh added a commit that referenced this pull request Mar 9, 2016
Refactor describe(), add llbuild tool types
@aciidgh aciidgh merged commit 4d576de into swiftlang:master Mar 9, 2016
@aciidgh aciidgh deleted the describe_refactor branch March 9, 2016 05:55
@mxcl
Copy link
Contributor

mxcl commented Mar 9, 2016

In future please wait for my review before merging non-trivial changes. Although in this case I would have said: great work 👍🏻

@aciidgh
Copy link
Contributor Author

aciidgh commented Mar 9, 2016

Oh, so far I thought you only triggered CI if you had reviewed. Will wait for explicit comment in future.

aciidgh added a commit to aciidgh/swift-package-manager that referenced this pull request Jan 11, 2019
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