Closed Bug 1052889 Opened 10 years ago Closed 10 years ago

Make Android Eclipse generate R.java

Categories

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

All
Android
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
mozilla34

People

(Reporter: nalexander, Assigned: nalexander)

References

Details

Attachments

(1 file, 1 obsolete file)

Currently, the org.mozilla.gecko.R class is generated by aapt as part of the moz.build system into $OBJDIR/m/a/b/generated/org/mozilla/gecko/R.java.  This file is then compiled by Eclipse.  (Eclipse generates other dummy R.java files that are more or less empty, that do get compiled, and that are ignored.)

This leads to subtle interactions between Eclipse's APK builder and the moz.build aapt invocation.  I've personally witnessed difficult to diagnose errors based on the order of additional resource directories (-S flags to aapt).

It would be better to have Eclipse do the R.java generation itself.
This patch does two things.  First, it adds the Search Activity sources
to the main Fennec Eclipse project (when enabled).  There's no reason
for a separate project for these, since they are built as part of the
main Fennec package by moz.build.

Second, it arranges for Eclipse to generate the R.java and Manifest.java
files for all Android libraries and ignores the files generated by
moz.build.  (The relevant classes are org.mozilla.{gecko,search}.R.)
This means renaming the FennecResources Eclipse project's package to
org.mozilla.gecko, and renaming the FennecResourcesSearch project's
package to org.mozilla.search.  To be consistent, I switched
org.mozilla.fennec.resources to org.mozilla.gecko throughout.
Attachment #8471945 - Flags: review?(bnicholson)
This patch does two things.  First, it adds the Search Activity sources
to the main Fennec Eclipse project (when enabled).  There's no reason
for a separate project for these, since they are built as part of the
main Fennec package by moz.build.

Second, it arranges for Eclipse to generate the R.java and Manifest.java
files for all Android libraries and ignores the files generated by
moz.build.  (The relevant classes are org.mozilla.{gecko,search}.R.)
This means renaming the FennecResources Eclipse project's package to
org.mozilla.gecko, and renaming the FennecResourcesSearch project's
package to org.mozilla.search.  To be consistent, I switched
org.mozilla.fennec.resources to org.mozilla.gecko throughout.

To accommodate the crash reporter resources, which depend on the static
and generated resources, I added a layer of indirection. By moving the
main resources into project FennecResourcesStatic, we can have (reading
indentation as "depends on"):

FennecResources
  FennecResourcesCrashReporter
    FennecResourcesStatic
    FennecResourcesGenerated
  FennecResourcesBranding

This lets us break the bidirectional dependency between FennecResources
and FennecResourcesCrashReporter.
Attachment #8471945 - Attachment is obsolete: true
Attachment #8471945 - Flags: review?(bnicholson)
Attachment #8472390 - Flags: review?(bnicholson)
Comment on attachment 8472390 [details] [diff] [review]
Make Android Eclipse generate R.java. r=bnicholson

Review of attachment 8472390 [details] [diff] [review]:
-----------------------------------------------------------------

\o/
Attachment #8472390 - Flags: review?(bnicholson) → review+
Blocks: 1053494
https://hg.mozilla.org/mozilla-central/rev/ebba69aab4e2
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 34
Product: Firefox for Android → Firefox Build System
Target Milestone: Firefox 34 → mozilla34
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: