mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-09-13 22:42:29 +03:00
auto-detect NDKs installed in standard paths
'ndk_paths' will be automatically filled out from well known sources like $ANDROID_HOME/ndk-bundle and $ANDROID_HOME/ndk/*. If a required version is missing in the buildserver VM, it will be automatically downloaded and installed into the standard $ANDROID_HOME/ndk/ directory. Manually setting it here will override the auto-detected values. The keys can either be the "release" (e.g. r21e) or the "revision" (e.g. 21.4.7075529). https://developer.android.com/studio/projects/configure-agp-ndk#agp_version_41 * sdkmanager installs "ndk;12.3.4567890" into $ANDROID_SDK_ROOT/ndk/ * sdkmanager installs "ndk-bundle" into $ANDROID_SDK_ROOT/ndk-bundle/
This commit is contained in:
parent
4686c06f62
commit
9f77044d0d
4 changed files with 64 additions and 20 deletions
|
@ -1832,6 +1832,28 @@ class CommonTest(unittest.TestCase):
|
|||
fdroidserver.common.auto_install_ndk(build)
|
||||
list_entry.assert_has_calls(calls)
|
||||
|
||||
def test_fill_config_defaults(self):
|
||||
"""Test the auto-detection of NDKs installed in standard paths"""
|
||||
sdk_path = tempfile.mkdtemp(
|
||||
prefix=inspect.currentframe().f_code.co_name, dir=self.tmpdir
|
||||
)
|
||||
|
||||
ndk_bundle = os.path.join(sdk_path, 'ndk-bundle')
|
||||
os.makedirs(ndk_bundle)
|
||||
with open(os.path.join(ndk_bundle, 'source.properties'), 'w') as fp:
|
||||
fp.write('Pkg.Desc = Android NDK\nPkg.Revision = 17.2.4988734\n')
|
||||
config = {'sdk_path': sdk_path}
|
||||
fdroidserver.common.fill_config_defaults(config)
|
||||
self.assertEqual({'r17c': ndk_bundle}, config['ndk_paths'])
|
||||
|
||||
r21e = os.path.join(sdk_path, 'ndk', '21.4.7075529')
|
||||
os.makedirs(r21e)
|
||||
with open(os.path.join(r21e, 'source.properties'), 'w') as fp:
|
||||
fp.write('Pkg.Desc = Android NDK\nPkg.Revision = 21.4.7075529\n')
|
||||
config = {'sdk_path': sdk_path}
|
||||
fdroidserver.common.fill_config_defaults(config)
|
||||
self.assertEqual({'r17c': ndk_bundle, 'r21e': r21e}, config['ndk_paths'])
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
os.chdir(os.path.dirname(__file__))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue