jbendtsen / tiny-android-template

Minimalist Android Project w/o Gradle
MIT License
42 stars 6 forks source link

Improve windows and androidx compatibility #6

Closed omar-azmi closed 6 months ago

omar-azmi commented 6 months ago

I was having difficulties getting the scripts to run in windows git-bash, and a lot of it had to to with path strings. This PR improves the compatibility of the scripts with windows, and can also compile projects with dependencies (such as androidx).

Overview of the changes made:

Fixes to consider before merging:

omar-azmi commented 6 months ago

Thanks for the indepth review, and also for the handy tool. Initially, I was mostly having issues getting the scripts to run on windows due to inconsistency between bash and cmd commands. But I realize now that this issue stems from the fact that executing a bash script via cmd redirects it to git-bash, which supports all bash commands, therefore no substitutions to your original $CMD variables is needed. but executing a pearl script via cmd, makes it run in the command-prompt environment, where bash commands will not be available. So, for consistency, a user should ideally run all of the scripts (.sh and .pl) in a bash terminal. This way, they won't have to redefine the command variables (including "/dev/null", which works on windows git-bash). Alternatively, we could modify the perl scripts so that they make use of builtin filesystem procedures, rather than calling system commands for trivial operations. This way, all scripts will function just fine irrespective of whether they were originally launched from cmd, or bash.

So, a summary of what I plan on changing in the followup commits:

omar-azmi commented 6 months ago

I've applied your suggestions, and it works fine on my machine, irrespective of whether I envoke the scripts from cmd or bash. I think it is good to go. would you mind testing it yourself and accepting the PR if it's not causing any issue? let me know if any changes need to be made.

jbendtsen commented 6 months ago

Looks good! I've tested it on my Windows machine and it works well. Nice touch with the bespoke recursive copy function in export-libs.pl. Thank you!