nim-lang / nimble

Package manager for the Nim programming language.
Other
1.25k stars 188 forks source link

nimbleDir ignored with custom tasks #495

Open pacien opened 6 years ago

pacien commented 6 years ago

A custom --nimbleDir seems to be ignored when executing a user-defined task.

Running a pre-defined task: no packages.json in the newly created nimble directory. This is expected behaviour.

 % nimble --nimbleDir:tmp1 --verbose build        
    Setting Nim stdlib prefix to 
    Setting Nim stdlib path to /home/kea/.choosenim/toolchains/nim-0.18.0/lib
  Verifying dependencies for dummy_nim@0.1.0
    Reading official package list
    Prompt: No local packages.json found, download it from internet? [y/N]

Running a custom task: a packages.json is somehow found despite the custom nimble directory being empty. The dependencies are installed in the wrong directory.

 % nimble --nimbleDir:tmp2 --verbose build_example 
    Setting Nim stdlib prefix to 
    Setting Nim stdlib path to /home/kea/.choosenim/toolchains/nim-0.18.0/lib
  Executing task build_example in /home/kea/code/dummy-nim/dummy_nim.nimble
    Setting Nim stdlib prefix to 
    Setting Nim stdlib path to /home/kea/.choosenim/toolchains/nim-0.18.0/lib
  Verifying dependencies for dummy_nim@0.1.0
    Reading official package list
   Checking for jester@any version
 Installing jester@any version
    Reading official package list
Downloading https://github.com/dom96/jester using git
    Cloning latest tagged version: v0.2.0
    Setting Nim stdlib prefix to 
    Setting Nim stdlib path to /home/kea/.choosenim/toolchains/nim-0.18.0/lib
  Verifying dependencies for jester@0.2.0
 Installing jester@0.2.0
    Copying file /tmp/nimble_27574/githubcom_dom96jester/changelog.markdown to /home/kea/.nimble/pkgs/jester-0.2.0/changelog.markdown
    Copying file /tmp/nimble_27574/githubcom_dom96jester/license.txt to /home/kea/.nimble/pkgs/jester-0.2.0/license.txt
    Copying file /tmp/nimble_27574/githubcom_dom96jester/jester.nimble to /home/kea/.nimble/pkgs/jester-0.2.0/jester.nimble
    Copying file /tmp/nimble_27574/githubcom_dom96jester/readme.markdown to /home/kea/.nimble/pkgs/jester-0.2.0/readme.markdown
    Copying file /tmp/nimble_27574/githubcom_dom96jester/jester.nim to /home/kea/.nimble/pkgs/jester-0.2.0/jester.nim
    Copying file /tmp/nimble_27574/githubcom_dom96jester/jester/private/utils.nim to /home/kea/.nimble/pkgs/jester-0.2.0/jester/private/utils.nim
    Copying file /tmp/nimble_27574/githubcom_dom96jester/jester/private/patterns.nim to /home/kea/.nimble/pkgs/jester-0.2.0/jester/private/patterns.nim
    Copying file /tmp/nimble_27574/githubcom_dom96jester/jester/private/errorpages.nim to /home/kea/.nimble/pkgs/jester-0.2.0/jester/private/errorpages.nim
    Copying file /tmp/nimble_27574/githubcom_dom96jester/jester.nimble to /home/kea/.nimble/pkgs/jester-0.2.0/jester.nimble
   Success: jester installed successfully.

dummy_nim.nimble:

version       = "0.1.0"
author        = "kea"
description   = "A dummy package"
license       = "MIT"
srcDir        = "src"
bin           = @["dummy_nim"]

requires "nim >= 0.18.0"
requires "jester"

task build_example, "Build example":
  setCommand "c", "example/example.nim"
dom96 commented 6 years ago

Yeah, I'm afraid these aren't passed yet.

You'll have to write exec "nimble c --nimbleDir:... example/example.nim" as a workaround in your task for now.

pacien commented 6 years ago

How can I retrieve the supplied nimbleDir argument to pass it inside the task?

dom96 commented 6 years ago

That's also not possible right now I'm afraid.

dom96 commented 5 years ago

This is fixed but I want a test for it.