Git Product home page Git Product logo

Comments (12)

mxcl avatar mxcl commented on May 29, 2024 1

I think you edited the PromiseKit specification instead of adding the PMKFoundation specification line I provided.

Anyway it still fails due to a limitation specified in the README. (The PMKFoundation module name is not the same as Package.swift name).

I recommend testing with more conventional libraries, I'll amend the README so it works.

from swift-sh.

mxcl avatar mxcl commented on May 29, 2024 1

K I have fixed the issue that meant importing PMKFoundation wouldn't work, coming in 1.1.3

from swift-sh.

mxcl avatar mxcl commented on May 29, 2024

Does swift build work independently of swift-sh?

from swift-sh.

mgrebenets avatar mgrebenets commented on May 29, 2024

Yep, we've got oneSwift package depending on Result package, running swift build from command line outputs this:

╰─$ swift build
Fetching https://github.com/antitypical/Result.git
Completed resolution in 4.81s
Cloning https://github.com/antitypical/Result.git
Resolving https://github.com/antitypical/Result.git at 3.2.4

The error I get with swift-sh is this at the moment:

╰─$ swift-sh swiftsh.swift
Fetching /Users/bigmac/Library/Developer/swift-sh.cache/swiftsh/mxcl/PromiseKit
error: failed to clone; fatal: repository '/Users/bigmac/Library/Developer/swift-sh.cache/swiftsh/mxcl/PromiseKit' does not exist
'swiftsh' /Users/bigmac/Library/Developer/swift-sh.cache/swiftsh: error: product dependency 'PromiseKit' not found

That's why I assumed that cloning failed, though I'm not 100% sure about that.

I can see Process class being used to run the swift build.
Is that part of Foundation framework or a 3rd party dependency?

from swift-sh.

mxcl avatar mxcl commented on May 29, 2024

This is a bug I fixed a few hours ago, please update.

You will also need to delete the cache:

rm -rf /Users/bigmac/Library/Developer/swift-sh.cache

from swift-sh.

mgrebenets avatar mgrebenets commented on May 29, 2024

I see, I'm on 1.1.1 while there's 1.1.2.
I guess I have to wait until it gets populated?
Running brew install or brew upgrade for mxcl/made/swift-sh tells me 1.1.1 is the latest.

I'll try later anyways, thanks for the help 👍

from swift-sh.

mxcl avatar mxcl commented on May 29, 2024

Ugh, sorry I didn't push to my homebrew tap. It's live now, brew upgrade swift-sh should do it.

I intend to automate the brew part.

Thanks for your patience for the error on my part, thanks for bringing it to my attention!

from swift-sh.

mgrebenets avatar mgrebenets commented on May 29, 2024

Looks good now, get all the source downloaded.
I'm trying to run an example with PromiseKit.
First I had to add Foundation import, since all the basic types would not be found by compiler.

Got it down to this so far:

#!/usr/bin/swift sh

import Foundation
import PromiseKit  // @mxcl ~> 6.5

let url = URL(string: "https://github.com/mxcl/swift-sh")!
let request = URLRequest(url: url)
firstly {
    URLSession.shared.dataTask(.promise, with: request)
}.then {
    after(.seconds(2))
}.done {
    print("Scripts with package dependencies!")
    exit(0)
}

RunLoop.main.run()

However, the PromiseKit extensions for URLSession are note there (according to compiler).

╰─$ swift-sh swiftsh.swift
Compile Swift Module 'swiftsh' (1 sources)
/Users/bigmac/Library/Developer/swift-sh.cache/swiftsh/main.swift:8:23: error: argument labels '(_:, with:)' do not match any available overloads
    URLSession.shared.dataTask(.promise, with: request)
                      ^       ~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/bigmac/Library/Developer/swift-sh.cache/swiftsh/main.swift:8:23: note: overloads for 'dataTask' exist with these partially matching parameter lists: (with: URLRequest, completionHandler: @escaping (Data?, URLResponse?, Error?) -> Void), (with: URL, completionHandler: @escaping (Data?, URLResponse?, Error?) -> Void)
    URLSession.shared.dataTask(.promise, with: request)
                      ^
error: terminated(1): /Applications/Xcode-10.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-build-tool -f /Users/bigmac/Library/Developer/swift-sh.cache/swiftsh/.build/debug.yaml swiftsh.exe output:
    Compile Swift Module 'swiftsh' (1 sources)
    /Users/bigmac/Library/Developer/swift-sh.cache/swiftsh/main.swift:8:23: error: argument labels '(_:, with:)' do not match any available overloads
        URLSession.shared.dataTask(.promise, with: request)
                          ^       ~~~~~~~~~~~~~~~~~~~~~~~~~
    /Users/bigmac/Library/Developer/swift-sh.cache/swiftsh/main.swift:8:23: note: overloads for 'dataTask' exist with these partially matching parameter lists: (with: URLRequest, completionHandler: @escaping (Data?, URLResponse?, Error?) -> Void), (with: URL, completionHandler: @escaping (Data?, URLResponse?, Error?) -> Void)
        URLSession.shared.dataTask(.promise, with: request)

This is unlrelated to the original issue though.

from swift-sh.

mxcl avatar mxcl commented on May 29, 2024

Oh my bad, the example script needs:

import PMKFoundation  // PromiseKit/Foundation ~> 3

from swift-sh.

mgrebenets avatar mgrebenets commented on May 29, 2024

Cool, though doesn't look like v3 has SPM manifest:

Updating https://github.com/mxcl/PromiseKit.git
https://github.com/mxcl/PromiseKit.git @ 3.5.3: error: https://github.com/mxcl/PromiseKit.git has no manifest for version 3.5.3

from swift-sh.

mxcl avatar mxcl commented on May 29, 2024

Sorry for the issues, I literally started this project about 30 hours ago. Heh. LMK if you have any other troubles.

from swift-sh.

mxcl avatar mxcl commented on May 29, 2024

Like here's a simple example script that works:

#!/usr/bin/swift sh
import Foundation
import Result  // @antitypical ~> 4.1

print(Result<Int, CocoaError>.success(3))

from swift-sh.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.