[android] Remove ndk.dir from local.properties

Fix Gradle 6.8.x warning.

Signed-off-by: Roman Tsisyk <roman@tsisyk.com>
This commit is contained in:
Roman Tsisyk 2021-03-21 17:28:57 +03:00 committed by Alexander Borsuk
parent 1d6cdc5793
commit 2b28d0334e
4 changed files with 11 additions and 19 deletions

View file

@ -40,7 +40,7 @@ jobs:
- name: Set up SDK
shell: bash
run: |
(cd tools/android; ./set_up_android.py --sdk $ANDROID_SDK_ROOT --ndk $ANDROID_NDK_ROOT)
(cd tools/android; ./set_up_android.py --sdk $ANDROID_SDK_ROOT)
- name: Compile
shell: bash

View file

@ -25,7 +25,7 @@ jobs:
- name: Set up SDK
shell: bash
run: |
(cd tools/android; ./set_up_android.py --sdk $ANDROID_SDK_ROOT --ndk $ANDROID_NDK_ROOT)
(cd tools/android; ./set_up_android.py --sdk $ANDROID_SDK_ROOT)
- name: Compile
shell: bash

View file

@ -177,9 +177,10 @@ Configure the repository for the debug mode:
Set Android SDK and NDK path:
```bash
./tools/android/set_up_android.py \
--sdk $HOME/Android/Sdk \
--ndk $HOME/Android/Sdk/ndk/22.0.7026061/ # Update for the actual NDK version
# Linux
./tools/android/set_up_android.py --sdk $HOME/Android/Sdk
# MacOS
./tools/android/set_up_android.py --sdk $HOME/Library/Android/Sdk
```
### Building

View file

@ -29,16 +29,13 @@ def read_local_properties():
androidRoot = os.path.join(os.path.dirname(sys.argv[0]), '..', '..', 'android')
propsFile = os.path.join(androidRoot, 'local.properties')
sdkDir = None
ndkDir = 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()
elif line.startswith('ndk.dir') and '=' in line:
ndkDir = line.split('=')[1].strip()
return (sdkDir, ndkDir)
return sdkDir
def query_path(title, option, default, subpath):
default = '' if not default else os.path.abspath(default)
@ -59,12 +56,11 @@ def query_path(title, option, default, subpath):
print('Could not find {0}, not an {1} path.'.format(test, title))
sys.exit(1)
def write_local_properties(sdkDir, ndkDir):
def write_local_properties(sdkDir):
content = ''.join([x + '\n' for x in [
'# Autogenerated file',
'# Do not add it to version control',
'sdk.dir={0}'.format(sdkDir),
'ndk.dir={0}'.format(ndkDir)
]])
# Create omim/android/local.properties
@ -86,19 +82,14 @@ def write_local_properties(sdkDir, ndkDir):
if __name__ == '__main__':
parser = OptionParser()
parser.add_option('-s', '--sdk', help='Path to Android SDK')
parser.add_option('-n', '--ndk', help='Path to Android NDK')
options, _ = parser.parse_args()
sdkDir = options.sdk
ndkDir = options.ndk
if not options.sdk or not options.ndk:
sdkDirOld, ndkDirOld = read_local_properties()
if not options.sdk:
sdkDirOld = read_local_properties()
if not sdkDir:
sdkDir = sdkDirOld
if not ndkDir:
ndkDir = ndkDirOld
sdkDir = query_path('Android SDK', options.sdk, sdkDir, ['platform-tools', 'adb'])
ndkDir = query_path('Android NDK', options.ndk, ndkDir, ['ndk-build'])
write_local_properties(sdkDir, ndkDir)
write_local_properties(sdkDir)