Skip to content
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

Allow For Stand Alone Packaging #302

Closed
brianmichel opened this issue Dec 28, 2015 · 17 comments
Closed

Allow For Stand Alone Packaging #302

brianmichel opened this issue Dec 28, 2015 · 17 comments
Labels
enhancement Ideas for improvements of existing features and rules.

Comments

@brianmichel
Copy link

It seems that SwiftLint relies upon an application as well as associated frameworks to be installed on the host system in order to work.

It would be very valuable to be able to have the entire package distributed in some sort of stand alone, executable package. This way a known, working version of the program can be distributed along with the repository containing the code that requires linting, without the need to distribute a series of binaries to a collection of CI servers.

@brianmichel
Copy link
Author

I would be interested in working on this, if the maintainers feel that this is a valuable request.

@keith
Copy link
Collaborator

keith commented Dec 28, 2015

This would be great. Currently for our fork and our CI server we've started creating and installing the .pkg files. Of course this requires sudo even though products are installed to /usr/local. Any way where we could just use a single executable swiftlint would be amazing.

@brianmichel
Copy link
Author

This would be great. Currently for our fork and our CI server we've started creating and installing the .pkg files. Of course this requires sudo even though products are installed to /usr/local. Any way where we could just use a single executable swiftlint would be amazing.

Agree, I’ll start digging into the source and see what I can come up with.

@scottrhoyt
Copy link
Contributor

The package route seems far easier, but here is the workaround I believe.

@jimmya
Copy link
Contributor

jimmya commented Dec 29, 2015

+1
I'm attempting to install SwiftLint on Xcode Server, but the password for _xcsbuildd is unknown so I can't use the sudo command required for installation.

@norio-nomura
Copy link
Collaborator

sudo is required by calling installer -pkg SwiftLint.pkg -target /.
You can install SwiftLint without sudo by make prefix_install that is used on Homebrew installation.

@norio-nomura
Copy link
Collaborator

@scottrhoyt Requiring sudo is not depends on where frameworks and executable are placed. sudo is required by installer for writing .pkg information into /var/db/receipts that directory is used by -target /.

@keith
Copy link
Collaborator

keith commented Dec 29, 2015

@norio-nomura right but doing make prefix_install on CI adds ~3 minutes for us. Where installing the .pkg is much faster.

@jpsim
Copy link
Collaborator

jpsim commented Dec 29, 2015

It seems that SwiftLint relies upon an application as well as associated frameworks to be installed on the host system in order to work.

Yes, the decision to use frameworks was made early on to simplify development.

Ideally, it would be possible to statically link Swift frameworks, thus creating a single executable binary, greatly simplifying the distribution process, but that's not currently possible.

Keeping track of all the source files for all dependencies to compile them in a single binary (i.e. single module) could be an alternative, but the maintenance overhead is discouraging.

I think llbuild supports statically linking packages, but that's not a viable approach until llbuild is generally available.

I would be interested in working on this, if the maintainers feel that this is a valuable request.

I have yet to hear a suitable alternative to the current method. So the first step would be to come up with one, then we can discuss steps to make it happen.

@jpsim jpsim added the enhancement Ideas for improvements of existing features and rules. label Dec 29, 2015
@scottrhoyt
Copy link
Contributor

Until Swift has a stable ABI (which I think is targeted for Swift 3.0), it will most likely be very challenging to go the statically linked route.

In all honesty, I think the most efficient route would be to spend time getting SwiftLint preinstalled whether that be manually on your local Jenkins or Xcode server, or hammering the hosted CI support to add it to their VM images.

@jpsim
Copy link
Collaborator

jpsim commented Dec 29, 2015

Great points @scottrhoyt. Note that you can also do what jazzy does to vendor SourceKitten by downloading or committing the SwiftLint binaries directly: https://github.com/realm/jazzy/tree/master/lib/jazzy/SourceKitten

@jpsim
Copy link
Collaborator

jpsim commented Jan 29, 2016

I'm closing this as I've highlighted ways to package SwiftLint "standalone". For single binary distribution, we'll have to wait for the Swift Package Manager to be officially released.

@jpsim jpsim closed this as completed Jan 29, 2016
@jpsim
Copy link
Collaborator

jpsim commented Jan 29, 2016

Actually, even with SPM, SwiftLint will rely on libSourceKitInProc.dylib, which is a dynamic library. So a single flat binary isn't possible.

@mtage70
Copy link

mtage70 commented Jun 22, 2016

This is probably not the thread to ask but I've been working with SwiftLint for a while now and I'm trying to get my SwiftLint warnings to appear on my CI system's integrations (XcodeServer based). I can install and run SwiftLint just fine on the _xcsbuildd user, yet when my integration completes I get only one warning from the build phase telling me "SwiftLint not installed...". If anyone has any advice it would be greatly appreciated!

@jpsim
Copy link
Collaborator

jpsim commented Jun 22, 2016

@mtage70 SwiftLint's probably not in the _xcsbuildd user's PATH environment

@mtage70
Copy link

mtage70 commented Jun 22, 2016

SwiftLint is located in "/usr/local/bin" which was in _xcsbuildd's PATH but to be sure I added "/usr/local/bin/swiftlint" as well. Unfortunately there was no change in result.

I should mention I can run SwiftLint from the terminal under _xcsbuildd as well get the output of Swiftlint in my bot's pre-run trigger script.

@jpsim
Copy link
Collaborator

jpsim commented Jun 22, 2016

@mtage70 could you please open a new issue, since your reports are unrelated to this ticket.

Please also share the contents of your Xcode project's SwiftLint build script phase.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Ideas for improvements of existing features and rules.
Projects
None yet
Development

No branches or pull requests

7 participants