Re: [swift-users] [swift-build-dev] Importing C system libraries

2017-03-28 Thread taylor swift via swift-users
I figured that was the intention, but we can’t be too surprised that everyone is maintaining personal modulemap repositories (and polluting search results — just try googling for a Swift PNG library!), especially when this central repo still doesn’t exist yet. If Swift ever comes on par with C

Re: [swift-users] [swift-build-dev] Importing C system libraries

2017-03-28 Thread Ankit Aggarwal via swift-users
I think the idea was that there will be one such repository which other packages can use, that too only until the system libraries start shipping their standard modulemap. I thought we had this written down in our documentation somewhere but couldn't find it. Maybe Daniel can expand on this. On

Re: [swift-users] [swift-build-dev] Importing C system libraries

2017-03-28 Thread Kelvin Ma via swift-users
This worked! Thanks! But why is having empty git repositories strewn about the “correct” way? System libraries should be imported from within the project, as they are in C. You have to admit it’s getting quite silly that Swift devs keep repositories like these

Re: [swift-users] [swift-build-dev] Importing C system libraries

2017-03-28 Thread Ankit Aggarwal via swift-users
In this case, these are just umbrella headers. If your modulemap contains absolute path to the header, then you don't need the header files, but SwiftPM will probably warn about this. Note that this is a "hack" to have system packages inside a single repository. The correct way is to have

Re: [swift-users] Importing C system libraries

2017-03-28 Thread Michael Ilseman via swift-users
This is into uncharted territory for me, but it seems you’re building with SwiftPM. You’ll probably want to configure extra compiler flags if that’s possible. You could also bite the bullet and build your C libraries with SwiftPM as well. Hopefully someone on swift-build-dev can help you out.

Re: [swift-users] Importing C system libraries

2017-03-28 Thread Kelvin Ma via swift-users
How do I compile a project with many modules? My tree looks like this: ​ On Tue, Mar 28, 2017 at 12:47 PM, Michael Ilseman wrote: > Sure! In this example, I have built libgit2. I have a directory called > Git, and inside that I have the following module map: > > module Git

Re: [swift-users] [swift-build-dev] Importing C system libraries

2017-03-28 Thread Kelvin Ma via swift-users
I can only fit one monitor in my dorm and it’s honestly tragic… On Tue, Mar 28, 2017 at 2:58 PM, David Sweeris wrote: > > On Mar 28, 2017, at 1:58 AM, Rien via swift-build-dev < > swift-build-...@swift.org> wrote: > > I feel your pain ;-) > > Just embrace the dark side, it

Re: [swift-users] Asynchronous error recovering with RecoverableError

2017-03-28 Thread Michael Ilseman via swift-users
New start task: https://bugs.swift.org/browse/SR-4405 Add @escaping to RecoverableError.attemptRecovery > On Mar 28, 2017, at 3:31 PM, Douglas Gregor wrote: > > >> On Mar 28, 2017, at 11:21 AM, Michael Ilseman

Re: [swift-users] Asynchronous error recovering with RecoverableError

2017-03-28 Thread Douglas Gregor via swift-users
> On Mar 28, 2017, at 11:21 AM, Michael Ilseman wrote: > > CC Doug Gregor, who git blame tells me wrote this part. > > Doug, this slightly predates noescape-by-default. Is this a bug or as > intended? It’s a bug; the point here is that we can do recovery asynchronously,

Re: [swift-users] [swift-build-dev] Importing C system libraries

2017-03-28 Thread David Sweeris via swift-users
> On Mar 28, 2017, at 1:58 AM, Rien via swift-build-dev > wrote: > > I feel your pain ;-) > > Just embrace the dark side, it takes a little time to get used to, but > chances are you won’t regret it. > > Btw: I still do my development in Xcode, its just that using

[swift-users] Set with element of NSObject subclasses didn't work as expected

2017-03-28 Thread Zhao Xin via swift-users
Please see the code first. import Foundation class Foo:Hashable { let value:Int public var hashValue: Int { return value } public static func ==(lhs: Foo, rhs: Foo) -> Bool { return lhs.value == rhs.value } init(_ value:Int) { self.value = value

Re: [swift-users] Foundation: build.ninja No such file or directory

2017-03-28 Thread Mohit Athwani via swift-users
Hi Phillipe, I'm doing this on Ubuntu 16.04 LTS and I first ran: swift/utils/build-script --xctest --foundation -t and then cd swift-corelibs-foundation ninja I wonder why this is happening! Thanks for your help! Mohit On Tue, Mar 28, 2017 at 12:31 PM, Philippe Hausler

[swift-users] Foundation: build.ninja No such file or directory

2017-03-28 Thread Mohit Athwani via swift-users
Hey guys, I am trying to build Foundation and is anybody else getting build.ninja: No such file or directory error? I just cloned everything from github. This did not happen with me when I worked on my previous pull request. Cheers! Mohit ___

Re: [swift-users] Foundation: build.ninja No such file or directory

2017-03-28 Thread Philippe Hausler via swift-users
What host os are you attempting to build on? For linux you need to have a configured Foundation initially to run ninja. This means that you need to build swift with the build-script including --foundation and --libdispatch and --xctest After one successful build you can run ninja in the

Re: [swift-users] Improving compilation times?

2017-03-28 Thread piotr gorzelany via swift-users
Jon, I enabled this setting in a Swift 3.1 project in Xcode 8.3 and incremental builds work as usual. The project does not recompile when making small changes. But I did notice a great decrease in build time for my project. Maybe the recompiles only happen on big changes? Because when I change

[swift-users] Foundation: build.ninja No such file or directory

2017-03-28 Thread Mohit Athwani via swift-users
I am trying to build Foundation and is anybody else getting build.ninja: No such file or directory error? I just cloned everything from github. This did not happen with me when I worked on my previous pull request. Cheers! -- Mohit Athwani

Re: [swift-users] Why does this leak?

2017-03-28 Thread Rick Aurbach via swift-users
This is getting interesting. I added your suggested test code (set to execute once): class FontSelectorDialog : UITableViewController { static let chooser : ColorChooser = ColorChooser() override func viewDidAppear(_ animated: Bool) {

Re: [swift-users] Improving compilation times?

2017-03-28 Thread Jon Shier via swift-users
That setting breaks incremental compilation, so you're getting clean build speed at the expense of incremental builds. Jon > On Mar 28, 2017, at 7:35 AM, Bartłomiej Nowak via swift-users > wrote: > > I’ve had the same issue and adding a user-defined setting >

Re: [swift-users] Improving compilation times?

2017-03-28 Thread Bartłomiej Nowak via swift-users
I’ve had the same issue and adding a user-defined setting `SWIFT_WHOLE_MODULE_OPTIMIZATION = YES` seemed to fix this. Down from 12 minutes to 2.5 after clean -> build. The question is why do we have to set such flags in Xcode ourselves, when it most probably should be the default setting? >

Re: [swift-users] Asynchronous error recovering with RecoverableError

2017-03-28 Thread Michael Ilseman via swift-users
CC Doug Gregor, who git blame tells me wrote this part. Doug, this slightly predates noescape-by-default. Is this a bug or as intended? > On Mar 28, 2017, at 8:49 AM, Elia Cereda via swift-users > wrote: > > Hi Dennis, > > Thanks for your answer. I can see that my

Re: [swift-users] Importing C system libraries

2017-03-28 Thread Michael Ilseman via swift-users
Sure! In this example, I have built libgit2. I have a directory called Git, and inside that I have the following module map: module Git [system] { header "/libgit2/include/git2.h" export * } When I run, I use: swift -I -L -lgit2 foo.swift inside

Re: [swift-users] Asynchronous error recovering with RecoverableError

2017-03-28 Thread Elia Cereda via swift-users
Hi Dennis, Thanks for your answer. I can see that my message needs some more context: RecoverableError is a protocol in the standard library that can be implemented to opt in to the error recovery mechanism available on macOS. attemptRecovery(optionIndex, resultHandler:) is one of the methods

Re: [swift-users] Importing C system libraries

2017-03-28 Thread Kelvin Ma via swift-users
Can you give an example? On Mon, Mar 27, 2017 at 3:59 PM, Michael Ilseman wrote: > Sure. At a low level, you can create a module.map file and use -L/-l flags > in your invocation of Swift. If you want to do so at a higher level, then > perhaps SwiftPM can. CCing

Re: [swift-users] Importing C system libraries

2017-03-28 Thread Kelvin Ma via swift-users
CLI’s are nothing to be afraid of :) tbh I find XCode much more difficult to work with than files and command line invocations. On Mon, Mar 27, 2017 at 4:16 PM, Michael Ilseman wrote: > I don’t know what you’re referring to, but my solution also works for > pre-open-source

Re: [swift-users] Why does this leak?

2017-03-28 Thread Alex Blewitt via swift-users
> On 28 Mar 2017, at 05:41, Rick Aurbach wrote: > > That wouldn’t work directly. The “leak” occurs when processing a segue called > in response to a user button push. (I suppose I could attempt to wire up a UI > Test, but would rather not go down that route.) > > What I can

Re: [swift-users] Importing C system libraries

2017-03-28 Thread Rien via swift-users
I feel your pain ;-) Just embrace the dark side, it takes a little time to get used to, but chances are you won’t regret it. Btw: I still do my development in Xcode, its just that using the SPM (Swift Package Manager) and git from the command line gives a whole extra dimension to my