1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-11-04 22:40:12 +01:00

maven=yes defaults to bindir=[subdir]/target

This commit is contained in:
Daniel Martí 2013-09-02 19:05:13 +02:00
parent 333c4af9f5
commit d59c0f64f9

View File

@ -422,6 +422,7 @@ def build_local(app, thisbuild, vcs, build_dir, output_dir, srclib_dir, extlib_d
print output print output
raise BuildException("NDK build failed for %s:%s" % (app['id'], thisbuild['version'])) raise BuildException("NDK build failed for %s:%s" % (app['id'], thisbuild['version']))
output = ""
# Build the release... # Build the release...
if 'maven' in thisbuild: if 'maven' in thisbuild:
print "Building Maven project..." print "Building Maven project..."
@ -438,7 +439,15 @@ def build_local(app, thisbuild, vcs, build_dir, output_dir, srclib_dir, extlib_d
if 'mvnflags' in thisbuild: if 'mvnflags' in thisbuild:
mvncmd += thisbuild['mvnflags'] mvncmd += thisbuild['mvnflags']
p = subprocess.Popen(mvncmd, cwd=root_dir, stdout=subprocess.PIPE, stderr=subprocess.PIPE) p = subprocess.Popen(mvncmd, cwd=root_dir, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
for line in p.stdout.readlines():
if verbose:
# Output directly to console
sys.stdout.write(line)
sys.stdout.flush()
output += line
elif 'gradle' in thisbuild: elif 'gradle' in thisbuild:
print "Building Gradle project..." print "Building Gradle project..."
if '@' in thisbuild['gradle']: if '@' in thisbuild['gradle']:
@ -482,6 +491,13 @@ def build_local(app, thisbuild, vcs, build_dir, output_dir, srclib_dir, extlib_d
print "Running %s on %s" % (" ".join(commands), gradle_dir) print "Running %s on %s" % (" ".join(commands), gradle_dir)
p = subprocess.Popen(commands, cwd=gradle_dir, stdout=subprocess.PIPE, stderr=subprocess.PIPE) p = subprocess.Popen(commands, cwd=gradle_dir, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
for line in p.stdout.readlines():
if verbose:
# Output directly to console
sys.stdout.write(line)
sys.stdout.flush()
output += line
else: else:
print "Building Ant project..." print "Building Ant project..."
if install: if install:
@ -492,24 +508,24 @@ def build_local(app, thisbuild, vcs, build_dir, output_dir, srclib_dir, extlib_d
antcommands = ['release'] antcommands = ['release']
p = subprocess.Popen(['ant'] + antcommands, cwd=root_dir, p = subprocess.Popen(['ant'] + antcommands, cwd=root_dir,
stdout=subprocess.PIPE, stderr=subprocess.PIPE) stdout=subprocess.PIPE, stderr=subprocess.PIPE)
output, error = p.communicate() _, error = p.communicate()
if p.returncode != 0: if p.returncode != 0:
raise BuildException("Build failed for %s:%s" % (app['id'], thisbuild['version']), output.strip(), error.strip()) raise BuildException("Build failed for %s:%s" % (app['id'], thisbuild['version']), output.strip(), error.strip())
if verbose:
print output
if install: if install:
if 'maven' in thisbuild: if 'maven' in thisbuild:
p = subprocess.Popen([mvn3, 'android:deploy', '-Dandroid.sdk.path=' + sdk_path], p = subprocess.Popen([mvn3, 'android:deploy', '-Dandroid.sdk.path=' + sdk_path],
cwd=root_dir, stdout=subprocess.PIPE, stderr=subprocess.PIPE) cwd=root_dir, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
output, error = p.communicate() output_, error = p.communicate()
if p.returncode != 0: if p.returncode != 0:
raise BuildException("Warning: Could not deploy %s:%s" % (app['id'], thisbuild['version']), output.strip(), error.strip()) raise BuildException("Warning: Could not deploy %s:%s" % (app['id'], thisbuild['version']), output_.strip(), error.strip())
return return
print "Successfully built version " + thisbuild['version'] + ' of ' + app['id'] print "Successfully built version " + thisbuild['version'] + ' of ' + app['id']
# Find the apk name in the output... # Find the apk name in the output...
if 'bindir' in thisbuild: if 'bindir' in thisbuild:
bindir = os.path.join(build_dir, thisbuild['bindir']) bindir = os.path.join(build_dir, thisbuild['bindir'])
elif 'maven' in thisbuild:
bindir = os.path.join(root_dir, 'target')
else: else:
bindir = os.path.join(root_dir, 'bin') bindir = os.path.join(root_dir, 'bin')
if thisbuild.get('initfun', 'no') == "yes": if thisbuild.get('initfun', 'no') == "yes":
@ -525,10 +541,9 @@ def build_local(app, thisbuild, vcs, build_dir, output_dir, srclib_dir, extlib_d
output, re.S|re.M) output, re.S|re.M)
if not m: if not m:
# This format is found in com.github.mobile, com.yubico.yubitotp and com.botbrew.basil for example... # This format is found in com.github.mobile, com.yubico.yubitotp and com.botbrew.basil for example...
m = re.match(r".*^\[INFO\] [^$]*aapt \[package,[^$]*" + app['id'] + "/" + thisbuild['bindir'] + "/([^/]+)\.ap[_k][,\]]", m = re.match(r'.*^\[INFO\] [^$]*aapt \[package,[^$]*' + bindir + '/([^/]+)\.ap[_k][,\]]',
output, re.S|re.M) output, re.S|re.M)
if not m: if not m:
print output
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'