Skip to content

Commit

Permalink
'move_to' function added, build script fixes (android)
Browse files Browse the repository at this point in the history
  • Loading branch information
MarketKernel committed Dec 28, 2023
1 parent a8bfa30 commit c60ab49
Show file tree
Hide file tree
Showing 6 changed files with 118 additions and 104 deletions.
178 changes: 89 additions & 89 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,53 @@ env:
jobs:

# build-android:
# runs-on: ubuntu-latest
build-android:
runs-on: ubuntu-latest
env:
CCACHE_TEMPDIR: /tmp/.ccache-temp
steps:

- uses: actions/checkout@v3
with:
submodules: recursive

- uses: actions/cache@v3
with:
path: ~/.ccache
key: ccache-ubuntu-build-${{ github.sha }}
restore-keys: ccache-ubuntu-build-

- name: Remove bundled Boost.
run: ${{env.REMOVE_BUNDLED_BOOST}}

- name: Set apt.conf
run: ${{env.APT_SET_CONF}}

- name: Update apt.
run: sudo apt update -y

- name: Install dependencies.
run: ${{env.APT_INSTALL_LINUX}}

- name: Build.
run: |
${{env.CCACHE_SETTINGS}}
cd build_scripts/android
./build_all.sh
- name: Create zip-arcive.
run: |
cd build_scripts/android
zip -r dist-android.zip dist
- uses: actions/upload-artifact@v3
with:
name: dist-android.zip
path: build_scripts/android/dist-android.zip
retention-days: 1

# build-macos:
# runs-on: macos-13
# env:
# CCACHE_TEMPDIR: /tmp/.ccache-temp
# steps:
Expand All @@ -31,39 +76,30 @@ jobs:
# - uses: actions/cache@v3
# with:
# path: ~/.ccache
# key: ccache-ubuntu-build-${{ github.sha }}
# restore-keys: ccache-ubuntu-build-
#
# - name: Remove bundled Boost.
# run: ${{env.REMOVE_BUNDLED_BOOST}}
#
# - name: Set apt.conf
# run: ${{env.APT_SET_CONF}}
#
# - name: Update apt.
# run: sudo apt update -y
# key: ccache-${{ runner.os }}-build-macos-${{ github.sha }}
# restore-keys: ccache-${{ runner.os }}-build-macos-
#
# - name: Install dependencies.
# run: ${{env.APT_INSTALL_LINUX}}
# - name: install dependencies
# run: |
# HOMEBREW_NO_AUTO_UPDATE=1 brew install ccache
#
# - name: Build.
# run: |
# ${{env.CCACHE_SETTINGS}}
# cd build_scripts/android
# cd build_scripts/macos
# ./build_all.sh
#
# - name: Create zip-arcive.
# run: |
# cd build_scripts/android
# zip -r dist-android.zip dist
# cd build_scripts/macos
# zip -r dist-macos.zip dist
#
# - uses: actions/upload-artifact@v3
# with:
# name: dist-android.zip
# path: build_scripts/android/dist-android.zip
# name: dist-macos.zip
# path: build_scripts/macos/dist-macos.zip
# retention-days: 1

# build-macos:
# build-ios:
# runs-on: macos-13
# env:
# CCACHE_TEMPDIR: /tmp/.ccache-temp
Expand All @@ -75,67 +111,31 @@ jobs:
#
# - uses: actions/cache@v3
# with:
# path: ~/.ccache
# key: ccache-${{ runner.os }}-build-macos-${{ github.sha }}
# restore-keys: ccache-${{ runner.os }}-build-macos-
# path: /Users/runner/Library/Caches/ccache
# key: ccache-${{ runner.os }}-build-ios-${{ github.sha }}
# restore-keys: ccache-${{ runner.os }}-build-ios-
#
# - name: install dependencies
# run: |
# HOMEBREW_NO_AUTO_UPDATE=1 brew install ccache
#
# - name: Build.
# run: |
# cd build_scripts/macos
# ${{env.CCACHE_SETTINGS}}
# cd build_scripts/ios
# ./build_all.sh
#
# - name: Create zip-arcive.
# run: |
# cd build_scripts/macos
# zip -r dist-macos.zip dist
# cd build_scripts/ios
# zip -r dist-ios.zip dist
#
# - uses: actions/upload-artifact@v3
# with:
# name: dist-macos.zip
# path: build_scripts/macos/dist-macos.zip
# name: dist-ios.zip
# path: build_scripts/ios/dist-ios.zip
# retention-days: 1

build-ios:
runs-on: macos-13
env:
CCACHE_TEMPDIR: /tmp/.ccache-temp
steps:

- uses: actions/checkout@v3
with:
submodules: recursive

- uses: actions/cache@v3
with:
path: /Users/runner/Library/Caches/ccache
key: ccache-${{ runner.os }}-build-ios-${{ github.sha }}
restore-keys: ccache-${{ runner.os }}-build-ios-

- name: install dependencies
run: |
HOMEBREW_NO_AUTO_UPDATE=1 brew install ccache
- name: Build.
run: |
${{env.CCACHE_SETTINGS}}
cd build_scripts/ios
./build_all.sh
- name: Create zip-arcive.
run: |
cd build_scripts/ios
zip -r dist-ios.zip dist
- uses: actions/upload-artifact@v3
with:
name: dist-ios.zip
path: build_scripts/ios/dist-ios.zip
retention-days: 1

