Commit Graph
53 Commits
Author SHA1 Message Date
Makoto Kato 7e2d6209fc Bug 1909382 - Use constexpr for static primitive type. r=geckoview-reviewers,ohall
We should use constexpr for literal value of primitive type that is generated code from Java.

Differential Revision: https://phabricator.services.mozilla.com/D217356
2024-08-06 07:33:51 +00:00
Ryan VanderMeulen 87f1f41111 Bug 1884192 - Use jvmToolchain for setting the target JVM version. r=mcarare
Differential Revision: https://phabricator.services.mozilla.com/D217824
2024-07-26 15:10:51 +00:00
Nicolas Guichard 677fa97c13 Bug 1881001 - Use the same AGP version for AC and GeckoView. r=geckoview-reviewers,nalexander,owlish
Delaying the definition of the generateSDKBindings task's arguments
ensures the android.bootClasspath has been populated.

Updating AGP apparently changes the default location of apilint's
apilint-result.json and api.txt, this moves them to a less foreign
location. Unfortunately apilint only seems to use relative paths here.

Differential Revision: https://phabricator.services.mozilla.com/D215654
2024-07-22 14:12:27 +00:00
Julien Cristau 786bf04dc4 Bug 1880848 - set {source,target}Compatibility in a java block for compatibility with gradle 9.0. r=geckoview-reviewers,owlish
See https://docs.gradle.org/8.6/userguide/upgrading_version_8.html#java_convention_deprecation

Differential Revision: https://phabricator.services.mozilla.com/D202160
2024-02-27 10:28:55 +00:00
Nicolas Guichard 0d5767ed85 Bug 1865048 - Move the wrapped class name initialization to the header of JNI wrappers. r=owlish,geckoview-reviewers
This is intended for Searchfox, to analyse and display the bindings
between Java and C++ code.

When the @WrapForJNI annotation is set on a method marked as native,
the code generator creates 3 files, for instance for EventDispatcher:
 * GeneratedJNIEventDispatcherWrappers.cpp
 * GeneratedJNI/EventDispatcherWrappers.h
 * GeneratedJNI/EventDispatcherNatives.h

The class that implements the member function bound from Java inherits
from EventDispatcher::Natives. That member function is defined in yet
another implementation file.

The mozsearch clang plugin only sees one single translation unit at a
time, so when it sees the definition of the actual bound method (and
when it emits the related data), it doesn't see the EventDispatcher
wrappers implementation anymore. At the moment it misses the name of
the wrapped Java class qualified class name.

This moves the name initialization from the wrappers impl file to the
header so that the mozsearch clang plugin can see the whole picture at
once when analysing the actual member functions' implementations.

The Java class members names were already initialized in the header so
this also makes things a bit more consistent in that regard.

Differential Revision: https://phabricator.services.mozilla.com/D196795
2023-12-28 22:47:46 +00:00
Norisz Fay f46c15bc4c Backed out changeset 3b88f6cbf7db (bug 1867079) for causing lint failure on CHANGELOG.md CLOSED TREE 2023-12-19 00:14:31 +02:00
Cathy Lu 5937e61eea Bug 1867079 - Set requestAnalysisCreationStatus deprecation for 124 r=geckoview-reviewers,owlish
Differential Revision: https://phabricator.services.mozilla.com/D196468
2023-12-18 21:38:37 +00:00
Ryan VanderMeulen 0824a67c23 Bug 1837640 - Target JVM 17 bytecode in GeckoView. r=geckoview-reviewers,owlish
Differential Revision: https://phabricator.services.mozilla.com/D180443
2023-06-12 22:27:13 +00:00
Ryan VanderMeulen 0e4d01392b Bug 1831238 - Update GeckoView to Kotlin 1.8.21 and Gradle Plugin 7.4.2. r=geckoview-reviewers,ohall
Differential Revision: https://phabricator.services.mozilla.com/D177126
2023-05-04 21:39:37 +00:00
Ryan VanderMeulen ccdc8369c5 Bug 1829938 - Update GeckoView to Kotlin 1.8.20 and Gradle Plugin 7.4.1. r=geckoview-reviewers,ohall
Differential Revision: https://phabricator.services.mozilla.com/D176461
2023-04-25 19:59:41 +00:00
Ryan VanderMeulen 8734fd29b4 Bug 1791878 - Update to kotlin 1.7.20 and gradle plugin 7.3.0. r=geckoview-reviewers,m_kato
Differential Revision: https://phabricator.services.mozilla.com/D175166
2023-04-24 20:11:57 +00:00
Ryan VanderMeulen 0fec7c26b0 Backed out changeset 216ebef85b80 (bug 1791878) for causing bug 1799002. 2022-11-10 22:59:42 -05:00
Ryan VanderMeulen 3f94957ed6 Bug 1791878 - Update to kotlin 1.7.20 and gradle plugin 7.3.0. r=geckoview-reviewers,m_kato
Differential Revision: https://phabricator.services.mozilla.com/D157864
2022-09-29 21:05:51 +00:00
Ryan VanderMeulen 3f8cba5973 Bug 1786174 - Update Android linter to v30.2.2 and fix newly-flagged errors. r=geckoview-reviewers,jonalmeida
Differential Revision: https://phabricator.services.mozilla.com/D155152
2022-08-31 22:10:39 +00:00
Jamie Nicol ead3d232db Bug 1762424 - Generate SDK bindings for android.view.SurfaceControl. r=agi
And android.view.SurfaceControl$Transaction.

