Closed Bug 1208793 Opened 9 years ago Closed 9 years ago

Reduce number of Gradle projects in Fennec |mach gradle| build

Categories

(Firefox Build System :: Android Studio and Gradle Integration, defect)

defect
Not set
normal

Tracking

(firefox44 fixed)

RESOLVED FIXED
Tracking Status
firefox44 --- fixed

People

(Reporter: nalexander, Assigned: nalexander)

References

Details

Attachments

(4 files)

Right now, we have many Gradle projects that go into building the main :app project.  Every Gradle operation performs a multi-project configure step, which is not cheap.  (Seconds, IIRC.)

The multiple projects are a left-over from how I coerced Eclipse into producing Fennec.  Gradle is much more flexible and many of these extra projects aren't necessary.

In particular, we should be able to trivially fold :branding into :base.  I expect a small amount of work will let us fold :preprocessed_code and :preprocessed_resources into :base as well.

There's an advantage to having /some/ code splitting, since compiling and dexing monolithic blogs is expensive.  So I wouldn't fold :thirdparty into :base, since it's basically fixed and untouched each incremental build.
Bug 1208793 - Part 1: Fix gradle-targets dependencies. r?sebastian

We were both lazy and incomplete before.  Lazy because .aapt.deps is a
sentinel, and doesn't necessarily see relevant changes, due to
timestamps and deletions.  Incomplete because we never forced
generated Java code to be fresh.
Attachment #8676029 - Flags: review?(s.kaspari)
Bug 1208793 - Part 2: Remove 'branding' Gradle project. r?sebastian

Technically, branding should be part of the App and not GeckoView, but
we don't have separated resources yet, so in it goes.
Attachment #8676030 - Flags: review?(s.kaspari)
Bug 1208793 - Part 3: Remove 'preprocessed_resources' Gradle project. r?sebastian

While testing, I found some issues with the existing dependencies.  To
address them, I've made all project preBuild tasks depend on the
(single) root generateCodeAndResources; this should ensure that the
Make integration happens as early as possible.  In addition, I fixed
the dependencies syncing the generated resources into the build
directory, which weren't quite right.  This works well locally now.
Attachment #8676031 - Flags: review?(s.kaspari)
Bug 1208793 - Part 4: Remove 'preprocessed_code' Gradle project. r?sebastian

This needed the same dependency changes that the previous part did.
There's a nice simplification here because some of the code is now
being compiled in the containing project (base) and not the (now
removed) sibling project.
Attachment #8676032 - Flags: review?(s.kaspari)
sebastian: it's my belief that we don't need a "Gradle clobber" for the |mach gradle-install| changes.  There will be old files in $OBJDIR/mobile/android/gradle/{old-project}, but since settings.gradle no longer longer refers to 'old-project' it should all work.
Assignee: nobody → nalexander
Status: NEW → ASSIGNED
Blocks: 1216430
Comment on attachment 8676029 [details]
MozReview Request: Bug 1208793 - Part 1: Fix gradle-targets dependencies. r?sebastian

https://reviewboard.mozilla.org/r/22541/#review20083
Attachment #8676029 - Flags: review?(s.kaspari) → review+
Comment on attachment 8676030 [details]
MozReview Request: Bug 1208793 - Part 2: Remove 'branding' Gradle project. r?sebastian

https://reviewboard.mozilla.org/r/22543/#review20085
Attachment #8676030 - Flags: review?(s.kaspari) → review+
Attachment #8676031 - Flags: review?(s.kaspari) → review+
Comment on attachment 8676031 [details]
MozReview Request: Bug 1208793 - Part 3: Remove 'preprocessed_resources' Gradle project. r?sebastian

https://reviewboard.mozilla.org/r/22545/#review20087
Comment on attachment 8676032 [details]
MozReview Request: Bug 1208793 - Part 4: Remove 'preprocessed_code' Gradle project. r?sebastian

https://reviewboard.mozilla.org/r/22547/#review20089
Attachment #8676032 - Flags: review?(s.kaspari) → review+
I tested those patches along with the ones from bug 1216430 and bug 1216434. It just works. No issues! :)

(In reply to Nick Alexander :nalexander from comment #5)
> sebastian: it's my belief that we don't need a "Gradle clobber" for the
> |mach gradle-install| changes.  There will be old files in
> $OBJDIR/mobile/android/gradle/{old-project}, but since settings.gradle no
> longer longer refers to 'old-project' it should all work.

Yeah, |mach gradle-install| was enough to get a working gradle build after applying the patches. However I needed to re-import the project into IntelliJ. Without that it refused to use the new gradle configuration.
Component: Build Config → Build Config & IDE Support
Product: Core → Firefox for Android
Target Milestone: mozilla44 → ---
Product: Firefox for Android → Firefox Build System
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: