Browse Source

Merge pull request #2119 from element-hq/misc/jme/add-rte-build-script

Add build script for the RTE library
pull/2126/head
Jorge Martin Espinosa 9 months ago committed by GitHub
parent
commit
5a593be997
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      features/messages/impl/build.gradle.kts
  2. 11
      libraries/textcomposer/impl/build.gradle.kts
  3. 2
      libraries/textcomposer/lib/.gitignore
  4. 3
      libraries/textcomposer/lib/build.gradle.kts
  5. 77
      tools/rte/build_rte.sh

1
features/messages/impl/build.gradle.kts

@ -74,7 +74,6 @@ dependencies { @@ -74,7 +74,6 @@ dependencies {
implementation(libs.vanniktech.blurhash)
implementation(libs.telephoto.zoomableimage)
implementation(libs.matrix.emojibase.bindings)
api(libs.matrix.richtexteditor.compose)
testImplementation(libs.test.junit)
testImplementation(libs.coroutines.test)

11
libraries/textcomposer/impl/build.gradle.kts

@ -34,8 +34,15 @@ dependencies { @@ -34,8 +34,15 @@ dependencies {
implementation(projects.libraries.testtags)
implementation(projects.libraries.uiUtils)
api(libs.matrix.richtexteditor)
api(libs.matrix.richtexteditor.compose)
releaseApi(libs.matrix.richtexteditor)
releaseApi(libs.matrix.richtexteditor.compose)
if (file("${rootDir.path}/libraries/textcomposer/lib/library-compose.aar").exists()) {
println("\nNote: Using local binaries of the Rich Text Editor.\n")
debugApi(projects.libraries.textcomposer.lib)
} else {
debugApi(libs.matrix.richtexteditor)
debugApi(libs.matrix.richtexteditor.compose)
}
ksp(libs.showkase.processor)

2
libraries/textcomposer/lib/.gitignore vendored

@ -0,0 +1,2 @@ @@ -0,0 +1,2 @@
# Built application files
*.aar

3
libraries/textcomposer/lib/build.gradle.kts

@ -0,0 +1,3 @@ @@ -0,0 +1,3 @@
configurations.maybeCreate("default")
artifacts.add("default", file("library.aar"))
artifacts.add("default", file("library-compose.aar"))

77
tools/rte/build_rte.sh

@ -0,0 +1,77 @@ @@ -0,0 +1,77 @@
#!/usr/bin/env bash
# Exit on error
set -e
# Ask to build from local source or to clone the repository
read -p "Do you want to build the RTE from local source (yes/no) default to yes? " buildLocal
buildLocal=${buildLocal:-yes}
date=$(gdate +%Y%m%d%H%M%S)
elementPwd=`pwd`
# Ask for the RTE local source path
# if folder rte/ exists, use it as default
if [ ${buildLocal} == "yes" ]; then
read -p "Please enter the path to the Rust SDK local source, default to ../matrix-rich-text-editor: " rtePath
rtePath=${rtePath:-../matrix-rich-text-editor/}
if [ ! -d "${rtePath}" ]; then
printf "\nFolder ${rtePath} does not exist. Please clone the matrix-rich-text-editor repository in the folder ../matrix-rich-text-editor.\n\n"
exit 0
fi
else
read -p "Please enter the RTE repository url, default to https://github.com/matrix-org/matrix-rich-text-editor.git " rteUrl
rteUrl=${rteUrl:-https://github.com/matrix-org/matrix-rich-text-editor.git}
read -p "Please enter the Rust SDK branch, default to main " rteBranch
rteBranch=${rteBranch:-main}
cd ..
git clone ${rteUrl} matrix-rich-text-editor-$date
cd matrix-rich-text-editor-$date
git checkout ${rteBranch}
rtePath=$(pwd)
cd ${elementPwd}
fi
cd ${rtePath}
git status
read -p "Will build with this version of the RTE ^. Is it correct (yes/no) default to yes? " rteCorrect
rteCorrect=${rteCorrect:-yes}
if [ ${rteCorrect} != "yes" ]; then
exit 0
fi
# Ask if the user wants to build the app after
read -p "Do you want to build the app after (yes/no) default to yes? " buildApp
buildApp=${buildApp:-yes}
cd ${elementPwd}
cd $rtePath
printf "\nBuilding the RTE for aarch64...\n\n"
make android-bindings-aarch64
cd platforms/android
./gradlew clean :library:assembleRelease :library-compose:assembleRelease
cp ./library/build/outputs/aar/library-release.aar $elementPwd/libraries/textcomposer/lib/library.aar
cp ./library-compose/build/outputs/aar/library-compose-release.aar $elementPwd/libraries/textcomposer/lib/library-compose.aar
cd ${elementPwd}
mkdir -p ./libraries/textcomposer/lib/versions
cp ./libraries/textcomposer/lib/library.aar ./libraries/textcomposer/lib/versions/library-${date}.aar
cp ./libraries/textcomposer/lib/library-compose.aar ./libraries/textcomposer/lib/versions/library-compose-${date}.aar
if [ ${buildApp} == "yes" ]; then
printf "\nBuilding the application...\n\n"
./gradlew assembleDebug
fi
if [ ${buildLocal} == "no" ]; then
printf "\nCleaning up...\n\n"
rm -rf ../matrix-rich-text-editor-$date
fi
printf "\nDone!\n"
Loading…
Cancel
Save