forked from samdze/playdate-nim
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
378 additions
and
267 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# begin Nimble config (version 2) | ||
when withDir(thisDir(), system.fileExists("nimble.paths")): | ||
include "nimble.paths" | ||
# end Nimble config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
*.pdx | ||
source/pdex.* | ||
*.dSYM | ||
playdate_example.pdx.zip | ||
playdate_example.pdx | ||
source/pdxinfo |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import std/[parseopt, strutils, os, macros, options] | ||
import playdate/build/[utils, actions] | ||
|
||
type | ||
BuildCommand = enum device, simulate, simulator, clean, bundle | ||
## The various actions that can be executed by this script | ||
|
||
CliConfig = object | ||
## Configurations collected from the Cli | ||
command: BuildCommand | ||
noAutoConfig: bool | ||
sdkPath: Option[string] | ||
extraArgs: seq[string] | ||
|
||
proc getCliConfig(): CliConfig = | ||
## Parses the build configuration from the input options | ||
for kind, key, val in getopt(): | ||
template addExtraArg() = | ||
var command = if kind == cmdLongOption: "--" else: "-" | ||
command &= key | ||
if val != "": | ||
command &= ":" & val | ||
result.extraArgs.add(command) | ||
|
||
case kind | ||
of cmdArgument: | ||
result.command = parseEnum[BuildCommand](key) | ||
of cmdLongOption, cmdShortOption: | ||
case key | ||
of "sdk-path": result.sdkPath = some(val) | ||
of "no-auto-config": result.noAutoConfig = true | ||
else: addExtraArg() | ||
of cmdEnd: | ||
discard | ||
|
||
let build = getCliConfig() | ||
|
||
let dump = getNimbleDump() | ||
|
||
let conf = PlaydateConf( | ||
dump: dump, | ||
kind: if build.command == device: DeviceBuild else: SimulatorBuild, | ||
sdkPath: sdkPath(build.sdkPath), | ||
pdxName: dump.name & ".pdx", | ||
nimbleArgs: build.extraArgs, | ||
noAutoConfig: build.noAutoConfig | ||
) | ||
|
||
case build.command | ||
of device, simulate, simulator: | ||
conf.configureBuild() | ||
of clean, bundle: | ||
discard | ||
|
||
case build.command | ||
of simulator: | ||
conf.simulatorBuild() | ||
of simulate: | ||
conf.simulatorBuild() | ||
conf.runSimulator() | ||
of device: | ||
conf.deviceBuild() | ||
of clean: | ||
conf.runClean() | ||
of bundle: | ||
conf.bundlePDX() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.