Closed Bug 1123416 Opened 10 years ago Closed 9 years ago

Root Gradle configuration in srcdir rather than objdir

Categories

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

All
Android
defect
Not set
normal

Tracking

(firefox44 fixed)

RESOLVED FIXED
Tracking Status
firefox44 --- fixed

People

(Reporter: nalexander, Assigned: nalexander)

References

Details

Attachments

(6 files)

Right now, |mach gradle-install| arranges a Gradle configuration in $OBJDIR/mobile/android/gradle. When IntelliJ imports that Gradle configuration, the .idea directory goes in the root, which is $OBJDIR/m/a/g. That means we can't commit .idea into version control. It also means we need to do /something/ before we can import the Gradle project into IJ (that something could be part of build-backend, or gradle-install, or ...). It's possible that we could root the Gradle configuration in m/a/gradle and perhaps have some or all of the non-rootProject projects in the object directory. We can certainly do the |mach gradle-install|-like operations in settings.gradle. This ticket tracks implementing enough that we can import mobile/android or mobile/android/gradle into IJ directly.
I had a shot at doing this, just recording some outcomes here. I was able to put .idea in m/a/gradle, but the module .iml files were still in $OBJDIR. IntelliJ doesn't handle missing .iml files gracefully -- you need to re-import. This is perhaps better than having the .idea directory disappear entirely, since the project still exists in some sense? Putting the .iml files in m/a/gradle/* will be very tricky. We still require a large number of symlinks for paths only, including in mobile/android/base. Without renaming a lot of things we're going to have a non-nested tree hierarchy in IntelliJ, which looks weird. My expectation is that we can configure Gradle to copy files from $OBJDIR that are processed without too much difficulty. (Of course, the build artifacts directory isn't a subdirectory of the src directory, so IJ shows it as a sibling, which looks weird too. No way around that that I can think of.)
Bug 1123416 - Make topsrcdir a valid Gradle project root. r?sebastian The sub-project definitions are still in the object directory (and still installed by |mach gradle-install); over time, we'll migrate them out. The Gradle wrapper and {settings,build}.gradle in topsrcdir are identical to those in mobile/android/gradle. I don't like the duplication, but I also don't want the burden of keeping the two configurations identical. We'll move away from the configuration using mobile/android/gradle as quickly as we can.
Attachment #8676365 - Flags: review?(s.kaspari)
Bug 1123416 - Limit IntelliJ objdir indexing. r?sebastian IntelliJ's exclusion mechanism (for Gradle-based projects) is not very flexible; we get just idea.module.excludeDirs. This patch crawls the file system to skip what we can.
Attachment #8676366 - Flags: review?(s.kaspari)
Assignee: nobody → nalexander
Status: NEW → ASSIGNED
sebastian: the sub-projects are still in the object directory. For me, that yields a tree like this. Making the sub-projects live in the source directory is surprisingly easy, now that we've laid the foundation; we just need to mass rename The Universe.
Comment on attachment 8676365 [details] MozReview Request: Bug 1123416 - Part 1: Make topsrcdir a valid Gradle project root. r?sebastian Bug 1123416 - Part 1: Make topsrcdir a valid Gradle project root. r?sebastian The sub-project definitions are still in the object directory (and still installed by |mach gradle-install); over time, we'll migrate them out. The Gradle wrapper and {settings,build}.gradle in topsrcdir are identical to those in mobile/android/gradle. I don't like the duplication, but I also don't want the burden of keeping the two configurations identical. We'll move away from the configuration using mobile/android/gradle as quickly as we can.
Attachment #8676365 - Attachment description: MozReview Request: Bug 1123416 - Make topsrcdir a valid Gradle project root. r?sebastian → MozReview Request: Bug 1123416 - Part 1: Make topsrcdir a valid Gradle project root. r?sebastian
Comment on attachment 8676367 [details] MozReview Request: Bug 1123416 - Part 2: Restrict $topsrcdir/build.gradle to Fennec. r?sebastian Bug 1123416 - Part 2: Restrict $topsrcdir/build.gradle to Fennec. r?sebastian
Attachment #8676367 - Attachment description: MozReview Request: Bug 1123416 - Restrict $topsrcdir/build.gradle to Fennec. r?sebastian → MozReview Request: Bug 1123416 - Part 2: Restrict $topsrcdir/build.gradle to Fennec. r?sebastian
Comment on attachment 8676366 [details] MozReview Request: Bug 1123416 - Part 3: Limit IntelliJ objdir indexing. r?sebastian Bug 1123416 - Part 3: Limit IntelliJ objdir indexing. r?sebastian x IntelliJ's exclusion mechanism (for Gradle-based projects) is not very flexible; we get just idea.module.excludeDirs. This patch crawls the file system to skip what we can.
Attachment #8676366 - Attachment description: MozReview Request: Bug 1123416 - Limit IntelliJ objdir indexing. r?sebastian → MozReview Request: Bug 1123416 - Part 3: Limit IntelliJ objdir indexing. r?sebastian
Bug 1174244 - Part 4: Remove 'thirdparty_adjust_sdk' Gradle project. r?sebastian
Attachment #8676531 - Flags: review?(s.kaspari)
Bug 1123416 - Part 5: Make a 'thirdparty' Gradle project in the source directory. r?sebastian I don't want to cut consumers of $OBJDIR/mobile/android/gradle over yet, so this doesn't remove the existing 'thirdparty' project.
Attachment #8676532 - Flags: review?(s.kaspari)
Comment on attachment 8676365 [details] MozReview Request: Bug 1123416 - Part 1: Make topsrcdir a valid Gradle project root. r?sebastian https://reviewboard.mozilla.org/r/22677/#review20281
Attachment #8676365 - Flags: review?(s.kaspari) → review+
Comment on attachment 8676367 [details] MozReview Request: Bug 1123416 - Part 2: Restrict $topsrcdir/build.gradle to Fennec. r?sebastian https://reviewboard.mozilla.org/r/22681/#review20293
Attachment #8676367 - Flags: review?(s.kaspari) → review+
Comment on attachment 8676366 [details] MozReview Request: Bug 1123416 - Part 3: Limit IntelliJ objdir indexing. r?sebastian https://reviewboard.mozilla.org/r/22679/#review20297 Nice! Btw. there's a lonely "x" in the commit message.
Attachment #8676366 - Flags: review?(s.kaspari) → review+
Attachment #8676531 - Flags: review?(s.kaspari) → review+
Comment on attachment 8676531 [details] MozReview Request: Bug 1174244 - Part 4: Remove 'thirdparty_adjust_sdk' Gradle project. r?sebastian https://reviewboard.mozilla.org/r/22743/#review20299
Comment on attachment 8676532 [details] MozReview Request: Bug 1123416 - Part 5: Make a 'thirdparty' Gradle project in the source directory. r?sebastian https://reviewboard.mozilla.org/r/22745/#review20303
Attachment #8676532 - Flags: review?(s.kaspari) → review+
This is pretty cool! I imported the root directory and it just works! After applying the patches |mach gradle-install| (Should not be needed, right?) and |mach gradle ...| yields an error (Symlink target path does not exist: /Users/sebastian/Projects/Mozilla/fx-team/mobile/android/gradle/thirdparty_adjust_sdk/build.gradle). But I can use |gradlew ..| without issues.
Oh, and |hg st| now lists the following IntelliJ files: > TheSilence:fx-team sebastian$ hg st > ? fx-team.iml > ? mobile/android/thirdparty/thirdparty.iml Should we just add *.iml to .hgignore?
Blocks: 1296146
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: