Skip to content

--genscript messes up nimcache and future nim invocations #13144

Closed
@timotheecour

Description

@timotheecour

--genscript messes up nimcache because it copies over Nim/lib/nimbase.h (which could be stale, or from an old commit, or with local modifications etc) to nimcache/nimbase.h and then future invocations of nim (that don't even involve --genscript) will be forced to pickup up that old nimcache/nimbase.h instead of the current Nim/lib/nimbase.h; even nim c --forceBuild main.nim won't help with that

Example

git checkout commit_with_older_nimbase # or simply do a local temporary modification to nimbase
nim c --genscript main.nim
git checkout -

nim c main.nim #  `--forceBuild` doesn't help
uses old nimbase/nimbase.h

Possible Solution

  • generate #include <nimbase.h> instead of #include "nimbase.h" in generateHeaders
    by using angle bracket include, it'll honor the -I flags and pickup the correct nimbase. However this may break the script generated by --genscript, which should be updated to add an appropriate -I flag

  • nimbase.h should be tracked as a depdendency in the main.json file generated by --genscript and maybe also the generated main.deps file

Additional Information

  • code where nimbase is copied for --genscript :
    copyFile(conf.libpath / RelativeFile"nimbase.h",
             getNimcacheDir(conf) / RelativeFile"nimbase.h")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions