Repo created
This commit is contained in:
parent
4af19165ec
commit
68073add76
12458 changed files with 12350765 additions and 2 deletions
50
tools/android/download_googleplay_metadata.sh
Executable file
50
tools/android/download_googleplay_metadata.sh
Executable file
|
|
@ -0,0 +1,50 @@
|
|||
#!/usr/bin/env bash
|
||||
#
|
||||
# Downloads metadata from Google Play
|
||||
#
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
cd "$(dirname "$0")/../../android"
|
||||
|
||||
check_keys() {
|
||||
if [[ ! -r "google-play.json" ]]; then
|
||||
echo >&2 "Missing $PWD/google-play.json"
|
||||
exit 2
|
||||
fi
|
||||
}
|
||||
|
||||
check_screenshots() {
|
||||
if [[ ! -r "../screenshots/android/en-US/graphics/phone-screenshots/1.jpg" ]]; then
|
||||
echo >&2 "Please checkout screenshots to $PWD/../screenshots"
|
||||
exit 3
|
||||
fi
|
||||
}
|
||||
|
||||
download_metadata() {
|
||||
set -x
|
||||
./gradlew bootstrapGoogleRelease
|
||||
|
||||
for locale in src/google/play/listings/??-??; do
|
||||
# Fix wrong file extension (.png instead of .jpg)
|
||||
for png in $locale/graphics/*-screenshots/*.png; do
|
||||
if [[ $(file -b "$png") =~ ^'JPEG ' ]]; then
|
||||
echo "Fixing $png extension"
|
||||
mv -f "$png" "${png%.png}.jpg"
|
||||
fi
|
||||
done
|
||||
# Copy new files to screenshots repository
|
||||
cp -Rpv $locale/graphics ../screenshots/android/$(basename $locale)/
|
||||
# Replace original directory with a symlink to screenshots repository
|
||||
rm -rf $locale/graphics
|
||||
ln -sf ../../../../../../screenshots/android/$(basename $locale)/graphics $locale/graphics
|
||||
done
|
||||
|
||||
# Ignore changelogs from all tracks exception production
|
||||
mv -f src/google/play/release-notes/en-US/production.txt src/google/play/release-notes/en-US/default.txt
|
||||
rm -f src/google/play/release-notes/en-US/alpha.txt src/google/play/release-notes/en-US/beta.txt src/google/play/release-notes/en-US/internal.txt
|
||||
}
|
||||
|
||||
check_keys
|
||||
check_screenshots
|
||||
download_metadata
|
||||
41
tools/android/download_vulkan_validation_layers.py
Executable file
41
tools/android/download_vulkan_validation_layers.py
Executable file
|
|
@ -0,0 +1,41 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import requests
|
||||
import zipfile
|
||||
import os
|
||||
import shutil
|
||||
|
||||
def download_vulkan_validation_layers():
|
||||
# Step 1: Download zip archive
|
||||
url = "https://github.com/KhronosGroup/Vulkan-ValidationLayers/releases/download/vulkan-sdk-1.3.275.0/android-binaries-1.3.275.0.zip"
|
||||
download_path = "vulkan_sdk.zip"
|
||||
|
||||
print("Downloading zip archive...")
|
||||
response = requests.get(url)
|
||||
with open(download_path, "wb") as f:
|
||||
f.write(response.content)
|
||||
print("Download complete.")
|
||||
|
||||
# Step 2: Unzip archive
|
||||
unzip_dir = "vulkan_sdk"
|
||||
print("Unzipping archive...")
|
||||
with zipfile.ZipFile(download_path, "r") as zip_ref:
|
||||
zip_ref.extractall(unzip_dir)
|
||||
print("Unzip complete.")
|
||||
|
||||
# Step 3: Rename unpacked folder to "jniLibs" and move it to "android/app/src/main"
|
||||
unpacked_folder = os.listdir(unzip_dir)[0]
|
||||
jniLibs_path = os.path.join(unzip_dir, "jniLibs")
|
||||
os.rename(os.path.join(unzip_dir, unpacked_folder), jniLibs_path)
|
||||
destination_path = "android/app/src/main"
|
||||
shutil.move(jniLibs_path, destination_path)
|
||||
print("Deploy complete.")
|
||||
|
||||
# Clean up downloaded zip file and empty directories
|
||||
os.remove(download_path)
|
||||
os.rmdir(unzip_dir)
|
||||
print("Clean up complete.")
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
download_vulkan_validation_layers()
|
||||
96
tools/android/set_up_android.py
Executable file
96
tools/android/set_up_android.py
Executable file
|
|
@ -0,0 +1,96 @@
|
|||
#!/usr/bin/env python3
|
||||
import os, sys, shutil, collections
|
||||
from optparse import OptionParser
|
||||
|
||||
# Fix for python 2
|
||||
try:
|
||||
input = raw_input
|
||||
except NameError:
|
||||
pass
|
||||
|
||||
def find_recursive(root, subpath, maxdepth=4):
|
||||
queue = collections.deque([(root, 0)])
|
||||
if 'PATH' in os.environ:
|
||||
envpath = os.environ['PATH'].split(':')
|
||||
relpath = ['..'] * (len(subpath) - 1)
|
||||
queue.extendleft([(os.path.join(x, *relpath), maxdepth) for x in envpath if 'android' in x.lower()])
|
||||
while len(queue) > 0:
|
||||
item = queue.popleft()
|
||||
if os.path.isfile(os.path.join(item[0], *subpath)):
|
||||
return os.path.abspath(item[0])
|
||||
if item[1] < maxdepth:
|
||||
for name in os.listdir(item[0]):
|
||||
fullname = os.path.join(item[0], name)
|
||||
if os.path.isdir(fullname) and '.' not in name:
|
||||
queue.append((fullname, item[1] + 1))
|
||||
return None
|
||||
|
||||
def read_local_properties():
|
||||
androidRoot = os.path.join(os.path.dirname(sys.argv[0]), '..', '..', 'android')
|
||||
propsFile = os.path.join(androidRoot, 'local.properties')
|
||||
sdkDir = None
|
||||
if os.path.exists(propsFile):
|
||||
with open(propsFile, 'r') as f:
|
||||
for line in f:
|
||||
line = line.strip()
|
||||
if line.startswith('sdk.dir') and '=' in line:
|
||||
sdkDir = line.split('=')[1].strip()
|
||||
return sdkDir
|
||||
|
||||
def test_path(title, path, subpath):
|
||||
test = os.path.join(path, *subpath)
|
||||
if path and os.path.isfile(test):
|
||||
return os.path.abspath(path)
|
||||
print('Could not find "{0}", it\'s not an {1} path!'.format(test, title))
|
||||
return None
|
||||
|
||||
def query_path(title, option, default, subpath):
|
||||
if option:
|
||||
path = test_path(title, option, subpath)
|
||||
if path:
|
||||
return path
|
||||
default = '' if not default else os.path.abspath(default)
|
||||
searchHint = ', "s" to search'
|
||||
while True:
|
||||
path = input('Path to {0}{1} [{2}]:'.format(title, searchHint, default)) or default
|
||||
if len(searchHint) > 0 and path.lower().strip() == 's':
|
||||
found = find_recursive(os.path.expanduser('~'), subpath)
|
||||
if found:
|
||||
print('Found {0} at "{1}".'.format(title, found))
|
||||
default = found
|
||||
else:
|
||||
print('{0} not found.'.format(title))
|
||||
searchHint = ''
|
||||
else:
|
||||
break
|
||||
return test_path(title, path, subpath)
|
||||
|
||||
def write_local_properties(sdkDir):
|
||||
sdkProp = 'sdk.dir={0}'.format(sdkDir)
|
||||
content = ''.join([x + '\n' for x in [
|
||||
'# Autogenerated file',
|
||||
'# Do not add it to version control',
|
||||
sdkProp,
|
||||
]])
|
||||
|
||||
# Create android/local.properties
|
||||
androidRoot = os.path.join(os.path.dirname(sys.argv[0]), '..', '..', 'android')
|
||||
propsFile = os.path.abspath(os.path.join(androidRoot, 'local.properties'))
|
||||
print('Writing "{0}" to {1}'.format(sdkProp, propsFile))
|
||||
with open(propsFile, 'w') as f:
|
||||
f.write(content)
|
||||
|
||||
if __name__ == '__main__':
|
||||
parser = OptionParser()
|
||||
parser.set_description(' '.join([
|
||||
'Writes Android SDK location into android/local.properties file.',
|
||||
'Prompts for SDK location and offers to search for it if started without options.',
|
||||
]))
|
||||
parser.add_option('-s', '--sdk', help='path to Android SDK')
|
||||
options, _ = parser.parse_args()
|
||||
|
||||
sdkDirOld = read_local_properties()
|
||||
sdkDir = query_path('Android SDK', options.sdk, sdkDirOld, ['platform-tools', 'adb'])
|
||||
|
||||
if sdkDir:
|
||||
write_local_properties(sdkDir)
|
||||
Loading…
Add table
Add a link
Reference in a new issue