floooh / fips

High-level build system for distributed, multi-platform C/C++ projects.
MIT License
468 stars 82 forks source link

Options to generate fewer vscode launch configs #276

Closed stbachmann closed 3 years ago

stbachmann commented 3 years ago

Adds an additional fips set option so fips generates fewer launch configs on fips gen when using vscode configurations.

Can be set via fips set vscode-launch-configs [all|minimal|skip_build]

minimal: Only generates one launch config per executable which builds + runs. skip_build: Generates the previous configs plus one that skips builds. all: Keeps the current behaviour and the default still.

My python skills are non-existant so please let me know if there are things to clean up, happy to do so!

floooh commented 3 years ago

The changes look good but I'm getting a somewhat confusing error on macOS (which still defaults to python2 unfortunately), might be a circular dependency (config imports vscode and vscode imports configs via settings). With python3 it works though. I'll see if I can come up with a solution.

Traceback (most recent call last):
  File "./fips", line 17, in <module>
    fips.run(fips_path, proj_path, sys.argv)
  File "/Users/floh/projects/fips/mod/fips.py", line 40, in run
    verb.import_verbs(fips_path, proj_path)
  File "/Users/floh/projects/fips/mod/verb.py", line 66, in import_verbs
    import_verbs_from('fips', fips_dir, fips_dir + '/verbs')
  File "/Users/floh/projects/fips/mod/verb.py", line 50, in import_verbs_from
    verb_module = imp.load_module(verb_module_name, fp, pathname, desc)
  File "/Users/floh/projects/fips/verbs/build.py", line 7, in <module>
    from mod import log, util, project, settings
  File "/Users/floh/projects/fips/mod/project.py", line 8, in <module>
    from mod import log, util, config, dep, template, settings, android, emsdk
  File "/Users/floh/projects/fips/mod/config.py", line 8, in <module>
    from mod.tools import cmake, make, ninja, xcodebuild, vscode, clion
  File "/Users/floh/projects/fips/mod/tools/vscode.py", line 3, in <module>
    from mod import util, log, verb, dep, settings
  File "/Users/floh/projects/fips/mod/settings.py", line 6, in <module>
    from mod import log, util, config
ImportError: cannot import name config
stbachmann commented 3 years ago

Oh interesting, I'll check it on my mac and see if I can come up with something.

floooh commented 3 years ago

Staaahp :) I already fixed everything. I ended up making the settings handling a lot more flexible, and vscode no longer imports the settings module but instead gets the current project settings as function argument.

stbachmann commented 3 years ago

Haha ok :D Nice!

floooh commented 3 years ago

Ok here's what I added:

https://github.com/floooh/fips/commit/d69e47a6daea894cd53c49eebf518499dd39fb3d

...lots of unrelated stuff in the set and unset fips-verbs, but those were basically 'drive-by' fixes that I had in mind for a bit longer... the only thing that's still a bit icky now (not related to your changes) is the argument validation in the set-verb, since that's still hardwired (better would be to have this also wrapped in helper functions in the settings module).

But anyway, the actual feature of controlling the launch targets works great, thanks a lot :)