Customizing location of source directory


(Misha Manulis) #1

Hello,

I'm working on a patch to make the location of the sources configurable.

I'd like to separate the work out into two separate patches. The first
patch will allow changing the default path to a custom one. The second
patch will allow adding multiple source directories.

The reason for this is that there are existing packages that use Cocoapods
or Carthage and have their source placed in various folders that are not
named as the default ones in package manager. For example,
https://github.com/izqui/Taylor, is a small webserver package that placed
it's sources in Taylor/ directory.

If I can pass in a custom sources location to the package manager, I can
add support for this package quite easily.

I wanted to ask the group some questions about this effort:

First of, is this something that you would support?

Second, looking at the code, its seems like the changes are needed only in
the package manager, is that correct?

Lastly, anything I should watch out for as I'm working through this?

Thank you,

Misha Manulis


(Max Howell) #2

Hello,

I'm working on a patch to make the location of the sources configurable.

I'd like to separate the work out into two separate patches. The first patch will allow changing the default path to a custom one. The second patch will allow adding multiple source directories.

The reason for this is that there are existing packages that use Cocoapods or Carthage and have their source placed in various folders that are not named as the default ones in package manager. For example, https://github.com/izqui/Taylor, is a small webserver package that placed it's sources in Taylor/ directory.

If I can pass in a custom sources location to the package manager, I can add support for this package quite easily.

I wanted to ask the group some questions about this effort:

First of, is this something that you would support?

Yes. I feel it is necessary.

Second, looking at the code, its seems like the changes are needed only in the package manager, is that correct?

Indeed.

Lastly, anything I should watch out for as I'm working through this?

Please just add tests and check they continue to run, otherwise I don’t think there are any gotchas.

Thank you,

Thank *you*!


(Misha Manulis) #3

Hi Max,

Question on compiling. So far, I've been using my local install of Swift,
that comes with XCode.

The instructions in the README suggest using the latest master for Swift
itself and building package manager as part of that. I haven't been able
to find instructions for how to compile package manager as part of Swift
though.

I've set up the XCode project, but I can't find any CLI switches or docs on
enabling building other components. Is documented somewhere or can someone
provide basic instructions and I'm happy to write up a How-To doc.

Thank you

Misha Manulis

···

On Wed, Dec 23, 2015 at 9:03 AM, Max Howell <max.howell@apple.com> wrote:

Hello,

I'm working on a patch to make the location of the sources configurable.

I'd like to separate the work out into two separate patches. The first
patch will allow changing the default path to a custom one. The second
patch will allow adding multiple source directories.

The reason for this is that there are existing packages that use Cocoapods
or Carthage and have their source placed in various folders that are not
named as the default ones in package manager. For example,
https://github.com/izqui/Taylor, is a small webserver package that placed
it's sources in Taylor/ directory.

If I can pass in a custom sources location to the package manager, I can
add support for this package quite easily.

I wanted to ask the group some questions about this effort:

First of, is this something that you would support?

Yes. I feel it is necessary.

Second, looking at the code, its seems like the changes are needed only in
the package manager, is that correct?

Indeed.

Lastly, anything I should watch out for as I'm working through this?

Please just add tests and check they continue to run, otherwise I don’t
think there are any gotchas.

Thank you,

Thank *you*!


(Drew Crawford) #4

I've been doing some dev in my tree. I don't know if this is the "recommended workflow" for OSX but it works for me.

1. Install binary snapshot from Swift.org
2. Checkout swiftpm source
3. cd /path/to/swiftpm
4. ./Utilities/bootstrap --swiftc /Library/Developer/Toolchains/swift-latest.xctoolchain/usr/bin/swiftc --sbt /Library/Developer/Toolchains/swift-latest.xctoolchain/usr/bin/swift-build-tool --build-tests test

That builds and runs the tests. The bootstrap script is the preferred build system at present AFAIK, since

1. While swiftpm self-hosts, it can't be turtles all the way down
2. swiftpm can't self-host its own tests; there is an ongoing proposal about this in this list. So, if you want to run tests (spoiler alert: you do) the bootstrap script is critical.

Questions I have not researched in any detail:

1. Whether building from inside Xcode is possible and/or simple
2. Whether Xcode autocomplete can be made to work

I would file a motion to get a "so, you want a development workflow for this project" kind of guide in Documentation/Internals, and the information above is probably 70% complete for OSX, but some resolution on the questions I don't know the answer to would improve it.

···

On Dec 27, 2015, at 5:37 PM, Misha Manulis via swift-build-dev <swift-build-dev@swift.org> wrote:

Hi Max,

Question on compiling. So far, I've been using my local install of Swift, that comes with XCode.

The instructions in the README suggest using the latest master for Swift itself and building package manager as part of that. I haven't been able to find instructions for how to compile package manager as part of Swift though.

I've set up the XCode project, but I can't find any CLI switches or docs on enabling building other components. Is documented somewhere or can someone provide basic instructions and I'm happy to write up a How-To doc.

Thank you

Misha Manulis

On Wed, Dec 23, 2015 at 9:03 AM, Max Howell <max.howell@apple.com <mailto:max.howell@apple.com>> wrote:

Hello,

I'm working on a patch to make the location of the sources configurable.

I'd like to separate the work out into two separate patches. The first patch will allow changing the default path to a custom one. The second patch will allow adding multiple source directories.

The reason for this is that there are existing packages that use Cocoapods or Carthage and have their source placed in various folders that are not named as the default ones in package manager. For example, https://github.com/izqui/Taylor, is a small webserver package that placed it's sources in Taylor/ directory.

If I can pass in a custom sources location to the package manager, I can add support for this package quite easily.

I wanted to ask the group some questions about this effort:

First of, is this something that you would support?

Yes. I feel it is necessary.

Second, looking at the code, its seems like the changes are needed only in the package manager, is that correct?

Indeed.

Lastly, anything I should watch out for as I'm working through this?

Please just add tests and check they continue to run, otherwise I don’t think there are any gotchas.

Thank you,

Thank *you*!

_______________________________________________
swift-build-dev mailing list
swift-build-dev@swift.org <mailto:swift-build-dev@swift.org>
https://lists.swift.org/mailman/listinfo/swift-build-dev


(Max Howell) #5

Hi Max,

Question on compiling. So far, I've been using my local install of Swift, that comes with XCode.

The instructions in the README suggest using the latest master for Swift itself and building package manager as part of that. I haven't been able to find instructions for how to compile package manager as part of Swift though.

I've set up the XCode project, but I can't find any CLI switches or docs on enabling building other components. Is documented somewhere or can someone provide basic instructions and I'm happy to write up a How-To doc.

I don’t quite understand your questions. This is what I do:

1. Download and install latest swift for darwin
2. xcrun launch-with-toolchain /Library/Developer/Toolchains/swift-latest.xctoolchain
3. ⌘B

Then to use this swift-build you just execute it:

    .build/debug/swift-build