In order to generate these bindings we must increase the maximum SDK
version argument we pass to SDKProcessor to 29. However, doing so
means that we now attempt to generate bindings for both Surface's
Surface(SurfaceTexture) and Surface(SurfaceControl)
constructors. These both translate in to C++ functions with identical
signatures - Surface::New(jni::Object::Param) - causing a compilation
failure.

This patch therefore also allows the stubName property to override
constructor names, and overrides the latter to
Surface::FromSurfaceControl(), thereby avoiding the conflict.

Differential Revision: https://phabricator.services.mozilla.com/D143484
2022-04-18 18:11:07 +00:00
Jamie Nicol c8d9347d32 Bug 1763392 - Generate SDK bindings for nested Java classes as nested C++ classes. r=agi,media-playback-reviewers,bryce
For example, the SDK class android.media.MediaDrm$KeyStatus will now
be defined as MediaDrm::KeyStatus rather than just KeyStatus.

Not only does this avoid polluting the top-level namespace, but it
also avoids a bug where invalid type names were generated if the
nested class contains a method with a parameter or return of the outer
class' type.

Differential Revision: https://phabricator.services.mozilla.com/D143043
2022-04-07 11:12:20 +00:00
Agi Sferro d2bf093c63 Bug 1724480 - Upgrade JDK to Java 17. r=glandium,ahal,calu
Differential Revision: https://phabricator.services.mozilla.com/D131972
2022-01-11 19:16:01 +00:00
Noemi Erli a908d62157 Backed out 2 changesets (bug 1724480) for causing Bug 1745152 and Bug 1745153 CLOSED TREE
Backed out changeset f988b79d58f4 (bug 1724480)
Backed out changeset 8a2fb9a2a3db (bug 1724480)
2021-12-09 18:58:02 +02:00
Agi Sferro ffe3c3fc10 Bug 1724480 - Upgrade JDK to Java 17. r=glandium,ahal,calu
Differential Revision: https://phabricator.services.mozilla.com/D131972
2021-12-08 23:55:53 +00:00
Agi Sferro 1a024122ee Bug 1571899 - Format Java codebase with google-java-formatter. r=owlish
This commit was generated by running |./mach lint -l android-formatter --fix|.

Differential Revision: https://phabricator.services.mozilla.com/D127733
2021-10-11 18:11:56 +00:00
Agi SferroandJan-Erik Rediger 8a7b77c52a Bug 1727438 - Upgrade to Gradle 6.9.1. r=nalexander,owlish
This is the last version that doesn't require Java 11, we will upgrade to
Gradle 7 once all components are ready (namely, apilint).

Co-authored-by: Jan-Erik Rediger <[email protected]>

