Commit 3c260fe3 authored by Marcus Hoffmann's avatar Marcus Hoffmann Committed by Lucio Maciel

build-sdk: allow giving SDK_DIR on commandline

Allow giving the path to the SDK_DIR via commandline.
This makes it easier to build the project when having a custom directory
structure like fdroid's srclibs infrastructure.
parent 991580e0
#!/bin/bash #!/bin/bash
CURRENT_DIR=$(pwd) CURRENT_DIR=$(pwd)
# The SDK dir should be 2 directories up in the tree, so we use dirname 2 times
# to get the common parent dir of the SDK and the app
GIT=$(which git) GIT=$(which git)
cd ../..
tmp=$(pwd) if [ "$#" -eq 1 ] && [ ! -z "$1" ]; then
SDK_DIR="$tmp/Rocket.Chat.Kotlin.SDK" # if in an argument is given this is the (relative) path to SDK_DIR
cd "${CURRENT_DIR}" SDK_DIR=$(readlink -f $1)
else
# The SDK dir should be 2 directories up in the tree, so we use dirname 2 times
# to get the common parent dir of the SDK and the app
cd ../..
tmp=$(pwd)
SDK_DIR="$tmp/Rocket.Chat.Kotlin.SDK"
cd "${CURRENT_DIR}"
fi
echo "CURRENT DIR: $CURRENT_DIR" echo "CURRENT DIR: $CURRENT_DIR"
echo "SDK DIR: $SDK_DIR" echo "SDK DIR: $SDK_DIR"
...@@ -99,4 +105,4 @@ cp -v "${SDK_DIR}"/core/build/libs/core-0.1-SNAPSHOT.jar "${CURRENT_DIR}"/libs/c ...@@ -99,4 +105,4 @@ cp -v "${SDK_DIR}"/core/build/libs/core-0.1-SNAPSHOT.jar "${CURRENT_DIR}"/libs/c
echo "$SHA" > "${SDK_DIR}"/.last_commit_hash echo "$SHA" > "${SDK_DIR}"/.last_commit_hash
exit 0 exit 0
\ No newline at end of file
...@@ -165,11 +165,13 @@ androidExtensions { ...@@ -165,11 +165,13 @@ androidExtensions {
// FIXME - build and install the sdk into the app/libs directory // FIXME - build and install the sdk into the app/libs directory
// We were having some issues with the kapt generated files from the sdk when importing as a module // We were having some issues with the kapt generated files from the sdk when importing as a module
def sdk_location=project.properties['sdk_location'] ?: ""
task compileSdk(type:Exec) { task compileSdk(type:Exec) {
if (System.getProperty('os.name').toLowerCase(Locale.ROOT).contains('windows')) { if (System.getProperty('os.name').toLowerCase(Locale.ROOT).contains('windows')) {
commandLine 'cmd', '/c', 'build-sdk.sh' commandLine 'cmd', '/c', 'build-sdk.sh', sdk_location
} else { } else {
commandLine './build-sdk.sh' commandLine './build-sdk.sh', sdk_location
} }
} }
preBuild.dependsOn compileSdk preBuild.dependsOn compileSdk
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment