tsolomko / SWCompression

A Swift framework for working with compression, archives and containers.
MIT License
233 stars 39 forks source link

Error using SPM #6

Closed daSkier closed 4 years ago

daSkier commented 5 years ago

Hi,

I'm new to SWCompression, so I'm just trying to get it setup with a Swift Package Manager project and I'm running into an issue when compiling.

Showing All Messages
: terminated(1): /Applications/Xcode-beta.app/Contents/Developer/usr/bin/git -C /Users/js/code/SPMTestProj/SPMTest/DerivedData/SPMTest/SourcePackages/checkouts/SWCompression submodule update --init --recursive output:
    Submodule 'Tests/Test Files' (https://github.com/tsolomko/SWCompression-Test-Files.git) registered for path 'Tests/Test Files'
    Cloning into '/Users/js/code/SPMTestProj/SPMTest/DerivedData/SPMTest/SourcePackages/checkouts/SWCompression/Tests/Test Files'...
    git: 'lfs' is not a git command. See 'git --help'.

    The most similar command is
        log
    error: external filter 'git lfs smudge %f' failed 1
    error: external filter 'git lfs smudge %f' failed
    fatal: 7z/SWCompressionSourceCode.7z: smudge filter lfs failed
    Unable to checkout '543e5bc90d065c9cac22e501cff97d5c4489ce45' in submodule path 'Tests/Test Files'

A couple of notes:

Thanks for any help you can provide.

daSkier commented 5 years ago

I forked the repo and removed the submodule and the "Test Files" folder from the project and it seems to resolve this problem. I don't know why this would be the case because I believe SPM supports submodules, but none the less it fixes the issue I was seeing.

I haven't gotten to test functionality yet to see if anything is broken as a result, but wanted to give the update.

tsolomko commented 5 years ago

Hi,

What you are experiencing is the weird relationship between SPM and Git LFS. I use Git LFS to store all the example files that are used by tests. I've put them into a separate git submodule exactly because I've tried to solve this problem. I was hoping that it would work since it seemed to me that SPM kinda ignores submodules (at least, at the time when I created the submodule). Apparently, it didn't work.

Somewhat easy solution that will fix the issue for you is to install Git LFS. Ideally, I would like to find a way to somehow prevent SPM from downloading the submodule, or, at least from trying to download git-lfs'd files. Currently, I am not aware of any methods to do so.

daSkier commented 5 years ago

Hi @tsolomko ,

Thanks for getting back to me. I tracked this down a little bit further. It appears that if you use SPM from the command line everything works as planned. I was actually seeing the error when using SPM from the new Xcode 11 betas.

As I said, everything is working when I use Swift/SPM from terminal, so it may be worth adding a small note about this in the project ReadMe.

Thanks again!

vookimedlo commented 5 years ago

All,

I can confirm that SWCompression could be managed by the new XCode-Beta 11.0 Beta 5 flawlessly.

The only need is to link git-lfs executable to the Xcode-beta.app. See https://stackoverflow.com/questions/57055604/xcode-11-swift-package-manager-unable-resolve-packages

Initially, you need to install git-lfs to your system. I use brew.

brew install git-lfs
quentinfasquel commented 3 years ago

@vookimedlo are you certain you get Xcode SPM working with git-lfs files ?

vookimedlo commented 3 years ago

@quentinfasquel XCode 11 beta didn't have the git-lfs executable bundled inside its app package. So, the solution I described worked for me at that time. With this in place, the SWCompression worked without any issue.