-
Notifications
You must be signed in to change notification settings - Fork 211
feat(#1450): add --skipBin to limit compilation of hybrid deps #1647
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 5 commits
6e09e24
ad98db5
e10b0c7
407808c
b32b4c3
f9c5622
5667f37
7ae5a3a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| # Package | ||
|
|
||
| version = "0.1.0" | ||
| author = "test" | ||
| description = "A new awesome nimble package" | ||
| license = "MIT" | ||
| srcDir = "src" | ||
| bin = @["pkgWithHybridDep"] | ||
|
|
||
|
|
||
| # Dependencies | ||
|
|
||
| requires "nim >= 2.2.4" | ||
| requires "https://github.com/nim-lang/nimble?subdir=tests/develop/hybrid" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| # This is just an example to get you started. A typical binary package | ||
| # uses this file as the main entry point of the application. | ||
|
|
||
| when isMainModule: | ||
| echo("Hello, World!") |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| # Tests that with --skipBin hybrid packages are not compiled | ||
|
|
||
| {.used.} | ||
|
|
||
| import unittest, os, strutils | ||
| import testscommon | ||
| from nimble import nimblePathsFileName, nimbleConfigFileName | ||
| from nimblepkg/common import cd | ||
|
|
||
| func exe(name: string): string = | ||
| when defined(windows): name & ".exe" else: name | ||
|
|
||
| template checkSkip(cmd: string, toSkip = false) = | ||
| var args = @[cmd] | ||
| if toSkip: args.add "--skipBin" | ||
| let res = execNimbleYes(args) | ||
| verify res | ||
| let hybridPkgDir = getPackageDir(pkgsDir, "hybrid") | ||
| check hybridPkgDir.len > 0 | ||
| check "Building hybrid/hybrid" in res.output != toSkip | ||
| check fileExists(hybridPkgDir / "hybrid".exe) != toSkip | ||
| check fileExists(installDir / "bin" / "hybrid") != toSkip | ||
| # --skipBin should not effect the root package | ||
| if cmd == "install": | ||
| check fileExists(installDir / "bin" / "pkgWithHybridDep") | ||
|
|
||
| template runTest(name: string, body: untyped) = | ||
| test name: | ||
| cd "pkgWithHybridDep": | ||
| cleanDir installDir | ||
| cleanFiles nimblePathsFileName, nimbleConfigFileName | ||
| body | ||
|
|
||
| suite "--skipBin": | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please dont use templates to expand the tests, its fine to extract repeated code but this doesnt follow the symmetry of the whole codebase. Try to be more meaningful in the suite name
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I thought at least one template would be necessary to abstract the repeated step ( |
||
| for command in ["setup", "install"]: | ||
| runTest command & " with --skipBin & without --skipBin": | ||
| checkSkip(command, true) | ||
| checkSkip(command, false) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just return here