Hi folks,

During Q4 I am trying to normalize the layout of our Java sources in
mobile/android.  This normalization:

"Ensures that a Java file with package x.y.z is in a directory ending
with java/x/y/z."

Right now, that's not true: we have lots of files with package
org.mozilla.gecko in mobile/android/base.  This normalization aligns the
file layouts on disk to the standard Java layout.

My motivation for doing this is to smooth IDE integration for Fennec
front-end developers.  I have written at length [3] about why we should
build Fennec with an external build system, and I believe the last eight
months have shown how fruitful Gradle and IntelliJ (and |mach artifact|)
can be.  Moving the Java sources around lets us do more; in particular:

* We can drop |mach gradle-install| and symlinks and just open
  mozilla-central as a Gradle project in IntelliJ.  This is better for
  core developers (no more losing your .idea customizations!) and for
  new contributors (no more pfaffing around with running |mach
  gradle-install| at just the right times).

* Having a regular Gradle installation will make it easier to experiment
  with new features.  Gradle and the Android-Gradle plugin is well
  documented.  The less magic we do behind the scenes, the more people
  can modify it.  (This doesn't address the moz.build magic, but one
  step at a time.)

* We can avoid the duplication we currently have in IntelliJ, where some
  Java files appear twice, occasionally fouling the indexer.

* We can show the Android sources "in context" in the mozilla-central
  tree.  The current IntelliJ project obscures the layout on disk,
  effectively hiding everything outside of mobile/android.  Often,
  that's appropriate for front-end developers, but often it's not.

Not everything is great:

* Moving files causes churn in |hg blame|.  I'm pleased to report that
  |hg blame| understands |hg mv|: here's the annotation of a moved file
  in a try build [4].

* Moving files increases typing.  Shells should tab-complete
  mobile/android/base/java/org/mozilla/gecko or whatever quickly; |find
  mobile/android/base -iname ...| is always available; and many editors
  find files in sub-directories automatically.  But at the end of the
  day, long paths require typing long paths.

* Moving files makes uplifts harder.  Sadly, |hg rebase| and |hg graft|
  don't handle this well.  I'm happy to author a script to update .patch
  files if this is a significant issue in practice.

This work is tracked by two main tickets: Bug 1107811 [1] tracks moving
mobile/android/base around, and Bug 1219058 [2] tracks moving
mobile/android/tests/browser/robocop around.  I just landed Bug 1219058,
so your test changes may need to be updated.

Please comment here or on Bug 1107811 if you have strong feelings for or
against this normalization.

Yours,
Nick

[1] https://bugzilla.mozilla.org/show_bug.cgi?id=1107811
[2] https://bugzilla.mozilla.org/show_bug.cgi?id=1219058
[3]
http://www.ncalexander.net/blog/2015/01/05/we-should-build-firefox-for-android-with-an-external-build-system/
[4]
https://hg.mozilla.org/try/annotate/b6fff75ca264/mobile/android/tests/browser/robocop/src/androidTest/java/org/mozilla/gecko/Actions.java
_______________________________________________
mobile-firefox-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/mobile-firefox-dev

Reply via email to