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:
|
||||
addRevDep(options.nimbleData, i, pkginfo)
|
||||
|
||||
proc buildFromDir(pkgInfo: PackageInfo, paths: seq[string],
|
||||
args: var seq[string]) =
|
||||
proc buildFromDir(pkgInfo: PackageInfo, paths, args: seq[string]) =
|
||||
## Builds a package as specified by ``pkgInfo``.
|
||||
if pkgInfo.bin.len == 0:
|
||||
raise newException(NimbleError,
|
||||
"Nothing to build. Did you specify a module to build using the" &
|
||||
" `bin` key in your .nimble file?")
|
||||
var args = args
|
||||
let realDir = pkgInfo.getRealDir()
|
||||
for path in paths: args.add("--path:\"" & path & "\" ")
|
||||
for bin in pkgInfo.bin:
|
||||
|
|
@ -244,14 +244,6 @@ proc buildFromDir(pkgInfo: PackageInfo, paths: seq[string],
|
|||
exc.hint = hint
|
||||
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) =
|
||||
## Removes files belonging to the package in ``dir``.
|
||||
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 pkgInfo.bin.len > 0:
|
||||
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)
|
||||
if existsDir(pkgDestDir) and existsFile(pkgDestDir / "nimblemeta.json"):
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ type
|
|||
of actionInstall, actionPath, actionUninstall, actionDevelop:
|
||||
packages*: seq[PkgTuple] # Optional only for actionInstall
|
||||
# and actionDevelop.
|
||||
passNimFlags*: seq[string]
|
||||
of actionSearch:
|
||||
search*: seq[string] # Search string.
|
||||
of actionInit, actionDump:
|
||||
|
|
@ -61,6 +62,7 @@ Usage: nimble COMMAND [opts]
|
|||
Commands:
|
||||
install [pkgname, ...] Installs a list of packages.
|
||||
[-d, --depsOnly] Install only dependencies.
|
||||
[-p, --passNim] Forward specified flag to compiler.
|
||||
develop [pkgname, ...] Clones a list of packages for development.
|
||||
Symlinks the cloned packages or any package
|
||||
in the current working directory.
|
||||
|
|
@ -175,6 +177,7 @@ proc initAction*(options: var Options, key: string) =
|
|||
case options.action.typ
|
||||
of actionInstall, actionPath, actionDevelop, actionUninstall:
|
||||
options.action.packages = @[]
|
||||
options.action.passNimFlags = @[]
|
||||
of actionCompile, actionDoc, actionBuild:
|
||||
options.action.compileOptions = @[]
|
||||
options.action.file = ""
|
||||
|
|
@ -303,6 +306,8 @@ proc parseFlag*(flag, val: string, result: var Options, kind = cmdLongOption) =
|
|||
case f
|
||||
of "depsonly", "d":
|
||||
result.depsOnly = true
|
||||
of "passnim", "p":
|
||||
result.action.passNimFlags.add(val)
|
||||
else:
|
||||
wasFlagHandled = false
|
||||
of actionUninstall:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue