Improve Android configury
* configure.ac (JAVA_PUSH_LINT): New macro. (JAVAFLAGS): New variable. Check for various lint flags and macros and enable them. * java/Makefile.in (ANDROID_ABI): * java/org/gnu/emacs/EmacsSdk7FontDriver.java: Remove compiler warning.
This commit is contained in:
parent
4ff3904e3c
commit
ea74f3c067
3 changed files with 75 additions and 7 deletions
75
configure.ac
75
configure.ac
|
@ -739,6 +739,32 @@ AC_ARG_ENABLE([build-details],
|
|||
[test "$enableval" = no && BUILD_DETAILS=--no-build-details])
|
||||
AC_SUBST([BUILD_DETAILS])
|
||||
|
||||
# JAVA_PUSH_LINT(OPT)
|
||||
# -------------------
|
||||
# Check if javac supports the diagnostic flag -Xlint:OPT.
|
||||
# If it does, add it to JAVAFLAGS.
|
||||
|
||||
AC_DEFUN([JAVA_PUSH_LINT],
|
||||
[
|
||||
AC_CACHE_CHECK([whether Java compiler accepts -Xlint:$1],
|
||||
[emacs_cv_javac_knows_lint_$1],
|
||||
AS_IF([rm -f conftest.class
|
||||
cat << EOF > conftest.java
|
||||
|
||||
class conftest
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
EOF
|
||||
("$JAVAC" -Xlint:$1 conftest.java 2>&AS_MESSAGE_LOG_FD) \
|
||||
&& rm -f conftest.class], [emacs_cv_javac_knows_lint_$1=yes],
|
||||
[emacs_cv_javac_knows_lint_$1=no]))
|
||||
|
||||
AS_IF([test "$emacs_cv_javac_knows_lint_$1" = "yes"],
|
||||
[JAVAFLAGS="$JAVAFLAGS -Xlint:$1"])
|
||||
])
|
||||
|
||||
# Start Android configuration. This is done in three steps:
|
||||
|
||||
# First, the SDK tools needed to build the Android package on the host
|
||||
|
@ -760,6 +786,7 @@ ZIPALIGN=
|
|||
DX=
|
||||
ANDROID_JAR=
|
||||
ANDROID_ABI=
|
||||
JAVAFLAGS=
|
||||
|
||||
# This is a list of Makefiles that have alternative versions for
|
||||
# Android.
|
||||
|
@ -807,7 +834,7 @@ specify its location before configuring Emacs, like so:
|
|||
JARSIGNER=/opt/jdk/bin/jarsigner ./configure --with-android])
|
||||
fi
|
||||
|
||||
AC_CACHE_CHECK([whether or not the Java compiler works],
|
||||
AC_CACHE_CHECK([whether the Java compiler works],
|
||||
[emacs_cv_working_javac],
|
||||
AS_IF([rm -f conftest.class
|
||||
cat << EOF > conftest.java
|
||||
|
@ -836,7 +863,7 @@ EOF
|
|||
a valid path to android.jar. See config.log for more details.])
|
||||
fi
|
||||
|
||||
AC_CACHE_CHECK([whether or not android.jar is new enough],
|
||||
AC_CACHE_CHECK([whether android.jar is new enough],
|
||||
[emacs_cv_android_s_or_later],
|
||||
AS_IF([rm -f conftest.class
|
||||
cat << EOF > conftest.java
|
||||
|
@ -859,8 +886,52 @@ EOF
|
|||
Android 13 (Tiramisu) or later.])
|
||||
fi
|
||||
|
||||
dnl See if the Java compiler supports the `--release' option which
|
||||
dnl makes it check for and prevent using features introduced after
|
||||
dnl Java 1.7.
|
||||
|
||||
AC_CACHE_CHECK([whether javac accepts --release 7],
|
||||
[emacs_cv_javac_release_7], AS_IF([rm -f conftest.class
|
||||
cat << EOF > conftest.java
|
||||
|
||||
class conftest
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
EOF
|
||||
("$JAVAC" --release 7 conftest.java 2>&AS_MESSAGE_LOG_FD) \
|
||||
&& rm -f conftest.class],
|
||||
[emacs_cv_javac_release_7=yes],
|
||||
[emacs_cv_javac_release_7=no]))
|
||||
|
||||
if test "$emacs_cv_javac_release_7" = "yes"; then
|
||||
JAVAFLAGS="$JAVAFLAGS --release 7"
|
||||
else
|
||||
dnl If not, just make sure the generated bytecode is correct.
|
||||
JAVAFLAGS="$JAVAFLAGS -target 1.7 -source 1.7"
|
||||
fi
|
||||
|
||||
dnl Enable some useful Java linting options.
|
||||
JAVA_PUSH_LINT([deprecation])
|
||||
JAVA_PUSH_LINT([cast])
|
||||
JAVA_PUSH_LINT([divzero])
|
||||
JAVA_PUSH_LINT([nonempty])
|
||||
JAVA_PUSH_LINT([empty])
|
||||
JAVA_PUSH_LINT([finally])
|
||||
JAVA_PUSH_LINT([overrides])
|
||||
JAVA_PUSH_LINT([path])
|
||||
JAVA_PUSH_LINT([serial])
|
||||
JAVA_PUSH_LINT([unchecked])
|
||||
|
||||
# Get the name of the android.jar file.
|
||||
ANDROID_JAR="$with_android"
|
||||
|
||||
dnl Set up the class path to include android.jar, along with the cwd
|
||||
dnl (which is $(top_builddir)/java.)
|
||||
JAVAFLAGS="$JAVAFLAGS -classpath \"$ANDROID_JAR:.\""
|
||||
AC_SUBST([JAVAFLAGS])
|
||||
|
||||
AC_PATH_PROGS([AAPT], [aapt], [], "${SDK_BUILD_TOOLS}:$PATH")
|
||||
if test "$AAPT" = ""; then
|
||||
AC_MSG_ERROR([The Android asset packaging tool was not found.
|
||||
|
|
|
@ -40,10 +40,7 @@ ANDROID_JAR = @ANDROID_JAR@
|
|||
ANDROID_ABI = @ANDROID_ABI@
|
||||
ANDROID_SDK_18_OR_EARLIER = @ANDROID_SDK_18_OR_EARLIER@
|
||||
ANDROID_SDK_8_OR_EARLIER = @ANDROID_SDK_8_OR_EARLIER@
|
||||
|
||||
WARN_JAVAFLAGS = -Xlint:deprecation
|
||||
JAVAFLAGS = -classpath "$(ANDROID_JAR):." -target 1.7 -source 1.7 \
|
||||
$(WARN_JAVAFLAGS)
|
||||
JAVAFLAGS = @JAVAFLAGS@
|
||||
|
||||
# Android 4.3 and earlier require Emacs to be signed with a different
|
||||
# digital signature algorithm.
|
||||
|
|
|
@ -325,7 +325,7 @@ protected class Sdk7FontObject extends FontObject
|
|||
list.add (new Sdk7FontEntity (typefaceList[i]));
|
||||
}
|
||||
|
||||
return (FontEntity[]) list.toArray (new FontEntity[0]);
|
||||
return list.toArray (new FontEntity[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Add table
Reference in a new issue