Differential Revision: https://phabricator.services.mozilla.com/D123569
2021-08-31 20:53:09 +00:00
Cosmin Sabou fb22f1953e Backed out 5 changesets (bug 1727438) for causing android build bustages. CLOSED TREE
Backed out changeset 66bad7f53820 (bug 1727438)
Backed out changeset e015a4e8b62e (bug 1727438)
Backed out changeset 97a06ad4cbcc (bug 1727438)
Backed out changeset ebb080f68880 (bug 1727438)
Backed out changeset 8d03d49fe3a3 (bug 1727438)
2021-08-31 00:11:19 +03:00
Agi SferroandJan-Erik Rediger d37ab2a42f Bug 1727438 - Upgrade to Gradle 6.9.1. r=nalexander,owlish
This is the last version that doesn't require Java 11, we will upgrade to
Gradle 7 once all components are ready (namely, apilint).

Co-authored-by: Jan-Erik Rediger <[email protected]>

Differential Revision: https://phabricator.services.mozilla.com/D123569
2021-08-30 19:15:10 +00:00
Butkovits Atila 2b555514f6 Backed out 5 changesets (bug 1727438, bug 1727577) for causing Android bustage. CLOSED TREE
Backed out changeset 552d8919435c (bug 1727577)
Backed out changeset 59d1a463178b (bug 1727438)
Backed out changeset 8cba5f574196 (bug 1727438)
Backed out changeset 00d32a3af979 (bug 1727438)
Backed out changeset efda82445d85 (bug 1727438)
2021-08-26 03:33:58 +03:00
Agi SferroandJan-Erik Rediger 9f9b030c27 Bug 1727438 - Upgrade to Gradle 6.9.1. r=nalexander
This is the last version that doesn't require Java 11, we will upgrade to
Gradle 7 once all components are ready (namely, apilint).

Co-authored-by: Jan-Erik Rediger <[email protected]>

Differential Revision: https://phabricator.services.mozilla.com/D123569
2021-08-25 21:02:17 +00:00
Agi Sferro 5a59be34e4 Bug 1686809 - Use Locale.ROOT when calling toLowerCase. r=owlish
By default `toLowerCase` uses the device's Locale, which could have unexpected
consequences on non-en_US locales.

See also
https://github.com/googleapis/google-http-java-client/pull/420#issue-200260049.

Differential Revision: https://phabricator.services.mozilla.com/D101822
2021-01-14 22:16:05 +00:00
Aaron Klotz e241f8cc94 Bug 1674224: Generate Java signature hints in JNI wrappers; r=geckoview-reviewers,agi
This patch adds some code to our annotation processor that produces comments in
our generated JNI headers to help the developer understand which types are
involved. There are two new types of comments:

* For generated methods from native to Java, we produce a simplified Java method
  signature (sans package names) to help the caller disambiguate parameter
  types. This is helpful since the machine-readable method signature tend to
  use `mozilla::jni::Object::Param` instead of actual types (for the purposes of
  avoiding dependency hell, presumably).
* For Java to native methods, we produce a sample signature that is usable for
  the implementation of the native method.

While we did discuss some ideas about other locations where we could output this
data, I'd like to start with the generated header files for now. We can make
adjustments to the output location in future bugs.

I will be attaching an example of a generated header that contains these new
comments to the bug.

Differential Revision: https://phabricator.services.mozilla.com/D96236
2020-11-10 17:11:34 +00:00
Aaron Klotz c70d677994 Bug 1674211: Part 1 - Modify the annotation processor for enums to only include enumerated values by default; r=geckoview-reviewers,agi
Our annotation processing for `enum`s kind of sucks.

The typical use case is that we want to generate wrappers for the values of the
`enum`.

On the one hand, we can annotate each individual enumerated value with
`@WrapForJNI` which is noisy and error-prone.

On the other hand, we can mark the entire `enum` as `@WrapForJNI`, which causes
everything in the enum to get JNI wrappers, including private members that we
typically don't care about. This pollutes the generated JNI wrappers with noise
and makes it harder for somebody inspecting the generated C++ header to find
relevant information.

This patch modifies the annotation processor so that `enum`s are treated as a
special case: when we mark an entire `enum` as `@WrapForJNI`, only the
enumerated values will be wrapped. Any additional fields or methods that we need
to wrap may then be annotated on a case-by-case basis.

