Remove @dir support from gradle

This commit is contained in:
Daniel Martí 2014-07-01 19:39:41 +02:00
parent 7be0634a52
commit 76ac2f591c
3 changed files with 8 additions and 30 deletions

View file

@ -989,19 +989,16 @@ actually not required or used, remove the directory instead (using
isn't used nor built will result in an error saying that native isn't used nor built will result in an error saying that native
libraries were expected in the resulting package. libraries were expected in the resulting package.
@item gradle=<flavour>[@@<dir>] @item gradle=<flavour>
Build with gradle instead of ant, specifying what flavour to assemble. Build with gradle instead of ant, specifying what flavour to assemble.
If <flavour> is 'yes', 'main' or empty, no flavour will be used. Note If <flavour> is 'yes' or 'main', no flavour will be used. Note
that this will not work on projects with flavours, since it will build that this will not work on projects with flavours, since it will build
all flavours and there will be no 'main' build. all flavours and there will be no 'main' build.
If @@<dir> is attached to <flavour>, then the gradle tasks will be run
in that directory. This might be necessary if gradle needs to be run in
the parent directory, in which case one would use
'gradle=<flavour>@@..'.
@item maven=yes[@@<dir>] @item maven=yes[@@<dir>]
Build with maven instead of ant. Like gradle, an extra @@<dir> tells f-droid Build with maven instead of ant. An extra @@<dir> tells f-droid to run maven
to run maven inside that relative subdirectory. inside that relative subdirectory. Sometimes it is needed to use @@.. so that
builds happen correctly.
@item preassemble=<task1> <task2> @item preassemble=<task1> <task2>
Space-separated list of gradle tasks to be run before the assemble task Space-separated list of gradle tasks to be run before the assemble task

View file

@ -473,17 +473,11 @@ def build_local(app, thisbuild, vcs, build_dir, output_dir, srclib_dir, extlib_d
logging.info("Cleaning Gradle project...") logging.info("Cleaning Gradle project...")
cmd = [config['gradle'], 'clean'] cmd = [config['gradle'], 'clean']
if '@' in thisbuild['gradle']:
gradle_dir = os.path.join(root_dir, thisbuild['gradle'].split('@', 1)[1])
gradle_dir = os.path.normpath(gradle_dir)
else:
gradle_dir = root_dir
adapt_gradle(build_dir) adapt_gradle(build_dir)
for name, number, libpath in srclibpaths: for name, number, libpath in srclibpaths:
adapt_gradle(libpath) adapt_gradle(libpath)
p = FDroidPopen(cmd, cwd=gradle_dir) p = FDroidPopen(cmd, cwd=root_dir)
elif thisbuild['type'] == 'kivy': elif thisbuild['type'] == 'kivy':
pass pass
@ -685,13 +679,7 @@ def build_local(app, thisbuild, vcs, build_dir, output_dir, srclib_dir, extlib_d
elif thisbuild['type'] == 'gradle': elif thisbuild['type'] == 'gradle':
logging.info("Building Gradle project...") logging.info("Building Gradle project...")
if '@' in thisbuild['gradle']: flavours = thisbuild['gradle'].split(',')
flavours = thisbuild['gradle'].split('@')[0].split(',')
gradle_dir = thisbuild['gradle'].split('@')[1]
gradle_dir = os.path.join(root_dir, gradle_dir)
else:
flavours = thisbuild['gradle'].split(',')
gradle_dir = root_dir
if len(flavours) == 1 and flavours[0] in ['main', 'yes', '']: if len(flavours) == 1 and flavours[0] in ['main', 'yes', '']:
flavours[0] = '' flavours[0] = ''
@ -711,7 +699,7 @@ def build_local(app, thisbuild, vcs, build_dir, output_dir, srclib_dir, extlib_d
if LooseVersion('0.8') <= thisbuild['gradlepluginver'] < LooseVersion('0.11'): if LooseVersion('0.8') <= thisbuild['gradlepluginver'] < LooseVersion('0.11'):
commands += ['-x', 'lintVital' + flavours_cmd + 'Release'] commands += ['-x', 'lintVital' + flavours_cmd + 'Release']
p = FDroidPopen(commands, cwd=gradle_dir) p = FDroidPopen(commands, cwd=root_dir)
elif thisbuild['type'] == 'ant': elif thisbuild['type'] == 'ant':
logging.info("Building Ant project...") logging.info("Building Ant project...")

View file

@ -1196,13 +1196,6 @@ def prepare_source(vcs, app, build, build_dir, srclib_dir, extlib_dir, onserver=
's@compileSdkVersion *[0-9]*@compileSdkVersion ' + n + '@g', 's@compileSdkVersion *[0-9]*@compileSdkVersion ' + n + '@g',
'build.gradle'], 'build.gradle'],
cwd=root_dir) cwd=root_dir)
if '@' in build['gradle']:
gradle_dir = os.path.join(root_dir, build['gradle'].split('@', 1)[1])
gradle_dir = os.path.normpath(gradle_dir)
FDroidPopen(['sed', '-i',
's@compileSdkVersion *[0-9]*@compileSdkVersion ' + n + '@g',
'build.gradle'],
cwd=gradle_dir)
# Remove forced debuggable flags # Remove forced debuggable flags
remove_debuggable_flags(root_dir) remove_debuggable_flags(root_dir)