Make Android Eclipse generate R.java

RESOLVED FIXED in Firefox 34

Status

()

Firefox for Android
Build Config & IDE Support
RESOLVED FIXED
4 years ago
4 years ago

People

(Reporter: nalexander, Assigned: nalexander)

Tracking

Trunk
Firefox 34
All
Android
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 1 obsolete attachment)

(Assignee)

Description

4 years ago
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.
(Assignee)

Comment 1

4 years ago
Created attachment 8471945 [details] [diff] [review]
Make Android Eclipse generate R.java. r=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.
Attachment #8471945 - Flags: review?(bnicholson)
(Assignee)

Comment 2

4 years ago
Created attachment 8472390 [details] [diff] [review]
Make Android Eclipse generate R.java. r=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+
(Assignee)

Updated

4 years ago
Blocks: 1053494
https://hg.mozilla.org/mozilla-central/rev/ebba69aab4e2
Status: ASSIGNED → RESOLVED
Last Resolved: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 34
You need to log in before you can comment on or make changes to this bug.