Dobiasd / FunctionalPlus

Functional Programming Library for C++. Write concise and readable C++ code.
http://www.editgym.com/fplus-api-search/
Boost Software License 1.0
2.07k stars 168 forks source link

Fixes for auto_generate #292

Closed mattpaletta closed 6 months ago

mattpaletta commented 7 months ago

I got the following error when running ninja after doing ninja clean. It appears that CMake is deleting the generated files when doing a clean because they are byproducts in the auto_generate target. I have included patches to the auto generate step to allow it to continue even when files are missing.

vscode ➜ /workspaces/project/build (master) $ ninja
[0/2] Re-checking globbed directories...
[2/323] cd /workspaces/project/build/third_party/FunctionalPlus && /usr...workspaces/project/third_party/FunctionalPlus/generate/auto_generate.py
FAILED: third_party/FunctionalPlus/CMakeFiles/auto_generate ../third_party/FunctionalPlus/include/fplus/fwd_instances.autogenerated_defines ../third_party/FunctionalPlus/include/fplus/curry_instances.autogenerated_defines ../third_party/FunctionalPlus/include_all_in_one/include/fplus/fplus.hpp /workspaces/project/build/third_party/FunctionalPlus/CMakeFiles/auto_generate /workspaces/project/third_party/FunctionalPlus/include/fplus/fwd_instances.autogenerated_defines /workspaces/project/third_party/FunctionalPlus/include/fplus/curry_instances.autogenerated_defines /workspaces/project/third_party/FunctionalPlus/include_all_in_one/include/fplus/fplus.hpp 
cd /workspaces/project/build/third_party/FunctionalPlus && /usr/bin/python3.10 /workspaces/project/third_party/FunctionalPlus/generate/auto_generate.py
Traceback (most recent call last):
  File "/workspaces/project/third_party/FunctionalPlus/generate/auto_generate.py", line 210, in <module>
    auto_generate()
  File "/workspaces/project/third_party/FunctionalPlus/generate/auto_generate.py", line 204, in auto_generate
    write_fwd_defines(all_function_and_bind_counts)
  File "/workspaces/project/third_party/FunctionalPlus/generate/auto_generate.py", line 180, in write_fwd_defines
    fwrite_content(FPLUS_INCLUDE_DIR + "/fwd_instances.autogenerated_defines", code)
  File "/workspaces/project/third_party/FunctionalPlus/generate/auto_generate.py", line 60, in fwrite_content
    old_content = fread_content(filename)
  File "/workspaces/project/third_party/FunctionalPlus/generate/auto_generate.py", line 48, in fread_content
    f = open(filename, "r", encoding='utf-8', errors='ignore')
FileNotFoundError: [Errno 2] No such file or directory: '/workspaces/project/third_party/FunctionalPlus/include/fplus/fwd_instances.autogenerated_defines'
Dobiasd commented 7 months ago

@pthom Since you know this part of the code base best: Do you agree with the proposed changes?

pthom commented 6 months ago

I do, this is a welcome change.

Dobiasd commented 6 months ago

@pthom Thank you! :heart:

And of course, also thank you @mattpaletta. :rocket: