mxcl / swift-sh

Easily script with third-party Swift dependencies.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Package not regenerated if you change the import reference

JetForMe opened this issue · comments

commented

I can't remember exactly how I got into this state, but I had done swift sh edit <my script. Then in Xcode I added

import Path // @mxcl ~> 1.4.0`

but it couldn't fetch the dependency. I re-read the docs, and saw I needed

import Path // mxcl/Path.swift ~> 1.4.0

(and the first time I tried this, I used @mxcl/Path.swift, not sure if that contributed).

Anyway, long story short, it seems once the project was open in Xcode, making changes to the comment and running either in Xcode or on the command line (with ./my-script.sh) didn't update things, and it couldn't find the dependency.

Once I did swift sh edit my-script.sh, it finally updated Package.swift to reflect the proper URL.

UPDATE: No, I take it back. It updated the Xcode package, but I still can't run it from the terminal:

$ ./inst-rom.sh 
inst-rom.sh:3:8: error: no such module 'Path'
import Path                             // https://github.com/mxcl/Path.swift.git ~> 1.4.0
       ^

I deleted the swift-sh cache directory entirely and tried executing my script on the command line, and it doesn't work. Is there another cache somewhere?

$ ./inst-rom.sh 
inst-rom.sh:3:8: error: no such module 'Path'
import Path                             // mxcl/Path.swift ~> 1.4.0
       ^
#!/usr/bin/env swift

import Path				// mxcl/Path.swift ~> 1.4.0


print("hello world \(Path.cwd)")
commented

Ugh, nevermind, I see what happened. Somehow dropped the sh from the shebang line.