[swift-build-dev] Swift Package Manager - Support for downloading/installing external dependencies that a Swift Package may have

Ricardo N Olivieri ricardo.olivieri at us.ibm.com
Mon Jan 25 14:31:27 CST 2016


Hello,

We are currently developing a Swift Package that has a dependency on a C 
open source library. This C open source library, on Linux, can be 
installed by executing: ‘apt-get install -y <library-name>’.

Though a developer who wanted to use our Swift Package in their 
application could specify in their Package.swift file the dependency on 
our Swift Package, that would not be enough. The developer would also need 
to execute manually the ‘apt-get install -y <library-name>’. We are 
thinking this extra step will probably dissuade developers from using our 
Swift Package.

We took a quick look around to see what other package management tools are 
doing such as NPM (for NodeJS). While doing this, we ran into the 
following NodeJS module: node-sass (
https://www.npmjs.com/package/node-sass). According to their 
documentation, it is a library that provides binding to libsass, which is 
a library written in C. A NodeJS developer who wants to leverage node-sass 
in their application only has to execute: 'npm install node-sass'. Behind 
the scenes, NPM seems to be executing all the required commands (such as 
apt-get installs) on behalf of the developer for installing any 
dependencies (see
https://gist.github.com/edouard-lopez/503d40a5c1a49cf8ae87). Hence, a 
NodeJS developer is completely abstracted from any low level dependencies 
(e.g. code written in C/C++) that are required and he/she only has to 
execute one command to leverage the NodeJS module (i.e. npm install 
<library-name>).

We are wondering if there are any plans to provide similar functionality 
in the Swift Package Manager. Maybe something along the lines of these two 
points below?

1) Swift Packages can specify dependencies on other libraries that are not 
Swift Packages (such as C libraries). The Swift Package Manager could then 
"parse" this metadata, download and install the corresponding dependencies 
on the system (e.g. by executing apt-get or similar commands). This could 
be part of the Packages.swift file or a new file for specifying 
dependencies that are not Swift Packages.

2) Define a naming convention for a script that, if found inside a Swift 
Package, is executed by the Swift Package Manager. This script could 
contain any set of instructions that should be executed as part of the 
installation of the Swift Package, such as downloading and installing any 
dependencies that the Swift Package needs. For instance, such a file could 
include instructions similar to those found here: 
https://gist.github.com/edouard-lopez/503d40a5c1a49cf8ae87

Any thoughts on this? Thanks.


Regards,
   Ricardo Olivieri
   Software Engineer

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


More information about the swift-build-dev mailing list