From 430b78f3c3cc98373f9aff55dc8dd8bd2e7fe7b4 Mon Sep 17 00:00:00 2001 From: Ayush Srivastava <55537146+ayush-srivastava-03@users.noreply.github.com> Date: Thu, 27 May 2021 20:05:31 +0530 Subject: [PATCH] Pilot (#30) * Changed default path of libiplinkc for MacOS * resolved cloudbuild issue * resolved cloudbuild issues * Update cloudbuild.yaml * Update Dockerfile * updated docker * Update cloudbuild.yaml * Update cloudbuild.yaml * Update cloudbuild.yaml * resolved docker build timeout issue * resolved docker build timeout issue * Update cloudbuild.yaml * Updated ReadME * Update README.md * Updated ReadMe and version Co-authored-by: shivamkumar99 <50213437+shivamkumar99@users.noreply.github.com> --- .gitignore | 1 - CHANGELOG.md | 10 ++++++++++ Dockerfile | 3 ++- Makefile | 12 +++++++----- README.md | 12 ++++++++++++ binding.gyp | 8 ++++---- cloudbuild.yaml | 2 +- docs/README.md | 12 ++++++++++++ functions/definitions.h | 3 ++- functions_win/promises_execute_win.cc | 3 ++- libUplink_win.cc | 3 ++- libuplinkcversion.h | 3 +++ package-lock.json | 2 +- package.json | 2 +- uplink.ts | 2 -- 15 files changed, 59 insertions(+), 19 deletions(-) delete mode 100644 .gitignore create mode 100644 libuplinkcversion.h diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 378eac25..00000000 --- a/.gitignore +++ /dev/null @@ -1 +0,0 @@ -build diff --git a/CHANGELOG.md b/CHANGELOG.md index 1dfacace..238359bf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,15 @@ # Storj-Nodejs Changelog +## [1.2.5]-29-04-2021 +* Updated ReadMe.md + +## [1.2.5]-28-04-2021 +* Updated ReadMe.md + +## [1.2.4]-19-04-2021 +* Added version with libuplinkc filename +* Changed default path of libiplinkc for MacOS + ## [1.2.3]-10-02-2021 * Tagged uplink-c v1.2.2 * Updated documentation diff --git a/Dockerfile b/Dockerfile index 1321a578..5fca0318 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,4 +14,5 @@ RUN mv go /usr/local ENV PATH=$PATH:/usr/local/go/bin # Installing node-gyp -RUN npm install -g node-gyp +RUN npm install -g node-gyp@7.1.2 +RUN node-gyp -v \ No newline at end of file diff --git a/Makefile b/Makefile index 7365dcab..ee52684c 100644 --- a/Makefile +++ b/Makefile @@ -9,14 +9,16 @@ GIT_REPO=https://github.com/storj/uplink-c UPLINKC_NAME=uplink-c UPLINKC_VERSION=v1.2.2 #Library Name -LIBRARY_NAME_LINUX=libuplinkc.so -LIBRARY_NAME_DARWIN=libuplinkc.dylib -LIBRARY_NAME_WIN=libuplinkc.dll +LIBRARY_NAME_LINUX=libuplinkcv1.2.4.so +LIBRARY_NAME_DARWIN=libuplinkcv1.2.4.dylib +LIBRARY_NAME_WIN=libuplinkcv1.2.4.dll LIBRARY_UPLINK=*.h -DELETE_LIBRARY_HEADER=libuplinkc.h +DELETE_LIBRARY_HEADER=libuplinkcv1.2.4.h +#Library Path +MACOS_DYLIB_DEFAULT_PAYH=/usr/local/lib #JSFOLDER JSFOLDER=dist -JSFOLDERLIB=libuplinkc.* +JSFOLDERLIB=libuplinkcv1.2.4.* #Color RED_COLOR=\033[31m GREEN_COLOR=\033[32m diff --git a/README.md b/README.md index d66cf226..8ba06026 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,18 @@ $ npm install -g node-gyp ``` $ npm install uplink-nodejs ``` +* Set Environment variable + * MacOS + * Set DYLD_LIBRARY_PATH environment variable + * Run following command inside root directory of your project + ``` + export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:$PWD/node_modules/uplink-nodejs/ + ``` + OR + * Copy libuplinkc*.* files from $PROJECTROOT/node_modules/uplink-nodejs/ to /usr/local/lib + * Windows + * Set Path environment variable to libuplinkc*.* which is $PROJECTROOT/node_modules/uplink-nodejs + >For NodeJS * Please ensure Node.js with version 10 or higher is [installed](https://nodejs.org/en/download/) diff --git a/binding.gyp b/binding.gyp index e8ffafc7..281b53ca 100644 --- a/binding.gyp +++ b/binding.gyp @@ -6,7 +6,7 @@ "target_name": "uplink", "include_dirs": ["./functions"], "sources":["./libUplink.cc", "./functions/promises_execute.cc", "./functions/promises_complete.cc", "./functions/project_operations.cc", "./functions/download_operations.cc", "./functions/upload_operations.cc", "./functions/access_operations.cc", "./functions/bucket_operations.cc", "./functions/object_operations.cc" ], - "libraries":["<(module_root_dir)/libuplinkc.so"], + "libraries":["<(module_root_dir)/libuplinkcv1.2.4.so"], "ldflags": ["-Wl,-rpath,'$$ORIGIN'"], "cflags_cc": ["-fexceptions","-fPIC","-Wno-unknown-pragmas"] } @@ -20,7 +20,7 @@ "sources":["libUplink_win.cc" , "./functions_win/promises_execute_win.cc", "./functions_win/promises_complete_win.cc", "./functions_win/project_operations_win.cc", "./functions_win/download_operations_win.cc", "./functions_win/upload_operations_win.cc", "./functions_win/access_operations_win.cc", "./functions_win/bucket_operations_win.cc", "./functions_win/object_operations_win.cc"], "copies":[{ "destination":"<(module_root_dir)/build/Release", - "files":["<(module_root_dir)/libuplinkc.dll","<(module_root_dir)/libuplinkc.h","<(module_root_dir)/uplink_definitions.h","<(module_root_dir)/uplink_combat.h"] + "files":["<(module_root_dir)/libuplinkcversion.h","<(module_root_dir)/libuplinkcv1.2.4.dll","<(module_root_dir)/libuplinkcv1.2.4.h","<(module_root_dir)/uplink_definitions.h","<(module_root_dir)/uplink_combat.h"] }], "ldflags":["-Wl,-rpath","build/Release"], }, @@ -34,10 +34,10 @@ "sources":["./libUplink.cc", "./functions/promises_execute.cc", "./functions/promises_complete.cc", "./functions/project_operations.cc", "./functions/download_operations.cc", "./functions/upload_operations.cc", "./functions/access_operations.cc", "./functions/bucket_operations.cc", "./functions/object_operations.cc"], "copies":[{ "destination":"<(module_root_dir)/build/Release", - "files":["<(module_root_dir)/libuplinkc.dylib","<(module_root_dir)/libuplinkc.h","<(module_root_dir)/uplink_definitions.h"] + "files":["<(module_root_dir)/libuplinkcv1.2.4.dylib","<(module_root_dir)/libuplinkcv1.2.4.h","<(module_root_dir)/libuplinkcversion.h","<(module_root_dir)/uplink_definitions.h"] }], "link_settings": { - "libraries": ["-L/<(module_root_dir)/build/Release","libuplinkc.dylib"] + "libraries": ["-L/<(module_root_dir)/build/Release","libuplinkcv1.2.4.dylib"] }, "ldflags":["-Wl,-rpath","build/Release"], "cxxflags":["-fPIC"], diff --git a/cloudbuild.yaml b/cloudbuild.yaml index 9340fe99..098c534e 100644 --- a/cloudbuild.yaml +++ b/cloudbuild.yaml @@ -5,7 +5,7 @@ steps: # storing storj API key in file - name: gcr.io/cloud-builders/gcloud entrypoint: 'bash' - args: ["-c","gcloud secrets versions access latest --secret=StorjAPIKey >>./dist/secret.txt" ] + args: ["-c","gcloud secrets versions access latest --secret=StorjAPIKey >>./secret.txt" ] # running npm install command - name: 'gcr.io/${PROJECT_ID}/npm' entrypoint: 'npm' diff --git a/docs/README.md b/docs/README.md index 07cd12c6..5be57271 100644 --- a/docs/README.md +++ b/docs/README.md @@ -22,6 +22,18 @@ $ npm install -g node-gyp $ npm install uplink-nodejs ``` +* Set Environment variable + * MacOS + * Set DYLD_LIBRARY_PATH environment variable + * Run following command inside root directory of your project + ``` + export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:$PWD/node_modules/uplink-nodejs/ + ``` + OR + * Copy libuplinkc*.* files from $PROJECTROOT/node_modules/uplink-nodejs/ to /usr/local/lib + * Windows + * Set Path environment variable to libuplinkc*.* which is $PROJECTROOT/node_modules/uplink-nodejs + >For NodeJS * Please ensure Node.js with version 10 or higher is [installed](https://nodejs.org/en/download/) * Check Node.js version diff --git a/functions/definitions.h b/functions/definitions.h index 6e1b9c89..36bcd724 100644 --- a/functions/definitions.h +++ b/functions/definitions.h @@ -10,7 +10,8 @@ #include #include #include "../uplink_definitions.h" -#include "../libuplinkc.h" +#include "../libuplinkcversion.h" +#include UPLINKCHEADER using std::string; using std::swap; diff --git a/functions_win/promises_execute_win.cc b/functions_win/promises_execute_win.cc index 8406c752..2c124f9a 100644 --- a/functions_win/promises_execute_win.cc +++ b/functions_win/promises_execute_win.cc @@ -1,7 +1,8 @@ +#include "../libuplinkcversion.h" #include "promises_execute_win.h" #include -HINSTANCE hGetProcIDDLL = LoadLibrary("../libuplinkc.dll"); +HINSTANCE hGetProcIDDLL = LoadLibrary(UPLINKCWINDOWSDLL); void openProjectPromiseExecute(napi_env env, void* data) { openProjectPromiseObj* obj = diff --git a/libUplink_win.cc b/libUplink_win.cc index 1a5f87fc..7ea5c42b 100644 --- a/libUplink_win.cc +++ b/libUplink_win.cc @@ -2,6 +2,7 @@ // Copyright 2020 Storj Storj #include "libUplink_win.h" +#include "libuplinkcversion.h" #include #include /* A utility function to reverse a string */ @@ -48,7 +49,7 @@ char* itoa(int num, char* str, int base) { } // HINSTANCE hGetProcIDDLL; void loaddll() { - hGetProcIDDLL = LoadLibrary("libuplinkc.dll"); + hGetProcIDDLL = LoadLibrary(UPLINKCWINDOWSHOMEDLL); } // function creates NAPI type error object napi_value createError(napi_env env, int64_t accessError, diff --git a/libuplinkcversion.h b/libuplinkcversion.h new file mode 100644 index 00000000..12dae4f3 --- /dev/null +++ b/libuplinkcversion.h @@ -0,0 +1,3 @@ +#define UPLINKCWINDOWSDLL "../libuplinkcv1.2.4.dll" +#define UPLINKCWINDOWSHOMEDLL "libuplinkcv1.2.4.dll" +#define UPLINKCHEADER "../libuplinkcv1.2.4.h" \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 956a427c..8fa7d01e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "uplink-nodejs", - "version": "1.2.3", + "version": "1.2.6", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 37d6a154..a5a94bc9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "uplink-nodejs", - "version": "1.2.3", + "version": "1.2.6", "description": "Storj-NodeJS bindings package", "main": "dist/uplink.js", "scripts": { diff --git a/uplink.ts b/uplink.ts index 50e8e263..12afd913 100644 --- a/uplink.ts +++ b/uplink.ts @@ -1,6 +1,4 @@ /* eslint-disable */ -import process from "process"; -process.chdir(__dirname); import {AccessResultStruct} from "./access.js"; import bindings = require("bindings");