Add passNim/p flag to pass compiler flags explicitly.
Remove redundant buildFromDir overload.
This commit is contained in:
parent
added89acc
commit
5ec2ecea77
2 changed files with 8 additions and 11 deletions
|
|
@ -213,13 +213,13 @@ proc processDeps(pkginfo: PackageInfo, options: Options): seq[PackageInfo] =
|
||||||
for i in reverseDeps:
|
for i in reverseDeps:
|
||||||
addRevDep(options.nimbleData, i, pkginfo)
|
addRevDep(options.nimbleData, i, pkginfo)
|
||||||
|
|
||||||
proc buildFromDir(pkgInfo: PackageInfo, paths: seq[string],
|
proc buildFromDir(pkgInfo: PackageInfo, paths, args: seq[string]) =
|
||||||
args: var seq[string]) =
|
|
||||||
## Builds a package as specified by ``pkgInfo``.
|
## Builds a package as specified by ``pkgInfo``.
|
||||||
if pkgInfo.bin.len == 0:
|
if pkgInfo.bin.len == 0:
|
||||||
raise newException(NimbleError,
|
raise newException(NimbleError,
|
||||||
"Nothing to build. Did you specify a module to build using the" &
|
"Nothing to build. Did you specify a module to build using the" &
|
||||||
" `bin` key in your .nimble file?")
|
" `bin` key in your .nimble file?")
|
||||||
|
var args = args
|
||||||
let realDir = pkgInfo.getRealDir()
|
let realDir = pkgInfo.getRealDir()
|
||||||
for path in paths: args.add("--path:\"" & path & "\" ")
|
for path in paths: args.add("--path:\"" & path & "\" ")
|
||||||
for bin in pkgInfo.bin:
|
for bin in pkgInfo.bin:
|
||||||
|
|
@ -244,14 +244,6 @@ proc buildFromDir(pkgInfo: PackageInfo, paths: seq[string],
|
||||||
exc.hint = hint
|
exc.hint = hint
|
||||||
raise exc
|
raise exc
|
||||||
|
|
||||||
proc buildFromDir(pkgInfo: PackageInfo, paths: seq[string], forRelease: bool) =
|
|
||||||
var args: seq[string]
|
|
||||||
if forRelease:
|
|
||||||
args = @["-d:release"]
|
|
||||||
else:
|
|
||||||
args = @[]
|
|
||||||
buildFromDir(pkgInfo, paths, args)
|
|
||||||
|
|
||||||
proc removePkgDir(dir: string, options: Options) =
|
proc removePkgDir(dir: string, options: Options) =
|
||||||
## Removes files belonging to the package in ``dir``.
|
## Removes files belonging to the package in ``dir``.
|
||||||
try:
|
try:
|
||||||
|
|
@ -356,7 +348,7 @@ proc installFromDir(dir: string, requestedVer: VersionRange, options: Options,
|
||||||
# if the build fails then the old package will still be installed.
|
# if the build fails then the old package will still be installed.
|
||||||
if pkgInfo.bin.len > 0:
|
if pkgInfo.bin.len > 0:
|
||||||
let paths = result.deps.map(dep => dep.getRealDir())
|
let paths = result.deps.map(dep => dep.getRealDir())
|
||||||
buildFromDir(pkgInfo, paths, true)
|
buildFromDir(pkgInfo, paths, options.action.passNimFlags & "-d:release")
|
||||||
|
|
||||||
let pkgDestDir = pkgInfo.getPkgDest(options)
|
let pkgDestDir = pkgInfo.getPkgDest(options)
|
||||||
if existsDir(pkgDestDir) and existsFile(pkgDestDir / "nimblemeta.json"):
|
if existsDir(pkgDestDir) and existsFile(pkgDestDir / "nimblemeta.json"):
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,7 @@ type
|
||||||
of actionInstall, actionPath, actionUninstall, actionDevelop:
|
of actionInstall, actionPath, actionUninstall, actionDevelop:
|
||||||
packages*: seq[PkgTuple] # Optional only for actionInstall
|
packages*: seq[PkgTuple] # Optional only for actionInstall
|
||||||
# and actionDevelop.
|
# and actionDevelop.
|
||||||
|
passNimFlags*: seq[string]
|
||||||
of actionSearch:
|
of actionSearch:
|
||||||
search*: seq[string] # Search string.
|
search*: seq[string] # Search string.
|
||||||
of actionInit, actionDump:
|
of actionInit, actionDump:
|
||||||
|
|
@ -61,6 +62,7 @@ Usage: nimble COMMAND [opts]
|
||||||
Commands:
|
Commands:
|
||||||
install [pkgname, ...] Installs a list of packages.
|
install [pkgname, ...] Installs a list of packages.
|
||||||
[-d, --depsOnly] Install only dependencies.
|
[-d, --depsOnly] Install only dependencies.
|
||||||
|
[-p, --passNim] Forward specified flag to compiler.
|
||||||
develop [pkgname, ...] Clones a list of packages for development.
|
develop [pkgname, ...] Clones a list of packages for development.
|
||||||
Symlinks the cloned packages or any package
|
Symlinks the cloned packages or any package
|
||||||
in the current working directory.
|
in the current working directory.
|
||||||
|
|
@ -175,6 +177,7 @@ proc initAction*(options: var Options, key: string) =
|
||||||
case options.action.typ
|
case options.action.typ
|
||||||
of actionInstall, actionPath, actionDevelop, actionUninstall:
|
of actionInstall, actionPath, actionDevelop, actionUninstall:
|
||||||
options.action.packages = @[]
|
options.action.packages = @[]
|
||||||
|
options.action.passNimFlags = @[]
|
||||||
of actionCompile, actionDoc, actionBuild:
|
of actionCompile, actionDoc, actionBuild:
|
||||||
options.action.compileOptions = @[]
|
options.action.compileOptions = @[]
|
||||||
options.action.file = ""
|
options.action.file = ""
|
||||||
|
|
@ -303,6 +306,8 @@ proc parseFlag*(flag, val: string, result: var Options, kind = cmdLongOption) =
|
||||||
case f
|
case f
|
||||||
of "depsonly", "d":
|
of "depsonly", "d":
|
||||||
result.depsOnly = true
|
result.depsOnly = true
|
||||||
|
of "passnim", "p":
|
||||||
|
result.action.passNimFlags.add(val)
|
||||||
else:
|
else:
|
||||||
wasFlagHandled = false
|
wasFlagHandled = false
|
||||||
of actionUninstall:
|
of actionUninstall:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue