Commit Graph

44 Commits

Author SHA1 Message Date
Nick Alexander
ec3a0bb18c Bug 1108782 - Part 1: straighten out Java classpaths. r=glandium
This commit is us getting out of our own way.  We were specifying
-classpath twice, once in $(JAVAC) and once in java-build.mk.  Only
the latter of these is active.  This a problem for ANDROID_EXTRA_JARS
-- those JARs should be on the classpath and input to $(DX) -- and
JARs that should be on the classpath but *not* input to $(DX).  This
commit removes the global flags to $(JAVAC) and adds
JAVA_{BOOT}CLASSPATH_JARS.  This required some hijinkery moving
wildcards to moz.build files, but everything seems to work.

As well as clarifying some parts of the build, part 2 uses this work
to modify the classpath.
2015-08-31 13:35:05 -07:00
Jim Chen
cce764c521 Bug 1194360 - Remove use of inherited constructors; r=snorp
GeneratedJNIWrappers.h was updated in bug 1192079 to use inherited
constructors, which is a gcc 4.8 feature. Many people are still using an
older version of NDK which only comes with gcc 4.7.
2015-08-13 16:57:34 -04:00
Jim Chen
4d224c779a Bug 1192079 - Use unqualified names when possible; r=snorp
To reduce verbosity of the generated code, this patch makes the code
generator use unqualified names when possible, e.g. use State::Ref
instead of GeckoThread::State::Ref. To accomplish that, function
prototypes now use the C++11 -> syntax for return types.
2015-08-13 00:53:39 -04:00
Jim Chen
d56439001f Bug 1192079 - Support inner classes in generated JNI wrapper; r=snorp
Currently, when we generate JNI wrapper for an inner class, the
resulting C++ class will not actually be a nested class of the enclosing
class. As a result, the class can be confusing to use. For example,
wrapping Java class GeckoThread.State results in two unrelated C++
classes, GeckoThread and State, and it'd be confusing to use State by
itself.

This patch adds support for inner classes. We start by scanning only for
top-level classes, and when processing each top-level class, we
recursively scan for inner classes through
JarClassIterator.getInnerClasses() and CodeGenerator.generateClasses().
For each Java inner classes, the resulting C++ class will be a nested
class. For example, wrapping GeckoThread.State will produce
widget::GeckoThread and widget::GeckoThread::State.
2015-08-13 00:53:39 -04:00
Mark Capella
cae75c601d Bug 1191161 - p3 - Rename / Shorten WrapElementForJNI to WrapForJNI, r=jchen 2015-08-07 02:09:08 -04:00
Mark Capella
9a8645bc71 Bug 1191161 - p1 - Merge WrapEntireClassForJNI into WrapElementForJNI, r=jchen 2015-08-06 01:55:29 -04:00
Jim Chen
b106a20e47 Bug 1186517 - Fix SDKProcessor API version detection; r=snorp
The API version detection functionality was broken in SDKProcessor
because we were passing in "Lpackage/Class;" as the class name rather
than just "package/Class". Also, some classes have a weird situation
where some methods were moved around in later API versions. For example,
some put* and get* methods in Bundle were moved to BaseBundle in API 21.
If we only checked BaseBundle.put*, we would think they are API 21+
only. The workaround is to check both the top-level class and the
declaring class for a member, and choose the lower API level as the
minimal API level for that member.

This patch also fixes bugs in including the right class members.
For SDKProcessor we want to include all public members of a class,
including inherited members, because the private/protected members are
not part of the public API. For AnnotationProcessor, we want to include
all the members declared in that class, including private and
protected members, because we may want to access private/protected
members of our own Java classes from C++.
2015-07-29 15:11:15 -04:00
Jim Chen
1c38f5954d Bug 1186517 - Adjust white spacing in generated files; r=me 2015-07-29 15:11:15 -04:00
Jim Chen
13e782de88 Bug 1178850 - Generate naive method bindings in annotation processor; r=snorp 2015-07-10 23:41:35 -04:00
Jim Chen
c46e55d3a0 Bug 1178850 - Make mozilla::jni::Param more intuitive to use; r=snorp 2015-07-10 23:41:35 -04:00
Wes Kocher
0f07ce99e1 Backed out 5 changesets (bug 1178850) for android build bustage CLOSED TREE
Backed out changeset 79085d3894e8 (bug 1178850)
Backed out changeset c02b603104ea (bug 1178850)
Backed out changeset d6dab7810669 (bug 1178850)
Backed out changeset 8ee5809f349b (bug 1178850)
Backed out changeset 821b22ce79e1 (bug 1178850)
2015-07-10 14:17:53 -07:00
Jim Chen
6dd55e4405 Bug 1178850 - Generate naive method bindings in annotation processor; r=snorp 2015-07-10 16:52:52 -04:00
Jim Chen
328f4b5fdc Bug 1178850 - Make mozilla::jni::Param more intuitive to use; r=snorp 2015-07-10 16:52:51 -04:00
Jim Chen
67f8ab8931 Bug 1116589 - Use templated JNI classes in generated bindings; r=snorp 2015-01-09 19:33:57 -05:00
James Willcox
8f367a5657 Bug 1099345 - Add more descriptive debugging output to the Android SDK code generator r=nalexander
--HG--
extra : rebase_source : 47d675ebe19db1a488498a19834674fe2fd8dc4f
2014-11-26 15:16:08 -06:00
Nick Alexander
ec8ac4c085 Bug 1099501 - Export and use ANDROID_TOOLS where appropriate. r=snorp,bnicholson
In certain configurations, in particular when installing the Android SDK
using HomeBrew, one sees a configuration with symlinks like:

    [brian@brian-macbook git]$ ls -l /usr/local/Cellar/android-sdk/23.0.2/
    total 72
    ...
    lrwxr-xr-x   1 brian  admin    38 Nov 14 16:39 platforms -> ../../../var/lib/android-sdk/platforms
    ...
    drwxr-xr-x  26 brian  admin   884 Nov 14 17:43 tools

