Skip to content

Commit b8a9578

Browse files
committed
Update cloud action to allow platform specific builds
1 parent 9ef3d77 commit b8a9578

File tree

1 file changed

+30
-31
lines changed

1 file changed

+30
-31
lines changed

docs/cli.md

+30-31
Original file line numberDiff line numberDiff line change
@@ -869,17 +869,16 @@ See [Modular resources](/registry/) for a conceptual overview of modules and the
869869

870870
##### Using the `build` subcommand
871871

872-
You can use the `module build start` or `module build local` commands to build your custom module according to the build steps you specify in your <file>meta.json</file> file:
872+
You can use the `module build start` or `module build local` commands to build your custom module according to the build steps in your <file>meta.json</file> file:
873873

874-
- Use `build start` to build or compile your module on a cloud build host that might offer additional platform support than you have access to locally.
874+
- 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.
875875
- Use `build local` to quickly test that your module builds or compiles as expected on your local hardware.
876876

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

879-
<!-- Developers can either have a single build file for all platforms, or platform specific files: -->
880-
881-
<!-- { {< tabs >}}
882-
{ {% tab name="Single Build File" %}} -->
880+
{{< tabs >}}
881+
{{% tab name="Single Build File" %}}
883882

884883
```json {class="line-numbers linkable-line-numbers"}
885884
"build": {
@@ -891,6 +890,27 @@ To configure your module's build steps, add a `build` object to your [`meta.json
891890
}
892891
```
893892

893+
{{% /tab %}}
894+
{{% tab name="Platform Specific" %}}
895+
896+
```json {class="line-numbers linkable-line-numbers"}
897+
"build": {
898+
"path" : "dist/archive.tar.gz", // optional - path to your built module
899+
// (passed to the 'viam module upload' command)
900+
"arch": {
901+
"linux/arm64": {
902+
"build": "./build-linux-arm64.sh" // command that will build your module
903+
},
904+
"darwin/arm64": {
905+
"build": "./build-darwin-arm64.sh" // command that will build your module
906+
}
907+
} // architecture(s) to build for
908+
}
909+
```
910+
911+
{{% /tab %}}
912+
{{< /tabs >}}
913+
894914
{{%expand "Click to view example setup.sh" %}}
895915

896916
```sh { class="command-line"}
@@ -954,27 +974,9 @@ tar -czvf dist/archive.tar.gz <PATH-TO-EXECUTABLE>
954974

955975
{{% /expand%}}
956976

957-
<!-- { {% /tab %}} -->
958-
<!-- { {% tab name="Platform Specific" %}}
977+
{{%expand "Click to view example build-linux-arm64.sh" %}}
959978

960-
```json {class="line-numbers linkable-line-numbers"}
961-
"build": {
962-
"path" : "dist/archive.tar.gz", // optional - path to your built module
963-
// (passed to the 'viam module upload' command)
964-
"arch": {
965-
"linux/arm64": {
966-
"build": "./build-linux-arm64.sh" // command that will build your module
967-
},
968-
"darwin/arm64": {
969-
"build": "./build-darwin-arm64.sh" // command that will build your module
970-
}
971-
} // architecture(s) to build for
972-
}
973-
```
974-
975-
{ {%expand "Click to view example build-linux-arm64.sh" %}}
976-
977-
```sh { class="command-line"}
979+
```sh {class="line-numbers linkable-line-numbers"}
978980
#!/bin/bash
979981
set -e
980982

@@ -1002,10 +1004,7 @@ python3 -m PyInstaller --onefile --hidden-import="googleapiclient" src/main.py
10021004
tar -czvf dist/archive.tar.gz <PATH-TO-EXECUTABLE>
10031005
```
10041006

1005-
{ {% /expand%}}
1006-
1007-
{{ % /tab %}}
1008-
{ {< /tabs >}} -->
1007+
{{% /expand%}}
10091008

10101009
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`:
10111010

0 commit comments

Comments
 (0)