Skip to content

Commit

Permalink
Update scripts (#88)
Browse files Browse the repository at this point in the history
## 🎟️ Tracking

<!-- Paste the link to the Jira or GitHub issue or otherwise describe /
point to where this change is coming from. -->

## 📔 Objective

- Unify all scripts to have `set -eo pipefail`, add shebangs and make
sure that they can be run from any directories.
- Allow Kotlin local builds to also build all the architectures
optionally.
- Fix sed command in memory_testing that broke when after the cargo-sort
PR, where the order of the entries was changed. Thanks ChatGPT for the
regex help hah

## ⏰ Reminders before review

- Contributor guidelines followed
- All formatters and local linters executed and passed
- Written new unit and / or integration tests where applicable
- Protected functional changes with optionality (feature flags)
- Used internationalization (i18n) for all UI strings
- CI builds passed
- Communicated to DevOps any deployment requirements
- Updated any necessary documentation (Confluence, contributing docs) or
informed the documentation
  team

## 🦮 Reviewer guidelines

<!-- Suggested interactions but feel free to use (or not) as you desire!
-->

- 👍 (`:+1:`) or similar for great changes
- 📝 (`:memo:`) or ℹ️ (`:information_source:`) for notes or general info
- ❓ (`:question:`) for questions
- 🤔 (`:thinking:`) or 💭 (`:thought_balloon:`) for more open inquiry
that's not quite a confirmed
  issue and could potentially benefit from discussion
- 🎨 (`:art:`) for suggestions / improvements
- ❌ (`:x:`) or ⚠️ (`:warning:`) for more significant problems or
concerns needing attention
- 🌱 (`:seedling:`) or ♻️ (`:recycle:`) for future improvements or
indications of technical debt
- ⛏ (`:pick:`) for minor or nitpick changes
  • Loading branch information
dani-garcia authored Dec 19, 2024
1 parent f84df29 commit f197d30
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 5 deletions.
19 changes: 17 additions & 2 deletions crates/bitwarden-uniffi/kotlin/publish-local.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#!/usr/bin/env bash
set -e
set -eo pipefail

cd "$(dirname "$0")"

SDK_REPO_ROOT="$(git rev-parse --show-toplevel)"

mkdir -p ./sdk/src/main/jniLibs/{arm64-v8a,armeabi-v7a,x86_64,x86}
Expand All @@ -10,8 +11,22 @@ mkdir -p ./sdk/src/main/jniLibs/{arm64-v8a,armeabi-v7a,x86_64,x86}
cross build -p bitwarden-uniffi --release --target=aarch64-linux-android
mv $SDK_REPO_ROOT/target/aarch64-linux-android/release/libbitwarden_uniffi.so ./sdk/src/main/jniLibs/arm64-v8a/libbitwarden_uniffi.so

# Build other archs
if [ $1 = "all" ]; then
echo "Building for all architectures"

cross build -p bitwarden-uniffi --release --target=armv7-linux-androideabi
mv $SDK_REPO_ROOT/target/armv7-linux-androideabi/release/libbitwarden_uniffi.so ./sdk/src/main/jniLibs/armeabi-v7a/libbitwarden_uniffi.so

cross build -p bitwarden-uniffi --release --target=x86_64-linux-android
mv $SDK_REPO_ROOT/target/x86_64-linux-android/release/libbitwarden_uniffi.so ./sdk/src/main/jniLibs/x86_64/libbitwarden_uniffi.so

cross build -p bitwarden-uniffi --release --target=i686-linux-android
mv $SDK_REPO_ROOT/target/i686-linux-android/release/libbitwarden_uniffi.so ./sdk/src/main/jniLibs/x86/libbitwarden_uniffi.so
fi

# Generate latest bindings
./build-schemas.sh

# Publish to local maven
# Publish to local maven (~/.m2/repository/com/bitwarden/sdk-android)
./gradlew sdk:publishToMavenLocal -Pversion=LOCAL
5 changes: 5 additions & 0 deletions crates/bitwarden-uniffi/swift/build.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
#!/usr/bin/env bash
set -eo pipefail

cd "$(dirname "$0")"

# Generate an xcframework for the Swift bindings.

# Cleanup dirs
Expand Down
6 changes: 5 additions & 1 deletion crates/bitwarden-wasm-internal/build.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Move to the root of the repository
#!/usr/bin/env bash
set -eo pipefail

cd "$(dirname "$0")"

# Move to the root of the repository
cd ../../

if [ "$1" != "-r" ]; then
Expand Down
2 changes: 1 addition & 1 deletion crates/memory-testing/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ COPY crates/bitwarden-crypto/Cargo.toml /app/crates/bitwarden-crypto/
COPY crates/memory-testing/Cargo.toml /app/crates/memory-testing/

# Patch Cargo.toml to remove `, "bitwarden_license/*"` from the members array
RUN sed -i 's/, "bitwarden_license\/\*"\(,\?\)/\1/' Cargo.toml
RUN sed -i 's/\([" ]*\)"bitwarden_license\/\*"[ ,]*\([" ]*\)/\1\2/g' Cargo.toml

RUN mkdir -p /app/crates/bitwarden-crypto/src \
/app/crates/bitwarden-crypto/benches \
Expand Down
4 changes: 3 additions & 1 deletion crates/memory-testing/run_test.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#!/usr/bin/env bash
set -eo pipefail

# Move to the root of the repository
cd "$(dirname "$0")"

# Move to the root of the repository
cd ../../

BASE_DIR="./crates/memory-testing"
Expand Down
8 changes: 8 additions & 0 deletions support/build-api.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
#!/usr/bin/env bash
set -eo pipefail

cd "$(dirname "$0")"

# Move to the root of the repository
cd ../

# Delete old directory to ensure all files are updated
rm -rf crates/bitwarden-api-api/src

Expand Down

0 comments on commit f197d30

Please sign in to comment.