2016-07-14 19:16:42 +03:00
|
|
|
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
|
2016-03-17 21:04:08 +03:00
|
|
|
# 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))')
|
|
|
|
|
2016-03-22 08:21:32 +03:00
|
|
|
@depends('--with-gradle')
|
|
|
|
def with_gradle(value):
|
2016-03-17 21:04:08 +03:00
|
|
|
if value:
|
2016-03-22 08:21:32 +03:00
|
|
|
return True
|
|
|
|
|
|
|
|
set_config('MOZ_BUILD_MOBILE_ANDROID_WITH_GRADLE', with_gradle)
|
2016-03-17 21:04:08 +03:00
|
|
|
|
2016-03-22 08:21:32 +03:00
|
|
|
|
|
|
|
@depends('--with-gradle', check_build_environment)
|
2016-11-04 00:50:43 +03:00
|
|
|
@imports(_from='os.path', _import='isfile')
|
2016-03-22 08:21:32 +03:00
|
|
|
def gradle(value, build_env):
|
2016-03-17 21:04:08 +03:00
|
|
|
gradle = value[0] if len(value) else \
|
2016-03-23 03:24:01 +03:00
|
|
|
os.path.join(build_env.topsrcdir, 'gradlew')
|
2016-03-17 21:04:08 +03:00
|
|
|
|
|
|
|
# TODO: verify that $GRADLE is executable.
|
2016-11-04 00:50:43 +03:00
|
|
|
if not isfile(gradle):
|
2016-03-25 09:48:21 +03:00
|
|
|
die('GRADLE must be executable: %s', gradle)
|
2016-03-17 21:04:08 +03:00
|
|
|
|
|
|
|
return gradle
|
|
|
|
|
2016-03-22 08:21:32 +03:00
|
|
|
set_config('GRADLE', gradle)
|
|
|
|
|
2016-03-17 21:04:08 +03:00
|
|
|
|
|
|
|
# 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):
|
2016-03-22 08:21:32 +03:00
|
|
|
return value[0] if value else ''
|
|
|
|
|
|
|
|
set_config('GRADLE_FLAGS', gradle_flags)
|
2016-03-17 21:04:08 +03:00
|
|
|
|
|
|
|
|
|
|
|
# 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:
|
2016-03-22 08:21:32 +03:00
|
|
|
return value[0]
|
|
|
|
|
|
|
|
set_config('GRADLE_MAVEN_REPOSITORY', gradle_maven_repository)
|