#Release
create-release:
runs-on: ubuntu-latest
Expand All @@ -155,38 +155,38 @@ jobs:
draft: false
prerelease: false

# # Android
# - name: Download Android artifact.
# uses: actions/download-artifact@v3
# with:
# name: dist-android.zip
#
# - name: Upload Android artifact.
# uses: actions/upload-release-asset@v1
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# upload_url: ${{ steps.create_release.outputs.upload_url }}
# asset_path: dist-android.zip
# asset_name: dist-android.zip
# asset_content_type: application/zip

# # iOS
- name: Download iOS artifact.
# Android
- name: Download Android artifact.
uses: actions/download-artifact@v3
with:
name: dist-ios.zip
name: dist-android.zip

- name: Upload iOS artifact.
- name: Upload Android artifact.
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: dist-ios.zip
asset_name: dist-ios.zip
asset_path: dist-android.zip
asset_name: dist-android.zip
asset_content_type: application/zip

# # iOS
# - name: Download iOS artifact.
# uses: actions/download-artifact@v3
# with:
# name: dist-ios.zip
#
# - name: Upload iOS artifact.
# uses: actions/upload-release-asset@v1
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# upload_url: ${{ steps.create_release.outputs.upload_url }}
# asset_path: dist-ios.zip
# asset_name: dist-ios.zip
# asset_content_type: application/zip

# # macOS
# - name: Download macOS artifact.
# uses: actions/download-artifact@v3
Expand Down
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,6 @@ add_library(monero-ffi SHARED ${MONEROFFI_SRC_FILES})
if (APPLE AND IOS)
target_link_libraries(monero-ffi
monero-cpp
${WALLET_API_LIBRARY}
${WALLET_LIBRARY}
${CRYPTONOTE_BASIC_LIBRARY}
${CRYPTONOTE_CORE_LIBRARY}
Expand Down
10 changes: 5 additions & 5 deletions build_scripts/android/build_monero_ffi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ for arch in "aarch" "aarch64" "i686" "x86_64"
do
FLAGS=""
BUILD_ARCH_DIR=${BUILD_DIR}/prefix_${arch}
DEST_LIB_DIR=${BUILD_ARCH_DIR}/lib/monero-ffi
DEST_INCLUDE_DIR=${BUILD_ARCH_DIR}/include/monero-ffi
DEST_LIB_DIR=${BUILD_ARCH_DIR}/lib
DEST_INCLUDE_DIR=${BUILD_ARCH_DIR}/include
export CMAKE_INCLUDE_PATH="${BUILD_ARCH_DIR}/include"
export CMAKE_LIBRARY_PATH="${BUILD_ARCH_DIR}/lib"
ANDROID_STANDALONE_TOOLCHAIN_PATH="${TOOLCHAIN_BASE_DIR}_${arch}"
Expand Down Expand Up @@ -62,7 +62,7 @@ CC=${CLANG} CXX=${CXXLANG} cmake -D USE_DEVICE_TREZOR=OFF -D BUILD_GUI_DEPS=1 -D

make -j$THREADS

#cp -r ./*.so $DEST_LIB_DIR
find . -type f \( -name "*.so" -o -name "*.a" \) -exec cp {} $DEST_LIB_DIR \;
cp ../../src/monero_ffi.hpp $DEST_INCLUDE_DIR
#find . -type f \( -name "*.so" -o -name "*.a" \) -exec cp {} $DEST_LIB_DIR \;
find . -type f \( -name "*.so" \) -exec cp {} $DEST_LIB_DIR \;
cp ../../src/monero_ffi.h $DEST_INCLUDE_DIR
done
4 changes: 2 additions & 2 deletions build_scripts/android/copy_monero_deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ DIST_INCLUDE_DIR=${DIST_DIR}/${ABI}/include
mkdir -p $DIST_LIB_DIR
mkdir -p $DIST_INCLUDE_DIR

cp -r ${BUILD_ARCH_DIR}/lib/* $DIST_LIB_DIR
cp -r ${BUILD_ARCH_DIR}/include/* $DIST_INCLUDE_DIR
cp -r ${BUILD_ARCH_DIR}/lib/*.so $DIST_LIB_DIR
cp -r ${BUILD_ARCH_DIR}/include/monero_ffi.h $DIST_INCLUDE_DIR

done
27 changes: 20 additions & 7 deletions src/monero_ffi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,26 @@ void store(ErrorBox* error)
}
}

void move_to(const char* path, const char* password, ErrorBox* error)
{
if (nullptr == _wallet)
{
error->code = -1;
error->message = WALLET_NOT_FOUND_MESSAGE;
return;
}

try
{
_wallet->move_to(path, password);
}
catch (std::exception& e)
{
error->code = -1;
error->message = strdup(e.what());
}
}

void close_current_wallet(ErrorBox* error)
{
if (nullptr == _wallet)
Expand Down Expand Up @@ -538,13 +558,6 @@ uint64_t get_end_height(ErrorBox* error)
return -1;
}

if (nullptr == _listener)
{
error->code = -1;
error->message = LISTENER_IS_NOT_SET_MESSAGE;
return -1;
}

uint64_t result;

try
Expand Down
2 changes: 2 additions & 0 deletions src/monero_ffi.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ const ByteArray get_cache_data(ErrorBox* error);

void store(ErrorBox* error);

void move_to(const char* path, const char* password, ErrorBox* error);

void close_current_wallet(ErrorBox* error);

// ************* Multisig *************
Expand Down

0 comments on commit c60ab49

Please sign in to comment.