mirror of
https://gitlab.com/fdroid/fdroidserver.git
synced 2024-11-19 21:30:10 +01:00
output= is now a glob path and can do gradle
This commit is contained in:
parent
da0a787879
commit
9800ed1a1a
@ -1120,10 +1120,12 @@ For example: @code{gradleprops=enableFoo,someSetting=bar} will result in
|
|||||||
Specify an alternate set of Ant commands (target) instead of the default
|
Specify an alternate set of Ant commands (target) instead of the default
|
||||||
'release'. It can't be given any flags, such as the path to a build.xml.
|
'release'. It can't be given any flags, such as the path to a build.xml.
|
||||||
|
|
||||||
@item output=path/to/output.apk
|
@item output=glob/to/output.apk
|
||||||
To be used when app is built with a tool other than the ones natively
|
Specify a glob path where the resulting unsigned release apk from the
|
||||||
supported, like GNU Make. The given path will be where the build= set of
|
build should be. This can be used in combination with build methods like
|
||||||
commands should produce the final unsigned release apk.
|
@code{gradle=yes} or @code{maven=yes}, but if no build method is
|
||||||
|
specified, the build is manual. You should run your build commands, such
|
||||||
|
as @code{make}, in @code{build=}.
|
||||||
|
|
||||||
@item novcheck=yes
|
@item novcheck=yes
|
||||||
Don't check that the version name and code in the resulting apk are
|
Don't check that the version name and code in the resulting apk are
|
||||||
|
@ -489,8 +489,8 @@ def build_local(app, build, vcs, build_dir, output_dir, srclib_dir, extlib_dir,
|
|||||||
# different from the default ones
|
# different from the default ones
|
||||||
p = None
|
p = None
|
||||||
gradletasks = []
|
gradletasks = []
|
||||||
method = build.method()
|
bmethod = build.build_method()
|
||||||
if method == 'maven':
|
if bmethod == 'maven':
|
||||||
logging.info("Cleaning Maven project...")
|
logging.info("Cleaning Maven project...")
|
||||||
cmd = [config['mvn3'], 'clean', '-Dandroid.sdk.path=' + config['sdk_path']]
|
cmd = [config['mvn3'], 'clean', '-Dandroid.sdk.path=' + config['sdk_path']]
|
||||||
|
|
||||||
@ -502,7 +502,7 @@ def build_local(app, build, vcs, build_dir, output_dir, srclib_dir, extlib_dir,
|
|||||||
|
|
||||||
p = FDroidPopen(cmd, cwd=maven_dir)
|
p = FDroidPopen(cmd, cwd=maven_dir)
|
||||||
|
|
||||||
elif method == 'gradle':
|
elif bmethod == 'gradle':
|
||||||
|
|
||||||
logging.info("Cleaning Gradle project...")
|
logging.info("Cleaning Gradle project...")
|
||||||
|
|
||||||
@ -529,10 +529,10 @@ def build_local(app, build, vcs, build_dir, output_dir, srclib_dir, extlib_dir,
|
|||||||
|
|
||||||
p = FDroidPopen(cmd, cwd=root_dir)
|
p = FDroidPopen(cmd, cwd=root_dir)
|
||||||
|
|
||||||
elif method == 'kivy':
|
elif bmethod == 'kivy':
|
||||||
pass
|
pass
|
||||||
|
|
||||||
elif method == 'ant':
|
elif bmethod == 'ant':
|
||||||
logging.info("Cleaning Ant project...")
|
logging.info("Cleaning Ant project...")
|
||||||
p = FDroidPopen(['ant', 'clean'], cwd=root_dir)
|
p = FDroidPopen(['ant', 'clean'], cwd=root_dir)
|
||||||
|
|
||||||
@ -639,7 +639,7 @@ def build_local(app, build, vcs, build_dir, output_dir, srclib_dir, extlib_dir,
|
|||||||
|
|
||||||
p = None
|
p = None
|
||||||
# Build the release...
|
# Build the release...
|
||||||
if method == 'maven':
|
if bmethod == 'maven':
|
||||||
logging.info("Building Maven project...")
|
logging.info("Building Maven project...")
|
||||||
|
|
||||||
if '@' in build.maven:
|
if '@' in build.maven:
|
||||||
@ -665,7 +665,7 @@ def build_local(app, build, vcs, build_dir, output_dir, srclib_dir, extlib_dir,
|
|||||||
|
|
||||||
bindir = os.path.join(root_dir, 'target')
|
bindir = os.path.join(root_dir, 'target')
|
||||||
|
|
||||||
elif method == 'kivy':
|
elif bmethod == 'kivy':
|
||||||
logging.info("Building Kivy project...")
|
logging.info("Building Kivy project...")
|
||||||
|
|
||||||
spec = os.path.join(root_dir, 'buildozer.spec')
|
spec = os.path.join(root_dir, 'buildozer.spec')
|
||||||
@ -726,7 +726,7 @@ def build_local(app, build, vcs, build_dir, output_dir, srclib_dir, extlib_dir,
|
|||||||
cmd.append('release')
|
cmd.append('release')
|
||||||
p = FDroidPopen(cmd, cwd=distdir)
|
p = FDroidPopen(cmd, cwd=distdir)
|
||||||
|
|
||||||
elif method == 'gradle':
|
elif bmethod == 'gradle':
|
||||||
logging.info("Building Gradle project...")
|
logging.info("Building Gradle project...")
|
||||||
|
|
||||||
cmd = [config['gradle']]
|
cmd = [config['gradle']]
|
||||||
@ -737,7 +737,7 @@ def build_local(app, build, vcs, build_dir, output_dir, srclib_dir, extlib_dir,
|
|||||||
|
|
||||||
p = FDroidPopen(cmd, cwd=root_dir)
|
p = FDroidPopen(cmd, cwd=root_dir)
|
||||||
|
|
||||||
elif method == 'ant':
|
elif bmethod == 'ant':
|
||||||
logging.info("Building Ant project...")
|
logging.info("Building Ant project...")
|
||||||
cmd = ['ant']
|
cmd = ['ant']
|
||||||
if build.antcommands:
|
if build.antcommands:
|
||||||
@ -752,7 +752,8 @@ def build_local(app, build, vcs, build_dir, output_dir, srclib_dir, extlib_dir,
|
|||||||
raise BuildException("Build failed for %s:%s" % (app.id, build.version), p.output)
|
raise BuildException("Build failed for %s:%s" % (app.id, build.version), p.output)
|
||||||
logging.info("Successfully built version " + build.version + ' of ' + app.id)
|
logging.info("Successfully built version " + build.version + ' of ' + app.id)
|
||||||
|
|
||||||
if method == 'maven':
|
omethod = build.output_method()
|
||||||
|
if omethod == 'maven':
|
||||||
stdout_apk = '\n'.join([
|
stdout_apk = '\n'.join([
|
||||||
line for line in p.output.splitlines() if any(
|
line for line in p.output.splitlines() if any(
|
||||||
a in line for a in ('.apk', '.ap_', '.jar'))])
|
a in line for a in ('.apk', '.ap_', '.jar'))])
|
||||||
@ -772,12 +773,12 @@ def build_local(app, build, vcs, build_dir, output_dir, srclib_dir, extlib_dir,
|
|||||||
raise BuildException('Failed to find output')
|
raise BuildException('Failed to find output')
|
||||||
src = m.group(1)
|
src = m.group(1)
|
||||||
src = os.path.join(bindir, src) + '.apk'
|
src = os.path.join(bindir, src) + '.apk'
|
||||||
elif method == 'kivy':
|
elif omethod == 'kivy':
|
||||||
src = os.path.join('python-for-android', 'dist', 'default', 'bin',
|
src = os.path.join('python-for-android', 'dist', 'default', 'bin',
|
||||||
'{0}-{1}-release.apk'.format(
|
'{0}-{1}-release.apk'.format(
|
||||||
bconfig.get('app', 'title'),
|
bconfig.get('app', 'title'),
|
||||||
bconfig.get('app', 'version')))
|
bconfig.get('app', 'version')))
|
||||||
elif method == 'gradle':
|
elif omethod == 'gradle':
|
||||||
src = None
|
src = None
|
||||||
for apks_dir in [
|
for apks_dir in [
|
||||||
os.path.join(root_dir, 'build', 'outputs', 'apk'),
|
os.path.join(root_dir, 'build', 'outputs', 'apk'),
|
||||||
@ -798,15 +799,23 @@ def build_local(app, build, vcs, build_dir, output_dir, srclib_dir, extlib_dir,
|
|||||||
if src is None:
|
if src is None:
|
||||||
raise BuildException('Failed to find any output apks')
|
raise BuildException('Failed to find any output apks')
|
||||||
|
|
||||||
elif method == 'ant':
|
elif omethod == 'ant':
|
||||||
stdout_apk = '\n'.join([
|
stdout_apk = '\n'.join([
|
||||||
line for line in p.output.splitlines() if '.apk' in line])
|
line for line in p.output.splitlines() if '.apk' in line])
|
||||||
src = re.match(r".*^.*Creating (.+) for release.*$.*", stdout_apk,
|
src = re.match(r".*^.*Creating (.+) for release.*$.*", stdout_apk,
|
||||||
re.S | re.M).group(1)
|
re.S | re.M).group(1)
|
||||||
src = os.path.join(bindir, src)
|
src = os.path.join(bindir, src)
|
||||||
elif method == 'raw':
|
elif omethod == 'raw':
|
||||||
src = os.path.join(root_dir, build.output)
|
globpath = os.path.join(root_dir, build.output)
|
||||||
src = os.path.normpath(src)
|
print(globpath)
|
||||||
|
globpath = os.path.normpath(globpath)
|
||||||
|
print(globpath)
|
||||||
|
apks = glob.glob(globpath)
|
||||||
|
if len(apks) > 1:
|
||||||
|
raise BuildException('Multiple apks match %s' % globpath, '\n'.join(apks))
|
||||||
|
if len(apks) < 1:
|
||||||
|
raise BuildException('No apks match %s' % globpath)
|
||||||
|
src = os.path.normpath(apks[0])
|
||||||
|
|
||||||
# Make sure it's not debuggable...
|
# Make sure it's not debuggable...
|
||||||
if common.isApkDebuggable(src, config):
|
if common.isApkDebuggable(src, config):
|
||||||
|
@ -1372,7 +1372,7 @@ def prepare_source(vcs, app, build, build_dir, srclib_dir, extlib_dir, onserver=
|
|||||||
f.write(props)
|
f.write(props)
|
||||||
|
|
||||||
flavours = []
|
flavours = []
|
||||||
if build.method() == 'gradle':
|
if build.build_method() == 'gradle':
|
||||||
flavours = build.gradle
|
flavours = build.gradle
|
||||||
|
|
||||||
if build.target:
|
if build.target:
|
||||||
@ -1461,7 +1461,7 @@ def prepare_source(vcs, app, build, build_dir, srclib_dir, extlib_dir, onserver=
|
|||||||
(app.id, build.version), p.output)
|
(app.id, build.version), p.output)
|
||||||
|
|
||||||
# Generate (or update) the ant build file, build.xml...
|
# Generate (or update) the ant build file, build.xml...
|
||||||
if build.method() == 'ant' and build.update != ['no']:
|
if build.build_method() == 'ant' and build.update != ['no']:
|
||||||
parms = ['android', 'update', 'lib-project']
|
parms = ['android', 'update', 'lib-project']
|
||||||
lparms = ['android', 'update', 'project']
|
lparms = ['android', 'update', 'project']
|
||||||
|
|
||||||
|
@ -305,7 +305,7 @@ def check_builds(app):
|
|||||||
ref = srclib.split('@')[1].split('/')[0]
|
ref = srclib.split('@')[1].split('/')[0]
|
||||||
if ref.startswith(s):
|
if ref.startswith(s):
|
||||||
yield "Branch '%s' used as commit in srclib '%s'" % (s, srclib)
|
yield "Branch '%s' used as commit in srclib '%s'" % (s, srclib)
|
||||||
if build.target and build.method() == 'gradle':
|
if build.target and build.build_method() == 'gradle':
|
||||||
yield "target= has no gradle support"
|
yield "target= has no gradle support"
|
||||||
|
|
||||||
|
|
||||||
|
@ -331,7 +331,7 @@ class Build():
|
|||||||
else:
|
else:
|
||||||
self.__dict__[f].append(v)
|
self.__dict__[f].append(v)
|
||||||
|
|
||||||
def method(self):
|
def build_method(self):
|
||||||
for f in ['maven', 'gradle', 'kivy']:
|
for f in ['maven', 'gradle', 'kivy']:
|
||||||
if self.get_flag(f):
|
if self.get_flag(f):
|
||||||
return f
|
return f
|
||||||
@ -339,6 +339,15 @@ class Build():
|
|||||||
return 'raw'
|
return 'raw'
|
||||||
return 'ant'
|
return 'ant'
|
||||||
|
|
||||||
|
# like build_method, but prioritize output=
|
||||||
|
def output_method(self):
|
||||||
|
if self.output:
|
||||||
|
return 'raw'
|
||||||
|
for f in ['maven', 'gradle', 'kivy']:
|
||||||
|
if self.get_flag(f):
|
||||||
|
return f
|
||||||
|
return 'ant'
|
||||||
|
|
||||||
def ndk_path(self):
|
def ndk_path(self):
|
||||||
version = self.ndk
|
version = self.ndk
|
||||||
if not version:
|
if not version:
|
||||||
|
Loading…
Reference in New Issue
Block a user