Gradle is a dependency of the android platform, not of other dependencies.

This commit is contained in:
Matthieu Gautier 2018-05-30 17:56:06 +02:00
parent 6de2cc80b6
commit 9b85791705
5 changed files with 16 additions and 8 deletions

View File

@ -18,7 +18,5 @@ class AllBaseDependencies(Dependency):
if (platformInfo.build != 'android' and
neutralEnv('distname') != 'Darwin'):
base_deps += ['ctpp2c', 'ctpp2']
if platformInfo.build == 'android':
base_deps += ['Gradle']
return base_deps

View File

@ -6,7 +6,8 @@ from .base import (
from kiwixbuild.utils import Remotefile, pj, copy_tree, add_execution_right
class Gradle(Dependency):
name = "Gradle"
neutral = True
name = "gradle"
class Source(ReleaseDownload):
archive = Remotefile('gradle-4.6-bin.zip',
@ -14,14 +15,18 @@ class Gradle(Dependency):
'https://services.gradle.org/distributions/gradle-4.6-bin.zip')
class Builder(BaseBuilder):
@property
def install_path(self):
return self.buildEnv.install_dir
def build(self):
self.command('install', self._install)
def _install(self, context):
copy_tree(
pj(self.source_path, "bin"),
pj(self.buildEnv.install_dir, "bin"),
pj(self.install_path, "bin"),
post_copy_function = add_execution_right)
copy_tree(
pj(self.source_path, "lib"),
pj(self.buildEnv.install_dir, "lib"))
pj(self.install_path, "lib"))

View File

@ -16,7 +16,7 @@ class KiwixAndroid(Dependency):
git_dir = "kiwix-android"
class Builder(GradleBuilder):
dependencies = ["Gradle", "kiwix-lib"]
dependencies = ["kiwix-lib"]
def build(self):
if option('targets') == 'kiwix-android-custom':

View File

@ -117,7 +117,7 @@ class AndroidArm(AndroidPlatformInfo):
class Android(MetaPlatformInfo):
name = "android"
toolchain_names = ['android-sdk']
toolchain_names = ['android-sdk', 'gradle']
subPlatformNames = ['android_arm', 'android_arm64', 'android_mips', 'android_mips64', 'android_x86', 'android_x86_64']
compatible_hosts = ['fedora', 'debian']
@ -128,5 +128,10 @@ class Android(MetaPlatformInfo):
def sdk_builder(self):
return get_target_step('android-sdk', 'neutral')
@property
def gradle_builder(self):
return get_target_step('gradle', 'neutral')
def set_env(self, env):
env['ANDROID_HOME'] = self.sdk_builder.install_path
env['PATH'] = ':'.join([pj(self.gradle_builder.install_path, 'bin'), env['PATH']])

View File

@ -23,7 +23,7 @@ base_deps_versions = {
'libmicrohttpd' : '0.9.46',
'gumbo' : '0.10.1',
'icu4c' : '58.2',
'Gradle' : '4.6',
'gradle' : '4.6',
'libaria2' : '1.33.1',
'libmagic' : '5.33',
'android-sdk' : 'r25.2.3',