Allowed specification of what babel packages to install via new categories - 'babel-core', 'babel-extra', and 'babel-all'
This commit is contained in:
parent
269bf8e334
commit
9620893d72
1 changed files with 23 additions and 8 deletions
|
|
@ -223,6 +223,10 @@ proc testStdlib(r: var TResults, pattern, options: string, cat: Category) =
|
||||||
testNoSpec r, makeTest(test, options, cat, actionCompile)
|
testNoSpec r, makeTest(test, options, cat, actionCompile)
|
||||||
|
|
||||||
# ----------------------------- babel ----------------------------------------
|
# ----------------------------- babel ----------------------------------------
|
||||||
|
type PackageFilter = enum
|
||||||
|
pfCoreOnly
|
||||||
|
pfExtraOnly
|
||||||
|
pfAll
|
||||||
|
|
||||||
let
|
let
|
||||||
babelExe = findExe("babel")
|
babelExe = findExe("babel")
|
||||||
|
|
@ -249,7 +253,7 @@ proc getPackageDir(package: string): string =
|
||||||
else:
|
else:
|
||||||
result = commandOutput[0]
|
result = commandOutput[0]
|
||||||
|
|
||||||
iterator listPackages(listAll = false): tuple[name, url: string] =
|
iterator listPackages(filter: PackageFilter): tuple[name, url: string] =
|
||||||
let packageList = parseFile(packageIndex)
|
let packageList = parseFile(packageIndex)
|
||||||
|
|
||||||
for package in packageList.items():
|
for package in packageList.items():
|
||||||
|
|
@ -257,18 +261,25 @@ iterator listPackages(listAll = false): tuple[name, url: string] =
|
||||||
name = package["name"].str
|
name = package["name"].str
|
||||||
url = package["url"].str
|
url = package["url"].str
|
||||||
isCorePackage = "nimrod-code" in normalize(url)
|
isCorePackage = "nimrod-code" in normalize(url)
|
||||||
if isCorePackage or listAll:
|
case filter:
|
||||||
|
of pfCoreOnly:
|
||||||
|
if isCorePackage:
|
||||||
|
yield (name, url)
|
||||||
|
of pfExtraOnly:
|
||||||
|
if not isCorePackage:
|
||||||
|
yield (name, url)
|
||||||
|
of pfAll:
|
||||||
yield (name, url)
|
yield (name, url)
|
||||||
|
|
||||||
proc testBabelPackages(r: var TResults, options: string, cat: Category) =
|
proc testBabelPackages(r: var TResults, cat: Category, filter: PackageFilter) =
|
||||||
if babelExe == "":
|
if babelExe == "":
|
||||||
quit("Cannot run babel tests: Babel binary not found.", quitFailure)
|
quit("Cannot run babel tests: Babel binary not found.", quitFailure)
|
||||||
|
|
||||||
if execCmd("$# update" % babelExe) == quitFailure:
|
if execCmd("$# update" % babelExe) == quitFailure:
|
||||||
quit("Cannot run babel tests: Babel update failed.")
|
quit("Cannot run babel tests: Babel update failed.")
|
||||||
|
|
||||||
for name, url in listPackages():
|
for name, url in listPackages(filter):
|
||||||
var test = makeTest(name, options, cat)
|
var test = makeTest(name, "", cat)
|
||||||
echo(url)
|
echo(url)
|
||||||
let
|
let
|
||||||
installProcess = startProcess(babelExe, "", ["install", "-y", name])
|
installProcess = startProcess(babelExe, "", ["install", "-y", name])
|
||||||
|
|
@ -290,7 +301,7 @@ proc testBabelPackages(r: var TResults, options: string, cat: Category) =
|
||||||
|
|
||||||
# ----------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------
|
||||||
|
|
||||||
const AdditionalCategories = ["debugger", "tools", "examples", "stdlib"]
|
const AdditionalCategories = ["debugger", "tools", "examples", "stdlib", "babel-core"]
|
||||||
|
|
||||||
proc `&.?`(a, b: string): string =
|
proc `&.?`(a, b: string): string =
|
||||||
# candidate for the stdlib?
|
# candidate for the stdlib?
|
||||||
|
|
@ -330,8 +341,12 @@ proc processCategory(r: var TResults, cat: Category, options: string) =
|
||||||
compileExample(r, "examples/*.nim", options, cat)
|
compileExample(r, "examples/*.nim", options, cat)
|
||||||
compileExample(r, "examples/gtk/*.nim", options, cat)
|
compileExample(r, "examples/gtk/*.nim", options, cat)
|
||||||
compileExample(r, "examples/talk/*.nim", options, cat)
|
compileExample(r, "examples/talk/*.nim", options, cat)
|
||||||
of "babel":
|
of "babel-core":
|
||||||
testBabelPackages(r, options, cat)
|
testBabelPackages(r, cat, pfCoreOnly)
|
||||||
|
of "babel-extra":
|
||||||
|
testBabelPackages(r, cat, pfExtraOnly)
|
||||||
|
of "babel-all":
|
||||||
|
testBabelPackages(r, cat, pfAll)
|
||||||
else:
|
else:
|
||||||
for name in os.walkFiles("tests" & DirSep &.? cat.string / "t*.nim"):
|
for name in os.walkFiles("tests" & DirSep &.? cat.string / "t*.nim"):
|
||||||
testSpec r, makeTest(name, options, cat)
|
testSpec r, makeTest(name, options, cat)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue