brim-borium/spotify_sdk

Can't install dependency on iOS

Closed this issue · 8 comments

Describe the bug
I just added the dependency as explained on the guide, but I'm getting an error related to ./prepare-iOS-SDK.sh

To Reproduce
Steps to reproduce the behavior:

  1. flutter pub pub add spotify_sdk
  2. open iOS Simulator
  3. flutter run

Expected behavior
It should start the app

Desktop (please complete the following information):

  • OS: Mac OS 10.15.7

Smartphone (please complete the following information):

  • Device: iPhone 11 Pro Simulator

Additional context
Here is the output for flutter run:

Launching lib/main.dart on iPhone 11 Pro in debug mode...
Running pod install...                                              3,3s
CocoaPods' output:
↳
      Preparing

    Analyzing dependencies

    Inspecting targets to integrate
      Using `ARCHS` setting to build architectures of target `Pods-Runner`: (``)

    Fetching external sources
    -> Fetching podspec for `Flutter` from `Flutter`
    -> Fetching podspec for `spotify_sdk` from `.symlinks/plugins/spotify_sdk/ios`

    Resolving dependencies of `Podfile`
      CDN: trunk Relative path: CocoaPods-version.yml exists! Returning local because checking is only
      perfomed in repo update

    Comparing resolved specification to the sandbox manifest
      A Flutter
      A spotify_sdk

    Downloading dependencies

    -> Installing Flutter (1.0.0)

    -> Installing spotify_sdk (0.0.1)
     > Running prepare command
       $ /bin/bash -c  set -e ./prepare-iOS-SDK.sh
    [!] /bin/bash -c
    set -e
    ./prepare-iOS-SDK.sh

    /bin/bash: ./prepare-iOS-SDK.sh: /bin/sh^M: bad interpreter: No such file or directory

    
Error output from CocoaPods:
↳
       /bin/bash: ./prepare-iOS-SDK.sh: /bin/sh^M: bad interpreter: No such file or directory

Thanks for the report. The issue seems to be the line endings within the prepare-iOS-SDK.sh script. This commands fixes it sed -i '' $'s/\r//' prepare-iOS-SDK.sh. However this file has not changed since 2020 and it used to work so there must be an update in the tooling that caused this. We will have to investigate a bit more.

OK I think I am getting somewhere. In the last release for some reason it is broken.

If I go on https://pub.dev/packages/spotify_sdk/versions and download 1.0.2, prepare-iOS-SDK.sh has LF (Unix) line endings but if I download 2.0.0, the same file has CRLF (Windows) line endings which makes the script fail.

At the same time the file has the correct LF line endings on GitHub.

@brim-borium I will need your help with this as I have never released a package on pub.dev myself. Do you point it to the repo and it checkouts out the code by itself or do you upload the code manually from your computer? Can it be that you are working on Windows and somehow the file got messed up there before creating the release?

For a release I just check out the main branch and release from the terminal. Working on a macbook. So this is very weird... We can check for the 2.1.0 release of this is still happening.

Release process
https://flutter.dev/docs/development/packages-and-plugins/developing-packages#publish

I had the same issue using v2.0.0 from pub.dev, but using the main branch everything works perfectly.

  spotify_sdk:
    git:
      url: git://github.com/brim-borium/spotify_sdk.git
      ref: main

For a release I just check out the main branch and release from the terminal. Working on a macbook. So this is very weird... We can check for the 2.1.0 release of this is still happening.

Release process
https://flutter.dev/docs/development/packages-and-plugins/developing-packages#publish

Let's check a couple things before releasing 2.1.0. After checking out the repo can you open prepare-iOS-SDK.sh in VSCode and check the status bar if it reports LF or CRLF?
Screenshot 2021-04-13 at 08 09 19

Can it be that you have a.gitattributes somewhere, either in the repo or globally that changes line endings like the example here?

So this is LF for me in vs code and also android studio. And I could not find any .gitattribute local or globally 🤷

Released the new version 2.1.0 and when downloading the package from pub.dev the mentioned file has the correct line ending

@fotiDim can you check if this is solved now?

Yes looks good