Error if buildjni= is present but no native code was packaged

This commit is contained in:
Daniel Martí 2014-03-27 19:22:21 +01:00
parent 25a8dd5af4
commit edda052000
2 changed files with 16 additions and 7 deletions

View file

@ -981,19 +981,22 @@ multi-component projects.
The build and scan processes will complain (refuse to build) if this The build and scan processes will complain (refuse to build) if this
parameter is not defined, but there is a @code{jni} directory present. parameter is not defined, but there is a @code{jni} directory present.
If the native code is being built by other means, you can specify If the native code is being built by other means like a gradle task, you
@code{no} here to avoid that. However, if the native code is actually can specify @code{no} here to avoid that. However, if the native code is
not required, remove the directory instead (using @code{prebuild} for actually not required or used, remove the directory instead (using
example). @code{rm=jni} for example). Using @code{buildjni=no} when the jni code
isn't used nor built will result in an error saying that native
libraries were expected in the resulting package.
@item gradle=<flavour>[@@<dir>] @item gradle=<flavour>[@@<dir>]
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', 'main' or empty, 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 If @@<dir> is attached to <flavour>, then the gradle tasks will be run
directory. This might be necessary if gradle needs to be run in the parent in that directory. This might be necessary if gradle needs to be run in
directory, in which case one would use 'gradle=<flavour>@@..'. 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. Like gradle, an extra @@<dir> tells f-droid

View file

@ -688,6 +688,7 @@ def build_local(app, thisbuild, vcs, build_dir, output_dir, srclib_dir, extlib_d
vercode = None vercode = None
version = None version = None
foundid = None foundid = None
nativecode = None
for line in p.stdout.splitlines(): for line in p.stdout.splitlines():
if line.startswith("package:"): if line.startswith("package:"):
pat = re.compile(".*name='([a-zA-Z0-9._]*)'.*") pat = re.compile(".*name='([a-zA-Z0-9._]*)'.*")
@ -702,7 +703,12 @@ def build_local(app, thisbuild, vcs, build_dir, output_dir, srclib_dir, extlib_d
m = pat.match(line) m = pat.match(line)
if m: if m:
version = m.group(1) version = m.group(1)
elif line.startswith("native-code:"):
nativecode = line[12:]
if thisbuild.get('buildjni') is not None:
if nativecode is None or "'" not in nativecode:
raise BuildException("Native code should have been built but none was packaged")
if thisbuild['novcheck']: if thisbuild['novcheck']:
vercode = thisbuild['vercode'] vercode = thisbuild['vercode']
version = thisbuild['version'] version = thisbuild['version']