Allow Nimble to override the `task` template in nimscript. (#8798)

This commit is contained in:
Dominik Picheta 2018-08-28 22:05:46 +01:00 • committed by Andreas Rumpf
commit 9ad17091cc

View file

@ -305,7 +305,6 @@ template withDir*(dir: string; body: untyped): untyped =
finally: finally:
cd(curDir) cd(curDir)
template `==?`(a, b: string): bool = cmpIgnoreStyle(a, b) == 0
proc writeTask(name, desc: string) = proc writeTask(name, desc: string) =
if desc.len > 0: if desc.len > 0:
@ -313,7 +312,14 @@ proc writeTask(name, desc: string) =
for i in 0 ..< 20 - name.len: spaces.add ' ' for i in 0 ..< 20 - name.len: spaces.add ' '
echo name, spaces, desc echo name, spaces, desc
template task*(name: untyped; description: string; body: untyped): untyped = proc cppDefine*(define: string) =
## tell Nim that ``define`` is a C preprocessor ``#define`` and so always
## needs to be mangled.
builtin
when not defined(nimble):
template `==?`(a, b: string): bool = cmpIgnoreStyle(a, b) == 0
template task*(name: untyped; description: string; body: untyped): untyped =
## Defines a task. Hidden tasks are supported via an empty description. ## Defines a task. Hidden tasks are supported via an empty description.
## Example: ## Example:
## ##
@ -330,12 +336,6 @@ template task*(name: untyped; description: string; body: untyped): untyped =
setCommand "nop" setCommand "nop"
`name Task`() `name Task`()
proc cppDefine*(define: string) =
## tell Nim that ``define`` is a C preprocessor ``#define`` and so always
## needs to be mangled.
builtin
when not defined(nimble):
# nimble has its own implementation for these things. # nimble has its own implementation for these things.
var var
packageName* = "" ## Nimble support: Set this to the package name. It packageName* = "" ## Nimble support: Set this to the package name. It