This should give us both cleaner Java and cleaner generated C++.

Differential Revision: https://phabricator.services.mozilla.com/D95203
2020-10-29 20:59:04 +00:00
Aaron Klotz aec2afb061 Bug 1637452: Part 18 - Remove support for unified JNI headers from AnnotationProcessor and build system; r=nalexander,geckoview-reviewers,agi
Differential Revision: https://phabricator.services.mozilla.com/D75381
2020-05-15 17:06:35 +00:00
Nick Alexander faf23c931c Bug 1448428 - Part 2: Transition "HardwareCodecCapabilityUtils" away from "unified" GeneratedJNI{Natives,Wrappers}.h header. r=snorp,geckoview-reviewers
Depends on D58574

Differential Revision: https://phabricator.services.mozilla.com/D58575
2020-05-13 18:11:06 +00:00
Aaron Klotz ba36718080 Bug 1448428 - Part 1d: Change naming scheme for generated source files; r=snorp,nalexander,geckoview-reviewers
We update the name generation code to dump the files into:
```
OBJDIR/widget/android/GeneratedJNI
```

which are then exported to `mozilla/java`

Differential Revision: https://phabricator.services.mozilla.com/D74720
2020-05-13 17:53:17 +00:00
Nick Alexander 6eb486918c Bug 1448428 - Part 1c: Allow incremental transition away from "unified" GeneratedJNI{Natives,Wrappers}.h header. r=snorp,geckoview-reviewers
This establishes a "high-water" mark that will make new files not be
"unified", and will allow to burn down the list of files require
unification.

Depends on D58573

Differential Revision: https://phabricator.services.mozilla.com/D58574
2020-05-13 18:11:06 +00:00
Nick Alexander e76946160c 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
2020-05-13 17:46:54 +00:00
Nick Alexander 77c3a53913 Bug 1448428 - Part 1a: Split generated JNI wrappers into multiple files. r=snorp,geckoview-reviewers
This handles the build system bits.

The subsequent patch will restore the "unified"
GeneratedJNI{Natives,Wrappers}.h header files, and will be folded into
this one before landing.

