Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some fixes to work with modern Gradle/Android #21

Merged
merged 4 commits into from
May 26, 2024

Conversation

tritao
Copy link
Contributor

@tritao tritao commented Apr 28, 2024

No description provided.

Copy link
Owner

@polymonster polymonster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks for the updates and maintenance!

Do you mind adding info to the readme file to document the androidnamespace feature?

Edit: update - Please check the CI issue, and my comments which came from after the CI ran.

Cheers!

@@ -290,7 +291,7 @@ function m.csv_string_from_table(tab)
end

function m.generate_cmake_lists(prj)
p.w('cmake_minimum_required (VERSION 2.6)')
p.w('cmake_minimum_required (VERSION 3.16)')
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should consider making this a parameter instead of hardcoding it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I considered but seems a bit overkill. Just upgraded to 3.0 which is from 2014, should be safe enough.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still think it’s worth making this a configurable parameter and keeping the old default. You’re the first person who’s come along and wanted to change this value and so at this point the best way to do so is by a configurable option, it’s extendible for future use cases and it can retain the default value.

I’m not sure why 2.6 was used but it was the default for some reason and has been that way ever since.

people are using this in production environments and I want to ensure any new changes incoming are additive.

@tritao
Copy link
Contributor Author

tritao commented Apr 29, 2024

Updated PR with the changes requested. Also added 5cc63ed just to clean the log a bit. But happy to remove from the PR if you want to keep it.

Copy link
Owner

@polymonster polymonster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

..

Copy link
Owner

@polymonster polymonster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change looks good in principle and thanks for checking the gradle version thoroughly.

I am just wondering about some scenarios, and am not entirely sure what the package attribute does.

you mentioned the androidnamespace comment, so this package attribute is now replaced with the androidnamespace?

I am wondering what happens in the scenario where the package attribute is deprecated (but not removed) we omit this code, but the user does not supply an androidnamespace in the lua config.

@polymonster
Copy link
Owner

Thanks for the update, a few more things to chew on there. Hopefully you can still work with your changes locally and we can carefully move toward merging into main.

There aren’t really enough test cases in the CI here to move safely. so I am just picking through the changes to make them as low friction and as backwards compatible as possible to maintain any existing lua configs

@tritao
Copy link
Contributor Author

tritao commented Apr 30, 2024

The change looks good in principle and thanks for checking the gradle version thoroughly.

I am just wondering about some scenarios, and am not entirely sure what the package attribute does.

you mentioned the androidnamespace comment, so this package attribute is now replaced with the androidnamespace?

I am wondering what happens in the scenario where the package attribute is deprecated (but not removed) we omit this code, but the user does not supply an androidnamespace in the lua config.

I think one issue might exists if the user supplies a recent enough gradle version but does not provide the androidnamespace key. We can check for this case and provide a warning/error to the user. Let me know if that would work and I can add it.

Regarding the message verbosity issue, we can use verbosef, would that work?

There aren’t really enough test cases in the CI here to move safely. so I am just picking through the changes to make them as low friction and as backwards compatible as possible to maintain any existing lua configs

Aside from the CMake minimum version, which should not really be an issue (3.0 was released 10 years ago, but can add an option as you wish), the behaviour does not change for existing code. It only changes behaviour for recent Gradle Android versions (which is broken at the moment), so in theory it should only improve things and never break anything. I also tested and if you provide androidnamespace for old Gradle versions it still works, but I can remove the output for older Gradle versions, just to be even safer.

@polymonster
Copy link
Owner

Can we generate a default androidnamespace value for gradle versions that require it? Much like how the previous package attribute was derived by the project name?

verbosef sounds good for the log.

With regards to CMake version, I really think being able to specify it in the config is the best way to go, it provides more flexibility.

@tritao
Copy link
Contributor Author

tritao commented Apr 30, 2024

Can we generate a default androidnamespace value for gradle versions that require it? Much like how the previous package attribute was derived by the project name?

Sounds like a good solution, will try that.

verbosef sounds good for the log.

With regards to CMake version, I really think being able to specify it in the config is the best way to go, it provides more flexibility.

Alright, though that raises the question of the default value. Using 2.6 will still give trouble as I got an error with that version by default, without any changes to the generated CMake projects.

@polymonster polymonster merged commit 6b12222 into polymonster:master May 26, 2024
1 check passed
@polymonster
Copy link
Owner

Took these changes in the end, to fix windows build issues. seems like it's easiest just to upgrade the toolchain to gradle 8 at least now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants