Skip to content

Commit

Permalink
feat(weaver): add build script and fix minor issues
Browse files Browse the repository at this point in the history
- Add a bash script in tools to build all the weaver packages in single command.
- Export `getMSPConfigurations` from fabric interop sdk
    (is imported in fabric cli, was causing compilation error on node 20)
- Move bash shebang to the top of `check-nodes-status`. On ubuntu 20 having
    this below was causing the file to be interpreted as sh (resulting in error)
- Update `package-local.json` files to be more inline with `package.json`.

Signed-off-by: Michal Bajer <[email protected]>
  • Loading branch information
outSH authored and petermetz committed Jan 19, 2024
1 parent 3291dcc commit 6d4fd00
Show file tree
Hide file tree
Showing 9 changed files with 289 additions and 168 deletions.
93 changes: 93 additions & 0 deletions tools/weaver-build-local.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
#!/usr/bin/env bash

THIS_SCRIPT_DIR="$(dirname "$0")"
WEAVER_DIR="$THIS_SCRIPT_DIR/../weaver"

echo -e "\n######################################"
echo "Remove weaver node_modules..."
echo -e "######################################\n"

echo "Cacti configure process interferes with weaver packages, clean it for fresh start"
find "$WEAVER_DIR" -name node_modules -exec rm -rf {} \;

echo -e "\n######################################"
echo "Environment check"
echo -e "######################################\n"

set -e # Fail on error from now on

echo "Weaver path: $WEAVER_DIR"
go version
rustc --version
java -version
protoc --version
protoc-gen-go --version
protoc-gen-go-grpc --version

echo -e "\n######################################"
echo "Build protos..."
echo -e "######################################\n"

echo "# JS"
pushd "${WEAVER_DIR}/common/protos-js"; make build; popd
echo "# Go"
pushd "${WEAVER_DIR}/common/protos-go"; make build; popd
echo "# Java"
pushd "${WEAVER_DIR}/common/protos-java-kt"; make build; popd
echo "# Solidity"
pushd "${WEAVER_DIR}/common/protos-sol"; make build; popd
echo "# Rust"
pushd "${WEAVER_DIR}/common/protos-rs"; make build; popd

echo -e "\n######################################"
echo "Build relay..."
echo -e "######################################\n"

pushd "${WEAVER_DIR}/core/relay"
make protos-local
make update-pkgs
make
popd

echo -e "\n######################################"
echo "Build fabric components..."
echo -e "######################################\n"

echo "# Node SDK"
pushd "${WEAVER_DIR}/sdks/fabric/interoperation-node-sdk"; make build-local; popd
echo "# Node CLI"
pushd "${WEAVER_DIR}/samples/fabric/fabric-cli"; make build-local; popd
echo "# Go SDK"
pushd "${WEAVER_DIR}/sdks/fabric/go-sdk"; make build-local; popd
echo "# Go CLI"
# TODO - uncomment once the build is fixed
# pushd "${WEAVER_DIR}/samples/fabric/go-cli"; make build-local; popd
echo "# Driver"
pushd "${WEAVER_DIR}/core/drivers/fabric-driver"; make build-local; popd
echo "# IIN Agent"
pushd "${WEAVER_DIR}/core/identity-management/iin-agent"; make build-local; popd

echo -e "\n######################################"
echo "Build corda components..."
echo -e "######################################\n"

echo "# Interop App"
pushd "${WEAVER_DIR}/core/network/corda-interop-app"; make build-local; popd
echo "# SDK"
pushd "${WEAVER_DIR}/sdks/corda"; make build; popd
echo "# Simple Application"
pushd "${WEAVER_DIR}/samples/corda/corda-simple-application"; make build-local; popd
echo "# Driver"
pushd "${WEAVER_DIR}/core/drivers/corda-driver"; make build-local; popd

echo -e "\n######################################"
echo "Build besu components..."
echo -e "######################################\n"

echo "# SDK"
pushd "${WEAVER_DIR}/sdks/besu/node"; make build-local; popd
echo "# CLI"
pushd "${WEAVER_DIR}/samples/besu/besu-cli"; make build-local; popd

