Skip to content

Commit f60a329

Browse files
committed
Update cloud action to allow platform specific builds
1 parent 168a52e commit f60a329

File tree

1 file changed

+32
-33
lines changed

1 file changed

+32
-33
lines changed

Diff for: docs/cli.md

+32-33
Original file line numberDiff line numberDiff line change
@@ -861,12 +861,11 @@ You can use the `module build start` or `module build local` commands to build y
861861
- Use `build start` to build or compile your module on a cloud build host that might offer more platform support than you have access to locally.
862862
- Use `build local` to quickly test that your module builds or compiles as expected on your local hardware.
863863

864-
To configure your module's build steps, add a `build` object to your [`meta.json` file](#the-metajson-file) like the following:
864+
To configure your module's build steps, add a `build` object to your [`meta.json` file](#the-metajson-file) like the following.
865+
You can either have a single build file for all platforms, or platform specific files.
865866

866-
<!-- Developers can either have a single build file for all platforms, or platform specific files: -->
867-
868-
<!-- { {< tabs >}}
869-
{ {% tab name="Single Build File" %}} -->
867+
{{< tabs >}}
868+
{{% tab name="Single Build File" %}}
870869

871870
```json {class="line-numbers linkable-line-numbers"}
872871
"build": {
@@ -878,6 +877,27 @@ To configure your module's build steps, add a `build` object to your [`meta.json
878877
}
879878
```
880879

880+
{{% /tab %}}
881+
{{% tab name="Platform Specific" %}}
882+
883+
```json {class="line-numbers linkable-line-numbers"}
884+
"build": {
885+
"path" : "dist/archive.tar.gz", // optional - path to your built module
886+
// (passed to the 'viam module upload' command)
887+
"arch": {
888+
"linux/arm64": {
889+
"build": "./build-linux-arm64.sh" // command that will build your module
890+
},
891+
"darwin/arm64": {
892+
"build": "./build-darwin-arm64.sh" // command that will build your module
893+
}
894+
} // architecture(s) to build for
895+
}
896+
```
897+
898+
{{% /tab %}}
899+
{{< /tabs >}}
900+
881901
{{% expand "Click to view example setup.sh" %}}
882902

883903
```sh {class="line-numbers linkable-line-numbers"}
@@ -903,7 +923,7 @@ pip3 install -r requirements.txt
903923

904924
{{% /expand %}}
905925

906-
{{%expand "Click to view example build.sh (with setup.sh)" %}}
926+
{{% expand "Click to view example build.sh (with setup.sh)" %}}
907927

908928
```sh {class="line-numbers linkable-line-numbers"}
909929
#!/bin/bash
@@ -939,29 +959,11 @@ python3 -m PyInstaller --onefile --hidden-import="googleapiclient" src/main.py
939959
tar -czvf dist/archive.tar.gz <PATH-TO-EXECUTABLE>
940960
```
941961

942-
{{% /expand%}}
943-
944-
<!-- { {% /tab %}} -->
945-
<!-- { {% tab name="Platform Specific" %}}
946-
947-
```json {class="line-numbers linkable-line-numbers"}
948-
"build": {
949-
"path" : "dist/archive.tar.gz", // optional - path to your built module
950-
// (passed to the 'viam module upload' command)
951-
"arch": {
952-
"linux/arm64": {
953-
"build": "./build-linux-arm64.sh" // command that will build your module
954-
},
955-
"darwin/arm64": {
956-
"build": "./build-darwin-arm64.sh" // command that will build your module
957-
}
958-
} // architecture(s) to build for
959-
}
960-
```
962+
{{% /expand %}}
961963

962-
{ {%expand "Click to view example build-linux-arm64.sh" %}}
964+
{{% expand "Click to view example build-linux-arm64.sh" %}}
963965

964-
```sh { class="command-line"}
966+
```sh {class="line-numbers linkable-line-numbers"}
965967
#!/bin/bash
966968
set -e
967969

@@ -973,9 +975,9 @@ python3 -m PyInstaller --onefile --hidden-import="googleapiclient" src/main.py
973975
tar -czvf dist/archive.tar.gz <PATH-TO-EXECUTABLE>
974976
```
975977

976-
{ {% /expand%}}
978+
{{% /expand %}}
977979

978-
{ {%expand "Click to view example build-darwin-arm64.sh" %}}
980+
{{% expand "Click to view example build-darwin-arm64.sh" %}}
979981

980982
```sh {class="line-numbers linkable-line-numbers"}
981983
#!/bin/bash
@@ -989,10 +991,7 @@ python3 -m PyInstaller --onefile --hidden-import="googleapiclient" src/main.py
989991
tar -czvf dist/archive.tar.gz <PATH-TO-EXECUTABLE>
990992
```
991993

992-
{ {% /expand%}}
993-
994-
{{ % /tab %}}
995-
{ {< /tabs >}} -->
994+
{{% /expand %}}
996995

997996
For example, the following extends the `my-module` <file>meta.json</file> file from the previous section using the single build file approach, adding a new `build` object to control its build parameters when used with `module build start` or `module build local`:
998997

0 commit comments

Comments
 (0)