<commit_before>import nake
import tables
import jester, asyncdispatch, browsers, closure_compiler # Stuff needed for JS target

let appName = "MyGame"
let bundleId = "com.mycompany.MyGame"
let javaPackageId = "com.mycompany.MyGame"

let androidSdk = "~/Library/Android/sdk"
let androidNdk = "~/Library/Android/sdk/ndk-bundle"
let sdlRoot = "~/Projects/SDL"

# This should point to the Nim include dir, where nimbase.h resides.
# Needed for android only
let nimIncludeDir = "~/Projects/nim/lib"

let macOSSDKVersion = "10.11"
let macOSMinVersion = "10.6"

let iOSSDKVersion = "9.1"
let iOSMinVersion = iOSSDKVersion

# Simulator device identifier should be set to run the simulator.
# Available simulators can be listed with the command:
# $ xcrun simctl list
let iOSSimulatorDeviceId = "18BE8493-7EFB-4570-BF2B-5F5ACBCCB82B"

let bundleName = appName & ".app"

let parallelBuild = "--parallelBuild:1"
let nimVerbose = "--verbosity:0"

var runOption = "--run"

let xCodeApp = "/Applications/Xcode.app"

let macOSSDK = xCodeApp/"Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX" & macOSSDKVersion & ".sdk"
let iOSSDK = xCodeApp/"Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS" & iOSSDKVersion & ".sdk"
let iOSSimulatorSDK = xCodeApp/"Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator" & iOSSDKVersion & ".sdk"

when defined(Windows):
    const silenceStdout = "2>nul"
else:
    const silenceStdout = ">/dev/null"

if dirExists("../.git"): # Install nimx
    withDir "..":
        direShell "nimble", "-y", "install", silenceStdout

proc infoPlistSetValueForKey(path, value, key: string) =
    direShell "defaults", "write", path, key, value

proc absPath(path: string): string =
    if path.isAbsolute(): path else: getCurrentDir() / path

proc makeBundle() =
    removeDir bundleName
    createDir bundleName
    for t, p in walkDir("res"):
        if t == pcDir:
            copyDir(p, bundleName / extractFilename(p))
        else:
            copyFile(p, bundleName / extractFilename(p))
    moveFile "main", bundleName / "main"
    let infoPlistPath = absPath(bundleName / "Info")
    infoPlistSetValueForKey(infoPlistPath, appName, "CFBundleName")
    infoPlistSetValueForKey(infoPlistPath, bundleId, "CFBundleIdentifier")

proc trySymLink(src, dest: string) =
    try:
        createSymlink(src, dest)
    except:
        discard

proc createSDLIncludeLink(dir: string, preferInstalledSDL: bool) =
    createDir dir
    if preferInstalledSDL and dirExists("/usr/local/include/SDL2"):
        trySymLink("/usr/local/include/SDL2", dir/"SDL2")
    else:
        trySymLink(sdlRoot/"include", dir/"SDL2")<commit_msg>Fixed SDL symlink when sdlroot starts with tilde<commit_after>import nake
import tables
import jester, asyncdispatch, browsers, closure_compiler # Stuff needed for JS target

let appName = "MyGame"
let bundleId = "com.mycompany.MyGame"
let javaPackageId = "com.mycompany.MyGame"

let androidSdk = "~/Library/Android/sdk"
let androidNdk = "~/Library/Android/sdk/ndk-bundle"
let sdlRoot = "~/Projects/SDL"

# This should point to the Nim include dir, where nimbase.h resides.
# Needed for android only
let nimIncludeDir = "~/Projects/nim/lib"

let macOSSDKVersion = "10.11"
let macOSMinVersion = "10.6"

let iOSSDKVersion = "9.1"
let iOSMinVersion = iOSSDKVersion

# Simulator device identifier should be set to run the simulator.
# Available simulators can be listed with the command:
# $ xcrun simctl list
let iOSSimulatorDeviceId = "18BE8493-7EFB-4570-BF2B-5F5ACBCCB82B"

let bundleName = appName & ".app"

let parallelBuild = "--parallelBuild:1"
let nimVerbose = "--verbosity:0"

var runOption = "--run"

let xCodeApp = "/Applications/Xcode.app"

let macOSSDK = xCodeApp/"Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX" & macOSSDKVersion & ".sdk"
let iOSSDK = xCodeApp/"Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS" & iOSSDKVersion & ".sdk"
let iOSSimulatorSDK = xCodeApp/"Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator" & iOSSDKVersion & ".sdk"

when defined(Windows):
    const silenceStdout = "2>nul"
else:
    const silenceStdout = ">/dev/null"

if dirExists("../.git"): # Install nimx
    withDir "..":
        direShell "nimble", "-y", "install", silenceStdout

proc infoPlistSetValueForKey(path, value, key: string) =
    direShell "defaults", "write", path, key, value

proc absPath(path: string): string =
    if path.isAbsolute(): path else: getCurrentDir() / path

proc makeBundle() =
    removeDir bundleName
    createDir bundleName
    for t, p in walkDir("res"):
        if t == pcDir:
            copyDir(p, bundleName / extractFilename(p))
        else:
            copyFile(p, bundleName / extractFilename(p))
    moveFile "main", bundleName / "main"
    let infoPlistPath = absPath(bundleName / "Info")
    infoPlistSetValueForKey(infoPlistPath, appName, "CFBundleName")
    infoPlistSetValueForKey(infoPlistPath, bundleId, "CFBundleIdentifier")

proc trySymLink(src, dest: string) =
    try:
        createSymlink(expandTilde(src), dest)
    except:
        discard

proc createSDLIncludeLink(dir: string, preferInstalledSDL: bool) =
    createDir dir
    if preferInstalledSDL and dirExists("/usr/local/include/SDL2"):
        trySymLink("/usr/local/include/SDL2", dir/"SDL2")
    else:
        trySymLink(sdlRoot/"include", dir/"SDL2")
{'fraction_non_alphanumeric': 0.11732254505332843, 'fraction_numerical': 0.011769032732622288, 'mean_word_length': 4.170152091254753, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2179703', 'n_tokens_mistral': 1905, 'n_tokens_neox': 1770, 'n_words': 440}