-
Notifications
You must be signed in to change notification settings - Fork 450
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
Make project config cache compatible #486
Conversation
@@ -85,14 +87,16 @@ processResources { task -> | |||
} | |||
} | |||
|
|||
compileJava { | |||
tasks.named("compileJava", JavaCompile) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using tasks.named
allows lazy task configuration.
https://docs.gradle.org/current/userguide/task_configuration_avoidance.html#task_configuration_avoidance_pitfalls_hidden_eager_task_realization
gradle.properties
Outdated
|
||
# Use AndroidX | ||
android.useAndroidX=true | ||
|
||
org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -Dfile.encoding=UTF-8 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://docs.oracle.com/javase/9/migrate/
The permanent generation was removed in JDK 8, this option causes gradle to fail in newer JDK versions with the following error.
Unable to start the daemon process.
This problem might be caused by incorrect configuration of the daemon.
For example, an unrecognized jvm option is used.
Unrecognized VM option 'MaxPermSize=512m'
24f2123
to
bfe6b34
Compare
# Disable Configuration Cache until we test it in this project | ||
org.gradle.unsafe.configuration-cache=false | ||
org.gradle.unsafe.configuration-cache=true | ||
org.gradle.caching=true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
enabling build cache should help speed things up as well
stone-java-gradle-plugin/src/main/kotlin/com/dropbox/stone/java/StonePlugin.kt
Show resolved
Hide resolved
stone-java-gradle-plugin/src/main/kotlin/com/dropbox/stone/java/StonePlugin.kt
Outdated
Show resolved
Hide resolved
stone-java-gradle-plugin/src/main/kotlin/com/dropbox/stone/java/StonePlugin.kt
Show resolved
Hide resolved
@@ -21,20 +21,6 @@ plugins { | |||
alias(dropboxJavaSdkLibs.plugins.binary.compatibility.validator) apply false | |||
} | |||
|
|||
allprojects { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved to root settings.gradle to centralize repo declaration
mavenCentral() | ||
} | ||
|
||
plugins.withId("com.vanniktech.maven.publish") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moved to :dropbox-sdk-java
|
||
val compileJava: Task = project.tasks.getByName(sourceSet.getCompileTaskName("java")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These dependency declarations were moved to the top of this file and are applied after the stoneTasks are created.
fix proguard config cache
@@ -1,11 +1,11 @@ | |||
[versions] | |||
android-compile-sdk = "33" | |||
android-gradle-plugin = "7.2.2" | |||
android-gradle-plugin = "7.4.2" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these bumps were needed for config cache
Co-authored-by: Jay Palacio <[email protected]> (cherry picked from commit f463957)
This PR moves us to the Gradle APIs which enable configuration avoidance (aka lazy config). After the refactor, I made sure no configuration cache problems appeared when running tasks in the project.
generateStone
task was modified to properly type task inputs and outputs.Measured improvements with
gradle-profiler
:help
(to measure configuration time) went from 236 ms => 59 ms:generateStone
(actually deletinggenerated_stone_source
) went from ~7 s to ~1 s (mainly due to turning on build-cache)