Skip to content
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

nimble script incuded files inconsistent use with cache #1178

Open
ggb-sw opened this issue Jan 21, 2024 · 0 comments
Open

nimble script incuded files inconsistent use with cache #1178

ggb-sw opened this issue Jan 21, 2024 · 0 comments

Comments

@ggb-sw
Copy link

ggb-sw commented Jan 21, 2024

Initial test:

# file: test1.nimble

include nimble_includes

version       = "0.1.0"
author        = "Me"
description   = "Test for nimble"
license       = "MIT"

# Dependencies

requires "nim >= 2.0.0"
# File: nimble_includes.nim

task test1, "First test for nimble":
  echo "Author: ", author
  echo "Description: ", description
  echo "project: ", projectName()

Now run nimble test1

Result is:

   Warning: Package 'test1' has an incorrect structure. The top level of the package source directory should contain at most one module, named 'test1.nim', but a file named 'nimble_includes.nim' was found. This will be an error in the future.
      Hint: If this is the primary source file in the package, rename it to 'test1.nim'. If it's a source file required by the main module, or if it is one of several modules exposed by 'test1', then move it into a 'test1/' subdirectory. If it's a test file or otherwise not required to build the the package 'test1.nim', prevent its installation by adding `skipFiles = @["nimble_includes.nim"]` to the .nimble file. See https://github.com/nim-lang/nimble#libraries for more info.
  Verifying dependencies for [email protected]
  Executing task test1 in /home/ggb/Temp/nim/test1/test1.nimble
Author: 
Description: 
project: test1

This works, to a degree, but does not show a description or author because the include statement is before the assignment of author and description, so I change that:

# file: test1.nimble

version       = "0.1.0"
author        = "Me"
description   = "Test for nimble"
license       = "MIT"

include nimble_includes

# Dependencies

requires "nim >= 2.0.0"

The output seems reasonable:

   Warning: Package 'test1' has an incorrect structure. The top level of the package source directory should contain at most one module, named 'test1.nim', but a file named 'nimble_includes.nim' was found. This will be an error in the future.
      Hint: If this is the primary source file in the package, rename it to 'test1.nim'. If it's a source file required by the main module, or if it is one of several modules exposed by 'test1', then move it into a 'test1/' subdirectory. If it's a test file or otherwise not required to build the the package 'test1.nim', prevent its installation by adding `skipFiles = @["nimble_includes.nim"]` to the .nimble file. See https://github.com/nim-lang/nimble#libraries for more info.
  Verifying dependencies for [email protected]
  Executing task test1 in /home/ggb/Temp/nim/test1/test1.nimble
Author: Me
Description: Test for nimble
project: test1

But it seems to work because the task test1 has been cached.

When I change the task name to test2 so as to invalidate the cache:

# File: nimble_includes.nim

task test2, "First test for nimble":
  echo "Author: ", author
  echo "Description: ", description
  echo "project: ", projectName()

And now run nimble test2

I now receive the error:

   Warning: Package 'test1' has an incorrect structure. The top level of the package source directory should contain at most one module, named 'test1.nim', but a file named 'nimble_includes.nim' was found. This will be an error in the future.
      Hint: If this is the primary source file in the package, rename it to 'test1.nim'. If it's a source file required by the main module, or if it is one of several modules exposed by 'test1', then move it into a 'test1/' subdirectory. If it's a test file or otherwise not required to build the the package 'test1.nim', prevent its installation by adding `skipFiles = @["nimble_includes.nim"]` to the .nimble file. See https://github.com/nim-lang/nimble#libraries for more info.
       Tip: 1 messages have been suppressed, use --verbose to show them.
nimble.nim(2130)         doAction

    Error:  Could not find task test2 in /home/ggb/Temp/nim/test1/test1.nimble
     Hint:  Run `nimble --help` and/or `nimble tasks` for a list of possible commands.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant