Closed
Bug 927388
Opened 11 years ago
Closed 9 years ago
[geckoview] Produce and upload Geckoview AAR during packaging
Categories
(Core Graveyard :: Embedding: GRE Core, defect)
Tracking
(firefox39 fixed)
RESOLVED
FIXED
mozilla39
Tracking | Status | |
---|---|---|
firefox39 | --- | fixed |
People
(Reporter: lucasr, Assigned: ahmedibrahimkhali, Mentored)
References
Details
Attachments
(2 files, 1 obsolete file)
10.01 KB,
patch
|
nalexander
:
feedback+
|
Details | Diff | Splinter Review |
7.95 KB,
patch
|
Details | Diff | Splinter Review |
Containing both library and assets. There's not a lot of information on the format itself right now: http://tools.android.com/tech-docs/new-build-system/aar-format
Updated•11 years ago
|
Comment 1•10 years ago
|
||
See http://www.ncalexander.net/blog/2014/07/10/build-your-own-browser-a-maven-repository-for-geckoview/ and the Jenkins job at https://ci.mozilla.org/job/mozilla-central-geckoview/ for guidance here. It would be nice to produce AARs as the TBPL build artifact, and just make Jenkins handle Maven deployment.
Updated•10 years ago
|
Summary: Generate an Android Archive (AAR) for GeckoView → [geckoview] Generate an Android Archive (AAR) for GeckoView
Comment 2•9 years ago
|
||
Now that Bug 1093242 has landed, this got a lot more feasible. The AAR should be called "geckoview-$BUILDID.aar", like the geckolibs precedent. It should * depend on geckolibs, rather than including the .so libraries itself; * include omni.ja; * include all of the Java code for Fennec in a single classes.jar; * include all of the resources (they're already packaged into a geckoview_resources.zip during the build of mobile/android/base; see https://dxr.mozilla.org/mozilla-central/source/mobile/android/base/Makefile.in#337. To get started on this ticket, read a little about the new AAR format (see link above) and then look at the code in https://dxr.mozilla.org/mozilla-central/source/python/mozbuild/mozbuild/action/package_geckolibs_aar.py. Try to extend that code to also write another AAR file and the metadata for it. You'll have to figure out how to set the dependencies on geckolibs in the maven POM (and the ivy.xml, I guess). After we have something generated locally, we can work on getting it uploaded to TBPL. This is very open-ended, so ask for feedback early and often!
Mentor: nalexander
Depends on: 1093242
Summary: [geckoview] Generate an Android Archive (AAR) for GeckoView → [geckoview] Produce and upload Geckoview AAR during packaging
Comment 3•9 years ago
|
||
Ahmed: you were interested in this. It's rather vague right now, but I can help along the way. You can make the existing code run either by adding the line [1] to your mozconfig and running |mach package| (hard) or just running (easy) ./mach python python/mozbuild/mozbuild/action/package_geckolibs_aar.py ARGUMENTS HERE [1] https://dxr.mozilla.org/mozilla-central/source/mobile/android/config/mozconfigs/android-api-11/nightly#18
Comment 4•9 years ago
|
||
> ./mach python python/mozbuild/mozbuild/action/package_geckolibs_aar.py > ARGUMENTS HERE You can see how the automation scripts call this by looking at https://dxr.mozilla.org/mozilla-central/source/toolkit/mozapps/installer/upload-files.mk#382.
Flags: needinfo?(ahmedibrahimkhali)
Assignee | ||
Comment 5•9 years ago
|
||
I've managed to copy the omni.ja to assets inside the aar and also copied the whole res folder to the aar. There are still classes.jar file and AndroidManifest.xml to be copied, but the problem is that I cannot find the compiled .class file, I've searched at the $OBJDIR and $TOPSRCDIR/mobile/android directories but I didn't find any .class files, any idea where would I find those files in the source tree ?
Flags: needinfo?(ahmedibrahimkhali) → needinfo?(nalexander)
Comment 6•9 years ago
|
||
(In reply to Ahmed Khalil from comment #5) > I've managed to copy the omni.ja to assets inside the aar and also copied > the whole res folder to the aar. > There are still classes.jar file and AndroidManifest.xml to be copied, but > the problem is that I cannot find the compiled .class file, I've searched at > the $OBJDIR and $TOPSRCDIR/mobile/android directories but I didn't find any > .class files, any idea where would I find those files in the source tree ? Yep -- look for build artifacts in $OBJDIR/mobile/android/base/jars, I think. You'll want to unzip the individual JAR files and rezip them into classes.jar, I think.
Flags: needinfo?(nalexander)
Assignee | ||
Comment 7•9 years ago
|
||
Here is a patch that bundles fennec's resources into geckoview.aar. I believe that there is still much room for improvement, especially in the generation of the pom and ivy xml files. Let me know what you think about it.
Attachment #8572898 -
Flags: review?(nalexander)
Comment 8•9 years ago
|
||
Comment on attachment 8572898 [details] [diff] [review] package_geckolibs_aar Review of attachment 8572898 [details] [diff] [review]: ----------------------------------------------------------------- Ahmed: this is a great first cut at this! The only substantive change I'd like to see is with the zip/rezip functionality. For both the resources and assembling classes.jar, I think you should be able to use the JarFileFinder at [1] to save unzipping. This will give us fine control on the inputs and outputs. I can't wait to test this locally and get a try build up! [1] https://dxr.mozilla.org/mozilla-central/source/python/mozbuild/mozpack/files.py#857 ::: python/mozbuild/mozbuild/action/package_geckolibs_aar.py @@ +34,5 @@ > <version>{version}</version> > <packaging>{packaging}</packaging> > + <dependencies> > + {dependencies} > + </dependencies> nit: indenting looks a little funky. @@ +62,4 @@ > </ivy-module> > '''.lstrip() > > +IVY_XML_DEPENDENCY_TEMPLATE=r''' nit: spaces around =. @@ +72,5 @@ > + archive_root = root.replace(path, '') > + for file in files: > + zip.write(os.path.join(root, file), os.path.join(archive_root, file)) > + > +#Copied from http://stackoverflow.com/a/12886818/429962 nit throughout: space after #. We try to use full sentence comments. @@ +119,5 @@ > + assets = FileFinder(os.path.join(fennec_path, 'assets'), ignore=['*.so']) > + for p, f in assets.find('omni.ja'): > + jarrer.add(os.path.join('assets', p), f) > + > + res_folder = FileFinder(os.path.join(fennec_path, 'res')) I expect we will need to take these from the geckoview_resources.zip produced by mobile/android/base/Makefile.in, but the idea is good! @@ +127,5 @@ > + # the folder that contains fennec's jars and resources > + base_path = os.path.join(distdir, '..', 'mobile', 'android', 'base') > + base_folder = FileFinder(base_path) > + > + #Unzip all jar files to $(DISTDIR)/geckoview_aar_classes Can we extract this unzip / rezip into a little helper function? @@ +129,5 @@ > + base_folder = FileFinder(base_path) > + > + #Unzip all jar files to $(DISTDIR)/geckoview_aar_classes > + geckoview_aar_classes_path = os.path.join(distdir, 'geckoview_aar_classes') > + for p, f in base_folder.find('*.jar'): I think we'll want every .jar except gecko-R.jar, at least at first. @@ +141,5 @@ > + #Add R.txt to the aar > + jarrer.add('R.txt', File(os.path.join(base_path, 'R.txt'))) > + > + #Finally add AndroidManifest.xml > + srcdir = os.path.join(topsrcdir, 'mobile', 'android', 'geckoview_library', 'geckolibs') Let's add a new directory and AndroidManifest.xml -- mobile/android/geckoview_library/geckoview/AndroidManifest.xml with the package name changed to org.mozilla.gecko. @@ +146,5 @@ > + jarrer.add('AndroidManifest.xml', File(os.path.join(srcdir, 'AndroidManifest.xml'))) > + > + jarrer.copy(output_file) > + return 0 > + nit: remove trailing whitespace (throughout).
Attachment #8572898 -
Flags: review?(nalexander) → feedback+
Assignee | ||
Comment 9•9 years ago
|
||
(In reply to Nick Alexander :nalexander from comment #8) > Comment on attachment 8572898 [details] [diff] [review] > package_geckolibs_aar > > Review of attachment 8572898 [details] [diff] [review]: > ----------------------------------------------------------------- > > Ahmed: this is a great first cut at this! > > The only substantive change I'd like to see is with the zip/rezip > functionality. For both the resources and assembling classes.jar, I think > you should be able to use the JarFileFinder at [1] to save unzipping. This > will give us fine control on the inputs and outputs. > I tried to use the JarFinder class, by suppling a JarReader to it, but for some reason I get an exception http://pastebin.com/NYe202er. I've read the test case that uses JarFinder and I think I'm doing it right [1] Here is the client code that tries to use JarFinder http://pastebin.com/fsNHGXjC. > Let's add a new directory and AndroidManifest.xml -- > mobile/android/geckoview_library/geckoview/AndroidManifest.xml with the > package name changed to org.mozilla.gecko. Would I add that by myself, or wait for you to add it ?
Flags: needinfo?(nalexander)
Comment 10•9 years ago
|
||
(In reply to Ahmed Khalil from comment #9) > (In reply to Nick Alexander :nalexander from comment #8) > > Comment on attachment 8572898 [details] [diff] [review] > > package_geckolibs_aar > > > > Review of attachment 8572898 [details] [diff] [review]: > > ----------------------------------------------------------------- > > > > Ahmed: this is a great first cut at this! > > > > The only substantive change I'd like to see is with the zip/rezip > > functionality. For both the resources and assembling classes.jar, I think > > you should be able to use the JarFileFinder at [1] to save unzipping. This > > will give us fine control on the inputs and outputs. > > > I tried to use the JarFinder class, by suppling a JarReader to it, but for > some reason I get an exception http://pastebin.com/NYe202er. > > I've read the test case that uses JarFinder and I think I'm doing it right > [1] > Here is the client code that tries to use JarFinder > http://pastebin.com/fsNHGXjC. I'll investigate this locally. > > Let's add a new directory and AndroidManifest.xml -- > > mobile/android/geckoview_library/geckoview/AndroidManifest.xml with the > > package name changed to org.mozilla.gecko. > > Would I add that by myself, or wait for you to add it ? Go for it! It'll fold into your patch.
Flags: needinfo?(nalexander)
Assignee | ||
Comment 11•9 years ago
|
||
Hi Nick, I've resolved all your comments, except for the JarFinder one. Also I've searched for geckoview_resources.zip, but I didn't find one in the $OBJDIR
Attachment #8572898 -
Attachment is obsolete: true
Attachment #8574056 -
Flags: review?(nalexander)
Assignee | ||
Comment 12•9 years ago
|
||
Hi Nick, I hope that you're alright, and everything is fine. Any updates on reviewing the patch ?
Flags: needinfo?(nalexander)
Comment 14•9 years ago
|
||
Updated•9 years ago
|
Assignee: nobody → nalexander
Status: NEW → ASSIGNED
Comment 15•9 years ago
|
||
Comment on attachment 8574834 [details] [diff] [review] Review fixes Hi Ahmed, First, great work! I made some fixes and improvements and tested this locally with the repository at https://github.com/ncalexan/geckobrowser-gradle. The browser builds but fails immediately, but not because of this work. We can address over time. Major points: * fix typo in <dependency> block; * resources from geckoview_resources.zip; * classes.jar was being incorrectly built (see http://stackoverflow.com/questions/12886768/how-to-unzip-file-in-python-on-all-oses/12886818#comment27680318_12886818) Take a look and see if it works for you locally? I've pushed a try build to see how we fare on infrastructure. And then we can test downloading from TreeHerder in the example project. Thanks for all your work on this!
Flags: needinfo?(nalexander) → needinfo?(ahmedibrahimkhali)
Comment 16•9 years ago
|
||
Comment on attachment 8574056 [details] [diff] [review] package_geckolibs_aar Review of attachment 8574056 [details] [diff] [review]: ----------------------------------------------------------------- Looks great! I've pushed some review adjustments back to you -- let me know how they look.
Attachment #8574056 -
Flags: review?(nalexander) → feedback+
Assignee | ||
Comment 17•9 years ago
|
||
(In reply to Nick Alexander :nalexander from comment #15) > Comment on attachment 8574834 [details] [diff] [review] > Review fixes > > Hi Ahmed, > > First, great work! I made some fixes and improvements and tested this > locally with the repository at > https://github.com/ncalexan/geckobrowser-gradle. The browser builds but > fails immediately, but not because of this work. We can address over time. > > Major points: > > * fix typo in <dependency> block; > * resources from geckoview_resources.zip; > * classes.jar was being incorrectly built (see > http://stackoverflow.com/questions/12886768/how-to-unzip-file-in-python-on- > all-oses/12886818#comment27680318_12886818) > > Take a look and see if it works for you locally? I've pushed a try build to > see how we fare on infrastructure. And then we can test downloading from > TreeHerder in the example project. > > Thanks for all your work on this! Hi Nick, Your code looks neat and great! but when I the script is used to generate the gecko(libs/views), for some reason the revision number is supplied in yyyyMMddHHmmss and the script fails with error: line 167, in main raise ValueError('Revision must be in yyyyMMddHH format: %s' % args.revision) ValueError: Revision must be in yyyyMMddHH format: 20150309231639) Perhaps that on Mac the revision number is supplied as expected and on Linux is not ? I don't know what about Windows.
Flags: needinfo?(ahmedibrahimkhali) → needinfo?(nalexander)
Comment 20•9 years ago
|
||
This worked fine in automation. I've landed with the additional files to upload (hope I didn't typo!). I didn't include the permissions in the AndroidManifest.xml, but we can work on improving that over time. Thanks for your work on this, Ahmed!
Flags: needinfo?(nalexander)
https://hg.mozilla.org/mozilla-central/rev/1707d2ad4051 https://hg.mozilla.org/mozilla-central/rev/6119cce9ce80
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
status-firefox39:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla39
Updated•9 years ago
|
Assignee: nalexander → ahmedibrahimkhali
Comment 23•8 years ago
|
||
I could build app using the AAR, but is not working on x86 processors (e.g. Acer Iconia Tab 8 A1-840FHD). Could you help? Thanks!
Comment 24•8 years ago
|
||
(In reply to Kiran from comment #23) > I could build app using the AAR, but is not working on x86 processors (e.g. > Acer Iconia Tab 8 A1-840FHD). > Could you help? We don't produce x86 AAR packages: http://ftp.mozilla.org/pub/mobile/nightly/latest-mozilla-central-android-x86/. You could build x86 and produce the AAR yourself. Alternately, you could grab the libraries from the ZIP files in that directory and shove them into the AAR yourself -- AARs are just ZIP files.
Updated•8 years ago
|
Product: Core → Core Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•