In this case, we have
ANDROID_SDK=/usr/local/Cellar/android-sdk/23.0.2/platforms/android-21.

It is an anti-pattern to use ANDORID_SDK/.. to find other paths in the
tree.  This pattern is used in at least two places:

1) When we try to find
/usr/local/Cellar/android-sdk/23.0.2/platforms/android-21/../../tools,
we end up in the /usr/local/var/lib subtree.  This patch works around
that by exporting and using ANDROID_TOOLS; ANDROID_TOOLS itself is
extracted using path matching, rather than following .. through the
filesystem.

2) We also need to use ANDROID_SDK_ROOT rather than
ANDROID_SDK/../.. through-out.

--HG--
extra : rebase_source : 5e0323a94f2b80550f17a624e16f338cdeec406d
2014-11-17 11:12:00 -08:00
James Willcox
2bbaa38108 Bug 1086693 - Part 5: Add a 'catchException' mode to JNI generator r=ckitching 2014-11-13 12:47:24 -06:00
James Willcox
a76d67963c Bug 1086693 - Part 4: Add a lazy initialization mode to CodeGenerator, and use it for SDK bindings r=ckitching 2014-11-13 12:47:24 -06:00
James Willcox
19e70e1a6a Bug 1086693 - Part 3: Don't generate members that are above a given API version r=ckitching 2014-11-13 12:47:23 -06:00
Nick Alexander
133c885122 Bug 1086693 - Part 2: Generate and build Android SDK JNI wrappers. r=gps 2014-11-13 12:47:23 -06:00
James Willcox
b4c6a5e0b9 Bug 1086693 - Part 1: Add SDKProcessor r=ckitching 2014-11-13 12:47:22 -06:00
Chris Kitching
a62d68db6a Bug 1067056: Remove JavaDomKeyLocation and GeneratorOptions annotation. r=jchen 2014-09-13 17:42:03 -07:00
Chris Kitching
cba2002f68 Bug 1049105: Make annotation processor compile with Xlint:all r=kats 2014-08-05 21:13:49 -07:00
Chris Kitching
5f62f95616 Bug 1049105: Remove generateStatic option from JNI wrapper generator r=kats 2014-08-05 15:04:38 -07:00
Kartikaya Gupta
f67775dbbf Follow-up to bug 1019836 to replace tabs with spaces. r=me and DONTBUILD because whitespace changes only. 2014-08-05 15:52:43 -04:00
Brad Lassey
07a99475ad bug 1019836 - Support narrow char strings in android bridge r=snorp 2014-06-04 15:04:12 -04:00
Chris Peterson
7de537bcf0 Bug 990764 - Replace MOZ_ASSUME_UNREACHABLE with MOZ_CRASH in widget/android. r=blassey 2014-04-27 18:56:46 -07:00
Jim Chen
1670a6bfc3 Bug 958706 - Make generated JNI wrappers handle uncaught exceptions; r=blassey
This patch adds AndroidBridge::HandleUncaughtException calls to generated JNI wrappers. Also, the JNI annotation now accepts the noThrow flag to indicate that the JNI caller wishes to handle Exceptions manually.
2014-01-17 23:32:25 -06:00
Ehsan Akhgari
39d03b8f1f Bug 956783 - Stop using NULL in Fennec's JNI code; r=jchen 2014-01-06 15:21:27 -05:00
Chris Kitching
924de3d3f6 Bug 946083: Prevent the annotation processor from choking on stale classfiles in the objdir. r=rnewman 2013-12-18 02:30:57 +00:00
Chris Kitching
a5186518ff Bug 913985: Part 3 - Update the annotation processor to generate wrapper classes. r=kats
--HG--
rename : build/annotationProcessors/MethodWithAnnotationInfo.java => build/annotationProcessors/AnnotationInfo.java
rename : build/annotationProcessors/utils/AlphabeticMethodComparator.java => build/annotationProcessors/utils/AlphabeticAnnotatableEntityComparator.java
rename : build/annotationProcessors/utils/GeneratableEntryPointIterator.java => build/annotationProcessors/utils/GeneratableElementIterator.java
2013-11-21 20:41:28 +00:00
Chris Kitching
d6016c2b0c Bug 913985: Part 1.5 - Update the annotation processor to handle the renamed annotations. r=kats 2013-11-12 10:41:00 -08:00
Ryan VanderMeulen
51ab56ef96 Backed out 7 changesets (bug 913985) for intermittent Android crashes.
Backed out changeset 53513a959cf0 (bug 913985)
Backed out changeset d23d1e678417 (bug 913985)
Backed out changeset a9c9187b4f4a (bug 913985)
Backed out changeset c6b02e4a3e35 (bug 913985)
Backed out changeset 895dae322e3c (bug 913985)
Backed out changeset 3d97e6a53313 (bug 913985)
Backed out changeset 892bb017f8ba (bug 913985)

