larpon / QtFirebase

An effort to bring Google's Firebase C++ API to Qt + QML
MIT License
284 stars 83 forks source link

Provide a CLI to be run qmake #153

Open davidzwa opened 4 years ago

davidzwa commented 4 years ago

As was already discussed, we'd possibly like to enhance qmake in a most non-intrusive way with very little maintanance. The reason is for the required FIREBASE_SDK_CPP environment variable which needs to be picked up by the deployment target at hand (Windows, Linux, iOS, Linux Android).

I'd like to think out how we would approach such a thing:

The CLI would have the following requirements:

Don't worry about the work/effort: I will take care of it. It's more a question of if you'd be interested in it and if the requirements align with what you think of it. Only then I will even start thinking about making such a plugin qmake tool.

larpon commented 4 years ago

A bulletproof CLI tool would be wonderful, no doubt.

I'm quite tempted to just let you do whatever you want - it just needs to work on Linux, macOS and Windows :slightly_smiling_face:

I have zero knowledge about powershell... How would I run it on my Linux machine?

larpon commented 4 years ago

... actually having the tool as a separate project might be even better - that way support tickets for the tool don't end up here - or at least I have a place to send people to, if you catch my drift. We can just make it an official "qtfirebase-setup-tool"?

davidzwa commented 4 years ago

Let's first work out the details and then decide on this repo or another. It would still be nice if we are both co-owner to the tool's repo in that case. The tool should help your troubles with understanding issues, so to be able to adjust it is in your benefit.

Powershell for Windows, Linux and Mac are:

Powershell for Windows

Powershell on Windows is directly installable as setup, side-to-side with another version of pwsh on Path. Powershell on Mac is installable with Brew. Powershell on Linux is first-tier supported for these distro's:

And a lot more by community (so basically everything).

The way I would install in on Ubuntu is with snapd as a snap package as I had issues with direct source install.

I do think powershell is a great scripting tool, but as I said: so is Python (which can do more). What has your preference?

larpon commented 4 years ago

Hmm... I see. :thinking: I think we'll have to go with python here.

My impression about what users find the most "hard"/confusing is currently:

  1. All the places you need to set the sdk/ndk paths (ideally it would follow the value of an entry from the users .pro or some kind of external small key/value file ... but ... you know ... qmake :man_shrugging: ... ).
  2. Some kind of assurance to which/each part of the setup "looks ok" (some kind of validation of at least SDK and NDK paths)
  3. Setup of messaging (on iOS there's a lot of web interface fiddling which we can't do much about?)
  4. "Exotic" configs when not using all firebase modules at once - what to include/exclude in .pro vs. build.gradle Info.plist etc.
  5. Probably much more I never see in the issues :)

I guess the tool could cover a lot of the above. It's also important that the tool can be re-run (here I'm thinking it has to be able to change SDK/NDK paths continuously).

I have no problem with introducing code/format conventions to help the tool (I.e QTFIREBASE_SDK_PATH shoudl always have this or that format in the .pro etc.) - given it's impossible to work around otherwise :slightly_smiling_face:

davidzwa commented 4 years ago

Nice, so what I'd like to start with is the qmake python interaction. How to run the tool and validate the existence of the right python. We dont want users to be forced to install python, but I would suggest 'if you want help, run the tool' approach. Or to put it differently: 'if you report an issue, include the tools logs'.

Second up for design is the cli itself. My preference is to design: the arguments with argparse and a config for static arguments. Argparse can merge them easily. Thoughts?

larpon commented 4 years ago

@davidzwa - that sound wonderful! It'd be nice with some more info in the issues for sure.


the arguments with argparse and a config for static arguments. <...>

Sounds good to me - no need to have 2 different input formats to the tool at this point.

Thanks for your input and efforts here - much obliged!

davidzwa commented 4 years ago

The efforts are mutual, and I cant stand to see something so worthy to fall over because of external changes. This tool is what you have been missing: isolation of problems.

The next TLDR will cover:

Qmake/python interaction

Ok so about the qmake interaction, we have to make sure either the tool is blazing fast or that it is run only when needed (bail on a valid/non-dirty state). I hope to focus on the first, but I wont be afraid to fall back to the second. About the CLI from qmake, I'm thinking about this basic call: exit_code = $$system($$pwd + '/qtfirebase_cli.py') This should listen for the returned error code, and continue 'just fine if exit_code == 0' otherwise the qmake should error out and quit with a reference to where the analysis log can be found. I mean, you ran the tool for a reason: save time, get analysis before make/deploy.

Dependencies:

Configuration file description

As per config I'm thinking of at least the following requirements:

Please read it through, I know it's quite in-depth, so you can skip the stuff non-essential to QtFirebase <-> deployment as long as you validate the following design choice:

Users of QtFirebase accept that they need to setup their system properly concerning Python, if they don't, this tool cannot provide them the full ease of setup. If they cannot install requests/py7zr, we provide fall-back to downloading Firebase to a location specified by default or specified manually.

larpon commented 4 years ago

@davidzwa it looks really good - engage! 😀

davidzwa commented 4 years ago

Will start reporting once started, nice task with a bit of change

larpon commented 4 years ago

Looking forward to see it! I've been wanting something like this for the project in ages.

davidzwa commented 4 years ago

Running python from QMake:

Project MESSAGE: INFO: 2020-08-03 23:53:12,646 [run_cli.py:6]: qtfirebase cli quit sucessfully
Project MESSAGE: INFO: 2020-08-03 23:53:12,733 [run_cli.py:6]: qtfirebase cli quit sucessfully

Running python from QMake with error:

Project MESSAGE: CRITICAL: 2020-08-03 23:54:09,571 [run_cli.py:7]: qtfirebase cli had a big ouch
Project MESSAGE: CRITICAL: 2020-08-03 23:54:09,658 [run_cli.py:7]: qtfirebase cli had a big ouch

W.I.P. please read the TODO.md to discuss what's next after I'm done with the tasks for the upcoming week/ 2 weeks.

https://github.com/davidzwa/QtFirebaseCLI

Hope you like my 2 hours of slamming a keyboard really hard

larpon commented 4 years ago

@davidzwa looks good at a glance - nice job! I'm a bit busy these days but will get back ASAP. Thanks for doing this!

davidzwa commented 4 years ago

No worries, will continue as planned next time I find free time.