What will still remain is to update the consumers of the .h files (all
the current #include lines) to use the fine-grained imports.  At that
time the "unified" header files can be removed entirely.

Differential Revision: https://phabricator.services.mozilla.com/D58572
2020-05-13 17:46:46 +00:00
Razvan Maries 80127d93ec Backed out 5 changesets (bug 1448428) for build bustages at SocketProcessParent.cpp. CLOSED TREE
Backed out changeset 192294c1413a (bug 1448428)
Backed out changeset da732f0c37d5 (bug 1448428)
Backed out changeset c48617a975e9 (bug 1448428)
Backed out changeset 92ca5adb7eb3 (bug 1448428)
Backed out changeset 3a3c734343f3 (bug 1448428)
2020-05-13 02:20:24 +03:00
Nick Alexander b0b9f4b85d Bug 1448428 - Part 2: Transition "HardwareCodecCapabilityUtils" away from "unified" GeneratedJNI{Natives,Wrappers}.h header. r=snorp,geckoview-reviewers
Depends on D58574

Differential Revision: https://phabricator.services.mozilla.com/D58575
2020-05-12 23:04:59 +00:00
Aaron Klotz ba229d6f46 Bug 1448428 - Part 1d: Change naming scheme for generated source files; r=snorp,nalexander,geckoview-reviewers
We update the name generation code to dump the files into:
```
OBJDIR/widget/android/jni/GeneratedJNI{Natives, Wrappers}
```

which are then exported to `mozilla/jni/natives` and `mozilla/jni/wrappers`

Differential Revision: https://phabricator.services.mozilla.com/D74720
2020-05-12 23:04:59 +00:00
Nick Alexander 544859b561 Bug 1448428 - Part 1c: Allow incremental transition away from "unified" GeneratedJNI{Natives,Wrappers}.h header. r=snorp,geckoview-reviewers
This establishes a "high-water" mark that will make new files not be
"unified", and will allow to burn down the list of files require
unification.

Depends on D58573

Differential Revision: https://phabricator.services.mozilla.com/D58574
2020-05-12 23:04:59 +00:00
Nick Alexander 1153d1170e 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
2020-05-12 23:02:07 +00:00
Nick Alexander 4358403a92 Bug 1448428 - Part 1a: Split generated JNI wrappers into multiple files. r=snorp,geckoview-reviewers
This handles the build system bits.

The subsequent patch will restore the "unified"
GeneratedJNI{Natives,Wrappers}.h header files, and will be folded into
this one before landing.

What will still remain is to update the consumers of the .h files (all
the current #include lines) to use the fine-grained imports.  At that
time the "unified" header files can be removed entirely.

Differential Revision: https://phabricator.services.mozilla.com/D58572
2020-05-12 23:01:49 +00:00
Makoto Kato 2272dac4ea Bug 1575438 - Don't use colon as argument separator on generate-sdk-bindings task. r=nalexander
The colon is drive separator on Windows, so if supporting Windows as build
environment, we have to change it.

Differential Revision: https://phabricator.services.mozilla.com/D44932
2019-09-20 08:19:51 +00:00
Nick Alexander 9cea5d09e0 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
2019-04-09 20:02:44 +00:00
Agi Sferro 10ace44e78 Bug 1513395 - Upgrade com.android.tools to 26.2.1. r=snorp,geckoview-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D14514
2018-12-14 21:33:05 +00:00
Nick Alexander dca2481ee0 Bug 1509572 - Part 6: Don't always generate annotations from Gradle. r=snorp
Before, we always ran the "generate JNI wrappers" command and had the
command be smart about updating the output.  Now we move the smarts to
the Gradle side to streamline the build.

Differential Revision: https://phabricator.services.mozilla.com/D12795
2018-11-26 21:44:00 +00:00
Nick Alexander 6e92c50222 Bug 1509572 - Part 4: Make geckoview:generateSDKBindings work without arguments. r=snorp
I'm not sure how this ever worked in the `android-gradle-dependencies`
task -- it must have been because of `--continue`.

Differential Revision: https://phabricator.services.mozilla.com/D12793
2018-11-26 21:43:30 +00:00
Dorel Luca c3146804ab Backed out 6 changesets (bug 1509572) for linting failure. CLOSED TREE
Backed out changeset 9f6a7e664cef (bug 1509572)
Backed out changeset f6653c7d2967 (bug 1509572)
Backed out changeset 122d6f1a1136 (bug 1509572)
Backed out changeset bc6911d14ae0 (bug 1509572)
Backed out changeset bd0729ff0bbc (bug 1509572)
Backed out changeset c4087e8ea340 (bug 1509572)
2018-11-26 23:21:28 +02:00
Nick Alexander 1d8ea80196 Bug 1509572 - Part 6: Don't always generate annotations from Gradle. r=snorp
Before, we always ran the "generate JNI wrappers" command and had the
command be smart about updating the output.  Now we move the smarts to
the Gradle side to streamline the build.

Depends on D12794

Differential Revision: https://phabricator.services.mozilla.com/D12795
2018-11-26 21:02:52 +00:00
Nick Alexander daee82219b Bug 1509572 - Part 4: Make geckoview:generateSDKBindings work without arguments. r=snorp
I'm not sure how this ever worked in the `android-gradle-dependencies`
task -- it must have been because of `--continue`.

Depends on D12792

Differential Revision: https://phabricator.services.mozilla.com/D12793
2018-11-26 19:16:39 +00:00
Jim Chen 1cf378f84a Bug 1492308 - 1. Generate natives binding for all JNIObject classes; r=snorp
Right now we skip generating natives binding for a class if the class
doesn't have native methods. However, we should still generate the
natives binding for JNIObject classes because these classes can still be
attached to C++ objects even without native methods.

Differential Revision: https://phabricator.services.mozilla.com/D7106
2018-10-02 19:59:28 +00:00
Nick Alexander 0fd070a63a Bug 1444546 - Part 4b: Make AnnotationProcessor avoid writing, like Python's FileAvoidWrite. r=jchen
This allows us to invoke AnnotationProcessor more than is strictly
necessary and not trigger expensive native code compilations unless
the native code has actually evolved.

MozReview-Commit-ID: H1BIzJsdyIh
2018-03-26 09:36:19 -07:00