--HG--
rename : build/annotationProcessors/AnnotationInfo.java => build/annotationProcessors/MethodWithAnnotationInfo.java
rename : build/annotationProcessors/utils/AlphabeticAnnotatableEntityComparator.java => build/annotationProcessors/utils/AlphabeticMethodComparator.java
rename : build/annotationProcessors/utils/GeneratableElementIterator.java => build/annotationProcessors/utils/GeneratableEntryPointIterator.java
rename : mobile/android/base/mozglue/generatorannotations/WrapElementForJNI.java => mobile/android/base/mozglue/GeneratableAndroidBridgeTarget.java
rename : mobile/android/base/mozglue/generatorannotations/OptionalGeneratedParameter.java => mobile/android/base/mozglue/OptionalGeneratedParameter.java
2013-11-19 10:56:09 -05:00
Chris Kitching
0a70086db6 Bug 913985 - Part 3: update the annotation processor to generate wrapper classes. r=kats
--HG--
rename : build/annotationProcessors/MethodWithAnnotationInfo.java => build/annotationProcessors/AnnotationInfo.java
rename : build/annotationProcessors/utils/AlphabeticMethodComparator.java => build/annotationProcessors/utils/AlphabeticAnnotatableEntityComparator.java
rename : build/annotationProcessors/utils/GeneratableEntryPointIterator.java => build/annotationProcessors/utils/GeneratableElementIterator.java
2013-11-18 20:31:35 -08:00
Chris Kitching
9f05737a52 Bug 913985 - Part 1.5: update the annotation processor to handle the renamed annotations. r=kats 2013-11-12 10:41:00 -08:00
cewang
65258a3c93 Bug 934359 - Solve endless loop problem in gecko/build/annotationProcessors/utils/Utils.java. r=kats 2013-11-18 09:11:35 -05:00
Nick Alexander
eb6e238088 Bug 933300 - Write preprocessed Fennec code into generated/org/mozilla/*. r=glandium 2013-11-13 19:32:55 -08:00
Nick Alexander
87836d119e Backed out changeset ba9c8fcf76e6 (bug 933300) 2013-11-13 17:11:58 -08:00
Nick Alexander
0e33d6ee0d Bug 933300 - Write preprocessed Fennec code into generated/org/mozilla/*. r=glandium
This writes source with preprocessed package names into
generated/org/mozilla/{firefox,firefox_beta,fennec,fennec_$USERID},
and the other preprocessed source into generated/org/mozilla/gecko.

This layout matches the Java package hierarchy and is what IDEs expect
when including $OBJDIR/generated as a source directory.

--HG--
extra : rebase_source : 5cc397e6808d21a662c1f718ef49ee148c15e465
2013-11-11 23:39:16 -05:00
Nick Alexander
b9e7d8a368 Bug 925185 - Part 2: Use add_java_jar and restrict JAVA_JAR_TARGETS to moz.build. r=gps 2013-10-24 15:38:22 -07:00
Nick Alexander
8e6abd287d Bug 923306 - Build annotationProcessors with JAVA_JAR_TARGETS. r=glandium 2013-10-09 17:05:37 -07:00
Nick Alexander
5b68497f5a Bug 923306 - Make annotationProcessors build with -Xlint:all. r=ckitching 2013-10-09 17:05:37 -07:00
Chris Kitching
c60ee7469f Bug 914760 - Generate less debugging code. r=rnewman 2013-09-10 21:10:47 -04:00
Chris Kitching
e59d2e3162 Bug 794981 - Part 8: Add an annotation processor to the build process to generate the contents of part 5. r=kats, r=glandium 2013-09-09 08:57:37 -04:00