javacc_path, mvn3, verbose, onserver)
# Scan before building...
+ print "Scanning source for common problems..."
buildprobs = common.scan_source(build_dir, root_dir, thisbuild)
if len(buildprobs) > 0:
print 'Scanner found ' + str(len(buildprobs)) + ' problems:'
str(len(buildprobs)) + " scanned problems")
# Build the source tarball right before we build the release...
+ print "Creating source tarball..."
tarname = app['id'] + '_' + thisbuild['vercode'] + '_src'
tarball = tarfile.open(os.path.join(tmp_dir,
tarname + '.tar.gz'), "w:gz")
# Run a build command if one is required...
if 'build' in thisbuild:
cmd = thisbuild['build']
+ if options.verbose:
+ print "Running custom build commands: " + cmd
+ else:
+ print "Running custom build commands..."
# Substitute source library paths into commands...
for name, libpath in srclibpaths:
libpath = os.path.relpath(libpath, root_dir)
cmd = cmd.replace('$$SDK$$', sdk_path)
cmd = cmd.replace('$$NDK$$', ndk_path)
cmd = cmd.replace('$$MVN3$$', mvn3)
- p = subprocess.Popen(['bash', '-c', cmd], cwd=root_dir,
- stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ if options.verbose:
+ # Note: output goes to console, not log
+ p = subprocess.Popen(['bash', '-x', '-c', cmd], cwd=root_dir)
+ else:
+ p = subprocess.Popen(['bash', '-c', cmd], cwd=root_dir,
+ stdout=subprocess.PIPE, stderr=subprocess.PIPE)
out, err = p.communicate()
if p.returncode != 0:
raise BuildException("Error running build command", out, err)
# Build native stuff if required...
if thisbuild.get('buildjni') not in (None, 'no'):
+ print "Building native libraries..."
jni_components = thisbuild.get('buildjni')
if jni_components == 'yes':
jni_components = ['']
# Build the release...
if 'maven' in thisbuild:
+ print "Building Maven project..."
mvncmd = [mvn3, 'clean', 'package', '-Dandroid.sdk.path=' + sdk_path]
if install:
mvncmd += ['-Dandroid.sign.debug=true']
mvncmd += thisbuild['mvnflags']
p = subprocess.Popen(mvncmd, cwd=root_dir, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
elif 'gradle' in thisbuild:
+ print "Building Gradle project..."
if '@' in thisbuild['gradle']:
flavour = thisbuild['gradle'].split('@')[0]
gradle_dir = thisbuild['gradle'].split('@')[1]
p = subprocess.Popen(commands, cwd=gradle_dir, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
else:
+ print "Building Ant project..."
if install:
antcommands = ['debug','install']
elif 'antcommand' in thisbuild:
# Add required external libraries...
if 'extlibs' in build:
+ print "Collecting prebuilt libraries..."
libsdir = os.path.join(root_dir, 'libs')
if not os.path.exists(libsdir):
os.mkdir(libsdir)
# Get required source libraries...
srclibpaths = []
if 'srclibs' in build:
+ print "Collecting source libraries..."
for lib in build['srclibs'].split(';'):
name, _ = lib.split('@')
srclibpaths.append((name, getsrclib(lib, srclib_dir, sdk_path, ndk_path, mvn3, preponly=onserver)))
# Run a pre-build command if one is required...
if 'prebuild' in build:
prebuild = build['prebuild']
+ if verbose:
+ print "Running source init (prebuild) commands:" + prebuild
+ else:
+ print "Running source init (prebuild) commands..."
+
# Substitute source library paths into prebuild commands...
for name, libpath in srclibpaths:
libpath = os.path.relpath(libpath, root_dir)
if p.returncode != 0:
raise BuildException("Error running pre-build command", out, err)
+ print "Applying generic clean-ups..."
+
if build.get('anal-tics', 'no') == 'yes':
fp = os.path.join(root_dir, 'src', 'com', 'google', 'android', 'apps', 'analytics')
os.makedirs(fp)