This repository has been archived by the owner on Mar 26, 2023. It is now read-only.
Clone swiftenv manually if .git folder has been removed. #37
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I was trying to use
heroku-buildpack-swift
as the buildpack for a server-side swift web app when deploying it to Pivotal Web Services (PWS), a large instance of Pivotal Cloud Foundry.I try to deploy my app using something like:
It appears that PWS removes the
.git
folder when it downloads the custom buildpack, so asking the buildpack to initialize it's submodules to bring inswiftenv
doesn't work and thebin/compile
script dies without successfully configuring the instance or deploying the web app.I'm proposing a work-around in this PR that checks for the existence of the
.git
folder before attempting to initialize the git submodules. If it can't find them, it goes and manually clonesswiftenv
and gets it onto thePATH
in the same way initializingswiftenv
as a submodule would. Using this fork/PR I was able to successfully deploy my swift app on PWS.I'm a total novice at buildpacks so please feel free to reject or request any amendments. As it stands now, the diff is quite small and seems to allow a single buildpack to deploy swift 4.0 applications to both heroku and PWS (and possibly other cloud foundry instances, haven't tested).
CC'ing @drnic @briancroom because it appears that You Might Care™ based on Cursory Internet Research®