mirror of
https://github.com/tutao/tutanota.git
synced 2025-12-07 13:49:47 +00:00
[ios, sdk] Optimize build
Check if generated files are up-to-date to avoid cascading rebuilds. Co-authored-by: ivk <ivk@tutao.de>
This commit is contained in:
parent
7e1a5584bf
commit
760c5123ab
2 changed files with 27 additions and 14 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -1,4 +1,5 @@
|
||||||
build
|
build
|
||||||
|
bindings
|
||||||
cache
|
cache
|
||||||
target
|
target
|
||||||
build-calendar-app
|
build-calendar-app
|
||||||
|
|
|
||||||
|
|
@ -25,12 +25,8 @@ includeArch() {
|
||||||
}
|
}
|
||||||
|
|
||||||
createFolderStructure() {
|
createFolderStructure() {
|
||||||
if [ -d "${SRC_ROOT}/target/combined" ]; then
|
mkdir -p "${SRC_ROOT}/target/combined/"
|
||||||
rm -r "${SRC_ROOT}/target/combined"
|
mkdir -p "${SRC_ROOT}/target/combined/${RELFLAG}"
|
||||||
fi
|
|
||||||
|
|
||||||
mkdir "${SRC_ROOT}/target/combined/"
|
|
||||||
mkdir "${SRC_ROOT}/target/combined/${RELFLAG}"
|
|
||||||
|
|
||||||
if [ -d "${SRC_ROOT}/tuta-sdk/ios/tutasdk/generated-src" ]; then
|
if [ -d "${SRC_ROOT}/tuta-sdk/ios/tutasdk/generated-src" ]; then
|
||||||
rm -r "${SRC_ROOT}/tuta-sdk/ios/tutasdk/generated-src"
|
rm -r "${SRC_ROOT}/tuta-sdk/ios/tutasdk/generated-src"
|
||||||
|
|
@ -42,13 +38,29 @@ createFolderStructure() {
|
||||||
}
|
}
|
||||||
|
|
||||||
generateLibrary() {
|
generateLibrary() {
|
||||||
lipo -create $ARCH_LIST -output "${SRC_ROOT}/target/combined/${RELFLAG}/libtutasdk.a"
|
for arch in $ARCH_LIST; do
|
||||||
|
if [ $arch -nt "${SRC_ROOT}/target/combined/${RELFLAG}/libtutasdk.a" ]; then
|
||||||
|
echo "$arch is newer!"
|
||||||
|
echo $(date -r $arch)
|
||||||
|
echo $(date -r "${SRC_ROOT}/target/combined/${RELFLAG}/libtutasdk.a" || echo "output of lipo doesn't exist")
|
||||||
|
lipo -create $ARCH_LIST -output "${SRC_ROOT}/target/combined/${RELFLAG}/libtutasdk.a"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
cp "${SRC_ROOT}/target/combined/${RELFLAG}/libtutasdk.a" "${SRC_ROOT}/tuta-sdk/ios/tutasdk/generated-src/tutasdk.a"
|
cp -p "${SRC_ROOT}/target/combined/${RELFLAG}/libtutasdk.a" "${SRC_ROOT}/tuta-sdk/ios/tutasdk/generated-src/tutasdk.a"
|
||||||
|
|
||||||
mv $SRC_ROOT/bindings/*.h "${SRC_ROOT}/tuta-sdk/ios/tutasdk/generated-src/headers/"
|
cp -p $SRC_ROOT/bindings/*.h "${SRC_ROOT}/tuta-sdk/ios/tutasdk/generated-src/headers/"
|
||||||
mv $SRC_ROOT/bindings/*.modulemap "${SRC_ROOT}/tuta-sdk/ios/tutasdk/generated-src/headers/"
|
cp -p $SRC_ROOT/bindings/*.modulemap "${SRC_ROOT}/tuta-sdk/ios/tutasdk/generated-src/headers/"
|
||||||
mv $SRC_ROOT/bindings/*.swift "${SRC_ROOT}/tuta-sdk/ios/tutasdk/generated-src/Sources/"
|
cp -p $SRC_ROOT/bindings/*.swift "${SRC_ROOT}/tuta-sdk/ios/tutasdk/generated-src/Sources/"
|
||||||
|
}
|
||||||
|
|
||||||
|
genSwiftIfNeeded() {
|
||||||
|
if [ "${SRC_ROOT}/target/$1/${RELFLAG}/libtutasdk.dylib" -nt "$SRC_ROOT/bindings/tutasdk.swift" ]; then
|
||||||
|
cargo run --package uniffi-bindgen -- generate --library "${SRC_ROOT}/target/$1/${RELFLAG}/libtutasdk.dylib" --out-dir "$SRC_ROOT/bindings" --language=swift
|
||||||
|
else
|
||||||
|
echo "File $SRC_ROOT/bindings/tutasdk.swift is up to date, no need to rengenerate"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
cd $SRC_ROOT
|
cd $SRC_ROOT
|
||||||
|
|
@ -66,18 +78,18 @@ for arch in $ARCHS; do
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Intel iOS simulator
|
# Intel iOS simulator
|
||||||
cargo run --package uniffi-bindgen -- generate --library "${SRC_ROOT}/target/x86_64-apple-ios/${RELFLAG}/libtutasdk.dylib" --out-dir "$SRC_ROOT/bindings" --language=swift
|
genSwiftIfNeeded x86_64-apple-ios
|
||||||
includeArch "${SRC_ROOT}/target/x86_64-apple-ios/${RELFLAG}/libtutasdk.a";
|
includeArch "${SRC_ROOT}/target/x86_64-apple-ios/${RELFLAG}/libtutasdk.a";
|
||||||
;;
|
;;
|
||||||
|
|
||||||
arm64)
|
arm64)
|
||||||
if [ $IS_SIMULATOR -eq 0 ]; then
|
if [ $IS_SIMULATOR -eq 0 ]; then
|
||||||
# Hardware iOS targets
|
# Hardware iOS targets
|
||||||
cargo run --package uniffi-bindgen -- generate --library "${SRC_ROOT}/target/aarch64-apple-ios/${RELFLAG}/libtutasdk.dylib" --out-dir "$SRC_ROOT/bindings" --language=swift
|
genSwiftIfNeeded aarch64-apple-ios
|
||||||
includeArch "${SRC_ROOT}/target/aarch64-apple-ios/${RELFLAG}/libtutasdk.a";
|
includeArch "${SRC_ROOT}/target/aarch64-apple-ios/${RELFLAG}/libtutasdk.a";
|
||||||
else
|
else
|
||||||
# M1 iOS simulator
|
# M1 iOS simulator
|
||||||
cargo run --package uniffi-bindgen -- generate --library "${SRC_ROOT}/target/aarch64-apple-ios-sim/${RELFLAG}/libtutasdk.dylib" --out-dir "$SRC_ROOT/bindings" --language=swift
|
genSwiftIfNeeded aarch64-apple-ios-sim
|
||||||
includeArch "${SRC_ROOT}/target/aarch64-apple-ios-sim/${RELFLAG}/libtutasdk.a";
|
includeArch "${SRC_ROOT}/target/aarch64-apple-ios-sim/${RELFLAG}/libtutasdk.a";
|
||||||
fi
|
fi
|
||||||
esac
|
esac
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue