[swift-build-dev] SwiftPM platform-specific build folders

Ricardo N Olivieri ricardo.olivieri at us.ibm.com
Fri Jun 23 09:04:44 CDT 2017


Got it, thx. I had wrongly assumed that the "--configuration/-c" option 
would only be available when code is getting compiled.

Another question/observation. All the options associated with the "swift 
build" command can be used during the execution of the build command (for 
specifying/passing a value). For instance, you can execute a command like

"swift build --configuration release --build-path=mydir1 --chdir=mydir2 
-Xcc -I/usr/include/folder2 -v"

What would happen in the following case?

"swift build --configuration release --build-path=mydir1 --chdir=mydir2 
-Xcc -I/usr/include/folder2 --bin-path -v"

In such case, would the "--bin-path" option be ignored or would the 
bin-path value be displayed, say, at the beginning beginning of the 
output?


Regards,
   Ricardo Olivieri
   Software Engineer


From:   David Hart <david at hartbit.com>
To:     Ricardo N Olivieri <ricardo.olivieri at us.ibm.com>
Cc:     Daniel Dunbar <daniel_dunbar at apple.com>, Gregor Milos 
<gmilos at apple.com>, Kyle Fuller <kyle at fuller.li>, 
"swift-build-dev at swift.org" <swift-build-dev at swift.org>
Date:   06/23/2017 01:04 AM
Subject:        Re: [swift-build-dev] SwiftPM platform-specific build 
folders





On 23 Jun 2017, at 05:41, Ricardo N Olivieri <ricardo.olivieri at us.ibm.com> 
wrote:

I see. One question though. If the output from "swift build --bin-path" 
includes the configuration folder (e.g. ".build/macosx-x86_64/debug), 
wouldn't the command then need to include the configuration as a 
parameter?

For instance, "swift build --bin-debug-path", would output 
".build/macosx-x86_64/debug", while "swift build --bin-release-path" would 
output ".build/macosx-x86_64/release”.

Does that make sense or did I miss something?

The build command already has a --configuration/-c option, so I would 
expect it to be:

$ swift build --bin-path
.build/macosx-x86_64/debug
$ swift build -c release --bin-path
.build/macosx-x86_64/release

Regards,
  Ricardo Olivieri
  Software Engineer
  IBM Swift Engineering at IBM Cloud


From:        David Hart <david at hartbit.com>
To:        Ricardo N Olivieri <ricardo.olivieri at us.ibm.com>
Cc:        Daniel Dunbar <daniel_dunbar at apple.com>, Gregor Milos <
gmilos at apple.com>, Kyle Fuller <kyle at fuller.li>, "
swift-build-dev at swift.org" <swift-build-dev at swift.org>
Date:        06/22/2017 03:50 PM
Subject:        Re: [swift-build-dev] SwiftPM platform-specific build 
folders



Response inline:

On 22 Jun 2017, at 21:00, Ricardo N Olivieri <ricardo.olivieri at us.ibm.com> 
wrote:

Thanks Daniel for the heads up.

I like the goals that SR-3583 and SR-5259 are targeting. For instance, 
because the solution described in SR-3583 is not yet available, we have 
been using the "--build-path" argument when building inside Docker 
containers or VMs as a way to avoid overriding the .build folder on the 
macOS host:

swift build --configuration debug --build-path .build-ubuntu-1404

If SR-3583 gets implemented, then SR-5259 would be certainly beneficial 
for our buildpack. As you pointed out, with SR-5259, the buildpack would 
be able to determine the build path at runtime without having to hard code 
it. In our buildpack we could execute "swift build --bin-path", which I 
assume would output something along these lines: “.build/macosx-x86_64”, 
“.build/ubuntu-1404”, etc... correct?

Actually, I think it should contain the full path, including the 
configuration folder:

.build/macosx-x86_64/debug

Question... would "swift build --display-build-path" be a better option 
than "swift build --bin-path" to display the path to the build folder? I 
am thinking this would align better with the current 
"--build-path" option that exists now:

The path mentioned by those options are different.

--build-path allows setting the root build folder, and the build process 
will then create the necessary platform/configuration folder structure 
inside there.

On the other hand, the option we plan to introduce will output the full 
path the binaries will be built into for a run with the same options, 
including the platform and configuration folders, hence the bin in the 
name.

But we are open to other name suggestions.

$ swift build --help
OVERVIEW: Build sources into binary products

USAGE: swift build [options]

OPTIONS:
 --build-path            Specify build/cache directory [default: ./.build]
 --chdir, -C             Change working directory before any other 
operation
 --color                 Specify color mode (auto|always|never) [default: 
auto]
 --configuration, -c     Build with configuration (debug|release) 
[default: debug]
 --enable-prefetching    Enable prefetching in resolver
 --verbose, -v           Increase verbosity of informational output
 -Xcc                    Pass flag through to all C compiler invocations
 -Xlinker                Pass flag through to all linker invocations
 -Xswiftc                Pass flag through to all Swift compiler 
invocations
 --help                  Display available options



Regards,
 Ricardo Olivieri
 Software Engineer
 IBM Swift Engineering at IBM Cloud


From:        Daniel Dunbar <daniel_dunbar at apple.com>
To:        David Hart <david at hartbit.com>, Kyle Fuller <kyle at fuller.li>, 
Gregor Milos <gmilos at apple.com>, Ricardo N Olivieri <
ricardo.olivieri at us.ibm.com>
Cc:        "swift-build-dev at swift.org" <swift-build-dev at swift.org>
Date:        06/19/2017 05:49 PM
Subject:        Re: [swift-build-dev] SwiftPM platform-specific build 
folders
Sent by:        daniel_dunbar at apple.com



(CC'ing a couple people I know have worked on build packs in the past.)

Thanks David!

For those only on the mailing list, we discussed this plan on the SwiftPM 
Slack channel, and I think making this change in the Swift 4 timeframe is 
right, even though it may break some things.

One of the main goals of the compatibility work is to make sure that we 
don't break any of the existing deployment workflows people have built on 
top of SwiftPM (for example PaaS buildpacks). We don't have time for a 
full "make install" type workflow which buildpacks could use, but my hope 
was that SR-5259 would be something existing build packs could migrate to 
to avoid having to hard code certain paths.

We'd love feedback on whether this seems like a reasonable plan.

- Daniel

On Jun 19, 2017, at 3:19 PM, David Hart via swift-build-dev <
swift-build-dev at swift.org> wrote:

Hello mailing-list,

I’m implementing SR-3583that builds SwiftPM products into 
platform-specific sub-folders. For example, on macOS, a default build will 
no longer build products into .build/debugbut instead in 
.build/macosx-x86_64/debug.

To alleviate this breaking change, several solutions have been planned:
SE-0179: A new swift run tool to allow users to run executable products 
without knowing their exact location.
SR-3583 will create a symlink after each build pointing from the old to 
the new build folder for backwards compatibility.
SR-5259: A new —bin-path option for the swift build command to print the 
build folder for 3rd party tools to use.

Of the above, only SE-0179 is currently fully implemented in master.

What does everybody think about this change and the solutions put into 
place to support it?

Regards,
David.
_______________________________________________
swift-build-dev mailing list
swift-build-dev at swift.org
https://lists.swift.org/mailman/listinfo/swift-build-dev








-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-build-dev/attachments/20170623/ce7bf268/attachment.html>


More information about the swift-build-dev mailing list