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

When patching or checking plugin versions, use *.gradle

Apparently all *.gradle files are valid, e.g. global.gradle.
This commit is contained in:
Daniel Martí 2015-04-06 17:42:26 +02:00
parent 021df3c424
commit acd49c6e4d
2 changed files with 12 additions and 7 deletions

View File

@ -430,7 +430,9 @@ def build_server(app, thisbuild, vcs, build_dir, output_dir, force):
def adapt_gradle(build_dir): def adapt_gradle(build_dir):
filename = 'build.gradle' filename = 'build.gradle'
for root, dirs, files in os.walk(build_dir): for root, dirs, files in os.walk(build_dir):
if filename in files: for filename in files:
if not filename.endswith('.gradle'):
continue
path = os.path.join(root, filename) path = os.path.join(root, filename)
logging.debug("Adapting %s at %s" % (filename, path)) logging.debug("Adapting %s at %s" % (filename, path))

View File

@ -1296,20 +1296,23 @@ def prepare_source(vcs, app, build, build_dir, srclib_dir, extlib_dir, onserver=
version_regex = re.compile(r".*'com\.android\.tools\.build:gradle:([^\.]+\.[^\.]+).*'.*") version_regex = re.compile(r".*'com\.android\.tools\.build:gradle:([^\.]+\.[^\.]+).*'.*")
gradlepluginver = None gradlepluginver = None
gradle_files = [os.path.join(root_dir, 'build.gradle')] gradle_dirs = [root_dir]
# Parent dir build.gradle # Parent dir build.gradle
parent_dir = os.path.normpath(os.path.join(root_dir, '..')) parent_dir = os.path.normpath(os.path.join(root_dir, '..'))
if parent_dir.startswith(build_dir): if parent_dir.startswith(build_dir):
gradle_files.append(os.path.join(parent_dir, 'build.gradle')) gradle_dirs.append(parent_dir)
for path in gradle_files: for dir_path in gradle_dirs:
if gradlepluginver: if gradlepluginver:
break break
if not os.path.isfile(path): if not os.path.isdir(dir_path):
continue continue
with open(path) as f: for filename in os.listdir(dir_path):
for line in f: if not filename.endswith('.gradle'):
continue
path = os.path.join(dir_path, filename)
for line in file(path):
match = version_regex.match(line) match = version_regex.match(line)
if match: if match:
gradlepluginver = match.group(1) gradlepluginver = match.group(1)