From f09ca711bd54c5a2acaa02f8af2922b31868dd56 Mon Sep 17 00:00:00 2001 From: "Shah, Kevin" Date: Mon, 26 Aug 2024 12:57:58 -0400 Subject: [PATCH] feat: CI support for native sdk --- .github/workflows/release-github.yml | 48 +++++- .github/workflows/utils.sh | 206 ++++++++++++++++++++++++ package-lock.json | 14 +- package.json | 2 +- src/openrpc/device.json | 150 ++++++----------- src/schemas/types.json | 3 +- src/sdks/core/package.json | 5 +- src/sdks/core/test/suite/device.test.ts | 7 +- src/sdks/discovery/package.json | 5 +- src/sdks/manage/package.json | 5 +- 10 files changed, 319 insertions(+), 126 deletions(-) diff --git a/.github/workflows/release-github.yml b/.github/workflows/release-github.yml index 897303fae..a71faaa72 100644 --- a/.github/workflows/release-github.yml +++ b/.github/workflows/release-github.yml @@ -18,6 +18,8 @@ jobs: release: name: Release runs-on: ubuntu-latest + container: + image: kevinshahfws/node-c:3.0 steps: # Checkout/install project - name: Checkout @@ -64,13 +66,19 @@ jobs: echo "NPM_DIST_TAG=test" >> $GITHUB_ENV echo "DOCS_TAG=pr-$(node ./src/js/version.mjs branch-to-prerelease ${{ github.head_ref }})" >> $GITHUB_ENV echo "FEATURE_BRANCH=${{ github.head_ref }}" >> $GITHUB_ENV - + - name: Set file permissions + run: | + chmod -R 755 ./ + chown -R $(id -u):$(id -g) ./ # Perform real (When not a PR) or dry-run (When PR) semantic-release - name: Release mono-artifact to GitHub if: (github.ref_name != 'main' && github.event_name != 'pull_request') || github.event_name == 'workflow_dispatch' env: GITHUB_TOKEN: ${{ secrets.SEMANTIC_RELEASE_BOT_PAT }} # <-- Allows semantic-release-bot to push changes to protected branches - run: npx semantic-release + DEBUG: semantic-release:* + run: | + git config --global --add safe.directory /__w/firebolt-apis/firebolt-apis + npx semantic-release - name: Dry-run mono-artifact if: (github.ref_name == 'main' && github.event_name != 'workflow_dispatch') || github.event_name == 'pull_request' env: @@ -89,13 +97,47 @@ jobs: uses: andstor/file-existence-action@v2 with: files: './src/sdks/core/dist/lib/firebolt.mjs' + - name: Get version from package.json + run: | + RELEASE_VERSION=$(node -p "require('./package.json').version") + echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV + echo "build_cpp_source=true" >> $GITHUB_ENV + - name: Set cpp build source Condition + if: steps.check_build.outputs.files_exists == 'false' || (github.ref_name == 'main' && github.event_name != 'pull_request' && github.event_name != 'workflow_dispatch') + run: echo "build_cpp_source=false" >> $GITHUB_ENV + + - name: Clone and Install Thunder + if: env.build_cpp_source == 'true' + id: install_thunder + run: | + .github/workflows/utils.sh cloneAndInstallThunder + - name: Generate native sdk source + if: env.build_cpp_source == 'true' + run: | + .github/workflows/utils.sh generateSource + - name: Build Core SDK CPP + if: env.build_cpp_source == 'true' + id: build_core_cpp + run: | + .github/workflows/utils.sh buildCoreCPPSDK $RELEASE_VERSION + - name: Build Manage SDK CPP + if: env.build_cpp_source == 'true' + id: build_manage_cpp + run: | + .github/workflows/utils.sh buildManageCPPSDK $RELEASE_VERSION + - name: Build Discovery SDK CPP + if: env.build_cpp_source == 'true' + id: build_discovery_cpp + run: | + .github/workflows/utils.sh buildDiscoveryCPPSDK $RELEASE_VERSION + - name: Release Firebolt SDKs to NPM if: steps.check_build.outputs.files_exists == 'true' && github.event_name != 'pull_request' && (github.ref_name != 'main' || github.event_name == 'workflow_dispatch') env: NPM_TOKEN: ${{ secrets.SEMANTIC_RELEASE_NPM_TOKEN }} # <-- Allows semantic-release to publish to npm without 2 factor auth. run: | npm --version - echo "NPM DIST TAG :: " $NPM_DIST_TAG + echo "NPM DIST TAG ::: " $NPM_DIST_TAG npm publish --tag $NPM_DIST_TAG --workspaces - name: Dry-run Firebolt SDKs to NPM if: steps.check_build.outputs.files_exists == 'true' && (github.ref_name == 'main' && github.event_name != 'workflow_dispatch') diff --git a/.github/workflows/utils.sh b/.github/workflows/utils.sh index 13c8e7ff7..9d4270d90 100755 --- a/.github/workflows/utils.sh +++ b/.github/workflows/utils.sh @@ -1,6 +1,13 @@ #!/bin/bash set -o pipefail +FIREBOLT_VERSION=1.0.0-next.0 +current_apis_dir=$(pwd) + +cd .. +current_dir=$(pwd) +cd $current_apis_dir + function runTests(){ echo "Clone firebolt-apis repo with pr branch" PR_BRANCH=$(echo "$EVENT_NAME" | tr '[:upper:]' '[:lower:]') @@ -147,6 +154,195 @@ function unzipArtifact(){ echo "Failures=$failures" >> "$GITHUB_ENV" } +function generateSource() { + echo " ************ Generating CPP SDK Source ************" + + echo "Generating source for Core SDK" + cd src/sdks/core + npm run cpp + + if [ $? -eq 0 ] + then + echo "Native Core SDK generated successfully" + echo " Core SDK Location" + cd build/cpp/src/ + ls -la + echo " ************ Source Generation Completed for Core SDK ************" + else + echo "Native Core SDK generation failed" + exit 1 + fi + + echo "Generating source for Manage SDK" + cd ../../../../manage + npm run cpp + + if [ $? -eq 0 ] + then + echo "Native Manage SDK generated successfully" + echo " Manage SDK Location" + cd build/cpp/src/ + ls -la + echo " ************ Source Generation Completed for Manage SDK ************" + else + echo "Native Manage SDK generation failed" + exit 1 + fi + + echo "Generate source for Discovery SDK" + cd ../discovery + npm run cpp + + if [ $? -eq 0 ] + then + echo "Native Discovery SDK generated successfully" + else + echo "Native Discovery SDK generation failed" + exit 1 + fi +} + +function cloneAndInstallThunder() { + cd .. + + git clone https://github.com/rdkcentral/Thunder.git + + cd Thunder + + git checkout 283b3d54334010403d85a4e69b3835de23e42331 + + cd .. + + git clone https://github.com/rdkcentral/ThunderTools.git + + cd ThunderTools + + git checkout 64b72b5ed491436b0e6bc2327d8a7b0e75ee2870 + + cd .. + + echo "current_dir is $current_dir" + + mkdir -p $current_dir/data + + if [ ! -d "$(pwd)/Thunder" ] + then + echo "Directory Thunder DOES NOT exist." + exit 9999 + fi + + if [ ! -d "$(pwd)/ThunderTools" ] + then + echo "Directory ThunderTools DOES NOT exist." + exit 9999 + fi + + if [ ! -d "$current_dir/firebolt-apis" ] + then + echo "Directory $current_dir/firebolt-apis DOES NOT exist." + exit 9999 + fi + + cd $current_dir + + [ -d "$current_dir/build" ] && rm -rf $current_dir/build + + echo "Building Thunder"; + + cmake -G Ninja -S ThunderTools -B build/ThunderTools -DCMAKE_INSTALL_PREFIX="install/usr" && echo "Tools Setup" || exit 9999 + + cmake --build build/ThunderTools --target install && echo "Thunder Tools Build succeeded" || exit 9999 + + #-G Ninja is the "Build system generator" + #-S is the source path + #-B is the output directory + cmake -G Ninja -S Thunder -B build/Thunder \ + -DBUILD_SHARED_LIBS=ON \ + -DBINDING="127.0.0.1" \ + -DCMAKE_BUILD_TYPE="Debug" \ + -DCMAKE_INSTALL_PREFIX="install/usr" \ + -DCMAKE_MODULE_PATH="${PWD}/install/usr/include/WPEFramework/Modules" \ + -DDATA_PATH="${PWD}/install/usr/share/WPEFramework" \ + -DPERSISTENT_PATH="${PWD}/install/var/wpeframework" \ + -DPORT="55555" \ + -DPROXYSTUB_PATH="${PWD}/install/usr/lib/wpeframework/proxystubs" \ + -DSYSTEM_PATH="${PWD}/install/usr/lib/wpeframework/plugins" \ + -DVOLATILE_PATH="tmp" && echo "Thunder configure succeeded" || exit 9999 + + cmake --build build/Thunder --target install && echo "Thunder Build succeeded" || exit 9999 +} + +function buildCoreCPPSDK() { + echo " ************ Building Core CPP SDK ************" + + FIREBOLT_VERSION=$(node -p "require('./package.json').version") + echo "The version from package.json is $FIREBOLT_VERSION" + + cd src/sdks/core + ls -la build/cpp/src + cp build/cpp/src/firebolt-core-native-sdk-${FIREBOLT_VERSION}.tgz $current_dir/data + cd $current_dir/data + tar -zxvf firebolt-core-native-sdk-${FIREBOLT_VERSION}.tgz + cd firebolt-core-native-sdk-${FIREBOLT_VERSION}/ + chmod +x ./build.sh + sed -i -e 's/prefix=/prefix /g' build.sh + cat ./build.sh + + echo "***************** firebolt.h *****************" + cat include/firebolt.h + + ./build.sh -s "$current_dir/install" || exit 9999 + ./build.sh -f "$current_dir/data/firebolt-core-native-sdk-${FIREBOLT_VERSION}/build/Firebolt" -s "$current_dir/install" + + cd $current_apis_dir +} + +function buildManageCPPSDK() { + echo " ************ Build Manage CPP SDK ************" + FIREBOLT_VERSION=$(node -p "require('./package.json').version") + echo "The version from package.json is $FIREBOLT_VERSION" + + cd $current_apis_dir + cd src/sdks/manage + ls -la build/cpp/src + cp build/cpp/src/firebolt-manage-native-sdk-${FIREBOLT_VERSION}.tgz $current_dir/data + cd $current_dir/data + tar -zxvf firebolt-manage-native-sdk-${FIREBOLT_VERSION}.tgz + cd firebolt-manage-native-sdk-${FIREBOLT_VERSION}/ + chmod +x ./build.sh + sed -i -e 's/prefix=/prefix /g' build.sh + cat ./build.sh + + echo "***************** firebolt.h *****************" + cat include/firebolt.h + + ./build.sh -s "$current_dir/install" || exit 9999 + ./build.sh -f "$current_dir/data/firebolt-manage-native-sdk-${FIREBOLT_VERSION}/build/Firebolt" -s "$current_dir/install" +} + +function buildDiscoveryCPPSDK() { + echo " ************ Build Discovery CPP SDK ************" + FIREBOLT_VERSION=$(node -p "require('./package.json').version") + echo "The version from package.json is $FIREBOLT_VERSION" + + cd $current_apis_dir + cd src/sdks/discovery + ls -la build/cpp/src + cp build/cpp/src/firebolt-discovery-native-sdk-${FIREBOLT_VERSION}.tgz $current_dir/data + cd $current_dir/data + tar -zxvf firebolt-discovery-native-sdk-${FIREBOLT_VERSION}.tgz + cd firebolt-discovery-native-sdk-${FIREBOLT_VERSION}/ + chmod +x ./build.sh + sed -i -e 's/prefix=/prefix /g' build.sh + cat ./build.sh + + echo "***************** firebolt.h *****************" + cat include/firebolt.h + + ./build.sh -s "$current_dir/install" || exit 9999 + ./build.sh -f "$current_dir/data/firebolt-discovery-native-sdk-${FIREBOLT_VERSION}/build/Firebolt" -s "$current_dir/install" +} + # Check argument and call corresponding function if [ "$1" == "runTests" ]; then runTests @@ -156,6 +352,16 @@ elif [ "$1" == "getArtifactData" ]; then getArtifactData elif [ "$1" == "unzipArtifact" ]; then unzipArtifact +elif [ "$1" == "generateSource" ]; then + generateSource +elif [ "$1" == "cloneAndInstallThunder" ]; then + cloneAndInstallThunder +elif [ "$1" == "buildCoreCPPSDK" ]; then + buildCoreCPPSDK +elif [ "$1" == "buildManageCPPSDK" ]; then + buildManageCPPSDK +elif [ "$1" == "buildDiscoveryCPPSDK" ]; then + buildDiscoveryCPPSDK else echo "Invalid function specified." exit 1 diff --git a/package-lock.json b/package-lock.json index 316d12f8c..1f6fc5dcb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19,7 +19,7 @@ "devDependencies": { "@commitlint/cli": "^17.0.3", "@commitlint/config-conventional": "^17.0.3", - "@firebolt-js/openrpc": "3.1.1-next.2", + "@firebolt-js/openrpc": "rdkcentral/firebolt-openrpc#fix-safe-name-issue", "@firebolt-js/schemas": "2.0.0", "@saithodev/semantic-release-backmerge": "^3.2.0", "@semantic-release/changelog": "^6.0.1", @@ -1075,10 +1075,10 @@ "link": true }, "node_modules/@firebolt-js/openrpc": { - "version": "3.1.1-next.2", - "resolved": "https://registry.npmjs.org/@firebolt-js/openrpc/-/openrpc-3.1.1-next.2.tgz", - "integrity": "sha512-D5b8ovtmRQNSlJ52LRJHtp0rmvlao6axzpmqYjW8wsljNeTj9QcAJ1xiUiYBt2uFitvGM6zQA04e3rbJhErJ+w==", + "version": "3.1.1-next.3", + "resolved": "git+ssh://git@github.com/rdkcentral/firebolt-openrpc.git#b73c1783c5b521df240243ed9a853302e86cf1b5", "dev": true, + "license": "Apache-2.0", "dependencies": { "ajv": "^8.12.0", "ajv-formats": "^2.1.1", @@ -16962,7 +16962,7 @@ }, "src/sdks/core": { "name": "@firebolt-js/sdk", - "version": "1.3.1-next.1", + "version": "1.3.1-next.2", "license": "Apache-2.0", "devDependencies": { "jest": "^28.1.0", @@ -16973,7 +16973,7 @@ }, "src/sdks/discovery": { "name": "@firebolt-js/discovery-sdk", - "version": "1.3.1-next.1", + "version": "1.3.1-next.2", "license": "Apache-2.0", "devDependencies": { "jest": "^28.1.0", @@ -16984,7 +16984,7 @@ }, "src/sdks/manage": { "name": "@firebolt-js/manage-sdk", - "version": "1.3.1-next.1", + "version": "1.3.1-next.2", "license": "Apache-2.0", "devDependencies": { "jest": "^28.1.0", diff --git a/package.json b/package.json index 94e0c8eee..38d1652fc 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,7 @@ "devDependencies": { "@commitlint/cli": "^17.0.3", "@commitlint/config-conventional": "^17.0.3", - "@firebolt-js/openrpc": "3.1.1-next.2", + "@firebolt-js/openrpc": "rdkcentral/firebolt-openrpc#fix-safe-name-issue", "@firebolt-js/schemas": "2.0.0", "@saithodev/semantic-release-backmerge": "^3.2.0", "@semantic-release/changelog": "^6.0.1", diff --git a/src/openrpc/device.json b/src/openrpc/device.json index 0dd8e11b4..41eddbdec 100644 --- a/src/openrpc/device.json +++ b/src/openrpc/device.json @@ -292,7 +292,34 @@ "name": "versions", "summary": "the versions", "schema": { - "$ref": "#/components/schemas/DeviceVersion" + "type": "object", + "properties": { + "sdk": { + "$ref": "https://meta.comcast.com/firebolt/types#/definitions/SemanticVersion", + "description": "The Firebolt SDK version" + }, + "api": { + "$ref": "https://meta.comcast.com/firebolt/types#/definitions/SemanticVersion", + "description": "The lateset Firebolt API version supported by the curent device." + }, + "firmware": { + "$ref": "https://meta.comcast.com/firebolt/types#/definitions/SemanticVersion", + "description": "The device firmware version." + }, + "os": { + "$ref": "https://meta.comcast.com/firebolt/types#/definitions/SemanticVersion", + "description": "**Deprecated** Use `firmware`, instead." + }, + "debug": { + "type": "string", + "description": "Detail version as a string, for debugging purposes" + } + }, + "required": [ + "api", + "firmware", + "os" + ] } }, "examples": [ @@ -361,8 +388,8 @@ "result": { "name": "Default Result", "value": { - "hdcp1.4": true, - "hdcp2.2": true + "hdcp14": true, + "hdcp22": true } } } @@ -436,8 +463,7 @@ "name": "Default Result", "value": { "stereo": true, - "dolbyDigital5.1": true, - "dolbyDigital5.1+": true, + "dolbyDigital51": true, "dolbyAtmos": true } } @@ -720,98 +746,20 @@ "components": { "schemas": { "Resolution": { - "oneOf": [ - { - "type": "array", - "items": [ - { - "type": "integer", - "const": 720, - "description": "Width in pixels" - }, - { - "type": "integer", - "const": 480, - "description": "Height in pixels" - } - ], - "additionalItems": false, - "minItems": 2, - "maxItems": 2 - }, - { - "type": "array", - "items": [ - { - "type": "integer", - "const": 720, - "description": "Width in pixels" - }, - { - "type": "integer", - "const": 576, - "description": "Height in pixels" - } - ], - "additionalItems": false, - "minItems": 2, - "maxItems": 2 - }, - { - "type": "array", - "items": [ - { - "type": "integer", - "const": 1280, - "description": "Width in pixels" - }, - { - "type": "integer", - "const": 720, - "description": "Height in pixels" - } - ], - "additionalItems": false, - "minItems": 2, - "maxItems": 2 - }, + "type": "array", + "items": [ { - "type": "array", - "items": [ - { - "type": "integer", - "const": 1920, - "description": "Width in pixels" - }, - { - "type": "integer", - "const": 1080, - "description": "Height in pixels" - } - ], - "additionalItems": false, - "minItems": 2, - "maxItems": 2 + "type": "integer", + "description": "Width in pixels" }, { - "type": "array", - "items": [ - { - "type": "integer", - "const": 3840, - "description": "Width in pixels" - }, - { - "type": "integer", - "const": 2160, - "description": "Height in pixels" - } - ], - "additionalItems": false, - "minItems": 2, - "maxItems": 2 + "type": "integer", + "description": "Height in pixels" } - ] + ], + "additionalItems": false, + "minItems": 2, + "maxItems": 2 }, "NetworkType": { "title": "NetworkType", @@ -839,10 +787,7 @@ "stereo": { "type": "boolean" }, - "dolbyDigital5.1": { - "type": "boolean" - }, - "dolbyDigital5.1+": { + "dolbyDigital51": { "type": "boolean" }, "dolbyAtmos": { @@ -851,8 +796,7 @@ }, "required": [ "stereo", - "dolbyDigital5.1", - "dolbyDigital5.1+", + "dolbyDigital51", "dolbyAtmos" ] }, @@ -885,16 +829,16 @@ "title": "HDCPVersionMap", "type": "object", "properties": { - "hdcp1.4": { + "hdcp14": { "type": "boolean" }, - "hdcp2.2": { + "hdcp22": { "type": "boolean" } }, "required": [ - "hdcp1.4", - "hdcp2.2" + "hdcp14", + "hdcp22" ], "description": "The type of HDCP versions that is supported" }, diff --git a/src/schemas/types.json b/src/schemas/types.json index 5d5eed60e..653ea6d86 100644 --- a/src/schemas/types.json +++ b/src/schemas/types.json @@ -35,8 +35,7 @@ "type": "string", "enum": [ "stereo", - "dolbyDigital5.1", - "dolbyDigital5.1+", + "dolbyDigital51", "dolbyAtmos" ] }, diff --git a/src/sdks/core/package.json b/src/sdks/core/package.json index 4a6ec06b9..752c007a4 100644 --- a/src/sdks/core/package.json +++ b/src/sdks/core/package.json @@ -11,7 +11,7 @@ "native": "npx firebolt-openrpc sdk --input ./dist/firebolt-core-open-rpc.json --template ./src/cpp --output ./build/c/src --static-module Platform --language ../../../node_modules/@firebolt-js/openrpc/languages/c", "cpp": "npm run cpp:compile && npm run cpp:install", "cpp:compile": "npx firebolt-openrpc sdk --input ./dist/firebolt-core-open-rpc.json --template ./src/cpp --output ./build/cpp/src --static-module Platform --language ../../../node_modules/@firebolt-js/openrpc/languages/cpp", - "cpp:install": "./build/cpp/src/scripts/install.sh -i ./build/cpp/src -s ./build/cpp/src/ -m core", + "cpp:install": "chmod +x ./build/cpp/src/scripts/install.sh && sdkVersion=$(npm run -s getVersion) && ./build/cpp/src/scripts/install.sh -i ./build/cpp/src -s ./build/cpp/src/ -m core -v $sdkVersion", "compile": "cd ../../.. && npm run compile", "slice": "npx firebolt-openrpc slice -i ../../../dist/firebolt-open-rpc.json --sdk ./sdk.config.json -o ./dist/firebolt-core-open-rpc.json", "docs": "npx firebolt-openrpc docs --input ./dist/firebolt-core-open-rpc.json --output build/docs/markdown --as-path", @@ -26,7 +26,8 @@ "test": "npm run test:setup && NODE_OPTIONS=--experimental-vm-modules npx --config=jest.config.json --detectOpenHandles jest", "prepack": "node ../../js/version.mjs validate && npm run broilerplate", "broilerplate": "rm ./CONTRIBUTING.md && cp ../../../CONTRIBUTING.md ./CONTRIBUTING.md && rm ./LICENSE && cp ../../../LICENSE ./LICENSE && rm ./NOTICE && cp ../../../NOTICE ./NOTICE", - "prettier": "prettier build/**/*.mjs --write --parser babel && prettier build/**/*.md --write --parser markdown" + "prettier": "prettier build/**/*.mjs --write --parser babel && prettier build/**/*.md --write --parser markdown", + "getVersion": "node -p \"require('./package.json').version\"" }, "repository": { "type": "git", diff --git a/src/sdks/core/test/suite/device.test.ts b/src/sdks/core/test/suite/device.test.ts index 7f9601cac..984561135 100644 --- a/src/sdks/core/test/suite/device.test.ts +++ b/src/sdks/core/test/suite/device.test.ts @@ -113,8 +113,8 @@ test("Device.make()", () => { test("Device.hdcp()", () => { const expectedOutput: Device.BooleanMap = { - "hdcp1.4": true, - "hdcp2.2": true, + "hdcp14": true, + "hdcp22": true, }; return Device.hdcp().then((res: Device.BooleanMap) => { expect(res).toEqual(expectedOutput); @@ -133,8 +133,7 @@ test("Device.audio()", () => { return Device.audio().then((res: Device.AudioProfiles) => { expect(res).toEqual({ dolbyAtmos: true, - "dolbyDigital5.1": true, - "dolbyDigital5.1+": true, + "dolbyDigital51": true, stereo: true, }); }); diff --git a/src/sdks/discovery/package.json b/src/sdks/discovery/package.json index 1426d97ad..33e24237e 100644 --- a/src/sdks/discovery/package.json +++ b/src/sdks/discovery/package.json @@ -11,7 +11,7 @@ "native": "npx firebolt-openrpc sdk --input ./dist/firebolt-discovery-open-rpc.json --template ./src/js --output ./build/c/src --language ../../../node_modules/@firebolt-js/openrpc/languages/c", "cpp": "npm run cpp:compile && npm run cpp:install", "cpp:compile": "npx firebolt-openrpc sdk --input ./dist/firebolt-discovery-open-rpc.json --template ./src/cpp --output ./build/cpp/src --static-module Platform --language ../../../node_modules/@firebolt-js/openrpc/languages/cpp", - "cpp:install": "./build/cpp/src/scripts/install.sh -i ./build/cpp/src -s ./build/cpp/src/ -m discovery", + "cpp:install": "chmod +x ./build/cpp/src/scripts/install.sh && sdkVersion=$(npm run -s getVersion) && ./build/cpp/src/scripts/install.sh -i ./build/cpp/src -s ./build/cpp/src/ -m discovery -v $sdkVersion", "compile": "cd ../../.. && npm run compile", "slice": "npx firebolt-openrpc slice -i ../../../dist/firebolt-open-rpc.json --sdk ./sdk.config.json -o ./dist/firebolt-discovery-open-rpc.json", "docs": "npx firebolt-openrpc docs --input ./dist/firebolt-discovery-open-rpc.json --output build/docs/markdown --as-path", @@ -26,7 +26,8 @@ "test": "npm run test:setup && NODE_OPTIONS=--experimental-vm-modules npx --config=jest.config.json --detectOpenHandles jest", "prepack": "node ../../js/version.mjs validate && npm run broilerplate", "broilerplate": "rm ./CONTRIBUTING.md && cp ../../../CONTRIBUTING.md ./CONTRIBUTING.md && rm ./LICENSE && cp ../../../LICENSE ./LICENSE && rm ./NOTICE && cp ../../../NOTICE ./NOTICE", - "prettier": "prettier build/**/*.mjs --write --parser babel && prettier build/**/*.md --write --parser markdown" + "prettier": "prettier build/**/*.mjs --write --parser babel && prettier build/**/*.md --write --parser markdown", + "getVersion": "node -p \"require('./package.json').version\"" }, "repository": { "type": "git", diff --git a/src/sdks/manage/package.json b/src/sdks/manage/package.json index 6549c6dfb..1edea23b6 100644 --- a/src/sdks/manage/package.json +++ b/src/sdks/manage/package.json @@ -11,7 +11,7 @@ "native": "npx firebolt-openrpc sdk --input ./dist/firebolt-manage-open-rpc.json --template ./src/js --output ./build/c/src --language ../../../node_modules/@firebolt-js/openrpc/languages/c", "cpp": "npm run cpp:compile && npm run cpp:install", "cpp:compile": "npx firebolt-openrpc sdk --input ./dist/firebolt-manage-open-rpc.json --template ./src/cpp --output ./build/cpp/src --static-module Platform --language ../../../node_modules/@firebolt-js/openrpc/languages/cpp", - "cpp:install": "./build/cpp/src/scripts/install.sh -i ./build/cpp/src -s ./build/cpp/src/ -m manage", + "cpp:install": "chmod +x ./build/cpp/src/scripts/install.sh && sdkVersion=$(npm run -s getVersion) && ./build/cpp/src/scripts/install.sh -i ./build/cpp/src -s ./build/cpp/src/ -m manage -v $sdkVersion", "compile": "cd ../../.. && npm run compile", "slice": "npx firebolt-openrpc slice -i ../../../dist/firebolt-open-rpc.json --sdk ./sdk.config.json -o ./dist/firebolt-manage-open-rpc.json", "docs": "npx firebolt-openrpc docs --input ./dist/firebolt-manage-open-rpc.json --output build/docs/markdown --as-path", @@ -26,7 +26,8 @@ "test": "npm run test:setup && NODE_OPTIONS=--experimental-vm-modules npx --config=jest.config.json --detectOpenHandles jest", "prepack": "node ../../js/version.mjs validate && npm run broilerplate", "broilerplate": "rm ./CONTRIBUTING.md && cp ../../../CONTRIBUTING.md ./CONTRIBUTING.md && rm ./LICENSE && cp ../../../LICENSE ./LICENSE && rm ./NOTICE && cp ../../../NOTICE ./NOTICE", - "prettier": "prettier build/**/*.mjs --write --parser babel && prettier build/**/*.md --write --parser markdown" + "prettier": "prettier build/**/*.mjs --write --parser babel && prettier build/**/*.md --write --parser markdown", + "getVersion": "node -p \"require('./package.json').version\"" }, "repository": { "type": "git",