Skip to content

Instantly share code, notes, and snippets.

@ankitspd
ankitspd / swift.sublime-build
Created April 21, 2024 14:35
swift.sublime-build
{
"cmd": ["swift", "build"],
"keyfiles": ["Package.swift"],
"variants": [
{
"name": "release",
"cmd": ["swift", "build", "-c", "release"]
},
{
"name": "test",
import Foundation
struct StringCodingKey: CodingKey {
var stringValue: String
init(stringValue: String) {
self.stringValue = stringValue
}
var intValue: Int? { return nil }
init?(intValue: Int) { fatalError() }
}
@ankitspd
ankitspd / server.py
Created October 15, 2016 06:09
Python multithreaded server
#! /usr/bin/env python
# Standard library imports.
from SocketServer import ThreadingMixIn
import BaseHTTPServer
import SimpleHTTPServer
import sys
import json
import os
from os.path import (join, exists, dirname, abspath, isabs, sep, walk, splitext,
#!/bin/sh
set -e
NINJA_RELEASE_ASSERT_DIR="${HOME}/Documents/workspaces/xcode/github/apple/build/Ninja-ReleaseAssert"
SOURCE_ROOT="${HOME}/Documents/workspaces/xcode/github/apple"
echo "Updating sources (except SwiftPM)"
${SOURCE_ROOT}/swift/utils/update-checkout --skip-repository swiftpm
echo "Done updating sources"
protocol DumbTerminalProtocol {
func write(_ string: String)
func endLine()
func flush()
}
protocol RichTerminalProtocol: DumbTerminalProtocol {
var width: Int { get }
func clearLine()
func moveCursor(y: Int)
@ankitspd
ankitspd / .py
Last active June 22, 2016 16:56
import json
import os
import pipes
import subprocess
import sys
import lit.Test
import lit.TestRunner
import lit.formats.base
@ankitspd
ankitspd / make-toolchain.sh
Last active June 6, 2016 17:54
Creates a toolchain on linux from a build created with `./swift/utils/build-script -R --llbuild --swiftpm --foundation --xctest`
#!/bin/sh
set -e
if [ -z "${CONFIGURATION}" ]; then
CONFIGURATION=debug
fi
PLATFORM='unknown'
unamestr=`uname`
client:
name: swift-build
tools: {}
targets:
test: []
default: [<SeaExec.module>, <SeaLib.Foo>, <SeaLib.Bar>, <SeaExec.exe>, <SeaLib.module>]
commands:
/Users/aciid/mycode/swiftpmProjects/SwiftCMixed/.build/debug/SeaExec.build:
tool: mkdir
outputs: [/Users/aciid/mycode/swiftpmProjects/SwiftCMixed/.build/debug/SeaExec.build]
@ankitspd
ankitspd / Lockfile.md
Created March 8, 2016 22:48
Lock file proposal

Lock File for Swift Package Manager

Introduction

A Lockfile file locking the state of resolved dependencies generated by swiftpm.

Motivation

Lockfile file can be helpful in situations like :

$ pkgutil --expand swift-DEVELOPMENT-SNAPSHOT-2016-03-01-a-osx.pkg swift-DEVELOPMENT-SNAPSHOT-2016-03-01-a-osx
$ cd swift-DEVELOPMENT-SNAPSHOT-2016-03-01-a-osx
$ cd swift-DEVELOPMENT-SNAPSHOT-2016-03-01-a-osx-package.pkg
$ mv Payload Payload.zip
$ open .
double click to extract
$ cd Payload\ 2/usr/bin
$ ./swiftc -v
Apple Swift version 3.0-dev (LLVM b361b0fc05, Clang 11493b0f62, Swift 24a0c3de75)