echo "Done!"
exit 0;
32 changes: 19 additions & 13 deletions weaver/core/drivers/fabric-driver/package-local.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,22 @@
"name": "@hyperledger/cacti-weaver-driver-fabric",
"version": "2.0.0-alpha.2",
"description": "",
"main": "out/server.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "npm run tsc",
"tsc": "tsc",
"start": "node out/server.js",
"watch": "tsc --watch",
"dev": "nodemon out/server.js",
"lint": "eslint '*/**/*.{js,ts,tsx}' --quiet --fix"
},
"repository": {
"type": "git",
"url": "https://github.com/hyperledger/cacti.git"
},
"author": "",
"license": "Apache-2.0",
"author": "",
"main": "out/server.js",
"scripts": {
"build": "npm run tsc",
"dev": "nodemon out/server.js",
"lint": "eslint '*/**/*.{js,ts,tsx}' --quiet --fix",
"start": "node out/server.js",
"test": "echo \"Error: no test specified\" && exit 1",
"tsc": "tsc",
"watch": "tsc --watch"
},
"dependencies": {
"@fidm/x509": "1.2.1",
"@grpc/grpc-js": "1.9.5",
Expand All @@ -26,10 +26,12 @@
"@typescript-eslint/eslint-plugin": "5.62.0",
"@typescript-eslint/parser": "5.62.0",
"dotenv": "8.6.0",
"eslint-config-prettier": "8.10.0",
"eslint-plugin-prettier": "3.4.1",
"eslint-config-prettier": "8.9.0",
"eslint-plugin-prettier": "5.0.0",
"fabric-ca-client": "2.2.19",
"fabric-common": "2.2.19",
"fabric-network": "2.2.19",
"fabric-protos": "2.2.19",
"level": "8.0.0",
"winston": "3.10.0"
},
Expand All @@ -39,5 +41,9 @@
"patch-package": "6.5.1",
"typedoc": "0.24.8",
"typescript": "4.9.5"
},
"engines": {
"node": ">=18",
"npm": ">=8"
}
}
106 changes: 57 additions & 49 deletions weaver/core/identity-management/iin-agent/package-local.json
Original file line number Diff line number Diff line change
@@ -1,51 +1,59 @@
{
"name": "@hyperledger/cacti-weaver-iin-agent",
"version": "2.0.0-alpha.2",
"description": "",
"main": "index.js",
"scripts": {
"test": "nyc mocha -r ts-node/register --exclude 'test/data/**/*.js' --recursive -t 10000",
"build": "npm run tsc",
"tsc": "tsc",
"start": "node out/server.js",
"watch": "tsc --watch",
"dev": "nodemon out/server.js",
"lint": "eslint '*/**/*.{js,ts,tsx}' --quiet --fix"
},
"repository": {
"type": "git",
"url": "https://github.com/hyperledger/cacti.git"
},
"author": "",
"license": "Apache-2.0",
"dependencies": {
"@fidm/x509": "1.2.1",
"@grpc/grpc-js": "1.9.5",
"@hyperledger/cacti-weaver-protos-js": "file:./protos-js",
"@hyperledger/cacti-weaver-sdk-fabric": "file:./cacti-weaver-sdk-fabric",
"@typescript-eslint/eslint-plugin": "3.10.1",
"@typescript-eslint/parser": "3.10.1",
"dotenv": "8.6.0",
"eslint-config-prettier": "6.15.0",
"eslint-plugin-prettier": "3.4.1",
"fabric-ca-client": "2.2.19",
"fabric-common": "2.2.19",
"fabric-network": "2.2.19"
},
"devDependencies": {
"@types/node": "16.18.41",
"chai": "4.3.7",
"chai-as-promised": "7.1.1",
"mocha": "5.2.0",
"nodemon": "2.0.22",
"nyc": "12.0.2",
"patch-package": "6.5.1",
"proto3-json-serializer": "1.1.1",
"rewire": "4.0.1",
"sinon": "6.3.5",
"sinon-chai": "3.7.0",
"ts-node": "10.9.1",
"typedoc": "0.24.8",
"typescript": "4.9.5"
}
"name": "@hyperledger/cacti-weaver-iin-agent",
"version": "2.0.0-alpha.2",
"description": "",
"repository": {
"type": "git",
"url": "https://github.com/hyperledger/cacti.git"
},
"license": "Apache-2.0",
"author": "",
"main": "index.js",
"scripts": {
"build": "npm run tsc",
"dev": "nodemon out/server.js",
"lint": "eslint '*/**/*.{js,ts,tsx}' --quiet --fix",
"start": "node out/server.js",
"test": "nyc mocha -r ts-node/register --exclude 'test/data/**/*.js' --recursive -t 10000",
"tsc": "tsc",
"watch": "tsc --watch"
},
"dependencies": {
"@fidm/x509": "1.2.1",
"@grpc/grpc-js": "1.9.5",
"@hyperledger/cacti-weaver-protos-js": "file:./protos-js",
"@hyperledger/cacti-weaver-sdk-fabric": "file:./cacti-weaver-sdk-fabric",
"@typescript-eslint/eslint-plugin": "3.10.1",
"@typescript-eslint/parser": "3.10.1",
"dotenv": "8.6.0",
"eslint-config-prettier": "6.15.0",
"eslint-plugin-prettier": "3.4.1",
"fabric-ca-client": "2.2.19",
"fabric-common": "2.2.19",
"fabric-network": "2.2.19",
"uuid": "9.0.1"
},
"devDependencies": {
"@types/jsrsasign": "10.5.11",
"@types/node": "16.18.41",
"@types/uuid": "9.0.6",
"chai": "4.3.7",
"chai-as-promised": "7.1.1",
"jsrsasign": "10.8.6",
"mocha": "5.2.0",
"nodemon": "2.0.22",
"nyc": "12.0.2",
"patch-package": "6.5.1",
"proto3-json-serializer": "1.1.1",
"rewire": "4.0.1",
"sinon": "6.3.5",
"sinon-chai": "3.7.0",
"ts-node": "10.9.1",
"typedoc": "0.24.8",
"typescript": "4.9.5"
},
"engines": {
"node": ">=18",
"npm": ">=8"
}
}
58 changes: 31 additions & 27 deletions weaver/samples/besu/besu-cli/package-local.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,12 @@
{
"name": "@hyperledger/cacti-weaver-besu-cli",
"version": "0.0.1",
"version": "2.0.0-alpha.2",
"description": "besu-cli CLI",
"private": true,
"license": "Apache-2.0",
"types": "build/types/types.d.ts",
"bin": {
"besu-cli": "bin/besu-cli"
},
"scripts": {
"format": "prettier --write **/*.{js,ts,tsx,json}",
"lint": "tslint -p .",
"clean-build": "rm -rf ./build",
"compile": "tsc -p .",
"copy-templates": "if [ -e ./src/templates ]; then cp -a ./src/templates ./build/; fi",
"build": "yarn format && yarn lint && yarn clean-build && yarn compile && yarn copy-templates",
"prepublishOnly": "yarn build",
"test": "jest",
"watch": "jest --watch",
"snapupdate": "jest --updateSnapshot",
"coverage": "jest --coverage"
},
"files": [
"tsconfig.json",
"tslint.json",
Expand All @@ -29,13 +16,34 @@
"docs",
"bin"
],
"license": "Apache-2.0",
"scripts": {
"build": "yarn format && yarn lint && yarn clean-build && yarn compile && yarn copy-templates",
"clean-build": "rm -rf ./build",
"compile": "tsc -p .",
"copy-templates": "if [ -e ./src/templates ]; then cp -a ./src/templates ./build/; fi",
"coverage": "jest --coverage",
"format": "prettier --write **/*.{js,ts,tsx,json}",
"lint": "tslint -p .",
"prepublishOnly": "yarn build",
"snapupdate": "jest --updateSnapshot",
"test": "jest",
"watch": "jest --watch"
},
"prettier": {
"semi": false,
"singleQuote": true
},
"jest": {
"preset": "ts-jest",
"testEnvironment": "node"
},
"dependencies": {
"@hyperledger/cacti-weaver-sdk-besu": "file:../../../sdks/besu/node",
"@hyperledger/cacti-weaver-protos-js": "file:../../../common/protos-js",
"@truffle/contract": "4.2.14",
"@truffle/contract": "4.6.28",
"gluegun": "5.1.6",
"winston": "3.3.3"
"web3": "1.10.0",
"winston": "3.10.0"
},
"devDependencies": {
"@types/jest": "29.5.3",
Expand All @@ -44,17 +52,13 @@
"prettier": "1.19.1",
"ts-jest": "29.1.1",
"ts-node": "10.9.1",
"tslint": "5.12.0",
"tslint-config-prettier": "1.17.0",
"tslint": "5.20.1",
"tslint-config-prettier": "1.18.0",
"tslint-config-standard": "8.0.1",
"typescript": "4.9.5"
},
"jest": {
"preset": "ts-jest",
"testEnvironment": "node"
},
"prettier": {
"semi": false,
"singleQuote": true
"engines": {
"node": ">=18",
"npm": ">=8"
}
}
Loading

0 comments on commit 6d4fd00

Please sign in to comment.