building/buildutil

Types

BuildContext = object
  projectPath*: string       ## . when in the wiish project
  targetOS*: TargetOS
  targetFormat*: TargetFormat
  releaseBuild*: bool
  doSigning*: bool
  verbose*: bool
  config*: WiishConfig
  currentStep*: BuildStep
  currentPlugin*: string
  dist_dir*: string          ## Directory where built output goes (final products)
  build_dir*: string         ## Path where intermediate build files live
  executable_path*: string ## For builds that produce an executable, this is the path
                           ## to that executable
  xcode_project_root*: string ## the dir containing the .xcodeproj file
  xcode_build_scheme*: string ## the -scheme to build
  xcode_build_destination*: string ## the -destination to build
  ios_sdk_version*: string
  nim_flags*: seq[string]    ## Flags that should be set when compiling Nim code.
                             ## Includes the flags from the config.
  nim_run_flags*: seq[string] ## Flags that should be set when running Nim code for targetRun
  
The context for all builds
BuildPlugin = concept p
    p.name() is string
    p.runStep(BuildStep, ref BuildContext)
BuildStep = enum
  Setup, PreCompile, Compile, PostCompile, PreBuild, Build, PostBuild,
  PrePackage, Package, PostPackage, PreSign, Sign, PostSign, PreNotarize,
  Notarize, PostNotarize, Run
List of steps that are executed during a build
TargetFormat = enum
  targetAuto = "auto", targetRun = "run", targetMacApp = "app",
  targetMacDMG = "dmg", targetWinExe = "exe",
  targetWinInstaller = "win-installer", targetIosApp = "ios-app",
  targetIosIpa = "ios-ipa", targetAndroidApk = "apk", targetLinuxBin = "bin"
TargetOS = enum
  AutoDetectOS = "auto", Android = "android", Ios = "ios",
  IosSimulator = "ios-simulator", MobileDev = "mobiledev", Linux = "linux",
  Mac = "mac", Windows = "windows"

Consts

ios_sdk_root = "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/"
simulator_sdk_root = "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/"

Procs

proc desktop(ctx: ref BuildContext): bool {....raises: [], tags: [].}
Return true if this build is for a desktop OS
proc getWiishPackageRoot(): string {....raises: [Exception, IOError, OSError], tags: [
    ExecIOEffect, ReadIOEffect, RootEffect].}
proc ios_sdk_path(ctx: ref BuildContext): string {....raises: [], tags: [].}
Given an sdk version, return the path to the SDK
proc log(ctx: ref BuildContext; msg: varargs[string]) {....raises: [IOError],
    tags: [WriteIOEffect].}
proc logStartStep(ctx: ref BuildContext) {....raises: [IOError, ValueError],
    tags: [WriteIOEffect].}
proc main_nim(ctx: ref BuildContext): string {.inline, ...raises: [], tags: [].}
Absolute path to the main nim file to build
proc newBuildContext(): ref BuildContext {....raises: [], tags: [].}
proc parseTargetFormat(x: string): TargetFormat {.inline, ...raises: [], tags: [].}
proc parseTargetOS(x: string): TargetOS {.inline, ...raises: [], tags: [].}
proc resizePNG(srcfile: string; outfile: string; width: int; height: int;
               removeAlpha = false) {....raises: [PixieError, IOError], tags: [
    RootEffect, ReadIOEffect, WriteIOEffect].}
proc sh(args: varargs[string, `$`]) {....raises: [OSError, Exception,
    CatchableError], tags: [ExecIOEffect, ReadEnvEffect, RootEffect].}
Run a process, failing the program if it fails
proc shoutput(args: varargs[string, `$`]): string {.
    ...raises: [Exception, IOError, OSError],
    tags: [ExecIOEffect, ReadIOEffect, RootEffect].}
Run a process and return the output as a string
proc simulator(ctx: ref BuildContext): bool {.inline, ...raises: [], tags: [].}
Return whether this build is for the iOS simulator or not.
proc viableTargets(os: TargetOS): set[TargetFormat] {....raises: [], tags: [].}
Return the TargetFormats that can be built for the given TargetOS
proc xcode_project_file(ctx: ref BuildContext): string {....raises: [OSError],
    tags: [ReadDirEffect].}
Find the name of the xcode project

Templates

template mobile(ctx: ref BuildContext): bool
Return true if this build is for a mobile OS
template withDir(dir: string; body: untyped): untyped
Execute a block of code within another directory.