From 00d088ec4ed71db5fa2c3790e52142556ceeecc6 Mon Sep 17 00:00:00 2001 From: Ivan Bobev Date: Mon, 20 Sep 2021 05:20:55 +0300 Subject: [PATCH] Fix missing binaries' extensions in "nimble dump" Fixes nim-lang/nimble#941 --- src/nimble.nim | 2 +- tests/issue941/config.nims | 1 + tests/issue941/issue941.nimble | 16 ++++++++++++++++ tests/issue941/src/issue941.nim | 7 +++++++ tests/tissues.nim | 24 ++++++++++++++++++++++++ 5 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 tests/issue941/config.nims create mode 100644 tests/issue941/issue941.nimble create mode 100644 tests/issue941/src/issue941.nim diff --git a/src/nimble.nim b/src/nimble.nim index 93393f0f5..9e05f029a 100644 --- a/src/nimble.nim +++ b/src/nimble.nim @@ -917,7 +917,7 @@ proc dump(options: Options) = fn "installFiles", p.installFiles fn "installExt", p.installExt fn "requires", p.requires - fn "bin", toSeq(p.bin.values) + fn "bin", p.bin.keys.toSeq fn "binDir", p.binDir fn "srcDir", p.srcDir fn "backend", p.backend diff --git a/tests/issue941/config.nims b/tests/issue941/config.nims new file mode 100644 index 000000000..1ac30fae8 --- /dev/null +++ b/tests/issue941/config.nims @@ -0,0 +1 @@ +switch("app", "lib") diff --git a/tests/issue941/issue941.nimble b/tests/issue941/issue941.nimble new file mode 100644 index 000000000..c2499a5c2 --- /dev/null +++ b/tests/issue941/issue941.nimble @@ -0,0 +1,16 @@ +# Package + +version = "0.1.0" +author = "Ivan Bobev" +description = "A new awesome nimble package" +license = "MIT" +srcDir = "src" + +bin = @[projectName()] + +import std/os +for name in bin: + namedBin[name] = name.toDll() + +# Dependencies +requires "nim >= 1.5.1" diff --git a/tests/issue941/src/issue941.nim b/tests/issue941/src/issue941.nim new file mode 100644 index 000000000..4b2a2701f --- /dev/null +++ b/tests/issue941/src/issue941.nim @@ -0,0 +1,7 @@ +# This is just an example to get you started. A typical library package +# exports the main API in this file. Note that you cannot rename this file +# but you can remove it if you wish. + +proc add*(x, y: int): int = + ## Adds two files together. + return x + y diff --git a/tests/tissues.nim b/tests/tissues.nim index 083d3e150..461a5d9eb 100644 --- a/tests/tissues.nim +++ b/tests/tissues.nim @@ -390,3 +390,27 @@ suite "issues": let lines = output.strip.processOutput() check exitCode != QuitSuccess check inLines(lines, "Nothing to build") + + test "issue #941 (add binaries' extensions in nimble dump command)": + cd "issue941": + let (output, exitCode) = execNimble("dump") + check exitCode == QuitSuccess + const expectedOutput = """ +name: "issue941" +version: "0.1.0" +author: "Ivan Bobev" +desc: "A new awesome nimble package" +license: "MIT" +skipDirs: "" +skipFiles: "" +skipExt: "nim" +installDirs: "" +installFiles: "" +installExt: "" +requires: "nim >= 1.5.1" +bin: "libissue941.so" +binDir: "" +srcDir: "src" +backend: "c" +""" + check output == expectedOutput