From d445aeb30485d2bf0bf9a7529e0d5185e6027995 Mon Sep 17 00:00:00 2001 From: Mike Date: Fri, 17 Dec 2021 22:21:11 -0500 Subject: [PATCH 1/3] Build system will now detect OS and pass it down to build_sdk.sh. build_sdk.sh will now automatically choose the correct cargo-make command line based on the OS --- frontend/app_flowy/.vscode/tasks.json | 19 +++++++++++++++++- frontend/scripts/build_sdk.sh | 29 ++++++++++++++++++--------- 2 files changed, 38 insertions(+), 10 deletions(-) diff --git a/frontend/app_flowy/.vscode/tasks.json b/frontend/app_flowy/.vscode/tasks.json index 0011a00fb7..2c81e02c42 100644 --- a/frontend/app_flowy/.vscode/tasks.json +++ b/frontend/app_flowy/.vscode/tasks.json @@ -15,6 +15,9 @@ "command": "sh ./scripts/build_sdk.sh", "windows": { "options": { + "env": { + "FLOWY_DEV_ENV": "Windows", + }, "shell": { "executable": "cmd.exe", "args": [ @@ -23,6 +26,20 @@ } } }, + "linux": { + "options": { + "env": { + "FLOWY_DEV_ENV": "Linux-x86", + } + }, + }, + "osx": { + "options": { + "env": { + "FLOWY_DEV_ENV": "macOS", + } + }, + }, "group": "build", "options": { "cwd": "${workspaceFolder}/../" @@ -31,6 +48,6 @@ // "$rustc" // ], "label": "build_flowy_sdk" - }, + } ] } \ No newline at end of file diff --git a/frontend/scripts/build_sdk.sh b/frontend/scripts/build_sdk.sh index 4e7b997664..8dfd3c079a 100755 --- a/frontend/scripts/build_sdk.sh +++ b/frontend/scripts/build_sdk.sh @@ -1,6 +1,7 @@ #!/bin/sh #!/usr/bin/env fish echo 'Start building rust sdk' + rustup show #Env check @@ -14,16 +15,26 @@ rustup show # 4. ~/.zshrc -# TODO: Automatically exec the script base on the current system +case "$FLOWY_DEV_ENV" in +Linux-aarch64) + cargo make --profile development-linux-aarch64 flowy-sdk-dev + ;; -# for macOS -cargo make --profile development-mac flowy-sdk-dev +Linux-x86) + cargo make --profile development-linux-x86 flowy-sdk-dev + ;; -# for Windows -#cargo make --profile development-windows flowy-sdk-dev +macOS) + cargo make --profile development-mac flowy-sdk-dev + ;; -# for Linux x86 -#cargo make --profile development-linux-x86 flowy-sdk-dev +Windows) + cargo make --profile development-windows flowy-sdk-dev + ;; -# for Linux aarch64 -#cargo make --profile development-linux-aarch64 flowy-sdk-dev +*) + # All undefined cases + echo "[ERROR] The FLOWY_DEV_ENV environment variable must be set. Please see the GitHub wiki for instructions." + exit 1 + ;; +esac From fc74b2b9625edf2dec769f6eb66e856d79891d4e Mon Sep 17 00:00:00 2001 From: Mike Date: Fri, 17 Dec 2021 22:31:01 -0500 Subject: [PATCH 2/3] Build system will now detect OS and pass it down to build_sdk.sh. build_sdk.sh will now automatically choose the correct cargo-make command line based on the OS --- frontend/scripts/build_sdk.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/scripts/build_sdk.sh b/frontend/scripts/build_sdk.sh index 8dfd3c079a..fba3587631 100755 --- a/frontend/scripts/build_sdk.sh +++ b/frontend/scripts/build_sdk.sh @@ -34,7 +34,7 @@ Windows) *) # All undefined cases - echo "[ERROR] The FLOWY_DEV_ENV environment variable must be set. Please see the GitHub wiki for instructions." + echo "[ERROR] The FLOWY_DEV_ENV environment variable must be set. Please see the GitHub wiki for build instructions." exit 1 ;; esac From 7a264dba6a3dcb5fd1e149ff26d46a7a1318e4cc Mon Sep 17 00:00:00 2001 From: Mike Date: Fri, 17 Dec 2021 22:21:11 -0500 Subject: [PATCH 3/3] Build system will now detect OS and pass it down to build_sdk.sh. build_sdk.sh will now automatically choose the correct cargo-make command line based on the OS # Conflicts: # frontend/scripts/build_sdk.sh --- frontend/scripts/build_sdk.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/scripts/build_sdk.sh b/frontend/scripts/build_sdk.sh index fba3587631..8dfd3c079a 100755 --- a/frontend/scripts/build_sdk.sh +++ b/frontend/scripts/build_sdk.sh @@ -34,7 +34,7 @@ Windows) *) # All undefined cases - echo "[ERROR] The FLOWY_DEV_ENV environment variable must be set. Please see the GitHub wiki for build instructions." + echo "[ERROR] The FLOWY_DEV_ENV environment variable must be set. Please see the GitHub wiki for instructions." exit 1 ;; esac