Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
list all known Android NDK versions as seen by fdroid/android-sdk-transparency-log
import re, requests
NDK_VERSION_NUMBER_REGEX = re.compile(r'[1-9][0-9]*\.[0-9]+\.[0-9]{7}(?:-[a-z0-9]+)?')
NDK_VERSION_REGEX = re.compile(r"""ndkVersion\s*[= ]\s*['"]([1-9][0-9]*\.[0-9]+\.[0-9]{7}(?:-[a-z0-9]+)?)["']""")
r = requests.get('https://gitlab.com/fdroid/android-sdk-transparency-log/-/raw/master/checksums.json')
data = r.json()
for url, entries in data.items():
for d in entries:
if url.startswith('https://dl.google.com/android/repository/android-ndk-'):
m = re.search(r'Pkg.Revision = .*', d.get('source.properties', ''))
if m:
ndk_version = m.group()
print(ndk_version, end='\t\t')
v = NDK_VERSION_NUMBER_REGEX.search(ndk_version).group()
print(v)
for build_gradle_snippet in (
'ndkVersion "%s"' % v,
"ndkVersion '%s'" % v,
'ndkVersion="%s"' % v,
'android.ndkVersion "%s"' % v,
):
n = NDK_VERSION_REGEX.search(build_gradle_snippet)
if n:
assert(n.group(1) == v)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment