зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1540820 - Don't write generated JNI wrappers for every Java-level change. r=agi
This was fallout from Bug 1509572, which moved the "invalidation smarts" to Gradle. Unfortunately, those smarts are not smart enough: there are many situations where the annotations might change (a new method) but where they don't actually change (a new method that isn't annotated with @JNITarget). Since we don't want to spend the time to make the "invalidation smarts" truly smart, we need to bring back this little bit of Bug 1509572. While we're here, we ensure that there is only one JNI wrapper generation task for GeckoView and Fennec, regardless of variant. Right now, those are named like: - geckoview:generateJNIWrappersForGeneratedWithGeckoBinariesDebug - app:generateJNIWrappersForFennecWithoutGeckoBinariesDebug See https://bugzilla.mozilla.org/show_bug.cgi?id=1509539#c1 for some discussion of these JNI wrapper generation tasks. Differential Revision: https://phabricator.services.mozilla.com/D26427 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
44fd876aaf
Коммит
b525daac01
|
@ -170,6 +170,21 @@ public class AnnotationProcessor {
|
|||
private static int writeOutputFile(final String name, final StringBuilder content) {
|
||||
final byte[] contentBytes = content.toString().getBytes(StandardCharsets.UTF_8);
|
||||
|
||||
try {
|
||||
final byte[] existingBytes = Files.readAllBytes(new File(name).toPath());
|
||||
if (Arrays.equals(contentBytes, existingBytes)) {
|
||||
return 0;
|
||||
}
|
||||
} catch (FileNotFoundException e) {
|
||||
// Pass.
|
||||
} catch (NoSuchFileException e) {
|
||||
// Pass.
|
||||
} catch (IOException e) {
|
||||
System.err.println("Unable to read " + name + ". Perhaps a permissions issue?");
|
||||
e.printStackTrace(System.err);
|
||||
return 1;
|
||||
}
|
||||
|
||||
try (FileOutputStream outStream = new FileOutputStream(name)) {
|
||||
outStream.write(contentBytes);
|
||||
} catch (IOException e) {
|
||||
|
|
|
@ -382,7 +382,9 @@ android.applicationVariants.all { variant ->
|
|||
}
|
||||
|
||||
android.applicationVariants.all { variant ->
|
||||
configureApplicationVariantWithJNIWrappers(variant, "Fennec")
|
||||
if (variant.name == mozconfig.substs.GRADLE_ANDROID_APP_VARIANT_NAME) {
|
||||
configureApplicationVariantWithJNIWrappers(variant, "Fennec")
|
||||
}
|
||||
}
|
||||
|
||||
if (gradle.startParameter.taskNames.any { it.endsWith('UnitTest') }) {
|
||||
|
|
|
@ -309,7 +309,9 @@ android.libraryVariants.all { variant ->
|
|||
}
|
||||
|
||||
android.libraryVariants.all { variant ->
|
||||
configureLibraryVariantWithJNIWrappers(variant, "Generated")
|
||||
if (variant.name == mozconfig.substs.GRADLE_ANDROID_GECKOVIEW_VARIANT_NAME) {
|
||||
configureLibraryVariantWithJNIWrappers(variant, "Generated")
|
||||
}
|
||||
}
|
||||
|
||||
apply plugin: 'maven-publish'
|
||||
|
|
Загрузка…
Ссылка в новой задаче