Bug 1189459 - Allow generating geckoview AAR files when MOZ_APP_NAME is not 'fennec'. r=gps
authorNick Alexander <nalexander@mozilla.com>
Thu, 30 Jul 2015 11:50:44 -0700
changeset 287793 fffe3ac33207713a9d71fcddadeeb938e6221a2a
parent 287792 437a166ba6ed525ee544b46c58270202d79a59a1
child 287794 b4db50d6a91edec44abff5e7ab55daa9b1f139dd
push id5067
push userraliiev@mozilla.com
push dateMon, 21 Sep 2015 14:04:52 +0000
treeherdermozilla-beta@14221ffe5b2f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgps
bugs1189459
milestone42.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1189459 - Allow generating geckoview AAR files when MOZ_APP_NAME is not 'fennec'. r=gps This just allows a little versatility for consumers such as b2gdroid, which are Fennec-like but don't have MOZ_APP_NAME=fennec. I elected to pass appname as a parameter rather than modify the existing distdir because I expect to want to differentiate, in some way, the output AAR files based on the underlying name. That is, in future we might generate geckoview-fennec-VERSION.aar and geckolibs-b2gdroid-VERSION.aar, or stuff the name into the Ivy version information, or... This also fixes a typo in one of the JarFinder instantiations.
python/mozbuild/mozbuild/action/package_geckolibs_aar.py
toolkit/mozapps/installer/upload-files.mk
--- a/python/mozbuild/mozbuild/action/package_geckolibs_aar.py
+++ b/python/mozbuild/mozbuild/action/package_geckolibs_aar.py
@@ -87,54 +87,54 @@ def _generate_geckoview_classes_jar(dist
         with zipfile.ZipFile(f.path) as zf:
             zf.extractall(geckoview_aar_classes_path)
 
     # Rezip them into a single classes.jar file.
     classes_jar_path =  os.path.join(distdir, 'classes.jar')
     _zipdir(geckoview_aar_classes_path, classes_jar_path)
     return File(classes_jar_path)
 
-def package_geckolibs_aar(topsrcdir, distdir, output_file):
+def package_geckolibs_aar(topsrcdir, distdir, appname, output_file):
     jarrer = Jarrer(optimize=False)
 
     srcdir = os.path.join(topsrcdir, 'mobile', 'android', 'geckoview_library', 'geckolibs')
     jarrer.add('AndroidManifest.xml', File(os.path.join(srcdir, 'AndroidManifest.xml')))
     jarrer.add('classes.jar', File(os.path.join(srcdir, 'classes.jar')))
 
-    jni = FileFinder(os.path.join(distdir, 'fennec', 'lib'))
+    jni = FileFinder(os.path.join(distdir, appname, 'lib'))
     for p, f in jni.find('**/*.so'):
         jarrer.add(os.path.join('jni', p), f)
 
     # Include the buildinfo JSON as an asset, to give future consumers at least
     # a hope of determining where this AAR came from.
     json = FileFinder(distdir, ignore=['*.mozinfo.json'])
     for p, f in json.find('*.json'):
         jarrer.add(os.path.join('assets', p), f)
 
     # This neatly ignores omni.ja.
-    assets = FileFinder(os.path.join(distdir, 'fennec', 'assets'))
+    assets = FileFinder(os.path.join(distdir, appname, 'assets'))
     for p, f in assets.find('**/*.so'):
         jarrer.add(os.path.join('assets', p), f)
 
     jarrer.copy(output_file)
     return 0
 
-def package_geckoview_aar(topsrcdir, distdir, output_file):
+def package_geckoview_aar(topsrcdir, distdir, appname, output_file):
     jarrer = Jarrer(optimize=False)
-    fennec_path = os.path.join(distdir, 'fennec')
-    assets = FileFinder(os.path.join(fennec_path, 'assets'), ignore=['*.so'])
+    app_path = os.path.join(distdir, appname)
+    assets = FileFinder(os.path.join(app_path, 'assets'), ignore=['*.so'])
     for p, f in assets.find('omni.ja'):
         jarrer.add(os.path.join('assets', p), f)
 
     # The folder that contains Fennec's JAR files and resources.
     base_path = os.path.join(distdir, '..', 'mobile', 'android', 'base')
 
     # The resource set is packaged during Fennec's build.
     resjar = JarReader(os.path.join(base_path, 'geckoview_resources.zip'))
-    for p, f in JarFinder(p, resjar).find('*'):
+    for p, f in JarFinder(base_path, resjar).find('*'):
         jarrer.add(os.path.join('res', p), f)
 
     # Package the contents of all Fennec JAR files into classes.jar.
     classes_jar_file = _generate_geckoview_classes_jar(distdir, base_path)
     jarrer.add('classes.jar', classes_jar_file)
 
     # Add R.txt.
     jarrer.add('R.txt', File(os.path.join(base_path, 'R.txt')))
@@ -154,33 +154,35 @@ def main(args):
     parser.add_argument('--verbose', '-v', default=False, action='store_true',
                         help='be verbose')
     parser.add_argument('--revision',
                         help='Revision identifier to write.')
     parser.add_argument('--topsrcdir',
                         help='Top source directory.')
     parser.add_argument('--distdir',
                         help='Distribution directory (usually $OBJDIR/dist).')
+    parser.add_argument('--appname',
+                        help='Application name (usually $MOZ_APP_NAME, like "fennec").')
     args = parser.parse_args(args)
 
     # An Ivy 'publication' date must be given in the form yyyyMMddHHmmss, and Mozilla buildids are in this format.
     if len(args.revision) != 14:
         raise ValueError('Revision must be in yyyyMMddHHmmss format: %s' % args.revision)
 
     paths_to_hash = []
 
     groupId='org.mozilla'
     packaging_type='aar'
     gecklibs_aar = os.path.join(args.dir, 'geckolibs-{revision}.aar').format(revision=args.revision)
     paths_to_hash.append(gecklibs_aar)
     geckoview_aar = os.path.join(args.dir, 'geckoview-{revision}.aar').format(revision=args.revision)
     paths_to_hash.append(geckoview_aar)
 
-    package_geckolibs_aar(args.topsrcdir, args.distdir, gecklibs_aar)
-    package_geckoview_aar(args.topsrcdir, args.distdir, geckoview_aar)
+    package_geckolibs_aar(args.topsrcdir, args.distdir, args.appname, gecklibs_aar)
+    package_geckoview_aar(args.topsrcdir, args.distdir, args.appname, geckoview_aar)
 
     geckolibs_pom_path = os.path.join(args.dir, 'geckolibs-{revision}.pom').format(revision=args.revision)
     paths_to_hash.append(geckolibs_pom_path)
     geckolibs_pom = MAVEN_POM_TEMPLATE.format(
             groupId=groupId,
             artifactId='geckolibs',
             version=args.revision,
             packaging=packaging_type,
--- a/toolkit/mozapps/installer/upload-files.mk
+++ b/toolkit/mozapps/installer/upload-files.mk
@@ -387,16 +387,17 @@ UPLOAD_EXTRA_FILES += \
   $(NULL)
 
 INNER_MAKE_GECKOLIBS_AAR= \
   $(PYTHON) -m mozbuild.action.package_geckolibs_aar \
     --verbose \
     --revision $(geckoaar-revision) \
     --topsrcdir '$(topsrcdir)' \
     --distdir '$(_ABS_DIST)' \
+    --appname '$(MOZ_APP_NAME)' \
     '$(_ABS_DIST)'
 else
 INNER_MAKE_GECKOLIBS_AAR=echo 'Android geckolibs.aar packaging requires packaging geckoview'
 endif # MOZ_DISABLE_GECKOVIEW
 else
 INNER_MAKE_GECKOLIBS_AAR=echo 'Android geckolibs.aar packaging is disabled'
 endif # MOZ_ANDROID_GECKOLIBS_AAR