Skip to content

Instantly share code, notes, and snippets.

@X140Yu
Forked from lexrus/auto-run.swift
Last active July 1, 2019 09:27
Show Gist options
  • Save X140Yu/29e194ef8f22807ae71f51391b69668a to your computer and use it in GitHub Desktop.
Save X140Yu/29e194ef8f22807ae71f51391b69668a to your computer and use it in GitHub Desktop.
每次执行 script.swift 都会检查是否需要重新编译,最后会执行编译后的 script.swiftc。
/*/../usr/bin/true
source="$0"
compiled="$0"c
if [[ "$source" -nt "$compiled" ]]; then
DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer xcrun swiftc -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -g "$source" -o "$compiled" || exit
fi
"$compiled"
exit
*/
print("👍")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment