mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-09-15 23:42:37 +03:00
Be more consistent when doing cleans
All update dirs, including ., will remove baddirs. Right before build=, (ant|maven|gradle) clean will run
This commit is contained in:
parent
87fd0d69d1
commit
0bde32fd99
2 changed files with 59 additions and 13 deletions
|
@ -349,6 +349,47 @@ def build_local(app, thisbuild, vcs, build_dir, output_dir, srclib_dir, extlib_d
|
||||||
build_dir, srclib_dir, extlib_dir, sdk_path, ndk_path,
|
build_dir, srclib_dir, extlib_dir, sdk_path, ndk_path,
|
||||||
javacc_path, mvn3, verbose, onserver)
|
javacc_path, mvn3, verbose, onserver)
|
||||||
|
|
||||||
|
# We need to clean via the build tool in case the binary dirs are
|
||||||
|
# different from the default ones
|
||||||
|
p = None
|
||||||
|
if 'maven' in thisbuild:
|
||||||
|
print "Cleaning Maven project..."
|
||||||
|
cmd = [mvn3, 'clean', '-Dandroid.sdk.path=' + sdk_path]
|
||||||
|
|
||||||
|
p = subprocess.Popen(cmd, cwd=root_dir,
|
||||||
|
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||||
|
elif 'gradle' in thisbuild:
|
||||||
|
print "Cleaning Gradle project..."
|
||||||
|
cmd = [gradle, 'clean']
|
||||||
|
|
||||||
|
if '@' in thisbuild['gradle']:
|
||||||
|
gradle_dir = os.path.join(root_dir, thisbuild['gradle'].split('@')[1])
|
||||||
|
else:
|
||||||
|
gradle_dir = root_dir
|
||||||
|
|
||||||
|
p = subprocess.Popen(cmd, cwd=gradle_dir,
|
||||||
|
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||||
|
else:
|
||||||
|
print "Cleaning Ant project..."
|
||||||
|
cmd = ['ant', 'clean']
|
||||||
|
p = subprocess.Popen(cmd, cwd=root_dir,
|
||||||
|
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||||
|
|
||||||
|
for line in iter(p.stdout.readline, ''):
|
||||||
|
if verbose:
|
||||||
|
# Output directly to console
|
||||||
|
sys.stdout.write(line)
|
||||||
|
sys.stdout.flush()
|
||||||
|
else:
|
||||||
|
output += line
|
||||||
|
for line in iter(p.stderr.readline, ''):
|
||||||
|
if verbose:
|
||||||
|
# Output directly to console
|
||||||
|
sys.stdout.write(line)
|
||||||
|
sys.stdout.flush()
|
||||||
|
else:
|
||||||
|
error += line
|
||||||
|
|
||||||
# Scan before building...
|
# Scan before building...
|
||||||
print "Scanning source for common problems..."
|
print "Scanning source for common problems..."
|
||||||
buildprobs = common.scan_source(build_dir, root_dir, thisbuild)
|
buildprobs = common.scan_source(build_dir, root_dir, thisbuild)
|
||||||
|
@ -449,7 +490,7 @@ def build_local(app, thisbuild, vcs, build_dir, output_dir, srclib_dir, extlib_d
|
||||||
# Build the release...
|
# Build the release...
|
||||||
if 'maven' in thisbuild:
|
if 'maven' in thisbuild:
|
||||||
print "Building Maven project..."
|
print "Building Maven project..."
|
||||||
mvncmd = [mvn3, 'clean', 'package', '-Dandroid.sdk.path=' + sdk_path]
|
mvncmd = [mvn3, 'package', '-Dandroid.sdk.path=' + sdk_path]
|
||||||
if install:
|
if install:
|
||||||
mvncmd += ['-Dandroid.sign.debug=true']
|
mvncmd += ['-Dandroid.sign.debug=true']
|
||||||
else:
|
else:
|
||||||
|
@ -511,7 +552,7 @@ def build_local(app, thisbuild, vcs, build_dir, output_dir, srclib_dir, extlib_d
|
||||||
if flavour in ['main', 'yes', '']:
|
if flavour in ['main', 'yes', '']:
|
||||||
flavour = ''
|
flavour = ''
|
||||||
|
|
||||||
commands = [gradle, 'clean']
|
commands = [gradle]
|
||||||
if 'preassemble' in thisbuild:
|
if 'preassemble' in thisbuild:
|
||||||
for task in thisbuild['preassemble'].split():
|
for task in thisbuild['preassemble'].split():
|
||||||
commands.append(task)
|
commands.append(task)
|
||||||
|
@ -541,7 +582,7 @@ def build_local(app, thisbuild, vcs, build_dir, output_dir, srclib_dir, extlib_d
|
||||||
|
|
||||||
else:
|
else:
|
||||||
print "Building Ant project..."
|
print "Building Ant project..."
|
||||||
antcommands = ['ant', 'clean']
|
antcommands = ['ant']
|
||||||
if install:
|
if install:
|
||||||
antcommands += ['debug','install']
|
antcommands += ['debug','install']
|
||||||
elif 'antcommand' in thisbuild:
|
elif 'antcommand' in thisbuild:
|
||||||
|
|
|
@ -1229,14 +1229,27 @@ def prepare_source(vcs, app, build, build_dir, srclib_dir, extlib_dir, sdk_path,
|
||||||
if os.path.exists(buildxml):
|
if os.path.exists(buildxml):
|
||||||
print 'Force-removing old build.xml'
|
print 'Force-removing old build.xml'
|
||||||
os.remove(buildxml)
|
os.remove(buildxml)
|
||||||
|
for baddir in [
|
||||||
|
'gen', 'bin', 'obj', # ant
|
||||||
|
'libs/armeabi-v7a', 'libs/armeabi', # jni
|
||||||
|
'libs/mips', 'libs/x86', # jni
|
||||||
|
'build', # gradle
|
||||||
|
'target']: # maven
|
||||||
|
badpath = os.path.join(build_dir, baddir)
|
||||||
|
if os.path.exists(badpath):
|
||||||
|
print "Removing '%s'" % badpath
|
||||||
|
shutil.rmtree(badpath)
|
||||||
for d in update_dirs:
|
for d in update_dirs:
|
||||||
cwd = os.path.join(root_dir, d)
|
cwd = os.path.join(root_dir, d)
|
||||||
# Remove gen and bin dirs in libraries
|
# Remove gen and bin dirs in libraries
|
||||||
# rid of them...
|
# rid of them...
|
||||||
for baddir in ['gen', 'bin', 'obj', 'libs/armeabi-v7a', 'libs/armeabi', 'libs/mips', 'libs/x86']:
|
for baddir in [
|
||||||
|
'gen', 'bin', 'obj', # ant
|
||||||
|
'libs/armeabi-v7a', 'libs/armeabi', # jni
|
||||||
|
'libs/mips', 'libs/x86']:
|
||||||
badpath = os.path.join(cwd, baddir)
|
badpath = os.path.join(cwd, baddir)
|
||||||
if os.path.exists(badpath):
|
if os.path.exists(badpath):
|
||||||
print "Removing %s in update dir %s" % (badpath, d)
|
print "Removing '%s'" % badpath
|
||||||
shutil.rmtree(badpath)
|
shutil.rmtree(badpath)
|
||||||
if verbose:
|
if verbose:
|
||||||
print "Update of '%s': exec '%s' in '%s'"%\
|
print "Update of '%s': exec '%s' in '%s'"%\
|
||||||
|
@ -1372,14 +1385,6 @@ def prepare_source(vcs, app, build, build_dir, srclib_dir, extlib_dir, sdk_path,
|
||||||
if basesrclib:
|
if basesrclib:
|
||||||
srclibpaths.append(basesrclib)
|
srclibpaths.append(basesrclib)
|
||||||
|
|
||||||
# There should never be bin, gen or native libs directories in the source, so just get
|
|
||||||
# rid of them...
|
|
||||||
for baddir in ['gen', 'bin', 'obj', 'libs/armeabi-v7a', 'libs/armeabi', 'libs/mips', 'libs/x86']:
|
|
||||||
badpath = os.path.join(root_dir, baddir)
|
|
||||||
if os.path.exists(badpath):
|
|
||||||
print "Removing %s" % badpath
|
|
||||||
shutil.rmtree(badpath)
|
|
||||||
|
|
||||||
# Apply patches if any
|
# Apply patches if any
|
||||||
if 'patch' in build:
|
if 'patch' in build:
|
||||||
for patch in build['patch'].split(';'):
|
for patch in build['patch'].split(';'):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue