Make GradleBuilder configurable.

A dependency (future kiwix-android-custom app) may want to use the gradle
builder for something else than `build` with the default options.
This commit is contained in:
Matthieu Gautier 2017-05-02 14:26:45 +02:00
parent c8f5acb41f
commit 39c2e67b80
1 changed files with 7 additions and 7 deletions

View File

@ -308,12 +308,14 @@ class MesonBuilder(Builder):
class GradleBuilder(Builder): class GradleBuilder(Builder):
gradle_target = "build"
gradle_option = "-i"
def build(self): def build(self):
self.command('configure', self._configure) self.command('configure', self._configure)
if hasattr(self, '_pre_compile_script'): if hasattr(self, '_pre_compile_script'):
self.command('pre_compile_script', self._pre_compile_script) self.command('pre_compile_script', self._pre_compile_script)
self.command('compile', self._compile) self.command('compile', self._compile)
self.command('install', self._install)
def _configure(self, context): def _configure(self, context):
# We don't have a lot to configure by itself # We don't have a lot to configure by itself
@ -323,10 +325,8 @@ class GradleBuilder(Builder):
shutil.copytree(self.source_path, self.build_path) shutil.copytree(self.source_path, self.build_path)
def _compile(self, context): def _compile(self, context):
command = "gradle clean assemble --info" command = "gradle {gradle_target} {gradle_option}"
command = command.format(
gradle_target=self.gradle_target,
gradle_option=self.gradle_option)
self.buildEnv.run_command(command, self.build_path, context) self.buildEnv.run_command(command, self.build_path, context)
command = "gradle build --info"
self.buildEnv.run_command(command, self.build_path, context)
def _install(self, context):
pass