Vapor unable to deploy to Heroku: We don't have build instructions for 5.3 - swift

I was able to commit the changes to my Heroku repo but when I push it it shows the following errors:
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Swift app detected
remote: -----> Using Swift 5.3 (from .swift-version file)
remote: -----> Using built-in clang (Swift 5.3)
remote: -----> Installing swiftenv
remote: -----> Installing Swift 5.3
remote: We don't have build instructions for 5.3.
remote: ! Push rejected, failed to compile Swift app.
remote:
remote: ! Push failed
I used the following commands:
$ git add .
$ git commit -am "make it better"
$ git push heroku master
I also changed the buildpack to vapor/vapor:
heroku buildpacks:set vapor/vapor
Why is this error happening, and how can I fix it?
I have even changed the swift version by following commands
echo "5.1.3" > .swift-version
git add .
git commit -m "Done"
and pushed it but it to Heroku shows the following error
package at '/tmp/build_8e6b47bc' is using Swift tools version 5.2.0 but the installed version is 5.1.0

Swift 5.3 doesn't appear to have been released yet, and the only Vapor buildpacks that I can find don't yet support it.
I think you're using this buildpack that uses Swift version 5.1.3 in its current documentation. Try reducing your Swift version to that (by editing your .swift-version file and committing) and redeploying.
Edit: Your new error indicates a Swift Tools version mismatch. I don't program in Swift, but it looks like this is defined by a line in your Package.swift file and that it is related to your Swift version:
The very first line of a package manifest indicates the Swift tools version required. This specifies the minimum version of Swift that the package supports. The Package description API may also change between Swift versions, so this line ensures Swift will know how to parse your manifest.
Try changing
// swift-tools-version:5.2
to
// swift-tools-version:5.1
then commit and redeploy.
I also recommend making sure that you are using the same version of Swift locally for development as you're targeting on the server.

Related

I am trying to install Vapor on my raspberrypi but getting strange errors

I am running Raspbian and have so far installed Swift 5.1.5 and cloned Vapor Branch 18.0.0 beta 27. I can't seem to get version 5.2 of Swift installed on my system somehow.
Nonetheless, the next step is to build Vapor, but it gives me the following error:
sudo swift build -c release
Updating https://github.com/jpsim/Yams.git
Updating https://github.com/apple/swift-nio.git
Updating https://github.com/vapor/console-kit.git
Updating https://github.com/apple/swift-log.git
Updating https://github.com/tanner0101/mustache.git
https://github.com/apple/swift-nio.git # master: error: terminated(128): git -C /home/pi/Downloads/toolbox/.build/repositories/swift-nio-b68c973e rev-parse --verify 'master^{commit}' output:
fatal: Needed a single revision
Not sure where to go from there, can't find any relevant info online.
Vapor 4 and the new toolbox all require Swift 5.2 - you'll need to get the installed before anything else.
Next that's an old version of the toolbox, you can find the latest release at https://github.com/vapor/toolbox/releases
Finally, the chances are you don't need the toolbox. It's used for creating new projects. If you just want to build or run existing ones, just use the swift commands

Installing Spritebuilder from source

I am trying to install spritebuilder but since it is no longer on the app store I have to do it through github. I ran the following code from the readme file on github.
git clone https://github.com/apportable/SpriteBuilder
cd SpriteBuilder
git submodule update --init --recursive
cd scripts
./build_distribution.py --version 1.x
but it keeps returning the error:
Testing failed:
Error: There is no SDK with the name or path '/Users/username/SpriteBuilder/scripts/SpriteBuilder/SpriteBuilder/macosx10.9'
** TEST FAILED **
The following build commands failed:
Check dependencies
(1 failure)
Am I doing something wrong? I went into the build folder despite the error and the .app is not able to be opened, saying it may be incomplete or corrupt.
I found a workaround by downloading Spritebuilder from a mirror hosting site.

Alamofire not working well with swift 3

