mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-23 12:51:06 +00:00
Bug 1256995 - Move --with-gradle to mobile/android/moz.configure. r=glandium
This also adds a GRADLE_FLAGS environment variable for use in automation. Manually tested. MozReview-Commit-ID: 8nDkqz2VnJn --HG-- extra : rebase_source : 32626a7dc0c0a6a440e300d92c31670f14319325 extra : amend_source : fe134e25f079851b4c648b53a7a485ee20c15c18
This commit is contained in:
parent
164643fa61
commit
40132bc444
12
build.gradle
12
build.gradle
@ -9,8 +9,10 @@ allprojects {
|
||||
}
|
||||
|
||||
repositories {
|
||||
maven {
|
||||
url gradle.mozconfig.substs.GRADLE_MAVEN_REPOSITORY
|
||||
if (gradle.mozconfig.substs.GRADLE_MAVEN_REPOSITORY) {
|
||||
maven {
|
||||
url gradle.mozconfig.substs.GRADLE_MAVEN_REPOSITORY
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -19,8 +21,10 @@ buildDir "${topobjdir}/gradle/build"
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
maven {
|
||||
url gradle.mozconfig.substs.GRADLE_MAVEN_REPOSITORY
|
||||
if (gradle.mozconfig.substs.GRADLE_MAVEN_REPOSITORY) {
|
||||
maven {
|
||||
url gradle.mozconfig.substs.GRADLE_MAVEN_REPOSITORY
|
||||
}
|
||||
}
|
||||
// For android-sdk-manager SNAPSHOT releases.
|
||||
maven {
|
||||
|
@ -255,11 +255,15 @@ def wanted_mozconfig_variables(help):
|
||||
'DSYMUTIL',
|
||||
'EXTERNAL_SOURCE_DIR',
|
||||
'GENISOIMAGE',
|
||||
'GRADLE',
|
||||
'GRADLE_FLAGS',
|
||||
'GRADLE_MAVEN_REPOSITORY',
|
||||
'JS_STANDALONE',
|
||||
'L10NBASEDIR',
|
||||
'MOZILLABUILD',
|
||||
'MOZ_ARTIFACT_BUILDS',
|
||||
'MOZ_BUILD_APP',
|
||||
'MOZ_BUILD_MOBILE_ANDROID_WITH_GRADLE',
|
||||
'MOZ_CALLGRIND',
|
||||
'MOZ_DMD',
|
||||
'MOZ_FMP4',
|
||||
|
@ -323,7 +323,6 @@ def old_configure_options(*options):
|
||||
'--with-gonk-toolchain-prefix',
|
||||
'--with-google-api-keyfile',
|
||||
'--with-google-oauth-api-keyfile',
|
||||
'--with-gradle',
|
||||
'--with-intl-api',
|
||||
'--with-ios-sdk',
|
||||
'--with-java-bin-path',
|
||||
|
49
mobile/android/gradle.configure
Normal file
49
mobile/android/gradle.configure
Normal file
@ -0,0 +1,49 @@
|
||||
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
|
||||
# vim: set filetype=python:
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
# If --with-gradle is specified, build mobile/android with Gradle. If no
|
||||
# Gradle binary is specified, or if --without-gradle is specified, use the in
|
||||
# tree Gradle wrapper. The wrapper downloads and installs Gradle, which is
|
||||
# good for local developers but not good in automation.
|
||||
option('--with-gradle', nargs='?',
|
||||
help='Enable building mobile/android with Gradle '
|
||||
'(argument: location of binary or wrapper (gradle/gradlew))')
|
||||
|
||||
@depends('--with-gradle', check_build_environment)
|
||||
def gradle(value, build_env):
|
||||
if value:
|
||||
set_config('MOZ_BUILD_MOBILE_ANDROID_WITH_GRADLE', '1')
|
||||
|
||||
gradle = value[0] if len(value) else \
|
||||
os.path.join(build_env['TOPSRCDIR'], 'gradlew')
|
||||
|
||||
# TODO: verify that $GRADLE is executable.
|
||||
if not os.path.isfile(gradle):
|
||||
error('GRADLE must be executable: %s' % gradle)
|
||||
|
||||
set_config('GRADLE', gradle)
|
||||
|
||||
return gradle
|
||||
|
||||
|
||||
# Automation uses this to change log levels, not use the daemon, and use
|
||||
# offline mode.
|
||||
option(env='GRADLE_FLAGS', default='', help='Flags to pass to Gradle.')
|
||||
|
||||
@depends('GRADLE_FLAGS')
|
||||
def gradle_flags(value):
|
||||
set_config('GRADLE_FLAGS', value[0] if value else '')
|
||||
|
||||
|
||||
# Automation will set this to file:///path/to/local via the mozconfig.
|
||||
# Local developer default is jcenter.
|
||||
option(env='GRADLE_MAVEN_REPOSITORY', default='https://jcenter.bintray.com/',
|
||||
help='Path to Maven repository containing Gradle dependencies.')
|
||||
|
||||
@depends('GRADLE_MAVEN_REPOSITORY')
|
||||
def gradle_maven_repository(value):
|
||||
if value:
|
||||
set_config('GRADLE_MAVEN_REPOSITORY', value[0])
|
@ -15,6 +15,10 @@ from mozbuild.base import (
|
||||
MachCommandConditions as conditions,
|
||||
)
|
||||
|
||||
from mozbuild.shellutil import (
|
||||
split as shell_split,
|
||||
)
|
||||
|
||||
from mach.decorators import (
|
||||
CommandArgument,
|
||||
CommandProvider,
|
||||
@ -63,6 +67,8 @@ class MachCommands(MachCommandBase):
|
||||
# $JAVA_HOME/bin/java into $JAVA_HOME.
|
||||
java_home = os.path.dirname(os.path.dirname(self.substs['JAVA']))
|
||||
|
||||
gradle_flags = shell_split(self.substs.get('GRADLE_FLAGS', ''))
|
||||
|
||||
# We force the Gradle JVM to run with the UTF-8 encoding, since we
|
||||
# filter strings.xml, which is really UTF-8; the ellipsis character is
|
||||
# replaced with ??? in some encodings (including ASCII). It's not yet
|
||||
@ -72,7 +78,7 @@ class MachCommands(MachCommandBase):
|
||||
# Android tools expect UTF-8: see
|
||||
# http://tools.android.com/knownissues/encoding. See
|
||||
# http://stackoverflow.com/a/21267635 for discussion of this approach.
|
||||
return self.run_process([self.substs['GRADLE']] + args,
|
||||
return self.run_process([self.substs['GRADLE']] + gradle_flags + args,
|
||||
append_env={
|
||||
'GRADLE_OPTS': '-Dfile.encoding=utf-8',
|
||||
'JAVA_HOME': java_home,
|
||||
|
@ -5,3 +5,4 @@
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
include('../../toolkit/moz.configure')
|
||||
include('gradle.configure')
|
||||
|
@ -2813,7 +2813,6 @@ MOZ_SCTP=
|
||||
MOZ_ANDROID_OMX=
|
||||
MOZ_MEDIA_NAVIGATOR=
|
||||
MOZ_OMX_PLUGIN=
|
||||
MOZ_BUILD_MOBILE_ANDROID_WITH_GRADLE=
|
||||
MOZ_VPX_ERROR_CONCEALMENT=
|
||||
MOZ_WEBSPEECH=1
|
||||
MOZ_WEBSPEECH_MODELS=
|
||||
@ -4140,68 +4139,6 @@ if test -n "$MOZ_OMX_PLUGIN"; then
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl ========================================================
|
||||
dnl Gradle support
|
||||
dnl
|
||||
dnl If --with-gradle is specified, build mobile/android with Gradle.
|
||||
dnl
|
||||
dnl If no Gradle binary is specified, use the in tree Gradle wrapper.
|
||||
dnl The wrapper downloads and installs Gradle, which is good for local
|
||||
dnl developers but not good in automation.
|
||||
dnl ========================================================
|
||||
|
||||
GRADLE=
|
||||
MOZ_ARG_WITH_STRING(gradle,
|
||||
[ --with-gradle=/path/to/bin/gradle
|
||||
Enable building mobile/android with Gradle (argument: location of binary or wrapper (gradle/gradlew))],
|
||||
if test "$withval" = "no" ; then
|
||||
dnl --without-gradle => use the wrapper in |mach gradle|, don't build
|
||||
dnl with Gradle by default.
|
||||
GRADLE=$srcdir/gradlew
|
||||
MOZ_BUILD_MOBILE_ANDROID_WITH_GRADLE=
|
||||
elif test "$withval" = "yes" ; then
|
||||
dnl --with-gradle => use the wrapper in |mach gradle|, build with
|
||||
dnl Gradle by default.
|
||||
GRADLE=$srcdir/gradlew
|
||||
MOZ_BUILD_MOBILE_ANDROID_WITH_GRADLE=1
|
||||
else
|
||||
dnl --with-gradle=/path/to/gradle => use the given binary in |mach
|
||||
dnl gradle|, build with Gradle by default.
|
||||
GRADLE=$withval
|
||||
MOZ_BUILD_MOBILE_ANDROID_WITH_GRADLE=1
|
||||
fi
|
||||
,
|
||||
dnl No --with{out}-gradle => use the wrapper in |mach gradle|, don't build
|
||||
dnl with Gradle by default.
|
||||
GRADLE=$srcdir/gradlew
|
||||
MOZ_BUILD_MOBILE_ANDROID_WITH_GRADLE=
|
||||
)
|
||||
|
||||
if test "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk" ; then
|
||||
if test -z "$GRADLE" -o ! -x "$GRADLE" ; then
|
||||
AC_MSG_ERROR([The program gradlew/gradle was not found. Use --with-gradle=/path/to/bin/gradle}])
|
||||
fi
|
||||
fi
|
||||
AC_SUBST(GRADLE)
|
||||
|
||||
dnl Path to Maven repository containing Gradle dependencies. Automation will
|
||||
dnl set this to file:///path/to/local via the mozconfig. Local developer
|
||||
dnl default is jcenter.
|
||||
if test -z "$GRADLE_MAVEN_REPOSITORY" ; then
|
||||
GRADLE_MAVEN_REPOSITORY=https://jcenter.bintray.com/
|
||||
fi
|
||||
AC_SUBST(GRADLE_MAVEN_REPOSITORY)
|
||||
|
||||
if test -n "$MOZ_BUILD_MOBILE_ANDROID_WITH_GRADLE"; then
|
||||
if test "$OS_TARGET" = "Android" -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk"; then
|
||||
dnl Only allow building mobile/android with Gradle.
|
||||
AC_DEFINE(MOZ_BUILD_MOBILE_ANDROID_WITH_GRADLE)
|
||||
else
|
||||
dnl fail if we're not building mobile/android.
|
||||
AC_MSG_ERROR([Can only build mobile/android with Gradle])
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl system libvpx Support
|
||||
dnl ========================================================
|
||||
MOZ_ARG_WITH_BOOL(system-libvpx,
|
||||
@ -7629,7 +7566,6 @@ AC_SUBST_LIST(FFVPX_ASFLAGS)
|
||||
AC_SUBST(MOZ_DIRECTSHOW)
|
||||
AC_SUBST(MOZ_ANDROID_OMX)
|
||||
AC_SUBST(MOZ_OMX_PLUGIN)
|
||||
AC_SUBST(MOZ_BUILD_MOBILE_ANDROID_WITH_GRADLE)
|
||||
AC_SUBST(MOZ_VPX_ERROR_CONCEALMENT)
|
||||
AC_SUBST(VPX_USE_YASM)
|
||||
AC_SUBST_LIST(VPX_ASFLAGS)
|
||||
|
Loading…
Reference in New Issue
Block a user