Bug 1448428 - Part 1b: Maintain "unified" GeneratedJNI{Natives,Wrappers}.h header. r=snorp,geckoview-reviewers
authorNick Alexander <nalexander@mozilla.com>
Wed, 13 May 2020 17:46:54 +0000
changeset 529693 9464ad22d4129fc97988e990883e5eb7d379753d
parent 529692 298f90202eda7df9de5c918a218057ce973c4f72
child 529694 bf98f3293602e139beb06ac46169bebba5e57ee0
push id37414
push usernbeleuzu@mozilla.com
push dateThu, 14 May 2020 02:40:10 +0000
treeherdermozilla-central@045d696faa87 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssnorp, geckoview-reviewers
bugs1448428
milestone78.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 1448428 - Part 1b: Maintain "unified" GeneratedJNI{Natives,Wrappers}.h header. r=snorp,geckoview-reviewers It's not trivial to split the existing "unified" include declaration into granular include declarations, so we continue generating a unified header that can be incrementally abandoned until it can be jettisoned. Depends on D58572 Differential Revision: https://phabricator.services.mozilla.com/D58573
mobile/android/annotations/src/main/java/org/mozilla/gecko/annotationProcessors/AnnotationProcessor.java
widget/android/moz.build
--- a/mobile/android/annotations/src/main/java/org/mozilla/gecko/annotationProcessors/AnnotationProcessor.java
+++ b/mobile/android/annotations/src/main/java/org/mozilla/gecko/annotationProcessors/AnnotationProcessor.java
@@ -45,29 +45,38 @@ public class AnnotationProcessor {
         final String[] jars = Arrays.copyOfRange(args, 1, args.length);
         Arrays.sort(jars);
 
         // Start the clock!
         long s = System.currentTimeMillis();
 
         int ret = 0;
 
+        final String unifiedHeaderFileName = OUTPUT_PREFIX + "JNIWrappers.h";
+        final String unifiedNativesFileName = OUTPUT_PREFIX + "JNINatives.h";
+
+        final StringBuilder unifiedHeaderFile = new StringBuilder(GENERATED_COMMENT);
+        final StringBuilder unifiedNativesFile = new StringBuilder(GENERATED_COMMENT);
+
         // Get an iterator over the classes in the jar files given...
         Iterator<ClassWithOptions> jarClassIterator = IterableJarLoadingURLClassLoader.getIteratorOverJars(jars);
 
         while (jarClassIterator.hasNext()) {
             final ClassWithOptions annotatedClass = jarClassIterator.next();
             if (!annotatedClass.hasGenerated()) {
                 continue;
             }
 
             final String sourceFileName = OUTPUT_PREFIX + annotatedClass.generatedName + "JNIWrappers.cpp";
             final String headerFileName = OUTPUT_PREFIX + annotatedClass.generatedName + "JNIWrappers.h";
             final String nativesFileName = OUTPUT_PREFIX + annotatedClass.generatedName + "JNINatives.h";
 
+            unifiedHeaderFile.append("#include \"" + headerFileName + "\"\n"); // annotatedClass.generatedName + "JNIWrappers.h\"\n");
+            unifiedNativesFile.append("#include \"" + nativesFileName + "\"\n"); // annotatedClass.generatedName + "JNINatives.h\"\n");
+
             final StringBuilder headerFile = new StringBuilder(GENERATED_COMMENT);
             final StringBuilder implementationFile = new StringBuilder(GENERATED_COMMENT);
             final StringBuilder nativesFile = new StringBuilder(GENERATED_COMMENT);
 
             headerFile.append(
                     "#ifndef " + getHeaderGuardName(headerFileName) + "\n" +
                     "#define " + getHeaderGuardName(headerFileName) + "\n" +
                     "\n" +
@@ -118,16 +127,19 @@ public class AnnotationProcessor {
                     "} /* mozilla */\n" +
                     "#endif // " + getHeaderGuardName(nativesFileName) + "\n");
 
             ret |= writeOutputFile(sourceFileName, implementationFile);
             ret |= writeOutputFile(headerFileName, headerFile);
             ret |= writeOutputFile(nativesFileName, nativesFile);
         }
 
+        ret |= writeOutputFile(unifiedHeaderFileName, unifiedHeaderFile);
+        ret |= writeOutputFile(unifiedNativesFileName, unifiedNativesFile);
+
         long e = System.currentTimeMillis();
         System.out.println("Annotation processing complete in " + (e - s) + "ms");
 
         System.exit(ret);
     }
 
     private static void generateClass(final ClassWithOptions annotatedClass,
                                       final StringBuilder headerFile,
--- a/widget/android/moz.build
+++ b/widget/android/moz.build
@@ -81,16 +81,17 @@ classes_with_WrapForJNI = [
     'WebNotificationDelegate',
     'WebRequest',
     'WebRequestError',
     'WebResponse',
     'XPCOMEventTarget',
 ]
 
 headers_from_WrapForJNI = sorted(
+    ['GeneratedJNINatives.h', 'GeneratedJNIWrappers.h'] +
     ['Generated{}JNINatives.h'.format(c) for c in classes_with_WrapForJNI] +
     ['Generated{}JNIWrappers.h'.format(c) for c in classes_with_WrapForJNI])
 
 sources_from_WrapForJNI = sorted(
     'Generated{}JNIWrappers.cpp'.format(c) for c in classes_with_WrapForJNI)
 
 EXPORTS.mozilla.widget += [
     'AndroidCompositorWidget.h',