I have a project written by swift 2.
I updated to swift 3, I'm using Alamofire and swiftyjson
so I updated their by cocoapods and I fixed all my project issues,
after all that I got this error about Alamofire
The following binaries use incompatible versions of Swift:
also I have these warnings
this is my pod file
this what I see in terminal after pod update
Update all pods
Updating local specs repositories
CocoaPods 1.2.0.beta.1 is available.
To update use: `sudo gem install cocoapods --pre`
[!] This is a test version we'd love you to try.
For more information, see https://blog.cocoapods.org and the CHANGELOG for this version at https://github.com/CocoaPods/CocoaPods/releases/tag/1.2.0.beta.1
Analyzing dependencies
Downloading dependencies
Using Alamofire (4.0.1)
Using DropDown (2)
Using SideMenu (2.0.5)
Using SwiftyJSON (3.1.1)
Generating Pods project
Integrating client project
Sending stats
Pod installation complete! There are 4 dependencies from the Podfile and 4 total pods installed.
[!] The `ehtamiApp [Debug]` target overrides the `EMBEDDED_CONTENT_CONTAINS_SWIFT` build setting defined in `Pods/Target Support Files/Pods-ehtamiApp/Pods-ehtamiApp.debug.xcconfig'. This can lead to problems with the CocoaPods installation
- Use the `$(inherited)` flag, or
- Remove the build settings from the target.
[!] The `ehtamiApp [Release]` target overrides the `EMBEDDED_CONTENT_CONTAINS_SWIFT` build setting defined in `Pods/Target Support Files/Pods-ehtamiApp/Pods-ehtamiApp.release.xcconfig'. This can lead to problems with the CocoaPods installation
- Use the `$(inherited)` flag, or
- Remove the build settings from the target.
what is that mean? and how I can fix it?

Swift 3 compiler in terminal

I've downloaded the Xcode 8.0 beta, which includes the updated Swift 3 compiler. Is it possible to use the Swift 3 compiler on the terminal?
For example, I can use the "Swift (filename)" command to compile and run Swift 2.2 code in the terminal.
The command line compiler for Swift is called swiftc. The -h option will show you the command line options.
The command line tool swift is the interactive version of the language.
To pick the version to use, use xcode-select. e.g.
sudo xcode-select -s /Applications/Xcode-beta.app/Contents/Developer/
TL;DR
Since you've already got Xcode 8 beta installed, this should work:
/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift
Smoke Test
$ /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -v
Apple Swift version 3.0 (swiftlang-800.0.30 clang-800.0.24)
...
Detailed Example
Here's a complete example using the example code for the Swift Package Manager.
$ git clone https://github.com/apple/example-package-dealer
Cloning into 'example-package-dealer'...
remote: Counting objects: 21, done.
remote: Total 21 (delta 0), reused 0 (delta 0), pack-reused 21
Unpacking objects: 100% (21/21), done.
Checking connectivity... done.
$ cd example-package-dealer/
$ /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift build
Cloning https://github.com/apple/example-package-deckofplayingcards.git
HEAD is now at 0879cff Merge pull request #1 from kostiakoval/master
...
Compile Swift Module 'Dealer' (1 sources)
Linking .build/debug/Dealer
$ .build/debug/Dealer
♣︎7
♠︎7
♠︎Q
♢3
♡6
♡7
♣︎K
♡K
♢2
♢8

Deploy Play app on Heroku from a subdirectory of git repo

I want to deploy a Play 2.0.4 app on Heroku using git push heroku master but I have moved the play root folder into a sub folder of my git repo. Is there a way to deploy from there?
Currently it misidentifies my project as a 1.2.4 Play app, then the compilation and the deployment fails.
-----> Play! app detected
-----> WARNING: Play! version not specified in dependencies.yml. Default version: 1.2.4 being used....
-----> Installing Play! 1.2.4.....
-----> done
-----> Installing ivysettings.xml..... done
-----> Building Play! application...
Install this git plugin.
https://github.com/apenwarr/git-subtree
Run "git subtree push --prefix **subfolder with app" heroku master"
You can add the version of Play you would like to a conf/dependencies.yml file your repo.
dependencies.yml:
# Application dependencies
require:
- play 2.0.4
It will then load the correct Play version.
I had the same issue, surprisingly no generic solution found. So I wrote a buildpack myself. Hope it is helpful
https://github.com/timanovsky/subdir-heroku-buildpack