Skip to content
This repository has been archived by the owner on Feb 20, 2023. It is now read-only.

FNX-14449 ⁃ Gradle configuration avoidance #13268

Merged
merged 1 commit into from Sep 2, 2020

Conversation

NotWoods
Copy link
Contributor

@NotWoods NotWoods commented Aug 4, 2020

No description provided.

@NotWoods NotWoods added the eng:build Build system, gradle, configuration label Aug 4, 2020
@NotWoods NotWoods force-pushed the configuration-avoidance branch 3 times, most recently from 1f88418 to b3d19b2 Compare August 4, 2020 18:35
@codecov-commenter
Copy link

codecov-commenter commented Aug 4, 2020

Codecov Report

Merging #13268 into master will increase coverage by 0.01%.
The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #13268      +/-   ##
============================================
+ Coverage     28.35%   28.36%   +0.01%     
  Complexity     1033     1033              
============================================
  Files           418      418              
  Lines         16826    16826              
  Branches       2190     2190              
============================================
+ Hits           4771     4773       +2     
+ Misses        11710    11708       -2     
  Partials        345      345              
Impacted Files Coverage Δ Complexity Δ
...mponents/searchengine/FenixSearchEngineProvider.kt 63.96% <0.00%> (+1.80%) 13.00% <0.00%> (ø%)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1e806b2...a392428. Read the comment docs.

@NotWoods NotWoods marked this pull request as ready for review August 4, 2020 19:01
@data-sync-user data-sync-user changed the title Gradle configuration avoidance FNX-14449 ⁃ Gradle configuration avoidance Aug 11, 2020
@liuche
Copy link
Contributor

liuche commented Aug 18, 2020

@mcomella you were recently looking at task parallelization, is this something you could review?
https://docs.gradle.org/current/userguide/task_configuration_avoidance.html

@mcomella mcomella self-requested a review August 18, 2020 00:17
@mcomella
Copy link
Contributor

@NotWoods Do you happen to know what the savings are here or how a similar change has impacted android-components?

@NotWoods
Copy link
Contributor Author

We implemented similar changes in AC.

These few commits get us to 3749 tasks created during config phase, vs current baseline of 23519.

Copy link
Contributor

@mcomella mcomella left a comment

Choose a reason for hiding this comment

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

I learned a lot from this PR. :) I have a few open questions before I can r+ though.

I'm a little concerned that it's easy to cause configuration avoidance to break (from eagerly realizing a few tasks or using the wrong APIs) but I guess that's better than not having configuration avoidance at all. I'm also concerned that our current code is written incorrectly (e.g. the buildTranslationArray task) such that moving to configuration avoidance might break it.

If I made this change, I probably wouldn't have been too careful testing so I figured I should ask: should we do more thorough testing on the tasks that we're changing and their integration into the build lifecycle?

app/build.gradle Outdated
@@ -735,5 +738,7 @@ tasks.register("updateCookiesExtensionVersion", Copy) { task ->
updateExtensionVersion(task, 'src/main/assets/extensions/cookies')
}

preBuild.dependsOn updateAdsExtensionVersion
preBuild.dependsOn updateCookiesExtensionVersion
preBuild.configure {
Copy link
Contributor

Choose a reason for hiding this comment

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

What's preBuild? Does this run every time we execute a gradle command? Or is it smart and only executes before Android compilation jobs?

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'm not sure where preBuild is set up. I tried to keep the logic consistent by hooking into configure, but we can also keep this line as is for now.

app/build.gradle Outdated
}
}

task buildTranslationArray {
tasks.register('buildTranslationArray') {
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't see this called from anywhere and it doesn't set dependencies but it seems to correctly fill the SUPPORTED_LOCALE_ARRAY: do you know why this works and why it will continue to work after lazy configuration?

I'm wondering if this has been running in the configuration phase this whole time (e.g. the code is not in doLast) and lazily registering it will prevent it from working.

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 think you're correct and the array is being populated as a side effect. I'll revert this line and file an issue.

Copy link
Contributor

@mcomella mcomella left a comment

Choose a reason for hiding this comment

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

lgtm. The tasks we've updated are all low risk – helper tasks, static analysis, etc. – expect for our change to the tests that adds additional logging output, which I think is used for TC parsing, i.e. no major compile task was touched. I verified it was working correctly locally, rebased on master, so I think this is good to land.

@mcomella mcomella merged commit d762dea into mozilla-mobile:master Sep 2, 2020
@NotWoods NotWoods deleted the configuration-avoidance branch September 2, 2020 04:59
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
eng:build Build system, gradle, configuration
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants