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

Allow for specifying --project-cache-dir in gradle.properties file #26093

Closed
bartekpacia opened this issue Aug 12, 2023 · 9 comments
Closed

Allow for specifying --project-cache-dir in gradle.properties file #26093

bartekpacia opened this issue Aug 12, 2023 · 9 comments
Assignees
Labels
a:documentation Documentation content in:invoking-gradle Running Executing
Milestone

Comments

@bartekpacia
Copy link

bartekpacia commented Aug 12, 2023

Expected Behavior

I don't want to have duplicated .gradle directories, so I usually run:

gradle --project-cache-dir ./android/.gradle :tasks --all

but I'd prefer to specify it in some gradle.properties file.

Current Behavior (optional)

No response

Context

This is a very small feature that would make my work a tiny bit easier.

See also:

@bartekpacia bartekpacia added a:feature A new functionality to-triage labels Aug 12, 2023
@jbartok
Copy link
Member

jbartok commented Aug 14, 2023

Thank you for your interest in Gradle!
Have you tried using org.gradle.projectcachedir in the properties file?
Even if it works, this should be documented, will requalify the issue as a documentation one.
P.S. All equivalent properties of Gradle start parameters should be well documented.

@jbartok jbartok added a:documentation Documentation content in:invoking-gradle Running Executing and removed a:feature A new functionality to-triage labels Aug 14, 2023
@bartekpacia
Copy link
Author

Thanks for response @jbartok. Unfortunately that didn't work.

$ cat gradle.properties
org.gradle.projectcachedir=./android/.gradle

But the .gradle directory is still created in my $PWD instead of $PWD/android.

@jbartok
Copy link
Member

jbartok commented Aug 15, 2023

Hmm... just tried it (with Gradle 8.3-rc-4) and works as you would expect for me... What Gradle version are you using?

@bartekpacia
Copy link
Author

7.5

@jbartok
Copy link
Member

jbartok commented Aug 15, 2023

You are correct; it indeed doesn't work correctly in Gradle 7.5. The smallest Gradle version I could find, where it does work correctly is 8.2.1. Is upgrading to that version an option for you?

@bartekpacia
Copy link
Author

Yeah, it's not a problem. For no apparent reason, I'm getting OutOfMemory with 8.2.1:

$ ./gradlew :android:app:assembleDebug
> Task :android:app:packageDebug FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':android:app:packageDebug'.
> A failure occurred while executing com.android.build.gradle.tasks.PackageAndroidArtifact$IncrementalSplitterRunnable
   > java.lang.OutOfMemoryError (no error message)

Thank you for support, I'll debug it and get back once I manage to fix it.

@bartekpacia
Copy link
Author

Okay, it works. OOM disappeared.

Thank you!

@bartekpacia
Copy link
Author

I'll leave it up to your whether to keep it open, because docs could surely be better :)

@jbartok jbartok removed the to-triage label Aug 15, 2023
@lkasso lkasso self-assigned this Sep 12, 2023
@lkasso lkasso linked a pull request Sep 29, 2023 that will close this issue
@lkasso
Copy link
Member

lkasso commented Sep 29, 2023

Fixed in #25724.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:documentation Documentation content in:invoking-gradle Running Executing
Projects
None yet
Development

No branches or pull requests

4 participants