Closed loganwright closed 8 years ago
Hi @LoganWright, there are currently two hooks.
You can place an executable in bin/post_compile
or bin/pre_compile
and it will be executed. pre_compile is actually before we've downloaded Swift. Would either of these hooks be ran at the correct time for you to use?
@kylef thanks for getting back so quick, I think I found those originally but I remember having trouble getting them to work, it may be may lack of bash experience so let me have another go at it.
For the specific use case above, I don't think this will solve it, but it's also not the most general use case so I don't want to go out of our way to add unnecessary complexity.
swift build --fetch
// run script here
swift build -c release
I need to modify folders that will be in the Packages/
directory. to remove extraneous targets, and that'll likely get handled by spm in future.
Thanks!
Okay, this wouldn't be possible at the moment due to the hooks being either too early or two late in the process. Let me give this a think and I'll try prepare something this afternoon.
okay, 4edf2ff changes when the pre_compile
hook is ran. You can now manually fetch and delete whatever you need to. swift build
we be ran afterwards so you won't need to do that step.
#!/usr/bin/env bash
set -e
swift build --fetch
// TODO: delete X
Here's my current use case:
Some packages have extra targets for development etc. that are being built and taking a long time. I can rm these packages after fetching, but I need a way to hook into heroku after fetching but before compile. I'd like to work out a way to do it within this buildpack so we don't have to fragment.
Is there a way I can do this now, or would a PR be appreciated?
Because swiftenv is installed, we can do something that is kind of cool and actually make the before/after scripts swift so you can add a
before-compile.swift
and aafter-compile.swift
that run on heroku accordingly.If the feature isn't already present, let me know what you think and I could put together a PR.
Thanks,
Logan