Skip to content

Commit

Permalink
Merge pull request #1449 from microsoft/v-annkoc/ndk-script
Browse files Browse the repository at this point in the history
Add a script that uses latest CI NDK version
  • Loading branch information
MatkovIvan committed Aug 6, 2020
2 parents aff84d7 + 17a426c commit d65e2ea
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions scripts/set-ndk-version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.

PROJECT_DIR="$(dirname "$0")/.."
PROPERTY_FILE="$ANDROID_HOME/ndk-bundle/source.properties"

echo "Reading ndk version from source.properties file..."
VERSION=$(cat $PROPERTY_FILE | sed 's/ //g' | grep "Pkg.Revision" | cut -d'=' -f2)
echo $VERSION
GRADLE_FILE="$PROJECT_DIR/apps/sasquatch/build.gradle"

if [ -z $VERSION ]; then
echo "No NDK found in the default location. Proceeding..."
else

# Insert ndkVersion = 'x.x.x' in the android section.
NDK_VERSION_LINE="ndkVersion = '$VERSION'"
echo "$(sed "s/android {/android {\\`echo -e '\n\r '`$NDK_VERSION_LINE/g" "$GRADLE_FILE")" > $GRADLE_FILE
fi

0 comments on commit d65e2ea

Please sign in to comment.