From 08f724651e9707ef3d943379276adbd6fd4f5a73 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Wed, 16 Sep 2020 15:58:32 +0200 Subject: [PATCH] remove "force_build_tools" config option, closes #738 The `force_build_tools` config option was added a long time ago to brute force the _build-tools_ version by trying to replace the value in `build.gradle` files. This is never something that should be used in production, since the app's build metadata should specify this kind of thing. And now that we're moving towards _androguard_ for everything except fdroid build and fdroid publish, _build-tools_ will no longer even be used in the other commands. --- examples/config.py | 4 ---- fdroidserver/build.py | 5 ----- fdroidserver/common.py | 1 - tests/build.TestCase | 17 ----------------- tests/run-tests | 2 -- 5 files changed, 29 deletions(-) diff --git a/examples/config.py b/examples/config.py index 5ece5631..7b43976c 100644 --- a/examples/config.py +++ b/examples/config.py @@ -36,10 +36,6 @@ # Build tools version to be used # build_tools = "28.0.3" -# Force all build to use the above version of build -tools, good for testing -# builds without having all of the possible build-tools installed. -# force_build_tools = True - # Command or path to binary for running Ant # ant = "ant" diff --git a/fdroidserver/build.py b/fdroidserver/build.py index 31ef0d0c..b3d4cd54 100644 --- a/fdroidserver/build.py +++ b/fdroidserver/build.py @@ -442,11 +442,6 @@ def build_local(app, build, vcs, build_dir, output_dir, log_dir, srclib_dir, ext gradletasks += ['assemble' + flavours_cmd + 'Release'] - if config['force_build_tools']: - force_gradle_build_tools(build_dir, config['build_tools']) - for name, number, libpath in srclibpaths: - force_gradle_build_tools(libpath, config['build_tools']) - cmd = [config['gradle']] if build.gradleprops: cmd += ['-P' + kv for kv in build.gradleprops] diff --git a/fdroidserver/common.py b/fdroidserver/common.py index 2a59152a..daa652b9 100644 --- a/fdroidserver/common.py +++ b/fdroidserver/common.py @@ -115,7 +115,6 @@ default_config = { }, 'cachedir': os.path.join(os.getenv('HOME'), '.cache', 'fdroidserver'), 'build_tools': MINIMUM_AAPT_BUILD_TOOLS_VERSION, - 'force_build_tools': False, 'java_paths': None, 'scan_binary': False, 'ant': "ant", diff --git a/tests/build.TestCase b/tests/build.TestCase index 25655229..decae7ab 100755 --- a/tests/build.TestCase +++ b/tests/build.TestCase @@ -6,7 +6,6 @@ import inspect import logging import optparse import os -import re import shutil import sys import tempfile @@ -59,22 +58,6 @@ class BuildTest(unittest.TestCase): os.makedirs(self.tmpdir) os.chdir(self.basedir) - def test_force_gradle_build_tools(self): - testdir = tempfile.mkdtemp(prefix=inspect.currentframe().f_code.co_name, dir=self.tmpdir) - shutil.copytree(os.path.join('source-files'), - os.path.join(testdir, 'source-files')) - teststring = 'FAKE_VERSION_FOR_TESTING' - fdroidserver.build.force_gradle_build_tools(testdir, teststring) - pattern = re.compile(r"buildToolsVersion[\s=]+'%s'\s+" % teststring) - for p in ('source-files/fdroid/fdroidclient/build.gradle', - 'source-files/Zillode/syncthing-silk/build.gradle', - 'source-files/open-keychain/open-keychain/build.gradle', - 'source-files/osmandapp/osmand/build.gradle', - 'source-files/open-keychain/open-keychain/OpenKeychain/build.gradle'): - with open(os.path.join(testdir, p), 'r') as f: - filedata = f.read() - self.assertIsNotNone(pattern.search(filedata)) - def test_get_apk_metadata(self): config = dict() fdroidserver.common.fill_config_defaults(config) diff --git a/tests/run-tests b/tests/run-tests index 551c5f55..dc4e934f 100755 --- a/tests/run-tests +++ b/tests/run-tests @@ -212,8 +212,6 @@ git clean -fdx # stick with known working commit, in case future commits break things for this code git reset --hard fea54e1161d5eb9eb1a54e26253ef84d3ab63705 if [ -d $ANDROID_HOME/platforms/android-23 && -d $ANDROID_HOME/build-tools/23.0.3 ]; then - echo "build_tools = '`ls -1 $ANDROID_HOME/build-tools/ | sort -n | tail -1`'" > config.py - echo "force_build_tools = True" >> config.py $fdroid build --verbose org.fdroid.ci.test.app:300 else echo 'WARNING: Skipping "fdroid build" test since android-23 is missing!'