From e220ecbb0a50732b147996db655cfb066aee3598 Mon Sep 17 00:00:00 2001 From: Pedro Pombeiro Date: Wed, 8 Jan 2020 15:41:07 +0100 Subject: [PATCH] Cleanup Signed-off-by: Pedro Pombeiro --- Makefile | 2 +- .../im/status/ethereum/module/StatusModule.java | 2 +- modules/react-native-status/desktop/rctstatus.cpp | 2 +- .../react-native-status/ios/RCTStatus/RCTStatus.m | 4 ++-- nix/default.nix | 2 +- nix/mobile/default.nix | 4 ++-- nix/mobile/ios/status-go-shell.nix | 14 +++++++------- nix/scripts/shell.sh | 7 ++++++- nix/shells.nix | 6 +++--- nix/status-go/default.nix | 2 +- scripts/release-android.sh | 7 ++++++- src/status_im/native_module/core.cljs | 2 +- 12 files changed, 32 insertions(+), 22 deletions(-) diff --git a/Makefile b/Makefile index 5164258c99..d83902f0a1 100644 --- a/Makefile +++ b/Makefile @@ -276,7 +276,7 @@ lint: ##@test Run code style checks lint-fix: export TARGET := lein lint-fix: ##@test Run code style checks and fix issues lein cljfmt fix - + test: export TARGET := lein test: ##@test Run tests once in NodeJS lein with-profile test doo node test once diff --git a/modules/react-native-status/android/src/main/java/im/status/ethereum/module/StatusModule.java b/modules/react-native-status/android/src/main/java/im/status/ethereum/module/StatusModule.java index daf61f624a..3eb208e9f9 100644 --- a/modules/react-native-status/android/src/main/java/im/status/ethereum/module/StatusModule.java +++ b/modules/react-native-status/android/src/main/java/im/status/ethereum/module/StatusModule.java @@ -1253,7 +1253,7 @@ class StatusModule extends ReactContextBaseJavaModule implements LifecycleEventL public void isDeviceRooted(final Callback callback) { callback.invoke(rootedDevice); } - + @ReactMethod public void validateMnemonic(final String seed, final Callback callback) { Log.d(TAG, "validateMnemonic"); diff --git a/modules/react-native-status/desktop/rctstatus.cpp b/modules/react-native-status/desktop/rctstatus.cpp index 21a54df2bc..c09b1558fb 100644 --- a/modules/react-native-status/desktop/rctstatus.cpp +++ b/modules/react-native-status/desktop/rctstatus.cpp @@ -687,4 +687,4 @@ void RCTStatus::generateAliasAndIdenticonAsync(QString publicKey, double callbac const char *alias = GenerateAlias({pubKey.data(), pubKey.length()}); const char *identicon = Identicon({pubKey.data(), pubKey.length()}); d->bridge->invokePromiseCallback(callbackId, QVariantList{alias, identicon}); -} \ No newline at end of file +} diff --git a/modules/react-native-status/ios/RCTStatus/RCTStatus.m b/modules/react-native-status/ios/RCTStatus/RCTStatus.m index 5ec9c927ec..93f1646a50 100644 --- a/modules/react-native-status/ios/RCTStatus/RCTStatus.m +++ b/modules/react-native-status/ios/RCTStatus/RCTStatus.m @@ -124,7 +124,7 @@ RCT_EXPORT_METHOD(initKeystore) { ^(void) { NSString *res = StatusgoInitKeystore(keystoreDir.path); - NSLog(@"StopNode result %@", res); + NSLog(@"InitKeyStore result %@", res); }); } @@ -434,7 +434,7 @@ RCT_EXPORT_METHOD(logout) { NSLog(@"Logout() method called"); #endif NSString *result = StatusgoLogout(); - + NSLog(@"%@", result); } diff --git a/nix/default.nix b/nix/default.nix index 21e0daf821..2da6f2b833 100644 --- a/nix/default.nix +++ b/nix/default.nix @@ -1,4 +1,4 @@ -{ +{ config ? {}, pkgs ? import ./pkgs.nix { inherit config; } }: diff --git a/nix/mobile/default.nix b/nix/mobile/default.nix index a8ecc50827..6ef6174926 100644 --- a/nix/mobile/default.nix +++ b/nix/mobile/default.nix @@ -1,4 +1,4 @@ -{ config, lib, stdenvNoCC, callPackage,status-go, +{ config, lib, stdenvNoCC, callPackage, status-go, localMavenRepoBuilder, composeXcodeWrapper, mkShell, mergeSh }: let @@ -21,7 +21,7 @@ let fastlane status-go.android status-go.ios - androidPlatform + androidPlatform iosPlatform ]; diff --git a/nix/mobile/ios/status-go-shell.nix b/nix/mobile/ios/status-go-shell.nix index bf44720d79..2fc96bd3f2 100644 --- a/nix/mobile/ios/status-go-shell.nix +++ b/nix/mobile/ios/status-go-shell.nix @@ -1,10 +1,10 @@ { mkShell, mergeSh, status-go }: -let +let shell = mkShell { shellHook = '' - if [ -z "$RCTSTATUS_FILEPATH" ]; then - echo "RCTSTATUS_FILEPATH is not defined! Aborting." + if [ -z "$STATUS_GO_IOS_LIBDIR" ]; then + echo "STATUS_GO_IOS_LIBDIR is not defined! Aborting." exit 1 fi @@ -13,13 +13,13 @@ let # Compare target folder with source to see if copying is required if [ -d "$RCTSTATUS_DIR/$targetBasename" ] && [ -d $STATUS_REACT_HOME/ios/Pods/ ] && \ - diff -q --no-dereference --recursive $RCTSTATUS_DIR/$targetBasename/ $RCTSTATUS_FILEPATH/ > /dev/null; then + diff -q --no-dereference --recursive $RCTSTATUS_DIR/$targetBasename/ $STATUS_GO_IOS_LIBDIR/ > /dev/null; then echo "$RCTSTATUS_DIR/$targetBasename already in place" else - sourceBasename="$(basename $RCTSTATUS_FILEPATH)" + sourceBasename="$(basename $STATUS_GO_IOS_LIBDIR)" echo "Copying $sourceBasename from Nix store to $RCTSTATUS_DIR" rm -rf "$RCTSTATUS_DIR/$targetBasename/" - cp -a $RCTSTATUS_FILEPATH $RCTSTATUS_DIR + cp -a $STATUS_GO_IOS_LIBDIR $RCTSTATUS_DIR chmod -R 755 "$RCTSTATUS_DIR/$targetBasename" if [ "$sourceBasename" != "$targetBasename" ]; then mv "$RCTSTATUS_DIR/$sourceBasename" "$RCTSTATUS_DIR/$targetBasename" @@ -27,5 +27,5 @@ let fi ''; }; -in +in mergeSh status-go.shell [ shell ] diff --git a/nix/scripts/shell.sh b/nix/scripts/shell.sh index 8300177eeb..e5081fb356 100755 --- a/nix/scripts/shell.sh +++ b/nix/scripts/shell.sh @@ -51,8 +51,13 @@ if [[ "$TARGET" =~ (linux|windows|darwin|macos) ]]; then nix-shell ${shellArgs[@]} --run "scripts/prepare-for-desktop-platform.sh" || exit fi +statusGoConfig='' if [ -n "${STATUS_GO_SRC_OVERRIDE}" ]; then - shellArgs+=("--arg config {status_go.src_override=\"${STATUS_GO_SRC_OVERRIDE}\";}") + statusGoConfig+="status_go.src_override=\"${STATUS_GO_SRC_OVERRIDE}\";" +fi + +if [ -n "$statusGoConfig" ]; then + shellArgs+=("--arg config {$statusGoConfig}") fi # if _NIX_ATTR is specified we shouldn't use shell.nix, the path will be different diff --git a/nix/shells.nix b/nix/shells.nix index eab455c05e..116512ceb3 100644 --- a/nix/shells.nix +++ b/nix/shells.nix @@ -1,13 +1,13 @@ # This file defines custom shells as well as shortcuts # for accessing more nested shells. -{ +{ config ? {}, pkgs ? import ./pkgs.nix { inherit config; } }: let # everything else we define in nix/ dir - targets = pkgs.callPackage ./targets.nix { }; + targets = pkgs.callPackage ./targets.nix { inherit config; }; # for calling lein targets in CI or Makefile leiningen-sh = pkgs.mkShell { @@ -27,7 +27,7 @@ let name = "status-react-shell"; # for identifying all shells buildInputs = with pkgs; lib.unique ([ # core utilities that should always be present in a shell - bash curl wget file unzip flock git gnumake jq ncurses + bash curl wget file unzip flock git gnumake jq ncurses # build specific utilities clojure leiningen maven watchman # other nice to have stuff diff --git a/nix/status-go/default.nix b/nix/status-go/default.nix index 4c7c97ffcd..f68f11d0dd 100644 --- a/nix/status-go/default.nix +++ b/nix/status-go/default.nix @@ -131,7 +131,7 @@ let inherit buildInputs; shellHook = '' # These variables are used by the iOS build preparation section in nix/mobile/ios/default.nix - export RCTSTATUS_FILEPATH=${status-go-packages.ios}/lib/Statusgo.framework + export STATUS_GO_IOS_LIBDIR=${status-go-packages.ios}/lib/Statusgo.framework ''; }; }; diff --git a/scripts/release-android.sh b/scripts/release-android.sh index 24c2c2616f..c110549729 100755 --- a/scripts/release-android.sh +++ b/scripts/release-android.sh @@ -6,8 +6,13 @@ source "$_current_dir/lib/setup/path-support.sh" source_lib "platform.sh" +statusGoConfig='' +if [ -n "${STATUS_GO_SRC_OVERRIDE}" ]; then + statusGoConfig+="status_go.src_override=\"${STATUS_GO_SRC_OVERRIDE}\";" +fi + nixOpts=( - "--arg config {status_go.src_override=\"${STATUS_GO_SRC_OVERRIDE}\";}" + "--arg config {${statusGoConfig}}" "--arg env {BUILD_ENV=\"${BUILD_ENV}\";ANDROID_ABI_SPLIT=\"${ANDROID_ABI_SPLIT}\";ANDROID_ABI_INCLUDE=\"${ANDROID_ABI_INCLUDE}\";}" "--argstr build-type ${BUILD_TYPE}" "--argstr build-number ${BUILD_NUMBER}" diff --git a/src/status_im/native_module/core.cljs b/src/status_im/native_module/core.cljs index de68ca9e2a..87bb3dc5c8 100644 --- a/src/status_im/native_module/core.cljs +++ b/src/status_im/native_module/core.cljs @@ -343,4 +343,4 @@ "Validate that a mnemonic conforms to BIP39 dictionary/checksum standards" [mnemonic callback] (log/debug "[native-module] validate-mnemonic") - (.validateMnemonic (status) mnemonic callback)) \ No newline at end of file + (.validateMnemonic (status) mnemonic callback))