From 40653d620d94bd8b3ef4b3c5654704a9c7d7c350 Mon Sep 17 00:00:00 2001 From: Andrew Plaza Date: Mon, 18 Nov 2024 14:30:31 -0500 Subject: [PATCH] Fix kotlin script not copying files to android directory (#1258) * fix kotlin script * fix noop workflow --- .github/workflows/noop.yml | 5 ----- dev/release-kotlin | 29 ++++++++++++++++++++++++++--- 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/.github/workflows/noop.yml b/.github/workflows/noop.yml index 5d2b96b3e..15d8b61a7 100644 --- a/.github/workflows/noop.yml +++ b/.github/workflows/noop.yml @@ -1,5 +1,4 @@ name: No Op - on: pull_request: # ignore code and some workflow changes @@ -13,7 +12,6 @@ on: - "!.github/workflows/test-workspace.yml" - "!bindings_ffi/**" - "!bindings_node/**" - - "!dev/**" - "!mls_validation_service/**" - "!xmtp_api_grpc/**" - "!xmtp_cryptography/**" @@ -26,18 +24,15 @@ on: - "!Cargo.lock" - "!rust-toolchain" - "!rustfmt.toml" - # Test and Lint steps are required for pull requests, but some file changes # don't require them to run. These jobs define the required steps for these # cases, but don't actually do anything. - jobs: test: name: Test runs-on: ubuntu-latest steps: - run: echo "Nothing to test" - lint: name: Lint runs-on: ubuntu-latest diff --git a/dev/release-kotlin b/dev/release-kotlin index bdc9e360c..86c1ff670 100755 --- a/dev/release-kotlin +++ b/dev/release-kotlin @@ -1,6 +1,21 @@ #!/bin/bash set -eou pipefail +RED='\033[0;31m' +GREEN='\033[0;32m' +WHITE='\033[0;97m' + +NC='\033[0m' # No Color + +XMTP_ANDROID="${1:-$(realpath ../xmtp-android)}" +if [ ! -d $XMTP_ANDROID ]; then + echo -e "${RED}xmtp-android directory not detected${NC}" + echo -e "${RED}Ensure directory exists.${NC}" + echo -e "${RED}Ensure \`github.com/xmtp/xmtp_android\` is cloned as a sibling directory or passed as the first argument to this script.${NC}" + exit +fi +echo -e "${GREEN}Android Directory:${NC} $XMTP_ANDROID" + # Local script to release android jniLibs with same environment as CI if [[ "${OSTYPE}" == "darwin"* ]]; then if ! which nix &>/dev/null; then @@ -31,7 +46,15 @@ for arch in arm64-v8a armeabi-v7a x86 x86_64; do mv "./bindings_ffi/jniLibs/$arch/$LIBRARY_NAME.so" "./bindings_ffi/jniLibs/$arch/$TARGET_NAME.so" done -if [[ -n "$1" ]]; then - rm -rf $1/library/src/main/jniLibs - mv "./bindings_ffi/jniLibs" $1/library/src/main +echo -e "${WHITE}jniLib generation successful.${NC}" + +read -r -p "$(echo -e $WHITE"Delete existing jniLibs and copy new ones? [y/N] "$NC)" response +response=${response} +if [[ "$response" =~ ^(yes|y)$ ]] +then + rm -rf $XMTP_ANDROID/library/src/main/jniLibs + cp -r "./bindings_ffi/jniLibs" $XMTP_ANDROID/library/src/main + echo "libs copied" +else + echo "done" fi