-
-
Notifications
You must be signed in to change notification settings - Fork 417
Allow setting Gradle JVM args in Project.xml #1859
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
Conversation
|
For less-common changes, I'd recommend using a template. No need to make everything configurable from project.xml. |
|
I perfectly agree that it is not the case to add every Gradle parameter to project.xml. Exposing more parameters could seem handy but it ultimately carries the need to maintain and devote time to them through releases. I'll make the case for this one. Personally, I do not want to care if Gradle exists at all. I just want to build and publish my games, and Lime is doing a lovely work in all the other targets. Unfortunately, Gradle is unable to asses its own ram requirements during a build, and the requirements themselves are a bit unpredictable. In my experience, Gradle did complain about wrong ram requirements when I inserted a bunch of image assets, or when I added some extensions (like hxcodec), or when i tried to build a bundle. So, the real PR here should be that I would want Lime to shield me from this insanity, like all the other targets. That, unfortunately, is nearly impossible because of Gradle. It would be the best if Gradle could use all the ram it needs without complaining. The second best next thing that Lime can do is: if Gradle is telling me to "please set jvmargs as: 'xxxx'", I would like Lime to give me a parameter where i can copy&paste these arguments, without having to ever know what they are or what Gradle is, and without having to define and maintain several templates for a single string that I need to set for certain builds but not others. In a perfect world we shouldn't have to do this, but Gradle is what it is. I'm sure this is the same reasoning behind the existence of So with this context in mind, in short:
In conclusion, I believe that Do you believe it would be better to have it as an env variable that is then passed to the gradle command line (in the same spirit of |
|
Here's an idea: allow passing arbitrary key-value pairs to gradle.properties. Saves us having to hash out what is and isn't important. It may not be the prettiest, but it works just like how you pass extra attributes to AndroidManifest.xml, so there's consistency. <config:android>
<application android:appCategory="game" android:supportsRtl="true" />
<activity android:immersive="false" />
<gradle-properties org.gradle.jvmargs='-Xmx512m "-XX:MaxMetaspaceSize=384m"' />
</config:android>And there's another more verbose option if string escaping is a problem.<config:android>
<gradle-properties>
<org.gradle.jvmargs>-Xmx512m "-XX:MaxMetaspaceSize=384m"</org.gradle.jvmargs>
</gradle-properties>
</config:android> |
|
Yeah, I believe your idea is more complete. Totally cool! |
|
Is there still time to merge this for 8.3.0 release? |
|
A bit unrelated comment: Would be also cool to be able to add something to build.gradle files, both root level and app level. Had to do so when integrating Firebase (https://firebase.google.com/docs/android/setup#groovy) . I needed to add a classpath to the dependencies section, right where this notice is placed :)) : Without this the Google Services gradle plugin just doesn't work. Then I needed to add implementation (to dependencies) and the Google Services plugin activation to the app level build.gradle. I made the copies of the files and set my templates dir, as suggested, but this is not a good approach, because a) the developer has to check the template build.gradle files to keep them up-to-date with each Lime release and b) another integration may also require the same approach so one of the templates will be overwritten. By the way, the Google Services plugin works only in the build.gradle file that has com.android.application plugin applied, meaning there is no way to make it work in an extension (that has 'com.android.library' plugin applied). |
|
Adding plugins to app/build.gradle makes sense and generalizes to a lot of use cases, so I've submitted #1999. Less sure about the root-level dependency. How common is it that someone will need to add something there? |
Wow, cool, thank! That was fast ))) Any chance to have the ability to add implementation dependencies to app level The template already has the section to copy the dependencies from the libs: It would be helpful to be able to add custom implementations here.
To be honest, this is the first time I had to add anything to the root-level |
I'm fairly certain a plugin can do that, and the PR allows you to specify plugins. I know it's an extra step, but it keeps the template cleaner. |
In fact, you're probably right and the plugin will process the implementation dependencies inheritd from the lbs. I will try this set-up next week and share here. |
Yes, this worked. So I put the implementation deps in an extension, applied the plugin was in the app-level build gradle and it worked. There is one thing, though - I still had to add a classpath dependency to make the plugin work.
It worked when the classpath dependency was added to the app-level build.gradle, but I still had to put it there manually.
In addition to the ability to apply the plugin, a way to specify it's classpath dependency is required, otherwise it won't work. Will comment in the pull request, @player-03. |
Some projects will require to allocate more memory for the gradle build, and it is a little annoying to have to restore the changed
gradle.propertiesfile each build.